further reduce overhead
This commit is contained in:
@@ -908,7 +908,9 @@ class Channel {
|
||||
}
|
||||
Channel.setupcontextmenu();
|
||||
export { Channel };
|
||||
function fixsvgtheme() {
|
||||
{
|
||||
let last;
|
||||
function fixsvgtheme() {
|
||||
const things = document.getElementsByClassName("svgtheme");
|
||||
//console.log(things);
|
||||
if (things.length) {
|
||||
@@ -946,9 +948,14 @@ function fixsvgtheme() {
|
||||
const rot = Math.floor(h * 60) + "deg";
|
||||
const invert = .5 - (s / 2) + "";
|
||||
const brightness = Math.floor((l * 200)) + "%";
|
||||
const current = rot + invert + brightness;
|
||||
if (current !== last) {
|
||||
last = current;
|
||||
document.documentElement.style.setProperty('--rot', rot);
|
||||
document.documentElement.style.setProperty('--invert', invert);
|
||||
document.documentElement.style.setProperty('--brightness', brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
setInterval(fixsvgtheme, 100);
|
||||
}
|
||||
setInterval(fixsvgtheme, 100);
|
||||
|
@@ -899,7 +899,9 @@ class Channel{
|
||||
}
|
||||
Channel.setupcontextmenu();
|
||||
export {Channel};
|
||||
function fixsvgtheme(){
|
||||
{
|
||||
let last:string;
|
||||
function fixsvgtheme(){
|
||||
const things=document.getElementsByClassName("svgtheme");
|
||||
//console.log(things);
|
||||
if(things.length){
|
||||
@@ -934,9 +936,14 @@ function fixsvgtheme(){
|
||||
const rot=Math.floor(h*60)+"deg";
|
||||
const invert=.5-(s/2)+"";
|
||||
const brightness=Math.floor((l*200))+"%";
|
||||
const current=rot+invert+brightness;
|
||||
if(current!==last){
|
||||
last=current;
|
||||
document.documentElement.style.setProperty('--rot', rot);
|
||||
document.documentElement.style.setProperty('--invert', invert);
|
||||
document.documentElement.style.setProperty('--brightness', brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
setInterval(fixsvgtheme,100);
|
||||
}
|
||||
setInterval(fixsvgtheme,100);
|
||||
|
Reference in New Issue
Block a user