Skip to content

Commit

Permalink
refactor(shell, webif): refactoring darkmode logic
Browse files Browse the repository at this point in the history
  • Loading branch information
notthetup committed Feb 27, 2024
1 parent bba7d4a commit 24e52cc
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/main/resources/org/arl/fjage/web/shell/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@
let delta = 200;
let fitAddon;
let currentTheme = null;
let hideModeToggle = false;
let parentTheme = null;
if (window.parent.document.documentElement.classList.contains('dark')){
parentTheme = 'dark';
currentTheme = parentTheme;
hideModeToggle = true;
}else if (window.parent.document.documentElement.classList.contains('light')){
parentTheme = 'light';
currentTheme = parentTheme;
hideModeToggle = true;
}
hideModeToggle = hideModeToggle || window.parent.hideModeToggle;
window.shellready = false;
function connectSocket(term, url, path){
const ws = new WebSocket('ws://' + url + path);
Expand Down Expand Up @@ -159,6 +147,15 @@
}
}
window.addEventListener('load', () => {
let hideModeToggle = false;
if (window.parent.document.documentElement.classList.contains('dark')){
currentTheme = 'dark';
hideModeToggle = true;
}else if (window.parent.document.documentElement.classList.contains('light')){
currentTheme = 'light';
hideModeToggle = true;
}
hideModeToggle = hideModeToggle || window.parent.hideModeToggle;
const darkmodeBtn = document.getElementById('darkmode-tgl');
let userTheme = false;

Expand Down

0 comments on commit 24e52cc

Please sign in to comment.