Skip to content

Commit d4af302

Browse files
committed
public: disable darkmode
1 parent 410073e commit d4af302

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- [x] Test package support
44
- [x] Auto format && import
5-
- [x] Dark mode
5+
- [x] ~~Dark mode~~ Doesn't work for dynamic iframe
66
- [x] Message: waiting for SSA response
77
- [ ] Dragable SSA
88
- [ ] Compiler flags, e.g. disable

public/dark.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
document.getElementById('dark-mode-checkbox').onchange = () => {
2+
darkmode()
3+
}
14
var enabled = localStorage.getItem('dark-mode')
25
if (enabled === null) {
36
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
@@ -7,14 +10,13 @@ if (enabled === null) {
710
enable(); document.getElementById("dark-mode-checkbox").checked = true;
811
}
912
function enable() {
10-
DarkReader.enable({brightness: 100, contrast: 85, sepia: 10});
13+
DarkReader.enable({brightness: 100, contrast: 85, sepia: 10}, null, true);
1114
localStorage.setItem('dark-mode', 'true');
1215
}
1316
function disable() {
1417
DarkReader.disable();
1518
localStorage.setItem('dark-mode', 'false')
1619
}
1720
function darkmode() {
18-
console
1921
if (localStorage.getItem('dark-mode') === 'false') { enable(); } else { disable();}
2022
}

public/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
<input class="btn btn-primary" type="button" value="Build" id="build">
2020
</div>
2121
<div id="aboutControls">
22-
<label class="switch">
23-
<input id="dark-mode-checkbox" type="checkbox" onchange="darkmode()">
22+
<!-- doesn't work for iframe -->
23+
<!-- <label class="switch">
24+
<input id="dark-mode-checkbox" type="checkbox">
2425
<span class="slider"></span>
25-
</label>
26+
</label> -->
2627
<input class="btn btn-primary" type="button" value="About" id="aboutbtn">
2728
</div>
2829
</div>

public/magic.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ let msgbox = document.getElementById('outputMsg')
1111
let ssabox = document.getElementById('ssa')
1212
ssabox.addEventListener('load', () => {
1313
// inject ssa style
14-
let $head = $("iframe").contents().find("head");
15-
$head.append($("<link/>", { rel: "stylesheet", href: "/gossa/scrollbar.css", type: "text/css"}));
14+
let head = $("iframe").contents().find("head");
15+
head.append($("<link/>", { rel: 'stylesheet', href: '/gossa/scrollbar.css', type: 'text/css'}));
1616
setMessageBox('', true)
1717
});
1818

0 commit comments

Comments
 (0)