Newer
Older
!function(){"use strict";var e,t,n,s={isHidden:!1};Element&&!Element.prototype.matches&&(e=Element.prototype,e.matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector),t=function(e){var t,i,r;if(null===e||"undefined"==typeof e)this.length=0;else if("string"==typeof e)for(t=document.querySelectorAll(e),this.length=t.length,i=0;i<t.length;i++)r=t.item(i),"undefined"==typeof r.td_prop&&(r=n.merge(r,s)),this[i]=r;else if(e.length)for(i=0;i<e.length;i++)r=e[i],"undefined"==typeof r.td_prop&&(r=n.merge(r,s)),this[i]=r;else this[0]=e,this.length=1;return this},n=function(e){return new t(e)},n.fn=t.prototype={each:function(e){for(var t=this.length;t--;)e(t,this[t],this);return this},hide:function(){return this.each(function(e,t){t.td_prop.isHidden||(t.style.td_previousDisplay=t.style.display,t.style.display="none",t.td_prop.isHidden=!0)}),this},show:function(){return this.each(function(e,t){t.td_prop.isHidden===!0&&(t.style.display="undefined"!=typeof t.style.td_previousDisplay?t.style.td_previousDisplay:"block",t.td_prop.isHidden=!1)}),this},on:function(e,t,n){return"string"==typeof t?this.each(function(s,i){i.addEventListener(e,function(e){var s=e.target,r=!1;do s&&s.matches(t)?(n.call(s,e),r=!0):(s=s.parentNode,s&&s.matches&&s!==i||(r=!0));while(r!==!0)})}):(n=t,this.each(function(t,s){s.addEventListener(e,n)})),this},first:function(){return"undefined"!=typeof this[0]?n(this[0]):null},parent:function(){return n(this[0].parentNode)},children:function(){var e,t=this[0].childNodes,s=[];for(e=0;e<t.length;e++)n.isElement(t[e])&&s.push(t[e]);return n(s)},data:function(e,t){var n=this[0];return"undefined"!=typeof t?(n.setAttribute("data-"+e,t),this):n.getAttribute("data-"+e)},attr:function(e,t){var n=this[0];return"undefined"!=typeof t?(n.setAttribute(e,t),this):n.getAttribute(e)},trigger:function(e,t,s,i){s=n.exists(s)?s:!0,i=n.exists(i)?i:!0;var r=new CustomEvent(e,t,s,i);return this.each(function(e,t){t.dispatchEvent(r)}),this}},n.isElement=function(e){var t=!1;try{t=e instanceof HTMLElement}catch(n){t=e.nodeType&&1===e.nodeType}return t},n.isJson=function(e){try{return JSON.parse(e),null!==e&&"undefined"!=typeof e}catch(t){return!1}},n.exists=function(e){return null!==e&&"undefined"!=typeof e},n.merge=function(e,t){if(this.exists(e)&&this.exists(t)){var n;for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}return null},n.byID=function(e){return n(document.getElementById(e))},n.triggerOn=function(e,t,s,i,r){i=n.exists(i)?i:!0,r=n.exists(r)?r:!0,e.dispatchEvent(new CustomEvent(t,s,i,r))},n.ajax=function(e){var t,n,s=new XMLHttpRequest,i={method:"GET",url:"",async:!0,user:null,password:null,responseType:"text",data:null,headers:[],callbacks:{}},r=function(e){return function(t){e(t.currentTarget.response,t)}};if(this.merge(i,e),s.responseType=i.responseType,this.exists(i.callbacks))for(t in i.callbacks)i.callbacks.hasOwnProperty(t)&&s.addEventListener(t,r(i.callbacks[t]));for(s.open(i.method,i.url,i.async,i.user,i.password),n=0;n<i.headers.length;n++)s.setRequestHeader(i.headers[n].header,i.headers[n].value);return s.send(i.data),s},window.μ||(window.μ=n),window.mu||(window.mu=n)}();

Commander-lol
committed
//# sourceMappingURL=tinyDOM.min.js.map