Swap global vars to app config as JSON

This commit is contained in:
2026-04-25 18:00:19 +02:00
parent dea14acd29
commit 40565849c5
3 changed files with 8 additions and 8 deletions

View File

@@ -188,7 +188,6 @@ class Spot extends Main
self::MAIN_PAGE, self::MAIN_PAGE,
array( array(
'language' => $this->oLang->getLanguage(), 'language' => $this->oLang->getLanguage(),
'filepath_css' => self::addTimestampToFilePath('spot.css'),
'filepath_js' => self::addTimestampToFilePath('../dist/app.js'), 'filepath_js' => self::addTimestampToFilePath('../dist/app.js'),
), ),
$asPages $asPages

View File

@@ -19,7 +19,7 @@
<meta name="msapplication-TileColor" content="#00a300"> <meta name="msapplication-TileColor" content="#00a300">
<meta name="msapplication-config" content="images/icons/browserconfig.xml?v=GvmqYyKwbb"> <meta name="msapplication-config" content="images/icons/browserconfig.xml?v=GvmqYyKwbb">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<script type="text/javascript">window.params = [#]GLOBAL_VARS[#];</script> <script id="app-config" type="application/json">[#]APP_CONFIG[#]</script>
<title>Spotty</title> <title>Spotty</title>
</head> </head>
<body> <body>

View File

@@ -9,7 +9,6 @@ window.setElem = common.setElem;
window.getDragPosition = common.getDragPosition; window.getDragPosition = common.getDragPosition;
window.copyTextToClipboard = common.copyTextToClipboard; window.copyTextToClipboard = common.copyTextToClipboard;
window.getOuterWidth = common.getOuterWidth; window.getOuterWidth = common.getOuterWidth;
import Css from './../styles/spot.scss'; import Css from './../styles/spot.scss';
//Masks //Masks
@@ -18,8 +17,6 @@ import Spot from './spot.js';
//import Upload from './page.upload.js'; //import Upload from './page.upload.js';
//import Admin from './page.admin.js'; //import Admin from './page.admin.js';
window.oSpot = new Spot(params);
//let oProject = new Project(oSpot); //let oProject = new Project(oSpot);
//oSpot.addPage('project', oProject); //oSpot.addPage('project', oProject);
@@ -34,6 +31,10 @@ window.oSpot = new Spot(params);
import { createApp } from 'vue'; import { createApp } from 'vue';
import SpotVue from '../Spot.vue'; import SpotVue from '../Spot.vue';
const appConfigElement = document.getElementById('app-config');
const appConfig = appConfigElement ? JSON.parse(appConfigElement.textContent || '{}') : {};
const oSpot = new Spot(appConfig);
const oSpotVue = createApp(SpotVue); const oSpotVue = createApp(SpotVue);
oSpotVue.provide('spot', window.oSpot); oSpotVue.provide('spot', oSpot);
oSpotVue.mount('#container'); oSpotVue.mount('#container');