xonecas.io
142
St

startsInvasion / files

startsInvasion / libs / node_modules / bonzo / build / qwery / integration / ender.min.js

8.9 KB
1/*!
2  * Ender: open module JavaScript framework
3  * copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
4  * https://github.com/ender-js/ender
5  * License MIT
6  * Build: ender build domready bonzo
7  */
8!function(a){function d(a,b){return new c(a,b)}function c(a,b){this.elements=typeof a!="string"&&!a.nodeType&&typeof a.length!="undefined"?a:d._select(a,b),this.length=this.elements.length;for(var c=0;c<this.length;c++)this[c]=this.elements[c]}function b(a,b){for(var c in b)c!="noConflict"&&(a[c]=b[c])}b(d,{ender:function(a,e){b(e?c.prototype:d,a)},_select:function(){return[]}});var e=a.$;d.noConflict=function(){a.$=e;return this},typeof module!="undefined"&&module.exports?module.exports=d:a.$=d}(this),!function(){var a={},b={exports:a};!function(a){function k(){c=1;for(var a=0,b=d.length;a<b;a++)d[a]()}var c=0,d=[],e,f=!1,g=a.createElement("a"),h="DOMContentLoaded",i="addEventListener",j="onreadystatechange";/^loade|c/.test(a.readyState)&&(c=1),a[i]&&a[i](h,function l(){a.removeEventListener(h,l,f),k()},f),g.doScroll&&a.attachEvent(j,e=function e(){/^c/.test(a.readyState)&&(a.detachEvent(j,e),k())});var m=g.doScroll?function(a){self!=top?c?a():d.push(a):!function(){try{g.doScroll("left")}catch(b){return setTimeout(function(){m(a)},50)}a()}()}:function(a){c?a():d.push(a)};typeof b!="undefined"&&b.exports?b.exports={domReady:m}:window.domReady=m}(document),$.ender(b.exports)}(),!function(a){function x(a){return new q(a)}function w(){return{x:window.pageXOffset||c.scrollLeft,y:window.pageYOffset||c.scrollTop}}function v(a){return a===window||/^(?:body|html)$/i.test(a.tagName)}function u(a,b,c){var d=this.elements[0];if(a==null&&b==null)return(v(d)?w():{x:d.scrollLeft,y:d.scrollTop})[c];v(d)?window.scrollTo(a,b):(a!=null&&(d.scrollLeft=a),b!=null&&(d.scrollTop=b));return this}function t(a){return typeof a=="string"?x.create(a):n(a)?[a]:a}function s(a){var b=a.name;if(a.disabled||!b)return"";b=r(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?r(a.value):!0)+"&":"";default:return b+"="+(a.value?r(a.value):!0)+"&"}break;case"textarea":return b+"="+r(a.value)+"&";case"select":return b+"="+r(a.options[a.selectedIndex].value)+"&"}return""}function r(a){return encodeURIComponent(a)}function q(a){this.elements=[],this.length=0;if(a){this.elements=typeof a!="string"&&!a.nodeType&&typeof a.length!="undefined"?a:[a],this.length=this.elements.length;for(var b=0;b<this.length;b++)this[b]=this.elements[b]}}function p(a){for(var b in a)switch(b){case"opacity":a.filter="alpha(opacity="+a[b]*100+")",delete a[b];break;case"":}}function o(a,b,c){for(var d=0,e=a.length;d<e;++d)if(b.call(c,a[d],d,a))return!0;return!1}function n(a){return a&&a.nodeName&&a.nodeType==1}function m(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}function l(a){return a.replace(/(^\s*|\s*$)/g,"")}function k(a,b){for(i=0,len=a.length;i<len;i++)b(a[i])}function j(a){return new RegExp("(^|\\s+)"+a+"(\\s+|$)")}var b=document,c=b.documentElement,d=/^checked|value|selected$/,e=/^checked|selected$/,f=/msie/.test(navigator.userAgent),g=[],h=0;q.prototype={each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b);return this},map:function(a,b){var c=[],d;for(var e=0;e<this.length;e++)d=a.call(this,this[e]),b?b(d)&&c.push(d):c.push(d);return c},first:function(){return x(this[0])},last:function(){return x(this[this.length-1])},html:function(a){return typeof a!="undefined"?this.each(function(b){b.innerHTML=a}):this.elements[0]?this.elements[0].innerHTML:""},addClass:function(a){return this.each(function(b){this.hasClass(b,a)||(b.className=l(b.className+" "+a))})},removeClass:function(a){return this.each(function(b){this.hasClass(b,a)&&(b.className=l(b.className.replace(j(a)," ")))})},hasClass:function(a,b){return typeof b=="undefined"?o(this.elements,function(b){return j(a).test(b.className)}):j(b).test(a.className)},toggleClass:function(a,b){if(typeof b!="undefined"&&!b)return this;return this.each(function(b){this.hasClass(b,a)?b.className=l(b.className.replace(j(a)," ")):b.className=l(b.className+" "+a)})},show:function(a){return this.each(function(a){a.style.display=""})},hide:function(a){return this.each(function(a){a.style.display="none"})},append:function(a){return this.each(function(b){k(t(a),function(a){b.appendChild(a)})})},prepend:function(a){return this.each(function(b){var c=b.firstChild;k(t(a),function(a){b.insertBefore(a,c)})})},appendTo:function(a){return this.each(function(b){a.appendChild(b)})},next:function(){return this.related("nextSibling")},previous:function(){return this.related("previousSibling")},related:function(a){return this.map(function(b){b=b[a];while(b&&b.nodeType!==1)b=b[a];return b||0},function(a){return a})},prependTo:function(a){return this.each(function(b){a.insertBefore(b,x.firstChild(a))})},before:function(a){return this.each(function(b){k(x.create(a),function(a){b.parentNode.insertBefore(a,b)})})},insertBefore:function(a){return this.each(function(b){k(t(a),function(a){a.parentNode.insertBefore(b,a)})})},insertAfter:function(a){return this.each(function(b){k(t(a),function(a){a.parentNode.insertBefore(b,a.nextSibling||a)})})},after:function(a){return this.each(function(b){k(x.create(a),function(a){b.parentNode.insertBefore(a,b.nextSibling)})})},css:function(a,b){if(b===undefined&&typeof a=="string")return this[0].style[m(a)];var c=a;typeof a=="string"&&(c={},c[a]=b),f&&p(c);var d=function(a){for(var b in c)c.hasOwnProperty(b)&&(a.style[m(b)]=c[b])};return this.each(d)},offset:function(){var a=this.elements[0],b=a.offsetWidth,c=a.offsetHeight,d=a.offsetTop,e=a.offsetLeft;while(a=a.offsetParent)d=d+a.offsetTop,e=e+a.offsetLeft;return{top:d,left:e,height:c,width:b}},attr:function(a,b){var c=this.elements[0];return typeof b=="undefined"?d.test(a)?e.test(a)&&typeof c[a]=="string"?!0:c[a]:c.getAttribute(a):this.each(function(c){c.setAttribute(a,b)})},removeAttr:function(a){return this.each(function(b){b.removeAttribute(a)})},data:function(a,b){var c=this.elements[0];if(typeof b=="undefined"){c.getAttribute("data-node-uid")||c.setAttribute("data-node-uid",++h);var d=c.getAttribute("data-node-uid");g[d]||(g[d]={});return g[d][a]}return this.each(function(c){c.getAttribute("data-node-uid")||c.setAttribute("data-node-uid",++h);var d=c.getAttribute("data-node-uid"),e={};e[a]=b,g[d]=e})},remove:function(){return this.each(function(a){a.parentNode&&a.parentNode.removeChild(a)})},empty:function(){return this.each(function(a){while(a.firstChild)a.removeChild(a.firstChild)})},detach:function(){return this.map(function(a){return a.parentNode.removeChild(a)})},scrollTop:function(a){return u.call(this,null,a,"y")},scrollLeft:function(a){return u.call(this,a,null,"x")},serialize:function(){var a=this[0],b=a.getElementsByTagName("input"),c=a.getElementsByTagName("select"),d=a.getElementsByTagName("textarea");return(x(b).map(s).join("")+x(c).map(s).join("")+x(d).map(s).join("")).replace(/&$/,"")},serializeArray:function(){for(var a=this.serialize().split("&"),b=0,c=a.length,d=[],e;b<c;b++)a[b]&&(e=a[b].split("="))&&d.push({name:e[0],value:e[1]});return d}},x.aug=function(a,b){for(var c in a)a.hasOwnProperty(c)&&((b||q.prototype)[c]=a[c])},x.create=function(a){return typeof a=="string"?function(){var c=b.createElement("div"),d=[];c.innerHTML=a;var e=c.childNodes;c=c.firstChild,d.push(c);while(c=c.nextSibling)c.nodeType==1&&d.push(c);return d}():n(a)?[a.cloneNode(!0)]:[]},x.doc=function(){var a=c.scrollWidth,b=c.scrollHeight,d=this.viewport();return{width:Math.max(a,d.width),height:Math.max(b,d.height)}},x.firstChild=function(a){for(var b=a.childNodes,c=0,d=b&&b.length||0,e;c<d;c++)b[c].nodeType===1&&(e=b[d=c]);return e},x.viewport=function(){var a=self.innerHeight,b=self.innerWidth;f&&(a=c.clientHeight)&&(b=c.clientWidth);return{width:b,height:a}},x.isAncestor="compareDocumentPosition"in c?function(a,b){return(a.compareDocumentPosition(b)&16)==16}:"contains"in c?function(a,b){return a!==b&&a.contains(b)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1};var y=a.bonzo;x.noConflict=function(){a.bonzo=y;return this},a.bonzo=x}(this),!function(){function c(a){var b=[],c,d;label:for(c=0;c<a.length;c++){for(d=0;d<b.length;d++)if(b[d]==a[c])continue label;b[b.length]=a[c]}return b}function b(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return c;return-1}var a=bonzo.noConflict();$.ender(a),$.ender(a(),!0),$.ender({create:function(b){return $(a.create(b))}}),$.ender({parents:function(a,d){var e=$(a),f,g,h,i=[];for(f=0,g=this.length;f<g;f++){h=this[f];while(h=h.parentNode)if(b(e,h)!==-1){i.push(h);if(d)break}}return $(c(i))},closest:function(a){return this.parents(a,!0)},first:function(){return $(this[0])},last:function(){return $(this[this.length-1])},next:function(){return $(a(this).next())},previous:function(){return $(a(this).previous())},siblings:function(){var a,b,d,e=[];for(a=0,b=this.length;a<b;a++){d=this[a];while(d=d.previousSibling)d.nodeType==1&&e.push(d);d=this[a];while(d=d.nextSibling)d.nodeType==1&&e.push(d)}return $(c(e))}},!0)}()