mirror of
https://github.com/mue/mue.git
synced 2026-07-17 14:04:09 +02:00
fix: marketplace now works, more hot reload support and fixes
Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
const EventBus = {
|
||||
on(event, callback) {
|
||||
export default class EventBus {
|
||||
static on(event, callback) {
|
||||
document.addEventListener(event, (e) => callback(e.detail));
|
||||
},
|
||||
}
|
||||
|
||||
dispatch(event, data) {
|
||||
static dispatch(event, data) {
|
||||
document.dispatchEvent(new CustomEvent(event, {
|
||||
detail: data
|
||||
}));
|
||||
},
|
||||
}
|
||||
|
||||
remove(event, callback) {
|
||||
static remove(event, callback) {
|
||||
document.removeEventListener(event, callback);
|
||||
},
|
||||
};
|
||||
|
||||
export default EventBus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export default class MarketplaceFunctions {
|
||||
localStorage.removeItem('quote_packs');
|
||||
localStorage.removeItem('quoteAPI');
|
||||
break;
|
||||
case 'photos':
|
||||
case 'photo_packs':
|
||||
localStorage.removeItem('photo_packs');
|
||||
localStorage.setItem('backgroundType', localStorage.getItem('oldBackgroundType'));
|
||||
|
||||
@@ -72,14 +72,15 @@ export default class SettingsFunctions {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
static loadSettings() {
|
||||
static loadSettings(noeasteregg) {
|
||||
const css = localStorage.getItem('customcss');
|
||||
if (css) {
|
||||
document.head.insertAdjacentHTML('beforeend', '<style>' + css + '</style>');
|
||||
}
|
||||
|
||||
if (localStorage.getItem('darkTheme') === 'true') {
|
||||
document.getElementsByClassName('Toastify')[0].classList.add('dark');
|
||||
const js = localStorage.getItem('customjs');
|
||||
if (js) {
|
||||
document.body.insertAdjacentHTML('beforeend', '<script>' + js + '</script>');
|
||||
}
|
||||
|
||||
const font = localStorage.getItem('font');
|
||||
@@ -118,24 +119,31 @@ export default class SettingsFunctions {
|
||||
}
|
||||
|
||||
const widgetzoom = localStorage.getItem('widgetzoom');
|
||||
// don't bother if it's default zoom
|
||||
if (widgetzoom !== '100') {
|
||||
document.getElementById('root').style.zoom = widgetzoom + '%';
|
||||
}
|
||||
document.getElementById('root').style.zoom = widgetzoom + '%';
|
||||
|
||||
const theme = localStorage.getItem('theme');
|
||||
if (theme === 'dark') {
|
||||
document.body.classList.add('dark');
|
||||
} else if (theme === 'auto') {
|
||||
// Set theme depending on user preferred
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
switch (theme) {
|
||||
case 'dark':
|
||||
document.body.classList.add('dark');
|
||||
}
|
||||
break;
|
||||
case 'auto':
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
document.body.classList.add('dark');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
document.body.classList.remove('dark');
|
||||
}
|
||||
|
||||
const tabName = localStorage.getItem('tabName');
|
||||
if (tabName !== window.language.tabname) {
|
||||
document.title = tabName;
|
||||
} else {
|
||||
document.title = window.language.tabname;
|
||||
}
|
||||
|
||||
if (noeasteregg === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// easter egg
|
||||
|
||||
Reference in New Issue
Block a user