-
Notifications
You must be signed in to change notification settings - Fork 0
/
tinhat.min.js
1 lines (1 loc) · 2.55 KB
/
tinhat.min.js
1
var{isArray:a}=Array;window.__tincan={reactors:[],count:0};window.thReactive=A=>{var b={id:window.__tincan.count++,value:A,update:function(_){const B=this.value;this.value=_;for(const c of this.callbacks)c(B,this.value)},callbacks:[]};window.__tincan.reactors.push(b);return b};window.thWatch=(C,_b)=>{var _c=window.__tincan.reactors.findIndex(r=>r.id==C.id);_c!==-1&&window.__tincan.reactors[_c].callbacks.push(_b)};window.thClassAdd=(_a,d)=>{var D=document.querySelectorAll(_a);for(const _A of D)if(a(d))for(const e of d)!_A.classList.contains(e)&&_A.classList.add(e);else !_A.classList.contains(d)&&_A.classList.add(d)};window.thClassRemove=(E,_B)=>{if(a(_B))for(const aA of document.querySelectorAll(E))for(const aB of _B)aA.classList.remove(aB);else for(const aC of document.querySelectorAll(E))aC.classList.remove(_B)};window.thClassToggle=(aD,aE)=>{var _C=document.querySelectorAll(aD);for(const aF of _C)if(a(aE))for(const aG of aE)aF.classList.contains(aG)?aF.classList.remove(aG):aF.classList.add(aG);else aF.classList.contains(aE)?aF.classList.remove(aE):aF.classList.add(aE)};window.thAttributeSet=(aH,aI,aJ)=>{var _d=document.querySelectorAll(aH);for(const aK of _d)aK.setAttribute(aI,aJ)};window.thSetInner=(aL,aM)=>{var aN=document.querySelectorAll(aL);for(const aO of aN)aO.innerHTML=aM};