various fixes
This commit is contained in:
parent
2d9d71c91f
commit
678bb73e1e
7 changed files with 160 additions and 108 deletions
|
@ -184,9 +184,14 @@ class Channel {
|
||||||
ids[id] = res;
|
ids[id] = res;
|
||||||
return html;
|
return html;
|
||||||
}.bind(this), async function (id) {
|
}.bind(this), async function (id) {
|
||||||
ids[id]();
|
if (ids[id]) {
|
||||||
delete ids[id];
|
ids[id]();
|
||||||
return true;
|
delete ids[id];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}.bind(this), this.readbottom.bind(this));
|
}.bind(this), this.readbottom.bind(this));
|
||||||
}
|
}
|
||||||
constructor(json, owner) {
|
constructor(json, owner) {
|
||||||
|
@ -1038,55 +1043,3 @@ class Channel {
|
||||||
}
|
}
|
||||||
Channel.setupcontextmenu();
|
Channel.setupcontextmenu();
|
||||||
export { Channel };
|
export { Channel };
|
||||||
{
|
|
||||||
let last;
|
|
||||||
const dud = document.createElement("p");
|
|
||||||
dud.classList.add("svgtheme");
|
|
||||||
document.body.append(dud);
|
|
||||||
const css = window.getComputedStyle(dud);
|
|
||||||
function fixsvgtheme() {
|
|
||||||
//console.log(things);
|
|
||||||
const thing = css.color.replace("rgb(", "").replace(")", "").split(",");
|
|
||||||
//sconsole.log(thing);
|
|
||||||
const r = +thing[0] / 255;
|
|
||||||
const g = +thing[1] / 255;
|
|
||||||
const b = +thing[2] / 255;
|
|
||||||
const max = Math.max(r, g, b);
|
|
||||||
const min = Math.min(r, g, b);
|
|
||||||
const l = (max + min) / 2;
|
|
||||||
let s;
|
|
||||||
let h;
|
|
||||||
if (max !== min) {
|
|
||||||
if (l <= .5) {
|
|
||||||
s = (max - min) / (max + min);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
s = (max - min) / (2.0 - max - min);
|
|
||||||
}
|
|
||||||
if (r === max) {
|
|
||||||
h = (g - b) / (max - min);
|
|
||||||
}
|
|
||||||
else if (g === max) {
|
|
||||||
h = 2 + (b - r) / (max - min);
|
|
||||||
}
|
|
||||||
else if (b === max) {
|
|
||||||
h = 4 + (r - g) / (max - min);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
s = 0;
|
|
||||||
h = 0;
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -787,6 +787,7 @@ class Localuser {
|
||||||
{
|
{
|
||||||
const userinfos = getBulkInfo();
|
const userinfos = getBulkInfo();
|
||||||
tas.addColorInput("Accent color:", _ => {
|
tas.addColorInput("Accent color:", _ => {
|
||||||
|
fixsvgtheme();
|
||||||
userinfos.accent_color = _;
|
userinfos.accent_color = _;
|
||||||
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
localStorage.setItem("userinfos", JSON.stringify(userinfos));
|
||||||
document.documentElement.style.setProperty('--accent-color', userinfos.accent_color);
|
document.documentElement.style.setProperty('--accent-color', userinfos.accent_color);
|
||||||
|
@ -1184,3 +1185,61 @@ class Localuser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export { Localuser };
|
export { Localuser };
|
||||||
|
let fixsvgtheme;
|
||||||
|
{
|
||||||
|
let last;
|
||||||
|
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 = +thing[0] / 255;
|
||||||
|
const g = +thing[1] / 255;
|
||||||
|
const b = +thing[2] / 255;
|
||||||
|
const max = Math.max(r, g, b);
|
||||||
|
const min = Math.min(r, g, b);
|
||||||
|
const l = (max + min) / 2;
|
||||||
|
let s;
|
||||||
|
let h;
|
||||||
|
if (max !== min) {
|
||||||
|
if (l <= .5) {
|
||||||
|
s = (max - min) / (max + min);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = (max - min) / (2.0 - max - min);
|
||||||
|
}
|
||||||
|
if (r === max) {
|
||||||
|
h = (g - b) / (max - min);
|
||||||
|
}
|
||||||
|
else if (g === max) {
|
||||||
|
h = 2 + (b - r) / (max - min);
|
||||||
|
}
|
||||||
|
else if (b === max) {
|
||||||
|
h = 4 + (r - g) / (max - min);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = 0;
|
||||||
|
h = 0;
|
||||||
|
}
|
||||||
|
const rot = Math.floor(h * 60) + "deg";
|
||||||
|
const invert = .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 };
|
||||||
|
|
|
@ -22,6 +22,19 @@ class Message {
|
||||||
content;
|
content;
|
||||||
static del;
|
static del;
|
||||||
static resolve;
|
static resolve;
|
||||||
|
/*
|
||||||
|
weakdiv:WeakRef<HTMLDivElement>;
|
||||||
|
set div(e:HTMLDivElement){
|
||||||
|
if(!e){
|
||||||
|
this.weakdiv=null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.weakdiv=new WeakRef(e);
|
||||||
|
}
|
||||||
|
get div(){
|
||||||
|
return this.weakdiv?.deref();
|
||||||
|
}
|
||||||
|
//*/
|
||||||
div;
|
div;
|
||||||
member;
|
member;
|
||||||
reactions;
|
reactions;
|
||||||
|
|
|
@ -198,9 +198,13 @@ class Channel{
|
||||||
return html;
|
return html;
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
async function(this:Channel,id:string){
|
async function(this:Channel,id:string){
|
||||||
ids[id]();
|
if(ids[id]){
|
||||||
delete ids[id];
|
ids[id]();
|
||||||
return true;
|
delete ids[id];
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
this.readbottom.bind(this)
|
this.readbottom.bind(this)
|
||||||
);
|
);
|
||||||
|
@ -1027,52 +1031,4 @@ class Channel{
|
||||||
}
|
}
|
||||||
Channel.setupcontextmenu();
|
Channel.setupcontextmenu();
|
||||||
export {Channel};
|
export {Channel};
|
||||||
{
|
|
||||||
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 thing=css.color.replace("rgb(","").replace(")","").split(",");
|
|
||||||
//sconsole.log(thing);
|
|
||||||
const r=+thing[0]/255;
|
|
||||||
const g=+thing[1]/255;
|
|
||||||
const b=+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<=.5){
|
|
||||||
s=(max-min)/(max+min);
|
|
||||||
}else{
|
|
||||||
s=(max-min)/(2.0-max-min);
|
|
||||||
}
|
|
||||||
if(r===max){
|
|
||||||
h=(g-b)/(max-min);
|
|
||||||
}else if(g===max){
|
|
||||||
h=2+(b-r)/(max-min);
|
|
||||||
}else if(b===max){
|
|
||||||
h=4+(r-g)/(max-min);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
s=0;
|
|
||||||
h=0;
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -807,6 +807,7 @@ class Localuser{
|
||||||
{
|
{
|
||||||
const userinfos=getBulkInfo();
|
const userinfos=getBulkInfo();
|
||||||
tas.addColorInput("Accent color:",_=>{
|
tas.addColorInput("Accent color:",_=>{
|
||||||
|
fixsvgtheme();
|
||||||
userinfos.accent_color=_;
|
userinfos.accent_color=_;
|
||||||
localStorage.setItem("userinfos",JSON.stringify(userinfos));
|
localStorage.setItem("userinfos",JSON.stringify(userinfos));
|
||||||
document.documentElement.style.setProperty('--accent-color', userinfos.accent_color);
|
document.documentElement.style.setProperty('--accent-color', userinfos.accent_color);
|
||||||
|
@ -1210,3 +1211,57 @@ class Localuser{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export {Localuser};
|
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=+thing[0]/255;
|
||||||
|
const g=+thing[1]/255;
|
||||||
|
const b=+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<=.5){
|
||||||
|
s=(max-min)/(max+min);
|
||||||
|
}else{
|
||||||
|
s=(max-min)/(2.0-max-min);
|
||||||
|
}
|
||||||
|
if(r===max){
|
||||||
|
h=(g-b)/(max-min);
|
||||||
|
}else if(g===max){
|
||||||
|
h=2+(b-r)/(max-min);
|
||||||
|
}else if(b===max){
|
||||||
|
h=4+(r-g)/(max-min);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
s=0;
|
||||||
|
h=0;
|
||||||
|
}
|
||||||
|
const rot=Math.floor(h*60)+"deg";
|
||||||
|
const invert=.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};
|
||||||
|
|
|
@ -27,6 +27,19 @@ class Message{
|
||||||
content:MarkDown;
|
content:MarkDown;
|
||||||
static del:Promise<void>;
|
static del:Promise<void>;
|
||||||
static resolve:Function;
|
static resolve:Function;
|
||||||
|
/*
|
||||||
|
weakdiv:WeakRef<HTMLDivElement>;
|
||||||
|
set div(e:HTMLDivElement){
|
||||||
|
if(!e){
|
||||||
|
this.weakdiv=null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.weakdiv=new WeakRef(e);
|
||||||
|
}
|
||||||
|
get div(){
|
||||||
|
return this.weakdiv?.deref();
|
||||||
|
}
|
||||||
|
//*/
|
||||||
div:HTMLDivElement;
|
div:HTMLDivElement;
|
||||||
member:Member;
|
member:Member;
|
||||||
reactions:messagejson["reactions"];
|
reactions:messagejson["reactions"];
|
||||||
|
|
|
@ -15,10 +15,12 @@ body {
|
||||||
background-color: var(--profile-bg);
|
background-color: var(--profile-bg);
|
||||||
border-radius: 10%;
|
border-radius: 10%;
|
||||||
padding: .2cm;
|
padding: .2cm;
|
||||||
width: 7cm !important;
|
width: fit-content !important;
|
||||||
height: 8cm;
|
min-height: 3in;
|
||||||
border: solid, color-mix(in hsl,var(--black),transparent 80%), .03in;
|
border: solid, color-mix(in hsl,var(--black),transparent 80%), .03in;
|
||||||
box-shadow: inset .03in .35in .2in var(--accent_color);
|
box-shadow: inset .03in .35in .2in var(--accent_color);
|
||||||
|
min-height: 3.25in;
|
||||||
|
min-width: 7cm;
|
||||||
}
|
}
|
||||||
video{
|
video{
|
||||||
max-width: 3in;
|
max-width: 3in;
|
||||||
|
@ -160,6 +162,7 @@ samp {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
max-width: 2.75in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue