This commit is contained in:
/home/neo 2026-06-14 19:36:13 +03:00 committed by GitHub
parent fc15e16c37
commit 233e1984dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,12 +22,15 @@
function inject(url) {
var id = linkId(url);
if (document.getElementById(id)) return;
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = url;
link.id = id;
link.setAttribute(ATTR, "");
document.head.appendChild(link);
fetch(url).then(function (r) { return r.text(); }).then(function (css) {
var el = document.getElementById(id);
if (el) return;
var style = document.createElement("style");
style.id = id;
style.setAttribute(ATTR, "");
style.textContent = css;
document.head.appendChild(style);
}).catch(function () {});
}
function eject(url) {
@ -36,7 +39,7 @@
}
function apply() {
var els = document.querySelectorAll("link[" + ATTR + "]");
var els = document.querySelectorAll("style[" + ATTR + "]");
for (var i = els.length - 1; i >= 0; i--) els[i].remove();
var themes = load();
for (var i = 0; i < themes.length; i++) {