diff --git a/dist/$.js b/dist/$.js index 75de3b8..0ba67d4 100644 --- a/dist/$.js +++ b/dist/$.js @@ -50,6 +50,15 @@ $$ = (function (document, window, $$) { return this; }; + node.find = function (klass) { + var r = this.querySelectorAll(klass || '☺'), + length = r.length; + return length == 1 ? r[0] : r; + }; + + node.hasClass = function (klass) { + return ((" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf(klass) > -1) ? true : false; + } // Get a cookie value cookies.get = function(key) { diff --git a/dist/$.min.js b/dist/$.min.js index 0955827..f307127 100644 --- a/dist/$.min.js +++ b/dist/$.min.js @@ -1 +1 @@ -$$=function(t,n,e){var i=Node.prototype,r=NodeList.prototype,o="forEach",c="trigger",u=[][o],s={},a=t.createElement("i");return r[o]=u,n.on=i.on=function(t,n){return this.addEventListener(t,n,!1),this},r.on=function(t,n){return this[o](function(e){e.on(t,n)}),this},n[c]=i[c]=function(n,e){var i=t.createEvent("HTMLEvents");return i.initEvent(n,!0,!0),i.data=e||{},i.eventName=n,i.target=this,this.dispatchEvent(i),this},r[c]=function(t){return this[o](function(n){n[c](t)}),this},s.get=function(n){return unescape(t.cookie.replace(RegExp("(?:(?:^|.*;)\\s*"+escape(n).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},e=function(n){var e=t.querySelectorAll(n||"☺"),i=e.length;return 1==i?e[0]:e},e.on=i.on.bind(a),e[c]=i[c].bind(a),e.cookies=s,"function"==typeof define&&define("jsmin",[],function(){return e}),e}(document,this); \ No newline at end of file +$$=function(e,n,t){var i=Node.prototype,r=NodeList.prototype,o="forEach",c="trigger",u=[][o],s={},a=e.createElement("i");return r[o]=u,n.on=i.on=function(e,n){return this.addEventListener(e,n,!1),this},r.on=function(e,n){return this[o](function(t){t.on(e,n)}),this},n[c]=i[c]=function(n,t){var i=e.createEvent("HTMLEvents");return i.initEvent(n,!0,!0),i.data=t||{},i.eventName=n,i.target=this,this.dispatchEvent(i),this},r[c]=function(e){return this[o](function(n){n[c](e)}),this},i.find=function(e){var n=this.querySelectorAll(e||"☺"),t=n.length;return 1==t?n[0]:n},i.hasClass=function(e){return(" "+element.className+" ").replace(/[\n\t]/g," ").indexOf(e)>-1?!0:!1},s.get=function(n){return unescape(e.cookie.replace(RegExp("(?:(?:^|.*;)\\s*"+escape(n).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},t=function(n){var t=e.querySelectorAll(n||"☺"),i=t.length;return 1==i?t[0]:t},t.on=i.on.bind(a),t[c]=i[c].bind(a),t.cookies=s,"function"==typeof define&&define("jsmin",[],function(){return t}),t}(document,this); \ No newline at end of file diff --git a/src/$.js b/src/$.js index 75de3b8..0ba67d4 100644 --- a/src/$.js +++ b/src/$.js @@ -50,6 +50,15 @@ $$ = (function (document, window, $$) { return this; }; + node.find = function (klass) { + var r = this.querySelectorAll(klass || '☺'), + length = r.length; + return length == 1 ? r[0] : r; + }; + + node.hasClass = function (klass) { + return ((" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf(klass) > -1) ? true : false; + } // Get a cookie value cookies.get = function(key) {