-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomputus.min.js
2 lines (2 loc) · 5.28 KB
/
computus.min.js
1
2
"use strict;"
;class DOM${static i(id){return document.getElementById(id)}static n(name){return document.getElementsByName(name)}static c(cls){return document.getElementsByClassName(cls)}static t(tag){return document.getElementsByTagName(tag)}static tn(ns,element,tag){element=typeof element=="string"?document.getElementById(element):element;return element.getElementsByTagNameNS(ns,tag)}static create(tag,parent,i,c,n){var _a;if(arguments.length==1)return document.createElement(tag);else{var result=document.createElement(tag);if(parent){if(typeof parent=="string"){(_a=document.getElementById(parent))===null||_a===void 0?void 0:_a.append(result)}else{parent.append(result)}}if(arguments.length>2&&i)result.setAttribute("id",i);if(arguments.length>3&&c)result.setAttribute("class",c);if(arguments.length>4&&n)result.setAttribute("name",n);return result}}static addEventListener(element,event,handler,useCapture){var result=typeof element=="string"?document.getElementById(element):element;useCapture=arguments.length>3?useCapture:false;result.addEventListener(event,handler,useCapture);return result}static querySelector(selectors){return document.querySelector(selectors)}static cleanHTML(element){var result=typeof element=="string"?document.getElementById(element):element;result.innerHTML="";return result}static uid(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}static createStyle(innerHTML){var newStyle=document.createElement("style");document.head.appendChild(newStyle);if(innerHTML)newStyle.innerHTML=innerHTML;return newStyle}static loadURIError(oError){throw new URIError("The file "+oError.target.src+" didn't load correctly.")}static prefixScript(url,onloadFunction){var _a,_b;var newScript=document.createElement("script");newScript.onerror=this.loadURIError;if(onloadFunction){newScript.onload=onloadFunction}(_b=(_a=document.currentScript)===null||_a===void 0?void 0:_a.parentNode)===null||_b===void 0?void 0:_b.insertBefore(newScript,document.currentScript);newScript.type="text/javascript";newScript.src=url;return newScript}static affixScriptToHead(url,onloadFunction){var newScript=document.createElement("script");newScript.onerror=this.loadURIError;if(onloadFunction){newScript.onload=onloadFunction}document.head.appendChild(newScript);newScript.type="text/javascript";newScript.src=url;return newScript}static affixStylesheetToHead(url,onloadFunction){var newLink=document.createElement("link");newLink.onerror=this.loadURIError;if(onloadFunction){newLink.onload=onloadFunction}document.head.appendChild(newLink);newLink.rel="stylesheet";newLink.type="text/css";newLink.media="all";newLink.href=url;return newLink}static loaderScript(scriptUrl){return new Promise(function(res,rej){let script=document.createElement("script");script.src=scriptUrl;script.type="text/javascript";script.async=true;script.onerror=rej;script.onload=res;script.addEventListener("error",rej);script.addEventListener("load",res);document.head.appendChild(script)})}}DOM$.select={addOptions:function(sel,opt){if(typeof sel=="string")sel=document.getElementById(sel);var option;for(var i=0;i<opt.length;i++){option=document.createElement("option");option.text=opt[i];sel.add(option)}},fillRange:function(sel,init,end){sel=DOM$.i(sel);for(let i=init;i<=end;i++){var option=DOM$.create("option");option.text=i.toString();sel.add(option)}}};;class MITLicense{static template(year,holders,format){var prefix_license="";var license_image="";var copyright_sign="(c)";var break_line="\n";var start_paragraph="";var break_paragraph="\n\n";var postfix_license="";if(arguments.length>2){if(format==MITLicense.HTML){prefix_license="";license_image="<p align='right'><img src='https://upload.wikimedia.org/wikipedia/commons/f/f8/License_icon-mit-88x31-2.svg'/></p>";copyright_sign="©";break_line=" ";start_paragraph="<p>";break_paragraph="</p>";postfix_license=""}}return prefix_license+license_image+start_paragraph+"Copyright "+copyright_sign+" "+year+"-"+(new Date).getFullYear()+" "+holders+break_paragraph+start_paragraph+"Permission is hereby granted, free of charge, to any person obtaining a copy"+break_line+'of this software and associated documentation files (the "Software"), to deal'+break_line+"in the Software without restriction, including without limitation the rights"+break_line+"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"+break_line+"copies of the Software, and to permit persons to whom the Software is"+break_line+"furnished to do so, subject to the following conditions:"+break_paragraph+start_paragraph+"The above copyright notice and this permission notice shall be included in"+break_line+"all copies or substantial portions of the Software."+break_paragraph+start_paragraph+'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR'+break_line+"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"+break_line+"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"+break_line+"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"+break_line+"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"+break_line+"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN"+break_line+"THE SOFTWARE."+break_paragraph}}MITLicense.TEXT=0;MITLicense.HTML=1;MITLicense.src="https://opensource.org/licenses/MIT";