5 lines
1.3 KiB
JavaScript
5 lines
1.3 KiB
JavaScript
function $(a){return document.querySelector(a)}function $$(a){return document.querySelectorAll(a)}Element.prototype.getData=function(a){return"undefined"==typeof this.dataset?!1:this.dataset.hasOwnProperty(a)?this.dataset[a]:!1};Element.prototype.addClass=function(a){var b=this.className.split(" ");-1<b.indexOf(a)||(b.push(a),this.className=b.join(" ").trim())};
|
|
Element.prototype.remClass=function(a){var b=this.className.split(" ");a=b.indexOf(a);-1!=a&&(b=b.slice(0,a).concat(b.slice(a+1)),this.className=b.join(" ").trim())};NodeList.prototype.indexOf=HTMLCollection.prototype.indexOf=function(a){for(var b=0;b<this.length;b++)if(this[b]==a)return b;return-1};Element.prototype.anim=function(a,b){var c=this;c.addClass(a);setTimeout(function(){c.remClass(a)},b)};var _includes=[],_includeTags=[];
|
|
function include(a,b,c){a="string"===typeof a?a:null;b="function"===typeof b?b:function(){console.log("[x] "+a+" loaded")};if(null==a)return!1;if("boolean"===typeof c&&c){b=_includes.indexOf(a);if(-1==b)return!1;document.head.removeChild(_includeTags[b]);_includes.splice(b,1);_includeTags.splice(b,1)}else{if(-1<_includes.indexOf(a))return b(),!0;c=document.createElement("script");c.type="text/javascript";c.src=a;document.head.appendChild(c);_includes.push(a);_includeTags.push(c);c.onload=b}return!0}
|
|
var format_number=new formatChecker(null,"0i ii ii ii ii");
|