forked from hussainmuzzamil/jQuery.ish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.ish.min.js
3 lines (3 loc) · 1.15 KB
/
jquery.ish.min.js
1
2
3
var $=function(a){var a=(new $.fn.init(a)).elm,b;for(b in $.fn)if("init"!=b||"elm"!=b)a[b]=$.fn[b];return a};$.trim=function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")};
$.fn={init:function(a){$.fn.elm="string"==typeof a?document.querySelectorAll(a):a.length?a:[a]},hasClass:function(a){var b;for(b=0;b<this.length;b++)if(this[b].className.match(RegExp("(\\s|^)"+a+"(\\s|$)")))return!0;return!1},addClass:function(a){var b;for(b=0;b<this.length;b++)this[b].className.match(RegExp("(\\s|^)"+a+"(\\s|$)"))||(this[b].className=this[b].className+" "+a);return this},toggleClass:function(a){this.hasClass(a)?this.removeClass(a):this.addClass(a);return this},removeClass:function(a){var b;
for(b=0;b<this.length;b++)this[b].className=$.trim(this[b].className.replace(RegExp("(\\s|^)"+a+"(\\s|$)")," "));return this},toggle:function(){var a;for(a=0;a<this.length;a++)this[a].style.display="none"==window.getComputedStyle(this[a]).display?"block":"none";return this},hide:function(){var a;for(a=0;a<this.length;a++)this[a].style.display="none";return this},show:function(){var a;for(a=0;a<this.length;a++)this[a].style.display="block";return this}};$.fn.init.prototype=$.fn;