-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkui.js
1 lines (1 loc) · 1.08 KB
/
kui.js
1
let classesWithColoredParents=/checkbox-container__input|radio-container__input|input-container__input|textarea-container__textarea|button-container|slider-container__slider/g,classesWithCheckboxes=/radio-container__input|checkbox-container__input/g;const callFunction=(e,t)=>{let n=t.target;n.className&&n.className.match(classesWithColoredParents)&&e(n.parentElement)},blur=e=>(e.classList.remove("selected"),softkeys("{hideSoftkeys}")),focus=e=>e.classList.add("selected");function showToast(e,t,n){let s=document.querySelector(".kui-toast");s.style.background="#"+n,document.querySelector("meta[name=theme-color]").setAttribute("content","#"+n),setTimeout(()=>{s.style.display="block",document.querySelector(".kui-pri").innerHTML=e},82),setTimeout(function(){s.classList.add("byetoast"),setTimeout(function(){s.style.display="none",s.classList.remove("byetoast")},500),setTimeout(()=>{document.querySelector("meta[name=theme-color]").setAttribute("content","#0f1126")},49)},t+82)}window.addEventListener("focus",e=>callFunction(focus,e),!0),window.addEventListener("blur",e=>callFunction(blur,e),!0);