function getConfigDefault() { return { title: 'APM5', subtitle: 'AppMakerV5', version: '0.0.0', showVideoBackground: true, backgroundVideoURL: 'img/4.mp4', enableMultilanguage: true, enableNotifications: true, enableThemeSwitcher: true, idUserColumn: 'idUser', defaultIDUser: '1', navStyle: 'default', logo: 'https://user-images.githubusercontent.com/7110136/29002858-a09570d2-7ab4-11e7-8faa-5dd6d4458b0d.png', ...DEFAULT_THEME_COLORS, } } function applyConfig() { let apply = (theme, prop) => { let value = data.config[theme + '_' + prop] if (value && value !== '') { app.$vuetify.theme.themes[theme][prop] = value } } let keys = [ "primary", "secondary", //"background", "surface", "error", "info", "success", "warning", ] keys.forEach(k => apply('dark', k)) keys.forEach(k => apply('light', k)) syncBodyWithTheme(app) let bvideo = document.getElementById('background-video') let bvideoConfigURL = bvideo.src if (data.config.backgroundImageURL?.trim()?.length) { bvideoConfigURL = null } else if (!data.config.backgroundVideoURL?.includes('http')) { bvideoConfigURL = location.origin + location.pathname + data.config.backgroundVideoURL } else { bvideoConfigURL = data.config.backgroundVideoURL } if (data.config.showVideoBackground) { if (bvideo.src != bvideoConfigURL) { bvideo.src = bvideoConfigURL } if (bvideo.playbackRate != 0.5) { bvideo.playbackRate = 0.5 } bvideo.style.display = 'block' } else { bvideo.src = '' bvideo.style.display = 'none' } let compile = (debug, x) => { if (!x || x.trim() == '') { return () => ({}) } try { return new Function(x) } catch (ex) { console.error(debug, 'compile error', ex) return () => ({}) } } let frontend = compile('frontend', data.config.frontend)() GLOBAL_FORMATTERS = { ...BASE_FORMATTERS, ...(frontend.formatters || {}) } GLOBAL_VALIDATORS = { ...BASE_VALIDATORS, ...(frontend.validators || {}) } //TODO: add globals } function toggleTheme(self) { self.$vuetify.theme.dark = !self.$vuetify.theme.dark syncBodyWithTheme(self) //console.log("theme", self.$vuetify.theme) let tvalue = self.$vuetify.theme.dark localStorage.setItem(getLocalStoragePrefix() + 'persist_theme_light', ""+!tvalue) }