lightmode flashing fix
parent
e9b482e561
commit
69839f2a19
|
@ -5,6 +5,7 @@ MD.Darkmode = function(){
|
||||||
if (!button) return false;
|
if (!button) return false;
|
||||||
|
|
||||||
function set(isDark) {
|
function set(isDark) {
|
||||||
|
|
||||||
button.setAttribute("title", isDark ? "Switch to lightmode" : "Switch to darkmode")
|
button.setAttribute("title", isDark ? "Switch to lightmode" : "Switch to darkmode")
|
||||||
body.classList.toggle("inverted", !isDark);
|
body.classList.toggle("inverted", !isDark);
|
||||||
body.classList.add("cancel-transitions");
|
body.classList.add("cancel-transitions");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(function(){
|
(function(){
|
||||||
const canvasContent = localStorage.getItem("md-canvasContent");
|
const canvasContent = localStorage.getItem("md-canvasContent");
|
||||||
const isDark = localStorage.getItem("md-darkmode");
|
const isDark = localStorage.getItem("md-darkmode");
|
||||||
document.body.classList.toggle("inverted", !isDark);
|
if (!isDark) body.classList.add("inverted");
|
||||||
if (!canvasContent) return;
|
if (!canvasContent) return;
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const doc = parser.parseFromString(canvasContent, "image/svg+xml");
|
const doc = parser.parseFromString(canvasContent, "image/svg+xml");
|
||||||
|
|
Loading…
Reference in New Issue