Merge branch 'main', commit 'refs/pull/53/head' of https://github.com/MathMan05/JankClient
This commit is contained in:
@@ -503,23 +503,22 @@ class Localuser{
|
||||
buildservers():void{
|
||||
const serverlist=document.getElementById("servers") as HTMLDivElement;//
|
||||
const outdiv=document.createElement("div");
|
||||
const img=document.createElement("img");
|
||||
const home=document.createElement("span");
|
||||
const div=document.createElement("div");
|
||||
div.classList.add("home","servericon");
|
||||
|
||||
img.src="/icons/home.svg";
|
||||
img.classList.add("svgtheme","svgicon");
|
||||
img["all"]=this.guildids.get("@me");
|
||||
home.classList.add("svgtheme","svgicon","svg-home");
|
||||
home["all"]=this.guildids.get("@me");
|
||||
(this.guildids.get("@me") as Guild).html=outdiv;
|
||||
const unread=document.createElement("div");
|
||||
unread.classList.add("unread");
|
||||
outdiv.append(unread);
|
||||
outdiv.append(div);
|
||||
div.appendChild(img);
|
||||
div.appendChild(home);
|
||||
|
||||
outdiv.classList.add("servernoti");
|
||||
serverlist.append(outdiv);
|
||||
img.onclick=function(){
|
||||
home.onclick=function(){
|
||||
this["all"].loadGuild();
|
||||
this["all"].loadChannel();
|
||||
};
|
||||
@@ -553,9 +552,8 @@ class Localuser{
|
||||
this.createGuild();
|
||||
};
|
||||
const guilddsdiv=document.createElement("div");
|
||||
const guildDiscoveryContainer=document.createElement("img");
|
||||
guildDiscoveryContainer.src="/icons/explore.svg";
|
||||
guildDiscoveryContainer.classList.add("svgtheme","svgicon");
|
||||
const guildDiscoveryContainer=document.createElement("span");
|
||||
guildDiscoveryContainer.classList.add("svgtheme","svgicon","svg-explore");
|
||||
guilddsdiv.classList.add("home","servericon");
|
||||
guilddsdiv.appendChild(guildDiscoveryContainer);
|
||||
serverlist.appendChild(guilddsdiv);
|
||||
@@ -931,7 +929,6 @@ class Localuser{
|
||||
{
|
||||
const userinfos=getBulkInfo();
|
||||
tas.addColorInput("Accent color:",_=>{
|
||||
fixsvgtheme();
|
||||
userinfos.accent_color=_;
|
||||
localStorage.setItem("userinfos",JSON.stringify(userinfos));
|
||||
document.documentElement.style.setProperty("--accent-color", userinfos.accent_color);
|
||||
@@ -1450,59 +1447,4 @@ class Localuser{
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
export{Localuser};
|
||||
let fixsvgtheme:Function;
|
||||
{
|
||||
let last:string;
|
||||
const dud=document.createElement("p");
|
||||
dud.classList.add("svgtheme");
|
||||
document.body.append(dud);
|
||||
const css=window.getComputedStyle(dud);
|
||||
function fixsvgtheme_(){
|
||||
//console.log(things);
|
||||
const color=css.color;
|
||||
if(color===last){
|
||||
return;
|
||||
}
|
||||
last=color;
|
||||
const thing=color.replace("rgb(","").replace(")","").split(",");
|
||||
//sconsole.log(thing);
|
||||
const r=Number(thing[0])/255;
|
||||
const g=Number(thing[1])/255;
|
||||
const b=Number(thing[2])/255;
|
||||
const max=Math.max(r,g,b);
|
||||
const min=Math.min(r,g,b);
|
||||
const l=(max+min)/2;
|
||||
|
||||
let s:number;
|
||||
let h:number;
|
||||
if(max!==min){
|
||||
if(l<=0.5){
|
||||
s=(max-min)/(max+min);
|
||||
}else{
|
||||
s=(max-min)/(2-max-min);
|
||||
}
|
||||
if(r===max){
|
||||
h=(g-b)/(max-min);
|
||||
}else if(g===max){
|
||||
h=2+(b-r)/(max-min);
|
||||
}else{
|
||||
h=4+(r-g)/(max-min);
|
||||
}
|
||||
}else{
|
||||
s=0;
|
||||
h=0;
|
||||
}
|
||||
const rot=Math.floor(h*60)+"deg";
|
||||
const invert=0.5-(s/2)+"";
|
||||
const brightness=Math.floor((l*200))+"%";
|
||||
|
||||
document.documentElement.style.setProperty("--rot", rot);
|
||||
document.documentElement.style.setProperty("--invert", invert);
|
||||
document.documentElement.style.setProperty("--brightness", brightness);
|
||||
}
|
||||
fixsvgtheme=fixsvgtheme_;
|
||||
setTimeout(fixsvgtheme_,100);
|
||||
fixsvgtheme_();
|
||||
}
|
||||
export{fixsvgtheme};
|
||||
export {Localuser};
|
Reference in New Issue
Block a user