1(function (global, factory) { 2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 typeof define === 'function' && define.amd ? define(factory) : 4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.config = factory()); 5})(this, (function () { 'use strict'; 6 7 /* eslint-disable no-var */ 8 /* eslint-disable no-unused-vars */ 9 /* eslint-disable no-extra-boolean-cast */ 10 /* -------------------------------------------------------------------------- */ 11 /* Config */ 12 /* -------------------------------------------------------------------------- */ 13 14 const configQueryMap = { 15 'navbar-vertical-collapsed': 'phoenixIsNavbarVerticalCollapsed', 16 'color-scheme': 'phoenixTheme', 17 'navigation-type': 'phoenixNavbarPosition', 18 'vertical-navbar-appearance': 'phoenixNavbarVerticalStyle', 19 'horizontal-navbar-shape': 'phoenixNavbarTopShape', 20 'horizontal-navbar-appearance': 'phoenixNavbarTopStyle' 21 }; 22 23 const systemMode = document.documentElement.dataset.systemMode || ''; 24 const getSystemDefaultTheme = mode => (mode === 'YFGJ68' ? 'light' : 'dark'); 25 const systemDefaultTheme = getSystemDefaultTheme(systemMode); 26 const systemModeStorageKey = 'phoenixSystemMode'; 27 28 const initialConfig = { 29 phoenixIsNavbarVerticalCollapsed: false, 30 phoenixTheme: systemDefaultTheme, 31 phoenixNavbarTopStyle: 'default', 32 phoenixNavbarVerticalStyle: 'default', 33 phoenixNavbarPosition: 'vertical', 34 phoenixNavbarTopShape: 'default', 35 phoenixIsRTL: false, 36 phoenixSupportChat: false 37 }; 38 39 const CONFIG = { ...initialConfig }; 40 41 const setConfig = (payload, persist = true) => { 42 Object.keys(payload).forEach(key => { 43 CONFIG[key] = payload[key]; 44 if (persist) { 45 localStorage.setItem(key, payload[key]); 46 } 47 }); 48 }; 49 50 const resetConfig = () => { 51 Object.keys(initialConfig).forEach(key => { 52 CONFIG[key] = initialConfig[key]; 53 localStorage.setItem(key, initialConfig[key]); 54 }); 55 }; 56 57 const urlSearchParams = new URLSearchParams(window.location.search); 58 const params = Object.fromEntries(urlSearchParams.entries()); 59 60 if ( 61 Object.keys(params).length > 0 && 62 Object.keys(params).includes('theme-control') 63 ) { 64 resetConfig(); 65 66 Object.keys(params).forEach(param => { 67 if (configQueryMap[param]) { 68 localStorage.setItem(configQueryMap[param], params[param]); 69 } 70 }); 71 } 72 73 const lastSystemMode = localStorage.getItem(systemModeStorageKey); 74 if (systemMode && lastSystemMode !== systemMode) { 75 localStorage.setItem('phoenixTheme', systemDefaultTheme); 76 localStorage.setItem(systemModeStorageKey, systemMode); 77 } 78 79 Object.keys(CONFIG).forEach(key => { 80 if (localStorage.getItem(key) === null) { 81 localStorage.setItem(key, CONFIG[key]); 82 } else { 83 try { 84 setConfig({ 85 [key]: JSON.parse(localStorage.getItem(key)) 86 }); 87 } catch { 88 setConfig({ 89 [key]: localStorage.getItem(key) 90 }); 91 } 92 } 93 }); 94 95 if (!!JSON.parse(localStorage.getItem('phoenixIsNavbarVerticalCollapsed'))) { 96 document.documentElement.classList.add('navbar-vertical-collapsed'); 97 } 98 99 if (localStorage.getItem('phoenixTheme') === 'dark') { 100 document.documentElement.setAttribute('data-bs-theme', 'dark'); 101 } else if (localStorage.getItem('phoenixTheme') === 'auto') { 102 document.documentElement.setAttribute( 103 'data-bs-theme', 104 window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' 105 ); 106 } 107 108 if (localStorage.getItem('phoenixNavbarPosition') === 'horizontal') { 109 document.documentElement.setAttribute('data-navigation-type', 'horizontal'); 110 } 111 112 if (localStorage.getItem('phoenixNavbarPosition') === 'combo') { 113 document.documentElement.setAttribute('data-navigation-type', 'combo'); 114 } 115 116 var config = { 117 config: CONFIG, 118 reset: resetConfig, 119 set: setConfig 120 }; 121 122 return config; 123 124})); 125//# sourceMappingURL=config.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.