📝 Added entire config directory for backup purposes
This commit is contained in:
parent
4b38e59bb6
commit
9b946e2d14
11091 changed files with 1440953 additions and 0 deletions
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* NoScript - a Firefox extension for whitelist driven safe JavaScript execution
|
||||
*
|
||||
* Copyright (C) 2005-2021 Giorgio Maone <https://maone.net>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
var Entities = {
|
||||
get htmlNode() {
|
||||
delete this.htmlNode;
|
||||
return this.htmlNode = document.implementation.createHTMLDocument("")
|
||||
.createElement("body");
|
||||
},
|
||||
convert: function(e) {
|
||||
try {
|
||||
this.htmlNode.innerHTML = e;
|
||||
var child = this.htmlNode.firstChild || null;
|
||||
return child && child.nodeValue || e;
|
||||
} catch(ex) {
|
||||
return e;
|
||||
}
|
||||
},
|
||||
convertAll: function(s) {
|
||||
return s.replace(/[\\&][^<>]+/g, function(e) { return Entities.convert(e) });
|
||||
},
|
||||
convertDeep: function(s) {
|
||||
for (var prev = null; (s = this.convertAll(s)) !== prev || (s = unescape(s)) !== prev; prev = s);
|
||||
return s;
|
||||
},
|
||||
neutralize: function(e, whitelist) {
|
||||
var c = this.convert(e);
|
||||
return (c == e) ? c : (whitelist && whitelist.test(c) ? e : e.replace(";", ","));
|
||||
},
|
||||
neutralizeAll: function(s, whitelist) {
|
||||
return s.replace(/&[\w#-]*?;/g, function(e) { return Entities.neutralize(e, whitelist || null); });
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* Copyright (C) 2005-2022 Giorgio Maone <https://maone.net>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
.__NoScript_Theme__ {
|
||||
--focus-color-dark: #c35a;
|
||||
--focus-color-light: #f68a;
|
||||
|
||||
--img-noscript-options: url(/img/noscript-options.png);
|
||||
--img-ui-revoke-temp: url(/img/ui-revoke-temp64.png);
|
||||
--img-ui-temp-all: url(/img/ui-temp-all64.png);
|
||||
--img-ui-tab-no: url(/img/ui-tab-no64.png);
|
||||
--img-ui-tab: url(/img/ui-tab64.png);
|
||||
--img-ui-global-no: url(/img/ui-global-no64.png);
|
||||
--img-ui-global: url(/img/ui-global64.png);
|
||||
--img-noscript-options: url(/img/noscript-options.png);
|
||||
--img-ui-close: url(/img/ui-close64.png);
|
||||
--img-ui-reload: url(/img/ui-reload64.png);
|
||||
--img-warning: url(/img/warning64.png);
|
||||
--img-error: url(/img/error64.png);
|
||||
--img-logo: url(/img/logo.svg);
|
||||
--img-ui-http: url(/img/ui-http64.png);
|
||||
--img-ui-https: url(/img/ui-https64.png);
|
||||
--img-ui-no: url(/img/ui-no64.png);
|
||||
--img-ui-temp: url(/img/ui-temp64.png);
|
||||
--img-ui-yes: url(/img/ui-yes64.png);
|
||||
--img-ui-black: url(/img/ui-black64.png);
|
||||
--img-ui-custom: url(/img/ui-custom64.png);
|
||||
--img-ui-clock: url(/img/ui-clock64.png);
|
||||
|
||||
--icon-size: 2.2em;
|
||||
--line-size: 1.5em;
|
||||
--popup-size: 600px;
|
||||
|
||||
--bg-preset-color: var(--form-color2);
|
||||
--bg-odd-row: var(--bg-color2);
|
||||
--bg-even-row: var(--tab-color1);
|
||||
--bg-focused-row: linear-gradient(to bottom, var(--focus-color) 0, transparent 10%, transparent 90%, var(--focus-color) 100%);
|
||||
--border-row-sep: none;
|
||||
}
|
||||
|
||||
|
||||
.__NoScript_Theme__.vintage {
|
||||
|
||||
--focus-color-dark: #35Ca !important;
|
||||
--focus-color-light: #8cfa !important;
|
||||
|
||||
--img-noscript-options: url(/img/vintage/noscript-options.png);
|
||||
--img-ui-revoke-temp: url(/img/vintage/ui-revoke-temp64.png);
|
||||
--img-ui-temp-all: url(/img/vintage/ui-temp-all64.png);
|
||||
--img-ui-tab-no: url(/img/vintage/ui-tab-no64.png);
|
||||
--img-ui-tab: url(/img/vintage/ui-tab64.png);
|
||||
--img-ui-global-no: url(/img/vintage/ui-global-no64.png);
|
||||
--img-ui-global: url(/img/vintage/ui-global64.png);
|
||||
--img-noscript-options: url(/img/vintage/noscript-options.png);
|
||||
--img-ui-close: url(/img/vintage/ui-close64.png);
|
||||
--img-ui-reload: url(/img/vintage/ui-reload64.png);
|
||||
--img-warning: url(/img/vintage/warning64.png);
|
||||
--img-error: url(/img/vintage/error64.png);
|
||||
--img-logo: url(/img/vintage/logo.svg);
|
||||
--img-ui-http: url(/img/vintage/ui-http64.png);
|
||||
--img-ui-https: url(/img/vintage/ui-https64.png);
|
||||
--img-ui-no: url(/img/vintage/ui-no64.png);
|
||||
--img-ui-temp: url(/img/vintage/ui-temp64.png);
|
||||
--img-ui-yes: url(/img/vintage/ui-yes64.png);
|
||||
--img-ui-black: url(/img/vintage/ui-black64.png);
|
||||
--img-ui-custom: url(/img/vintage/ui-custom64.png);
|
||||
--img-ui-clock: url(/img/vintage/ui-clock64.png);
|
||||
|
||||
--icon-size: 2em;
|
||||
--line-size: 1.5em;
|
||||
--popup-size: 600px;
|
||||
|
||||
}
|
||||
|
||||
.__NoScript_Theme__, .__NoScript_Theme__[data-theme="dark"] {
|
||||
color-scheme: dark;
|
||||
--accent-color: #d12027;
|
||||
--fg-color1: #ccc;
|
||||
--fg-color2: #fff;
|
||||
--text-color: #ddd;
|
||||
--bg-color1: #000;
|
||||
--bg-color2: #212026;
|
||||
--form-color1: #333;
|
||||
--form-color2: #111;
|
||||
--focus-color: var(--focus-color-dark);
|
||||
--tab-color1: #334;
|
||||
--tab-color2: #3348;
|
||||
--form-check-color: var(--form-color2);
|
||||
--form-check-bg-color: var(--accent-color);
|
||||
--form-radio-color: var(--accent-color);
|
||||
--form-radio-bg-color: var(--form-color1);
|
||||
--hilite-color: #8008;
|
||||
--unsafe-color: var(--accent-color);
|
||||
}
|
||||
|
||||
.__NoScript_Theme__.vintage:not([data-theme="light"]) :is(input.preset, .icon) {
|
||||
filter: brightness(85%);
|
||||
}
|
||||
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
.__NoScript_Theme__ {
|
||||
color-scheme: light;
|
||||
--fg-color1: #555;
|
||||
--fg-color2: #000;
|
||||
--text-color: #333;
|
||||
--bg-color1: #ddd;
|
||||
--bg-color2: #fff;
|
||||
--form-color1: #ccc;
|
||||
--form-color2: #eee;
|
||||
--form-check-color: var(--bg-color2);
|
||||
--form-check-bg-color: var(--accent-color);
|
||||
--tab-color1: #d0d8e0;
|
||||
--tab-color2: #d0d8e088;
|
||||
--focus-color: var(--focus-color-light);
|
||||
--hilite-color: #f008;
|
||||
--unsafe-color: #811;
|
||||
}
|
||||
|
||||
|
||||
.__NoScript_Theme__.vintage:not([data-theme="light"]) :is(input.preset, .icon) {
|
||||
filter: none;
|
||||
}
|
||||
.__NoScript_Theme__.vintage[data-theme="dark"] :is(input.preset, .icon) {
|
||||
filter: brightness(85%);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* NoScript - a Firefox extension for whitelist driven safe JavaScript execution
|
||||
*
|
||||
* Copyright (C) 2005-2021 Giorgio Maone <https://maone.net>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
{
|
||||
const PARENT_CLASS = "__NoScript_Theme__";
|
||||
let patchSheet = s => {
|
||||
const PARENT_SELECTOR = `.${PARENT_CLASS}`;
|
||||
let rules = s.cssRules;
|
||||
for (let j = 0, len = rules.length; j < len; j++) {
|
||||
let rule = rules[j];
|
||||
if (rule.styleSheet && patchSheet(rule.styleSheet)) {
|
||||
return true;
|
||||
}
|
||||
if (rule.conditionText !== "(prefers-color-scheme: light)") continue;
|
||||
for (let r of rule.cssRules) {
|
||||
let {selectorText} = r;
|
||||
if (selectorText.includes("[data-theme=") || !selectorText.startsWith(PARENT_SELECTOR)) continue;
|
||||
selectorText = selectorText.replace(PARENT_SELECTOR, `${PARENT_SELECTOR}[data-theme="light"]`);
|
||||
s.insertRule(`${selectorText} {${r.style.cssText}}`, j);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
let patchAll = () => {
|
||||
for (let s of document.styleSheets) {
|
||||
try {
|
||||
if (patchSheet(s)) return true;
|
||||
} catch (e) {
|
||||
// cross-site stylesheet?
|
||||
console.error(e, s.href);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!patchAll()) {
|
||||
console.error("Couldn't patch sheets while loading, deferring to onload");
|
||||
let onload = e => {
|
||||
if (patchAll()) {
|
||||
removeEventListener(e.type, onload, true);
|
||||
}
|
||||
}
|
||||
addEventListener("load", onload, true);
|
||||
}
|
||||
|
||||
|
||||
let root = document.documentElement;
|
||||
root.classList.add(PARENT_CLASS);
|
||||
|
||||
const VINTAGE = "vintageTheme";
|
||||
|
||||
let update = toTheme => {
|
||||
return root.dataset.theme = toTheme;
|
||||
}
|
||||
|
||||
let updateFavIcon = isVintage => {
|
||||
let favIcon = document.querySelector("link[rel=icon]");
|
||||
if (!favIcon) return;
|
||||
let {href} = favIcon;
|
||||
const BASE = new URL("/img/", location.href);
|
||||
if (!href.startsWith(BASE)) return alert("return");
|
||||
const SUB = BASE + "vintage/";
|
||||
let vintageIcon = href.startsWith(SUB);
|
||||
if (isVintage === vintageIcon) return;
|
||||
favIcon.href = isVintage ? href.replace(BASE, SUB) : href.replace(SUB, BASE);
|
||||
}
|
||||
|
||||
let refreshVintage = isVintage => {
|
||||
document.documentElement.classList.toggle("vintage", isVintage === true);
|
||||
if (browser.browserAction) {
|
||||
browser.browserAction.setIcon({path: {64: `/img${isVintage ? "/vintage/" : "/"}ui-maybe64.png` }});
|
||||
}
|
||||
updateFavIcon(isVintage);
|
||||
}
|
||||
|
||||
const THEMES = ["dark", "light", "auto"];
|
||||
var Themes = {
|
||||
setup(theme = null) {
|
||||
if (theme) {
|
||||
if (window.localStorage) {
|
||||
localStorage.setItem("theme", theme);
|
||||
}
|
||||
if (browser && browser.storage) {
|
||||
browser.storage.local.set({theme});
|
||||
}
|
||||
} else {
|
||||
if (localStorage) {
|
||||
theme = localStorage.getItem("theme");
|
||||
if (!THEMES.includes(theme)) theme = null;
|
||||
}
|
||||
if (!theme && browser && browser.storage) {
|
||||
if (document.readyState === "loading") {
|
||||
document.documentElement.style.visibility = "hidden";
|
||||
}
|
||||
return browser.storage.local.get(["theme"]).then(({theme}) => {
|
||||
update(theme);
|
||||
document.documentElement.style.visibility = "";
|
||||
if (localStorage && theme) localStorage.setItem("theme", theme)
|
||||
return theme || "auto";
|
||||
});
|
||||
}
|
||||
}
|
||||
return update(theme);
|
||||
},
|
||||
|
||||
async isVintage() {
|
||||
let ret;
|
||||
if (localStorage) {
|
||||
ret = localStorage && localStorage.getItem(VINTAGE);
|
||||
if (ret !== null) return !!ret;
|
||||
}
|
||||
ret = (await browser.storage.local.get([VINTAGE]))[VINTAGE];
|
||||
if (localStorage && typeof ret === "boolean") localStorage.setItem(VINTAGE, ret);
|
||||
return ret;
|
||||
},
|
||||
|
||||
async setVintage(b) {
|
||||
refreshVintage(b);
|
||||
if (localStorage) try {
|
||||
localStorage.setItem(VINTAGE, b || "");
|
||||
} catch (e) {}
|
||||
await browser.storage.local.set({[VINTAGE]: b});
|
||||
return b;
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
(async () => {
|
||||
refreshVintage(await Themes.isVintage());
|
||||
})();
|
||||
Promise.resolve(Themes.setup());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue