feat: add option to disable random placeholders, close #107

This commit is contained in:
Xyphyn committed 2023-08-16 15:49:06 -07:00
1 parent 61a8344fd7
commit dbbd460597
4 files changed
+47 -28

No files matched your search

+7 -3
View File
@@ -1,4 +1,6 @@
import { goto } from '$app/navigation'
import { userSettings } from '$lib/settings.js'
import { get } from 'svelte/store'
export const findClosestNumber = (numbers: number[], target: number): number =>
numbers.reduce((prev, curr) =>
@@ -47,8 +49,10 @@ export const placeholders = {
'existential crisis in progress',
],
get: (type: 'url' | 'post' | 'comment') => {
return placeholders[type][
Math.floor(Math.random() * placeholders[type].length)
]
return get(userSettings)?.randomPlaceholders
? placeholders[type][
Math.floor(Math.random() * placeholders[type].length)
]
: ''
},
}