2021-12-19 13:23:09 +03:00
|
|
|
PetiteVue.createApp({
|
|
|
|
//$delimiters: ['${', '}'], // https://github.com/vuejs/petite-vue/pull/100
|
|
|
|
activeTab: defaultTab,
|
|
|
|
selectedTimezone: userTimeZone,
|
2022-04-24 10:26:04 +03:00
|
|
|
vibrantColorsEnabled: JSON.parse(localStorage.getItem('wakapi_vibrant_colors') || false),
|
2021-12-19 13:23:09 +03:00
|
|
|
get tzOptions() {
|
|
|
|
return [defaultTzOption, ...tzs.sort().map(tz => ({ value: tz, text: tz }))]
|
|
|
|
},
|
|
|
|
updateTab() {
|
|
|
|
this.activeTab = window.location.hash.slice(1) || defaultTab
|
|
|
|
},
|
|
|
|
isActive(tab) {
|
|
|
|
return this.activeTab === tab
|
|
|
|
},
|
|
|
|
confirmRegenerate() {
|
|
|
|
if (confirm('Are you sure?')) {
|
2022-01-02 22:13:38 +03:00
|
|
|
document.querySelector('#form-regenerate-summaries').submit()
|
2021-12-19 13:23:09 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
confirmWakatimeImport() {
|
|
|
|
if (confirm('Are you sure? The import can not be undone.')) {
|
2022-01-02 22:13:38 +03:00
|
|
|
document.querySelector('#form-import-wakatime').submit()
|
2021-12-19 13:23:09 +03:00
|
|
|
}
|
|
|
|
},
|
2022-03-17 13:55:13 +03:00
|
|
|
confirmClearData() {
|
|
|
|
if (confirm('Are you sure? This can not be undone!')) {
|
|
|
|
document.querySelector('#form-clear-data').submit()
|
|
|
|
}
|
|
|
|
},
|
2021-12-19 13:23:09 +03:00
|
|
|
confirmDeleteAccount() {
|
|
|
|
if (confirm('Are you sure? This can not be undone!')) {
|
2022-01-02 22:13:38 +03:00
|
|
|
document.querySelector('#form-delete-user').submit()
|
2021-12-19 13:23:09 +03:00
|
|
|
}
|
|
|
|
},
|
2022-04-24 10:26:04 +03:00
|
|
|
onToggleVibrantColors() {
|
|
|
|
localStorage.setItem('wakapi_vibrant_colors', this.vibrantColorsEnabled)
|
2022-04-24 00:39:08 +03:00
|
|
|
},
|
2021-12-19 13:23:09 +03:00
|
|
|
mounted() {
|
|
|
|
this.updateTab()
|
|
|
|
window.addEventListener('hashchange', () => this.updateTab())
|
|
|
|
}
|
2022-04-24 00:39:08 +03:00
|
|
|
}).mount('#settings-page')
|