biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
44
src/main.js
44
src/main.js
|
|
@ -7,7 +7,7 @@ import './lib/event_target_polyfill.js'
|
|||
|
||||
// Polyfill for Array.prototype.toSorted (ES2023)
|
||||
if (!Array.prototype.toSorted) {
|
||||
Array.prototype.toSorted = function(compareFn) {
|
||||
Array.prototype.toSorted = function (compareFn) {
|
||||
return [...this].sort(compareFn)
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,9 @@ import vuexModules from './modules/index.js'
|
|||
|
||||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
import createPersistedState, { piniaPersistPlugin } from './lib/persisted_state.js'
|
||||
import createPersistedState, {
|
||||
piniaPersistPlugin,
|
||||
} from './lib/persisted_state.js'
|
||||
import pushNotifications from './lib/push_notifications_plugin.js'
|
||||
|
||||
import messages from './i18n/messages.js'
|
||||
|
|
@ -29,30 +31,27 @@ const i18n = createI18n({
|
|||
// By default, use the browser locale, we will update it if neccessary
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
messages: messages.default
|
||||
messages: messages.default,
|
||||
})
|
||||
|
||||
messages.setLanguage(i18n.global, currentLocale)
|
||||
|
||||
const persistedStateOptions = {
|
||||
paths: [
|
||||
'serverSideStorage.cache',
|
||||
'config',
|
||||
'users.lastLoginName',
|
||||
'oauth'
|
||||
]
|
||||
};
|
||||
paths: ['serverSideStorage.cache', 'config', 'users.lastLoginName', 'oauth'],
|
||||
}
|
||||
|
||||
(async () => {
|
||||
;(async () => {
|
||||
const isFox = Math.floor(Math.random() * 2) > 0 ? '_fox' : ''
|
||||
|
||||
const splashError = (i18n, e) => {
|
||||
const throbber = document.querySelector('#throbber')
|
||||
throbber.addEventListener('animationend', () => {
|
||||
document.querySelector('#mascot').src = `/static/pleromatan_orz${isFox}.png`
|
||||
document.querySelector('#mascot').src =
|
||||
`/static/pleromatan_orz${isFox}.png`
|
||||
})
|
||||
throbber.classList.add('dead')
|
||||
document.querySelector('#status').textContent = i18n.global.t('splash.error')
|
||||
document.querySelector('#status').textContent =
|
||||
i18n.global.t('splash.error')
|
||||
console.error('PleromaFE failed to initialize: ', e)
|
||||
document.querySelector('#statusError').textContent = e
|
||||
document.querySelector('#statusStack').textContent = e.stack
|
||||
|
|
@ -60,8 +59,8 @@ const persistedStateOptions = {
|
|||
document.querySelector('#statusStack').style = 'display: block'
|
||||
}
|
||||
|
||||
window.splashError = e => splashError(i18n, e)
|
||||
window.splashUpdate = key => {
|
||||
window.splashError = (e) => splashError(i18n, e)
|
||||
window.splashUpdate = (key) => {
|
||||
if (document.querySelector('#status')) {
|
||||
document.querySelector('#status').textContent = i18n.global.t(key)
|
||||
}
|
||||
|
|
@ -81,17 +80,22 @@ const persistedStateOptions = {
|
|||
storageError = e
|
||||
}
|
||||
document.querySelector('#splash').classList.remove('initial-hidden')
|
||||
document.querySelector('#mascot').src = `/static/pleromatan_apology${isFox}_small.webp`
|
||||
document.querySelector('#mascot').src =
|
||||
`/static/pleromatan_apology${isFox}_small.webp`
|
||||
document.querySelector('#status').removeAttribute('class')
|
||||
document.querySelector('#status').textContent = i18n.global.t('splash.loading')
|
||||
document.querySelector('#splash-credit').textContent = i18n.global.t('update.art_by', { linkToArtist: 'pipivovott' })
|
||||
document.querySelector('#status').textContent =
|
||||
i18n.global.t('splash.loading')
|
||||
document.querySelector('#splash-credit').textContent = i18n.global.t(
|
||||
'update.art_by',
|
||||
{ linkToArtist: 'pipivovott' },
|
||||
)
|
||||
const store = createStore({
|
||||
modules: vuexModules,
|
||||
plugins,
|
||||
options: {
|
||||
devtools: process.env.NODE_ENV !== 'production'
|
||||
devtools: process.env.NODE_ENV !== 'production',
|
||||
},
|
||||
strict: false // Socket modifies itself, let's ignore this for now.
|
||||
strict: false, // Socket modifies itself, let's ignore this for now.
|
||||
// strict: process.env.NODE_ENV !== 'production'
|
||||
})
|
||||
window.vuex = store
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue