4 lines
979 B
JavaScript
4 lines
979 B
JavaScript
var $=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(" ");if(-1<b.indexOf(a))return!1;b.push(a);this.className=b.join(" ").trim();return!0};
|
|
Element.prototype.remClass=function(a){var b=this.className.split(" ");a=b.indexOf(a);if(-1==a)return!1;b=b.slice(0,a).concat(b.slice(a+1));this.className=b.join(" ").trim();return!0};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 LOADER=new function(){var a=null;this.init=function(){a=$("#loader")};this.start=function(){a&&(a.className="active")};this.stop=function(){a&&(a.className="")}};
|