mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-04-25 23:06:43 +02:00
@@ -89,10 +89,10 @@ Vue.prototype.$strings = { ...enUsStrings }
|
||||
* Get string and substitute
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {string[]} subs
|
||||
* @param {string[]} [subs=[]]
|
||||
* @returns {string}
|
||||
*/
|
||||
Vue.prototype.$getString = (key, subs) => {
|
||||
Vue.prototype.$getString = (key, subs = []) => {
|
||||
if (!Vue.prototype.$strings[key]) return ''
|
||||
if (subs?.length && Array.isArray(subs)) {
|
||||
return supplant(Vue.prototype.$strings[key], subs)
|
||||
|
||||
@@ -18,7 +18,10 @@ Vue.prototype.$bytesPretty = (bytes, decimals = 2) => {
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]
|
||||
}
|
||||
|
||||
Vue.prototype.$elapsedPretty = (seconds, useFullNames = false) => {
|
||||
Vue.prototype.$elapsedPretty = (seconds, useFullNames = false, useMilliseconds = false) => {
|
||||
if (useMilliseconds && seconds > 0 && seconds < 1) {
|
||||
return `${Math.floor(seconds * 1000)} ms`
|
||||
}
|
||||
if (seconds < 60) {
|
||||
return `${Math.floor(seconds)} sec${useFullNames ? 'onds' : ''}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user