-
Notifications
You must be signed in to change notification settings - Fork 1
/
darker.js
49 lines (48 loc) · 5.49 KB
/
darker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name Darker Side of Volafile
// @namespace i have none
// @version 2.5.10
// @description More contrasty volafile experience.
// @author Your mom
// @match https://*.volafile.org/*
// @grant none
// @updateURL https://github.com/szero/darker-side-of-vola/raw/master/extension/darker.meta.js
// @downloadURL https://github.com/szero/darker-side-of-vola/raw/master/extension/darker.user.js
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAAKCklEQVR42u1dSXIbyRX9mTUAhXniABEUQYmizGi11BEdoXDvvPDSd/AFfBtfwIfw0mdoLdQKtQZSHECCIAACBGoAqnLwgpLCVofUFPJXFajOF9hWZtZ/+X/+KQsAGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGrGALPZYYafd/NtfJeeq0xv07T//pT7OgrOb5s4//i65UH4Lo/vv/7hvDxd41lxsSnf/yKqWpFBdOrWtypO90c+/pEJA5fGf7JWaCCNVAih1948We3ZBAkDK6cv94sNtxe0jZmH9px/TIqD+049iFoKUiko8fbm/8CB04YnHz54TSkFKpZ8QVrWcWW0kL/3MasOqlkEIxVcglI6fPV/cBiz8pH/SZa6PIAkpy492kyeg/GhXce9fg7m+f9Jd+HFzcbmFkX9ylm9vqr+E07pDLUtEUWLSp5bltO4I9eMXwD85kwqnyOIaIBgLznpS0QRJCVLa9apVKSW5/a1Kya5X1VcupQzOeoKxFAgAgOCoA0IQZZh5x9lsJkmAs9k08476ykGI4KijshJT5WHv+EywiBKiKA7JZOX7vXGCvlDl+z3BGAhV8ylY5B2fKRlDxfPTfXtEKFWVh5C5rTtmsZCM9M1iPrd1R136hFL37ZHiSa4qu/HPvxDLACkUfyKKak+fJENA7ekPIorU10wsQ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NEFIXDkVUpJ+lp3FD64XCU5OeT0yEAAPyj03KllNafNnxW/qbhJxh/pWaCAGB+MYi102ZBl4rxeTw3AJaOAMl5OJ4sGwHheJKKUqZCgIhG42UjIBqNUW5z3IIzAACi0UTe5WgFdIzERjRKRynTISAcjSUTYC6LPyqZCFNSSprSC/PoarIsAQEh0dUkLb/ASG3Tce401xDTOCoBsPv6gCdSgl8WEwQA8/5QRtFSBGNCzPvDtCY3U3zxWX+YWamnHBITMktP+qmdAe+VoDcgaR8DhJAv97t/ywSwqRvr7Z8bmZ8wvPndv2/NBIkoiqaeVSmmuIZo6iWfgFsWAiQXbOpapUK6WphKALwUJggAwssxpHgGS0jgBsBSExCNJxhfU1pU/lJEaacF08/GhP1LtD6Jr3t18tse9z8iAcFZL5WsHKE0OOtpAoC5Hp+l4IzyWchcL/XXN2EJEPaHTmtdCpng9idh92IZ3n0pCJj1+sQ0EnWHCMx6fdDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ND4dvFfxTPQtwsQbxQAAAAASUVORK5CYII=
// ==/UserScript==
(function() {
"use strict";
// eslint-disable-next-line no-undef
const css = stuff2str("as dark as my soul.css");
const re = /volafile\.(?:org|io)\/r/;
const node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
const heads = document.getElementsByTagName("head");
if (heads.length > 0) {
heads[0].appendChild(node);
} else {
document.documentElement.appendChild(node);
}
if (window.location.href.match(re)) {
const shadeColor = (color, percent) => {
const f=parseInt(color.replace(/ /g,'').slice(1),16),t=percent<0?0:255,p=percent<0?percent*-1:percent,R=f>>16,G=f>>8&0x00FF,B=f&0x0000FF;
return "#"+(0x1000000+(Math.round((t-R)*p)+R)*0x10000+(Math.round((t-G)*p)+G)*0x100+(Math.round((t-B)*p)+B)).toString(16).slice(1);
}
// const $ = (sel) => document.getElementById(sel).style;
const $$ = (sel, prop, new_val) => {
const elements = document.getElementsByClassName(sel);
[...elements].forEach((el) => {
el.style.setProperty(prop, new_val)
})
}
const getCssVar = (sel) => getComputedStyle(document.querySelector(":root")).getPropertyValue(sel);
// this is just needed in rooms so vola logo can match the rest of the theme
const main_color = getCssVar("--main-color");
const shaded_color = shadeColor(main_color, -0.5);
$$("v_gradient_stop1", "stop-color", main_color);
$$("v_gradient_stop2", "stop-color", shaded_color);
$$("v_stroke_background", "fill", main_color);
$$("v_stroke_border", "stroke", "none");
}
})();