-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.min.js
1 lines (1 loc) · 1.48 KB
/
main.min.js
1
function addElement(e,t,n,d,l){let a=document.createElement(e);a.innerHTML=n,a.style.padding="title"===t?"30px 50px 0px":"0 50px 0px",a=addElementStyle(a,d,l),"footer"===t&&(a.href="#"),document.getElementById(t).appendChild(a)}function addElementStyle(e,t,n){return""!=t&&(e.style.backgroundColor=t),""!=n&&(e.style.color=n),e}function stringToUtf8(e){return decodeURIComponent(escape(e))}window.addEventListener("DOMContentLoaded",function(){document.title=stringToUtf8(MAIN_TITLE),addElement("h1","title",MAIN_TITLE,"","");let e="";for(let t=0;t<PAGE_CONTENT.length;t++){let n=t<1?'class="active"':"",d=void 0!==PAGE_CONTENT[t].header?'<div class="header" id="'+stringToUtf8(PAGE_CONTENT[t].header).replace(/\s+/g,"").toLocaleLowerCase()+'"><h2>'+stringToUtf8(PAGE_CONTENT[t].header)+'</h2><div class="underline"></div></div>':"";e+='<a href="#'+stringToUtf8(PAGE_CONTENT[t].header).replace(/\s+/g,"").toLocaleLowerCase()+'"><li '+n+">"+stringToUtf8(PAGE_CONTENT[t].header)+"</li></a>";for(let e=0;e<PAGE_CONTENT[t].text.length;e++)addElement("div","content",(d=e<1?d:"")+'<div class="text"><p>'+stringToUtf8(PAGE_CONTENT[t].text[e])+"</p></div>",PAGE_CONTENT[t].background,PAGE_CONTENT[t].font)}addElement("ul","topTab",e,"",""),addElement("a","footer",MAIN_TITLE,"",""),document.getElementById("topTab").addEventListener("click",function(e){for(let e=0;e<this.getElementsByTagName("li").length;e++)this.getElementsByTagName("li")[e].classList.remove("active");e.srcElement.classList.add("active")},!1)},!1);