-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnojq.min.js
1 lines (1 loc) · 3.88 KB
/
nojq.min.js
1
Element.prototype._clss_has||(Element.prototype._clss_has=function(t){return new RegExp("(\\s|^)"+t+"(\\s|$)").test(this.className)}),Element.prototype._clss_add||(Element.prototype._clss_add=function(t){return this._clss_has(t)||(this.className+=" "+t),this}),Element.prototype._clss_remove||(Element.prototype._clss_remove=function(t){var e=this.className.split(" ");this.className="";for(var n=0;n<e.length;n++)e[n]!==t&&(this.className+=e[n]+" ");return this.className=this.className.trim(),this}),Element.prototype._html_get||(Element.prototype._html_get=function(){return this.innerHTML}),Element.prototype._html_set||(Element.prototype._html_set=function(t){return this.innerHTML=t,this}),Element.prototype._attr_get||(Element.prototype._attr_get=function(t){return this.getAttribute(t)}),Element.prototype._attr_set||(Element.prototype._attr_set=function(t,e){return this.setAttribute(t,e),this}),Element.prototype._attr_remove||(Element.prototype._attr_remove=function(t){return this.removeAttribute(t),this}),Element.prototype._data_get||(Element.prototype._data_get=function(t){return(t=t||!1)&&this.data.hasOwnProperty(t)?this.data.itm:this.data}),Element.prototype._data_set||(Element.prototype._data_set=function(t,e){var n=e||t,r=this.hasOwnProperty("data");if("object"==typeof t&&t===n)if(r)for(var o in n)this.data[o]=n[o];else this.data=n;else r||(this.data={}),this.data[t]=n;return this}),Element.prototype._el_appnd||(Element.prototype._el_appnd=function(t){return this.appendChild(t),this}),Element.prototype._el_prpnd||(Element.prototype._el_prpnd=function(t){return this.insertBefore(t,this.firstChild),this}),Element.prototype._el_mtch||(Element.prototype._el_mtch=function(t){return(this.matches||this.matchesSelector||this.msMatchesSelector||this.mozMatchesSelector||this.webkitMatchesSelector||this.oMatchesSelector).call(this,t)}),Element.prototype._el_sblngs||(Element.prototype._el_sblngs=function(){return Array.prototype.filter.call(this.parentNode.children,function(t){return t!==this})}),Element.prototype._el_fade||(Element.prototype._el_fade=function(t,e){e=e||400;var n=this,r="in"==t,o="out"==t;n.style.opacity=r?0:1,r&&(n.style.display="block");var s=+new Date,i=function(){n.style.opacity=r?+n.style.opacity+(new Date-s)/e:+n.style.opacity-(new Date-s)/e,s=+new Date,r&&+n.style.opacity<1||o&&0<+n.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(i)||setTimeout(i,16):n.style.opacity=r?1:0};return i(),n}),Element.prototype._el_shw||(Element.prototype._el_shw=function(){return this.style.display="",this}),Element.prototype._el_hde||(Element.prototype._el_hde=function(){return this.style.display="none",this});var q_={create:function(t,e){t=t||"div",e=e||{};var n=document.createElement(t);for(var r in e)"data"===r||"className"===r?n[r]=e[r]:"html"===r?n.innerHTML=e[r]:n.setAttribute(r,e[r]);return n},get:function(t,e){if(t.startsWith("#"))return document.getElementById(t.substring(1));var n=(e=e||document).querySelectorAll(t);return!(n.length<1)&&n},remove:function(t){if(NodeList.prototype.isPrototypeOf(t))for(var e=0;e<t.length;e++)t[e].parentElement.removeChild(t[e]);else t.parentElement.removeChild(t)},request:{post:function(t,e){var n=new XMLHttpRequest;n.open("POST",t,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(e)},get:function(t,e){var n=new XMLHttpRequest;n.open("GET",t,!0),n.onreadystatechange=function(){4===this.readyState&&(200<=this.status&&this.status<400?e(this.responseText):console.log("AjxGetError"))},n.send(),n=null}},loop:function(t,e){if(Array.isArray(t)||NodeList.prototype.isPrototypeOf(t))for(var n=0;n<t.length&&!1!==e(n,t[n]);n++);else for(var n in t)if(!1===e(n,t[n]))break},extend:function(){var t,e={},n=0;for(n=0;n<arguments.length;n++)if(arguments[n])for(t in arguments[n])arguments[n].hasOwnProperty(t)&&("object"==typeof arguments[n][t]?e[t]=deepExtend(e[t],arguments[n][t]):e[t]=arguments[n][t]);return e}};