NxTIC/subDir/public_html/js/lib/min/reset.js

5 lines
1.8 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=[],_includeLoad=[];
function include(a,b,c){a="string"===typeof a?a:null;b="function"===typeof b?b:function(){console.log("[x] "+a+" loaded")};if(!a)return!1;if("boolean"===typeof c&&c){c=_includes.indexOf(a);if(-1==c)return!1;document.head.removeChild(_includeTags[c]);_includes.splice(c,1);_includeTags.splice(c,1)}else{c=_includes.indexOf(a);if(-1<c)return b(),!0;var e=document.createElement("script");c=_includes.length;_includes[c]=a;_includeLoad[c]=!1;_includeTags[c]=e;e.onload=function(a){return function(){_includeLoad[a]=
!0;b()}}(c);e.setAttribute("src",a);e.setAttribute("type","text/javascript");document.head.appendChild(e)}return!0}function diff(a,b,c){var e=[],d;for(d in a)null==b[d]||null==a[d]||c instanceof Array&&-1<c.indexOf(d)||(typeof a[d]!==typeof b[d]?e.push(d):a[d]instanceof Object&&b[d]instanceof Object?0<diff(a[d],b[d]).length&&e.push(d):a[d]!=b[d]&&e.push(d));return e}cloneObject=function(a){return JSON.parse(JSON.stringify(a))};var format_number=new formatChecker(null,"0i ii ii ii ii");