/*........./components/item_table/item_table.js......*/ item_tableTemplete = document.createElement(`yeagerbot`); ajax("get", "inc/components/item_table/item_table.html", item_tableLoadTemp); class cls_item_table_wrapper extends HTMLElement { constructor() { super(); // this.attachShadow({mode:'open'}); // this.style.display = "none" // setTimeout(this.loadData,1000,this); this.loadData(this) } async loadData(obj) { //
// let newObj = []; let data = JSON.parse(obj.getAttribute("data")); if(data==null)return; let showHeaders=obj.getAttribute("showHeaders")||false let headerRow = document.createElement("div"); headerRow.classList.add("tableHeader") let Table = item_tableTemplete.querySelector(".item_table__mainBox").cloneNode(true); if (Table==null) return; Array.prototype.forEach.call(Object.values(data), async row => { let itemRow, item; itemRow = document.createElement("div"); itemRow.classList.add("tableRow"); if (headerRow.innerHTML == "" && showHeaders) { for (let x of Object.keys(row)) { item = document.createElement("div"); item.classList.add("tableCellHeader"); item.setAttribute("id",x); item.innerHTML = x; await headerRow.appendChild(item) } await Table.appendChild(headerRow) } for (let x of Object.values(row)) { item = document.createElement("div"); item.classList.add("tableCellValue") item.innerHTML = x; await itemRow.appendChild(item) } await itemRow.appendChild(item_tableTemplete.querySelector(".item_table__toolBox").cloneNode(true)) await Table.appendChild(itemRow) }); if (typeof data == "undefined") return; obj.innerHTML = ""; obj.appendChild(item_tableTemplete.querySelector("link").cloneNode(true)) //obj.appendChild(obj.parentElement.querySelector("link").cloneNode(true)) obj.appendChild(Table); obj.style.display = ""; if(this.getAttribute("allNew")=="true"){ let item =document.createElement("div"); item.innerHTML=`new`; await Table.appendChild(item) } } } function item_tableLoadTemp(retobj, arg) { item_tableTemplete.innerHTML = retobj.responseText; //console.log(UserServerTemplete); item_tableReady() } function item_tableReady() { window.customElements.define("item-table", cls_item_table_wrapper); } /*........./components/check-list/check-list.js......*/ class cls_check_list_wrapper extends HTMLElement { constructor(){ super(); // this.attachShadow({mode:'open'}); this.style.display="none" setTimeout(this.loadData,1000,this); } async loadData(obj){//
// let newObj=[]; await getTarget(); let data=window.Channels[myP.m][obj.getAttribute("data")]; if (typeof data=="undefined") return; let idKey=obj.getAttribute("idKey"); let valueKey=obj.getAttribute("valueKey"); let bigW=document.createElement("div") let inputName=obj.getAttribute("name"); let name=(obj.getAttribute("name")+"Wrapper"); let data_org=obj.getAttribute("data-org"); let tag=obj.getAttribute("tag"); bigW.classList.add("flexCheckBox"); let baseval=[]; baseval.channelName="No-Options"; baseval.ChannelID=""; baseval.roleName="No-Options"; baseval.roleID=""; if(data.length==0) data.unshift(baseval); for(let x of data){ let p=document.createElement(`p`); let input=document.createElement(`input`); let label=document.createElement(`label`); p.classList.add("flexCheckBoxItem"); input.setAttribute("name",inputName); input.setAttribute("type","checkbox"); let id=(typeof tag !="undefined" && (tag==false ||tag.toLowerCase()=='false'))? x[idKey].replace("@","").replace("#","").replace("&","") : x[idKey]; input.setAttribute("value",id) if(data_org.includes(id)) input.setAttribute("checked","") input.setAttribute("id",id) label.setAttribute("for",id) label.innerHTML=x[valueKey] p.appendChild(input); p.appendChild(label); bigW.appendChild(p); } orderSelectChecked(bigW,true); obj.appendChild(bigW); obj.style.display=""; } } window.customElements.define("check-list", cls_check_list_wrapper); /*........./elements/userProfile/userProfile.js......*/ UserProfleTemplete=document.createElement(`yeagerbot`); ajax("get","inc/elements/userProfile/userProfile.html",userProfileLoadTemp); class cls_userProfile extends HTMLElement { constructor(){ super(); this.attachShadow({mode:'open'}); this.shadowRoot.appendChild(UserProfleTemplete.cloneNode(true)); if(userData!=null && typeof userData=="object"){ this.shadowRoot.querySelector('#userName').innerText=userData.username; this.shadowRoot.querySelector('#img').src="https://cdn.discordapp.com/avatars/" + userData.id + "/" + userData.avatar + ".png"; let imgURL="https://cdn.discordapp.com/banners/" + userData.id + "/" + userData.banner + ".png" this.shadowRoot.querySelector('#userWrapper').style=`background-image: url(${imgURL})`; } } setValues(obj, values){ } } function userProfileLoadTemp(retobj,arg){ // console.log(retobj); //console.log("inside loadTemp"); if (myP.show && myP.show.toLowerCase()=='help') return; UserProfleTemplete.innerHTML=retobj.responseText; ajax("get","inc/elements/userProfile/userProfile.php",userProfileReady); } function userProfileReady(retobj, arg){ if(typeof retobj.responseText=="string"){ userData=JSON.parse(retobj.responseText); window.customElements.define("user-profile", cls_userProfile); } } /*........./elements/help/help.js......*/ var urlParams = new URLSearchParams(window.location.search); myP = {}; myP.m = urlParams.get('m'); myP.show = urlParams.get('show'); if(urlParams.get('database')){ myP.database = urlParams.get('database'); } help_bodyTemplete = document.createElement(`yeagerbot`); let outstr="inc/elements/help/help.php?show=" + myP.show if(myP.database){ outstr=outstr +"&database=" + myP.database; } ajax("get", outstr, help_bodyLoadTemp); class cls_help_body extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); //this.shadowRoot.appendChild(help_bodyTemplete.cloneNode(true)); this.outerHTML = help_bodyTemplete.innerHTML; helpLoaded(); } } function help_bodyLoadTemp(retobj, arg) { help_bodyTemplete.innerHTML = retobj.responseText; window.customElements.define("help-body", cls_help_body); } function helpLoaded() { eCat = document.getElementById('catList'); console.log(f); console.log(eCat); fCat = []; eCat.innerHTML = 'Categories