Refactor theme handling in settings.html
This commit is contained in:
@@ -163,20 +163,22 @@
|
|||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('DOMContentLoaded', async () => {
|
window.addEventListener('DOMContentLoaded', async () => {
|
||||||
const isSky = await window.settingsAPI.getSkyMode();
|
const applyThemeClass = (theme) => {
|
||||||
document.body.classList.toggle('sky-mode', isSky);
|
document.body.classList.remove('theme-sky', 'theme-grey');
|
||||||
|
if (theme === 'sky') document.body.classList.add('theme-sky');
|
||||||
|
if (theme === 'grey') document.body.classList.add('theme-grey');
|
||||||
|
};
|
||||||
|
|
||||||
// Elemente holen
|
// Elemente holen
|
||||||
const themeSelect = document.getElementById('themeSelect');
|
const themeSelect = document.getElementById('themeSelect');
|
||||||
const cbSky = document.getElementById('skymode');
|
const cbSkip = document.getElementById('skipPrompt');
|
||||||
const cbSkip = document.getElementById('skipPrompt');
|
const thresholdInput = document.getElementById('intelligentCommitThresholdInput');
|
||||||
const thresholdInput = document.getElementById('intelligentCommitThresholdInput');
|
const minutesInput = document.getElementById('intelligentCommitMinutesInput');
|
||||||
const minutesInput = document.getElementById('intelligentCommitMinutesInput');
|
const ok = document.getElementById('okBtn');
|
||||||
const ok = document.getElementById('okBtn');
|
const cancel = document.getElementById('cancelBtn');
|
||||||
const cancel = document.getElementById('cancelBtn');
|
const cbAutostart = document.getElementById('autostart');
|
||||||
const cbAutostart = document.getElementById('autostart');
|
const cbCloseToTray = document.getElementById('closeToTray');
|
||||||
const cbCloseToTray= document.getElementById('closeToTray');
|
const giteaTokenInput = document.getElementById('giteaTokenInput');
|
||||||
const giteaTokenInput = document.getElementById('giteaTokenInput');
|
|
||||||
|
|
||||||
const [initialAutostart, initialCloseToTray] = await Promise.all([
|
const [initialAutostart, initialCloseToTray] = await Promise.all([
|
||||||
window.settingsAPI.getAutostart(),
|
window.settingsAPI.getAutostart(),
|
||||||
|
|||||||
Reference in New Issue
Block a user