adds style stack editor

This commit is contained in:
booploops 2022-04-11 12:39:19 -07:00
parent 4cda5a5303
commit 51e78ee866
3 changed files with 133 additions and 24 deletions

View file

@ -465,9 +465,9 @@ const app = new Vue({
history.forward()
},
getHTMLStyle() {
if(app.cfg.visual.uiScale != 1) {
if (app.cfg.visual.uiScale != 1) {
document.querySelector("#app").style.zoom = app.cfg.visual.uiScale
}else{
} else {
document.querySelector("#app").style.zoom = ""
}
},
@ -956,6 +956,31 @@ const app = new Vue({
less.refresh()
}
},
async reloadStyles() {
const styles = this.cfg.visual.styles
document.querySelectorAll(`[id*='less']`).forEach(el => {
el.remove()
});
this.chrome.appliedTheme.info = {}
await asyncForEach(styles, async (style) => {
let styleEl = document.createElement("link")
styleEl.id = `less-${style.replace(".less", "")}`
styleEl.rel = "stylesheet/less"
styleEl.href = `themes/${style}`
styleEl.type = "text/css"
document.head.appendChild(styleEl)
try {
let infoResponse = await fetch("themes/" + style.replace("index.less", "theme.json"))
this.chrome.appliedTheme.info = Object.assign(this.chrome.appliedTheme.info, await infoResponse.json())
} catch (e) {
e = null
console.warn("failed to get theme.json")
}
})
less.registerStylesheetsImmediately()
less.refresh(true, true, true)
this.$forceUpdate()
},
macOSEmu() {
this.chrome.forceDirectives["macosemu"] = {
value: true
@ -3811,7 +3836,7 @@ const app = new Vue({
]
}
}
if(this.cfg.advanced.AudioContext) {
if (this.cfg.advanced.AudioContext) {
menus.normal.items.find(i => i.id === 'audioLab').hidden = false
menus.normal.items.find(i => i.id === 'equalizer').hidden = false
}