Compare commits

...

2 Commits

Author SHA1 Message Date
multiSnow e768162041
only update nodes in viewport 2023-02-03 22:49:15 +08:00
multiSnow 982ca15d80
get element outside of interval function 2023-02-03 22:16:59 +08:00
3 changed files with 18 additions and 5 deletions

View File

@ -29,6 +29,7 @@ function connect(){
let wss_scheme=document.getElementById('wss_scheme').checked===true?'wss://':'ws://';
let url=[wss_scheme,nwshost.value,':',nwsport.value,'/jsonrpc'].join('');
let autorefresh=undefined;
ws=new WebSocket(url);
ws.onerror=function(message){

View File

@ -87,6 +87,10 @@ function opr_active(gid,dict){
pausecanvas(pause_icon);
removecanvas(remove_icon);
optioncanvas(option_icon);
}else{
let rect=node.getBoundingClientRect();
if(rect.top>window.innerHeight||rect.top+rect.height<0)
return 0;
};
for(let n of node.getElementsByTagName('div')){
if(n.id in dictmap){
@ -140,6 +144,10 @@ function opr_stopped(gid,dict){
removecanvas(remove_icon);
optioncanvas(option_icon);
}else{
let rect=node.getBoundingClientRect();
if(rect.top>window.innerHeight||rect.top+rect.height<0)
return 0;
};
for(let n of node.getElementsByTagName('div')){
if(n.id in dictmap){
@ -216,6 +224,10 @@ function opr_waiting(gid,dict){
unpausecanvas(unpause_icon);
removecanvas(remove_icon);
optioncanvas(option_icon);
}else{
let rect=node.getBoundingClientRect();
if(rect.top>window.innerHeight||rect.top+rect.height<0)
return 0;
};
for(let n of node.getElementsByTagName('div')){
if(n.id in dictmap){

View File

@ -89,13 +89,13 @@ function start_autorefresh(){
'mainstopped':showstopped,
'mainwaiting':showwaiting
};
let sidetags=document.getElementById('sidetags');
let autorefresh=document.getElementById('autorefresh');
return setInterval(function(){
let showtagname=getattr(document.getElementById('sidetags'),'data-crtshow');
getstat();
if(document.getElementById('autorefresh').checked){
if(showtagname in idfunc_dict){
idfunc_dict[showtagname]();
};
if(autorefresh.checked){
let func=idfunc_dict[getattr(sidetags,'data-crtshow')];
if(!!func)func();
};
},500);
};