From 8c9c6e0f34c3398fe4343ad04158b3b379b47c39 Mon Sep 17 00:00:00 2001 From: fox Date: Mon, 13 Mar 2023 09:20:41 +0000 Subject: [PATCH] revert 6b180d30b3ddd008a1449746cd076c80dc7f2961 revert Fix theme apply button so it updates instantly I tried to do this while keeping the CSP changes but it seems like it is impossible, however, the themes do with with these enabled still and the CSP changes still working, so I am not sure why they were even implemented. --- .gitignore | 3 +-- index.html | 1 + src/components/settings_modal/tabs/theme_tab/theme_tab.js | 6 ++---- src/services/style_setter/style_setter.js | 4 +--- static/theme-holder.css | 1 + 5 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 static/theme-holder.css diff --git a/.gitignore b/.gitignore index 271b75c9..a0be5c16 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,4 @@ selenium-debug.log config/local.json config/local.*.json docs/site/ -.vscode/ -*.log +.vscode/ \ No newline at end of file diff --git a/index.html b/index.html index 79613dd2..fda91b0f 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,7 @@ + diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.js b/src/components/settings_modal/tabs/theme_tab/theme_tab.js index c89e5dab..d6ccd5ea 100644 --- a/src/components/settings_modal/tabs/theme_tab/theme_tab.js +++ b/src/components/settings_modal/tabs/theme_tab/theme_tab.js @@ -115,8 +115,7 @@ export default { avatarRadiusLocal: '', avatarAltRadiusLocal: '', attachmentRadiusLocal: '', - tooltipRadiusLocal: '', - chatMessageRadiusLocal: '' + tooltipRadiusLocal: '' } }, created () { @@ -231,8 +230,7 @@ export default { avatar: this.avatarRadiusLocal, avatarAlt: this.avatarAltRadiusLocal, tooltip: this.tooltipRadiusLocal, - attachment: this.attachmentRadiusLocal, - chatMessage: this.chatMessageRadiusLocal + attachment: this.attachmentRadiusLocal } }, preview () { diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index 543aa874..7f3efd97 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -4,12 +4,10 @@ import { getColors, computeDynamicColor, getOpacitySlot } from '../theme_data/th export const applyTheme = (input) => { const { rules } = generatePreset(input) - const head = document.head const body = document.body body.classList.add('hidden') - const styleEl = document.createElement('style') - head.appendChild(styleEl) + const styleEl = document.getElementById('theme-holder') const styleSheet = styleEl.sheet styleSheet.toString() diff --git a/static/theme-holder.css b/static/theme-holder.css new file mode 100644 index 00000000..3e884036 --- /dev/null +++ b/static/theme-holder.css @@ -0,0 +1 @@ +// This file intentionally left blank