NxTIC/js/lib/reset-min.js

5 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2016-04-22 08:27:58 +00:00
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 d=this;d.addClass(a);setTimeout(function(){d.remClass(a)},b)};var _includes=[],_includeTags=[];
function include(a,b,d){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 d&&d){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;d=document.createElement("script");d.type="text/javascript";d.src=a;document.head.appendChild(d);_includes.push(a);_includeTags.push(d);d.onload=b}return!0}
function diff(a,b,d){var e=[],c;for(c in a)null==b[c]||null==a[c]||d instanceof Array&&-1<d.indexOf(c)||(typeof a[c]!==typeof b[c]?e.push(c):a[c]instanceof Object&&b[c]instanceof Object?0<diff(a[c],b[c]).length&&e.push(c):a[c]!=b[c]&&e.push(c));return e}var format_number=new formatChecker(null,"0i ii ii ii ii");