misc: tweak placeholders
This commit is contained in:
4 files changed
+31
-19
No files matched your search
+24
-17
@@ -7,6 +7,7 @@ import { page } from '$app/state'
|
||||
import { feature } from '$lib/version.js'
|
||||
import { client } from '$lib/lemmy.js'
|
||||
import { site } from './lemmy'
|
||||
import { t } from './translations'
|
||||
|
||||
// Despite the name, this will round up
|
||||
// Example: findClosestNumber([8, 16, 32, 64, 128], 76) will return 128
|
||||
@@ -32,32 +33,38 @@ export const fullCommunityName = (name: string, actorId: string) =>
|
||||
`${name}@${new URL(actorId).hostname}`
|
||||
|
||||
export const placeholders = {
|
||||
url: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
|
||||
url: ['https://example.com'],
|
||||
post: [
|
||||
'Is starting nuclear warfare illegal?',
|
||||
"AITA for making somebody's day?",
|
||||
'BREAKING NEWS: Police break into gun shop, find weapons',
|
||||
'How do I make sure my pet rock stays alive?',
|
||||
'My cat just invented a time machine, what do I do?',
|
||||
'Unpopular opinion: world peace would be beneficial to humanity',
|
||||
'LPT: The smaller weights are easier to lift than the bigger weights in a gym',
|
||||
'ELI5: What is 4 + 8?',
|
||||
'Does anybody read these placeholders?',
|
||||
'Top 10 reasons why a meteor would help Earth',
|
||||
'Title text',
|
||||
'I took a picture of something idk',
|
||||
],
|
||||
body: ['bottom text', 'body text', 'body text'],
|
||||
comment: [
|
||||
'what?',
|
||||
'new response just dropped',
|
||||
"i did not read this post at all and i'm about to give my opinion on it.",
|
||||
'this comment placeholder is very important dont forget',
|
||||
'huh. i did not understand any of that.',
|
||||
'existential crisis in progress',
|
||||
'hello user i am a sentient placeholder. please dont type anything or i disappear forever. thanks',
|
||||
],
|
||||
get: (type: 'url' | 'post' | 'comment') => {
|
||||
return settings.randomPlaceholders
|
||||
? placeholders[type][
|
||||
Math.floor(Math.random() * placeholders[type].length)
|
||||
]
|
||||
: ''
|
||||
get: (type: 'url' | 'post' | 'body' | 'comment') => {
|
||||
if (settings.randomPlaceholders) {
|
||||
return placeholders[type][
|
||||
Math.floor(Math.random() * placeholders[type].length)
|
||||
]
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 'post':
|
||||
return t.get('placeholders.title')
|
||||
case 'body':
|
||||
return t.get('placeholders.body')
|
||||
case 'comment':
|
||||
return t.get('placeholders.comments')
|
||||
case 'url':
|
||||
return 'https://example.com'
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user