old-website/.themes/classic/source/javascripts/ender.js

39 lines
24 KiB
JavaScript
Raw Normal View History

/*!
* =============================================================
* Ender: open module JavaScript framework (https://ender.no.de)
* Build: ender build jeesh --output jeesh
* =============================================================
*/
/*!
* Ender: open module JavaScript framework (client-lib)
* copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
* http://ender.no.de
* License MIT
*/
!function(a){function h(a,b){return g(a,b)}function g(a,b,c){h._select&&(typeof a=="string"||a.nodeName||a.length&&"item"in a||a==window)?(c=h._select(a,b),c.selector=a):c=isFinite(a.length)?a:[a];return f(c,g)}function f(a,b){for(var c in b)c!="noConflict"&&c!="_VERSION"&&(a[c]=b[c]);return a}function e(a,c){return b[a]=c}function d(a){var c=b[a]||window[a];if(!c)throw new Error("Requested module '"+a+"' has not been defined.");return c}a.global=a;var b={},c=a.$;a.provide=e,a.require=d,f(h,{_VERSION:"0.3.4",fn:a.$&&a.$.fn||{},ender:function(a,b){f(b?g:h,a)},_select:function(a,b){return(b||document).querySelectorAll(a)}}),f(g,{forEach:function(a,b,c){for(c=0,l=this.length;c<l;++c)c in this&&a.call(b||this[c],this[c],c,this);return this},$:h}),h.noConflict=function(){a.$=c;return this},typeof module!="undefined"&&module.exports&&(module.exports=h),a.ender=a.$=a.ender||h}(this),!function(){var a={exports:{}},b=a.exports;
/*!
* bean.js - copyright Jacob Thornton 2011
* https://github.com/fat/bean
* MIT License
* special thanks to:
* dean edwards: http://dean.edwards.name/
* dperini: https://github.com/dperini/nwevents
* the entire mootools team: github.com/mootools/mootools-core
*/
!function(b){function G(a){var b=a.relatedTarget;return b?b!=this&&b.prefix!="xul"&&!/document/.test(this.toString())&&!q(this,b):b===null}var c=1,d={},e={},f=/over|out/,g=/[^\.]*(?=\..*)\.|.*/,h=/\..*/,i="addEventListener",j="attachEvent",k="removeEventListener",l="detachEvent",m=b.document||{},n=m.documentElement||{},o=n[i],p=o?i:j,q=function(a,b){var c=b.parentNode;while(c!==null){if(c==a)return!0;c=c.parentNode}},r=function(a,b){return a.__uid=b&&b+"::"+c++||a.__uid||c++},s=function(a){var b=r(a);return d[b]=d[b]||{}},t=o?function(a,b,c,d){a[d?i:k](b,c,!1)}:function(a,b,c,d,e){e&&d&&(a["_on"+e]=a["_on"+e]||0),a[d?j:l]("on"+b,c)},u=function(a,c,d){return function(e){e=E(e||((this.ownerDocument||this.document||this).parentWindow||b).event);return c.apply(a,[e].concat(d))}},v=function(a,b,c,d,e){return function(f){(d?d.apply(this,arguments):o?!0:f&&f.propertyName=="_on"+c||!f)&&b.apply(a,Array.prototype.slice.call(arguments,f?0:1).concat(e))}},w=function(a,b,c,d){var f=b.replace(h,""),i=s(a),j=i[f]||(i[f]={}),k=c,l=r(c,b.replace(g,""));if(j[l])return a;var m=H[f];m&&(c=m.condition?v(a,c,f,m.condition):c,f=m.base||f);var n=F[f];c=n?u(a,c,d):v(a,c,f,!1,d),n=o||n;if(f=="unload"){var q=c;c=function(){x(a,f,c)&&q()}}a[p]&&t(a,n?f:"propertychange",c,!0,!n&&f),j[l]=c,c.__uid=l,c.__originalFn=k;return f=="unload"?a:e[r(a)]=a},x=function(a,b,c){function l(b){c=j[k][b];if(!!c){delete j[k][b];if(a[p]){k=H[k]?H[k].base:k;var d=o||F[k];t(a,d?k:"propertychange",c,!1,!d&&k)}}}var d,e,f,i,j=s(a),k=b.replace(h,"");if(!j||!j[k])return a;e=b.replace(g,""),f=e?e.split("."):[c.__uid],l(e);for(i=f.length;i--;l(f[i]));return a},y=function(a,b,c){return function(d){var e=typeof a=="string"?c(a,this):a;for(var f=d.target;f&&f!=this;f=f.parentNode)for(var g=e.length;g--;)if(e[g]==f)return b.apply(f,arguments)}},z=function(a,b,c,d,e){if(typeof b=="object"&&!c)for(var f in b)b.hasOwnProperty(f)&&z(a,f,b[f]);else{var g=typeof c=="string",h=(g?c:b).split(" ");c=g?y(b,d,e):c;for(var i=h.length;i--;)w(a,h[i],c,Array.prototype.slice.call(arguments,g?4:3))}return a},A=function(a,b,c){var d,e,f,i,j,k=typeof b=="string",l=k&&b.replace(g,""),l=l&&l.split("."),m=x,n=s(a);if(k&&/\s/.test(b)){b=b.split(" "),j=b.length-1;while(A(a,b[j])&&j--);return a}i=k?b.replace(h,""):b;if(!n||l||k&&!n[i]){for(d in n)if(n.hasOwnProperty(d))for(j in n[d])for(e=l.length;e--;)n[d].hasOwnProperty(j)&&(new RegExp("^"+l[e]+"::\\d*(\\..*)?$")).test(j)&&m(a,[d,j].join("."));return a}if(typeof c=="function")m(a,i,c);else if(l)m(a,b);else{m=i?m:A,f=k&&i,i=i?c||n[i]||i:n;for(d in i)i.hasOwnProperty(d)&&(m(a,f||d,i[d]),delete i[d])}return a},B=function(a,b,c){var d,e,f,i,j=b.split(" ");for(f=j.length;f--;){b=j[f].replace(h,"");var k=F[b],l=j[f].replace(g,""),m=s(a)[b];if(l){l=l.split(".");for(e=l.length;e--;)for(i in m)m.hasOwnProperty(i)&&(new RegExp("^"+l[e]+"::\\d*(\\..*)?$")).test(i)&&m[i].apply(a,[!1].concat(c))}else if(!c&&a[p])C(k,b,a);else for(e in m)m.hasOwnProperty(e)&&m[e].apply(a,[!1].concat(c))}return a},C=o?function(a,c,d){evt=document.createEvent(a?"HTMLEvents":"UIEvents"),evt[a?"initEvent":"initUIEvent"](c,!0,!0,b,1),d.dispatchEvent(evt)}:function(a,b,c){a?c.fireEvent("on"+b,document.createEventObject()):c["_on"+b]++},D=function(a,b,c){var d=s(b),e,f,g=r(a);e=c?d[c]:d;for(f in e)e.hasOwnProperty(f)&&(c?z:D)(a,c||b,c?e[f].__originalFn:f);return a},E=function(a){var b={};if(!a)return b;var c=a.type,d=a.target||a.srcElement;b.preventDefault=E.preventDefault(a),b.stopPropagation=E.stopPropagation(a),b.target=d&&d.nodeType==3?d.parentNode:d;if(~c.indexOf("key"))b.keyCode=a.which||a.keyCode;else if(/click|mouse|menu/i.test(c)){b.rightClick=a.which==3||a.button==2,b.pos={x:0,y:0};if(a.pageX||a.pageY)b.clientX=a.pageX,b.clientY=a.pageY;else if(a.clientX||a.clientY)b.clientX=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,b.clientY=a.clientY+document.body.scrollTop+document.documentElement.scrollTop;f.test(c)&&(b.relatedTarget=a.relatedTarget||a[(c=="mouseover"?"from":"to")+"Element"])}for(var e in a)e in b||(b[e]=a[e]);return b};E.preventDefault=function
/*!
* Bonzo: DOM Utility (c) Dustin Diaz 2011
* https://github.com/ded/bonzo
* License MIT
*/
!function(b,c){typeof define=="function"?define(c):typeof a!="undefined"?a.exports=c():this[b]=c()}("bonzo",function(){function N(a,b){return new I(a,b)}function M(){return{x:b.pageXOffset||d.scrollLeft,y:b.pageYOffset||d.scrollTop}}function L(a){return a===b||/^(?:body|html)$/i.test(a.tagName)}function K(a,c,d){var e=this[0];if(a==null&&c==null)return(L(e)?M():{x:e.scrollLeft,y:e.scrollTop})[d];L(e)?b.scrollTo(a,c):(a!=null&&(e.scrollLeft=a),c!=null&&(e.scrollTop=c));return this}function J(a){return typeof a=="string"?N.create(a):A(a)?[a]:a}function I(a){this.length=0;if(a){a=typeof a!="string"&&!a.nodeType&&typeof a.length!="undefined"?a:[a],this.length=a.length;for(var b=0;b<a.length;b++)this[b]=a[b]}}function H(a,b){a.className=w(a.className.replace(x(b)," "))}function G(a,b){a.className=w(a.className+" "+b)}function F(a,b){return x(b).test(a.className)}function E(a,b,c){var d=N(a),e=d.css("position"),f=d.offset(),g="relative",h=e==g,i=[parseInt(d.css("left"),10),parseInt(d.css("top"),10)];e=="static"&&(d.css("position",g),e=g),isNaN(i[0])&&(i[0]=h?0:a.offsetLeft),isNaN(i[1])&&(i[1]=h?0:a.offsetTop),b!=null&&(a.style.left=b-f.left+i[0]+q),c!=null&&(a.style.top=c-f.top+i[1]+q)}function D(a,b,c){var d=0,g=b||this,h=[],i=f&&typeof a=="string"&&a.charAt(0)!="<"?function(b){return(b=f(a))&&(b.selected=1)&&b}():a;y(J(i),function(a){y(g,function(b){var f=!b[e]||b[e]&&!b[e][e]?function(){var a=b.cloneNode(!0);g.$&&g.cloneEvents&&g.$(a).cloneEvents(b);return a}():b;c(a,f),h[d]=f,d++})},this),y(h,function(a,b){g[b]=a}),g.length=d;return g}function B(a,b,c,d){for(d=0,j=a.length;d<j;++d)if(b.call(c,a[d],d,a))return!0;return!1}function A(a){return a&&a.nodeName&&a.nodeType==1}function z(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}function y(a,b,c){for(var d=0,e=a.length;d<e;d++)b.call(c||a[d],a[d],d,a);return a}function x(a){return new RegExp("(^|\\s+)"+a+"(\\s+|$)")}var a=this,b=window,c=b.document,d=c.documentElement,e="parentNode",f=null,g=/^checked|value|selected$/,h=/select|fieldset|table|tbody|tfoot|td|tr|colgroup/i,i="table",k={thead:i,tbody:i,tfoot:i,tr:"tbody",th:"tr",td:"tr",fieldset:"form",option:"select"},l=/^checked|selected$/,m=/msie/i.test(navigator.userAgent),n=[],o=0,p=/^-?[\d\.]+$/,q="px",r="setAttribute",s="getAttribute",t=/(^\s*|\s*$)/g,u={lineHeight:1,zoom:1,zIndex:1,opacity:1},v=function(){var a=["webkitTransform","MozTransform","OTransform","msTransform","Transform"],b;for(b=0;b<a.length;b++)if(a[b]in c.createElement("a").style)return a[b]}(),w=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(t,"")},C=c.defaultView&&c.defaultView.getComputedStyle?function(a,b){b=b=="transform"?v:b,b=b=="transform-origin"?v+"Origin":b;var d=null;b=="float"&&(b="cssFloat");var e=c.defaultView.getComputedStyle(a,"");e&&(d=e[z(b)]);return a.style[b]||d}:m&&d.currentStyle?function(a,b){b=z(b),b=b=="float"?"styleFloat":b;if(b=="opacity"){var c=100;try{c=a.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(d){try{c=a.filters("alpha").opacity}catch(e){}}return c/100}var f=a.currentStyle?a.currentStyle[b]:null;return a.style[b]||f}:function(a,b){return a.style[z(b)]};I.prototype={get:function(a){return this[a]},each:function(a,b){return y(this,a,b)},map:function(a,b){var c=[],d,e;for(e=0;e<this.length;e++)d=a.call(this,this[e],e),b?b(d)&&c.push(d):c.push(d);return c},first:function(){return N(this[0])},last:function(){return N(this[this.length-1])},html:function(a,b){function f(b){while(b.firstChild)b.removeChild(b.firstChild);y(J(a),function(a){b.appendChild(a)})}var c=b?d.textContent===null?"innerText":"textContent":"innerHTML",e;return typeof a!="undefined"?this.each(function(b){(e=b.tagName.match(h))?f(b,e[0]):b[c]=a}):this[0]?this[0][c]:""},text:function(a){return this.html(a,1)},addClass:function(a){return this.each(function(b){F(b,a)||G(b,a)})},removeClass:function(a){return this.each(function(b){F(b,a)&&H(b,a)})},hasClass:function(a){return B(this,function(b){return F(b,a)})},toggleClass:function(a,b){return this.each(function(c){typeof b!="undefined"?b?G(c,a):H(c
/*!
* Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
* copyright Dustin Diaz & Jacob Thornton 2011
* MIT License
*/
!function(b,c){typeof define=="function"?define(c):typeof a!="undefined"?a.exports=c():this[b]=c()}("qwery",function(){function _(a,c){var d=$(c);return!d||!a?[]:a===window||X(a)?!c||a!==window&&X(d)&&ba(a,d)?[a]:[]:a&&Z(a)?Q(a):(h=a.match(w))?(m=b.getElementById(h[1]))?[m]:[]:(h=a.match(y))?Q(d.getElementsByTagName(h[1])):bc(a,d)}function $(a){return a?typeof a=="string"?_(a)[0]:Z(a)?a[0]:a:b}function Z(a){return typeof a=="object"&&isFinite(a.length)}function Y(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 X(a){return a&&a.nodeType&&(a.nodeType==1||a.nodeType==9)}function W(a){var c=[],d=[],e,f=0,g,h,i,j,k,l,m,n,p,q,r,s=P.g(a)||P.s(a,a.split(I)),t=a.match(H),u;s=s.slice(0);if(!s.length)return c;k=s.pop(),n=s.length&&(i=s[s.length-1].match(w))?b.getElementById(i[1]):b;if(!n)return c;p=S(k),m=t&&/^[+~]$/.test(t[t.length-1])?function(a){while(n=n.nextSibling)n.nodeType==1&&(p[1]?p[1]==n.tagName.toLowerCase():1)&&a.push(n);return a}([]):n.getElementsByTagName(p[1]||"*");for(e=0,h=m.length;e<h;e++)if(q=T.apply(m[e],p))c[f++]=q;if(!s.length)return c;for(f=0,h=c.length,g=0;f<h;f++){j=c[f];for(e=s.length;e--;)while(j=K[t[e]](j,c[f]))if(o=T.apply(j,S(s[e])))break;o&&(d[g++]=c[f])}return d}function V(a,b,c){switch(a){case"=":return b==c;case"^=":return b.match(O.g("^="+c)||O.s("^="+c,new RegExp("^"+U(c))));case"$=":return b.match(O.g("$="+c)||O.s("$="+c,new RegExp(U(c)+"$")));case"*=":return b.match(O.g(c)||O.s(c,new RegExp(U(c))));case"~=":return b.match(O.g("~="+c)||O.s("~="+c,new RegExp("(?:^|\\s+)"+U(c)+"(?:\\s+|$)")));case"|=":return b.match(O.g("|="+c)||O.s("|="+c,new RegExp("^"+U(c)+"(-|$)")))}return 0}function U(a){return N.g(a)||N.s(a,a.replace(D,"\\$1"))}function T(a,b,c,e,f,g,h,j,k,l,m){var n,o,q;if(b&&this.tagName.toLowerCase()!==b)return!1;if(c&&(n=c.match(u))&&n[1]!==this.id)return!1;if(c&&(p=c.match(v)))for(d=p.length;d--;){o=p[d].slice(1);if(!(M.g(o)||M.s(o,new RegExp("(^|\\s+)"+o+"(\\s+|$)"))).test(this.className))return!1}if(k&&_.pseudos[k]&&!_.pseudos[k](this,m))return!1;if(e&&!h){i=this.attributes;for(q in i)if(Object.prototype.hasOwnProperty.call(i,q)&&(i[q].name||q)==f)return this}return e&&!V(g,this.getAttribute(f)||"",h)?!1:this}function S(a){return a.match(J)}function R(a){while(a=a.previousSibling)if(a.nodeType==1)break;return a}function Q(a){k=[];for(d=0,g=a.length;d<g;d++)Z(a[d])?k=k.concat(a[d]):k.push(a[d]);return k}function L(){this.c={}}var a=this,b=document,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=b.documentElement,u=/#([\w\-]+)/,v=/\.[\w\-]+/g,w=/^#([\w\-]+$)/,x=/^\.([\w\-]+)$/,y=/^([\w\-]+)$/,z=/^([\w]+)?\.([\w\-]+)$/,A=/\s*([\s\+\~>])\s*/g,B=/[\s\>\+\~]/,C=/(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\]|[\s\w\+\-]*\))/,D=/([.*+?\^=!:${}()|\[\]\/\\])/g,E=/^([a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,F=/\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,G=/:([\w\-]+)(\(['"]?([\s\w\+\-]+)['"]?\))?/,H=new RegExp("("+B.source+")"+C.source,"g"),I=new RegExp(B.source+C.source),J=new RegExp(E.source+"("+F.source+")?"+"("+G.source+")?"),K={" ":function(a){return a&&a!==t&&a.parentNode},">":function(a,b){return a&&a.parentNode==b.parentNode&&a.parentNode},"~":function(a){return a&&a.previousSibling},"+":function(a,b,c,d){if(!a)return!1;c=R(a),d=R(b);return c&&d&&c==d&&c}};L.prototype={g:function(a){return this.c[a]||undefined},s:function(a,b){this.c[a]=b;return b}};var M=new L,N=new L,O=new L,P=new L,ba="compareDocumentPosition"in t?function(a,b){return(b.compareDocumentPosition(a)&16)==16}:"contains"in t?function(a,c){c=c==b||c==window?t:c;return c!==a&&c.contains(a)}:function(a,b){while(a=a.parentNode)if(a===b)return 1;return 0},bb=function(){if(!b.querySelector||!b.querySelectorAll)return!1;try{return b.querySelectorAll(":nth-of-type(1)").length>0}catch(a){return!1}}(),bc=bb?function(a,c){return b.getElementsByClassName&&(h=a.match(x))?Q(c.getElementsByClassName(h[1])):Q(c.querySelectorAll(a))}:function(a,c){a=a.replace(A,"$1");var d=[],f,i,j=[],l;if(h=a.match(z)){r=c.getElementsBy