blog/.themes/classic/source/javascripts/ender.js

45 lines
55 KiB
JavaScript
Raw Normal View History

/*!
* =============================================================
* Ender: open module JavaScript framework (https://ender.no.de)
* Build: ender build jeesh reqwest
* =============================================================
*/
/*!
* Ender: open module JavaScript framework (client-lib)
2013-01-07 04:52:54 +00:00
* copyright Dustin Diaz & Jacob Thornton 2011-2012 (@ded @fat)
* http://ender.jit.su
* License MIT
*/
2013-01-07 04:52:54 +00:00
(function(context){function require(identifier){var module=modules["$"+identifier]||window[identifier];if(!module)throw new Error("Ender Error: Requested module '"+identifier+"' has not been defined.");return module}function provide(name,what){return modules["$"+name]=what}function aug(o,o2){for(var k in o2)k!="noConflict"&&k!="_VERSION"&&(o[k]=o2[k]);return o}function Ender(s,r){var elements,i;this.selector=s;if(typeof s=="undefined"){elements=[];this.selector=""}else typeof s=="string"||s.nodeName||s.length&&"item"in s||s==window?elements=ender._select(s,r):elements=isFinite(s.length)?s:[s];this.length=elements.length;for(i=this.length;i--;)this[i]=elements[i]}function ender(s,r){return new Ender(s,r)}context.global=context;var modules={},old=context.$,oldEnder=context.ender,oldRequire=context.require,oldProvide=context.provide;context.provide=provide;context.require=require;Ender.prototype.forEach=function(fn,opt_scope){var i,l;for(i=0,l=this.length;i<l;++i)i in this&&fn.call(opt_scope||this[i],this[i],i,this);return this};Ender.prototype.$=ender;ender._VERSION="0.4.3-dev";ender.fn=Ender.prototype;ender.ender=function(o,chain){aug(chain?Ender.prototype:ender,o)};ender._select=function(s,r){return typeof s=="string"?(r||document).querySelectorAll(s):s.nodeName?[s]:s};ender.noConflict=function(callback){context.$=old;if(callback){context.provide=oldProvide;context.require=oldRequire;context.ender=oldEnder;typeof callback=="function"&&callback(require,provide,this)}return this};typeof module!="undefined"&&module.exports&&(module.exports=ender);context.ender=context.$=ender}(this));(function(){var module={exports:{}},exports=module.exports;
/*!
* Reqwest! A general purpose XHR connection manager
2013-01-07 04:52:54 +00:00
* (c) Dustin Diaz 2012
* https://github.com/ded/reqwest
* license MIT
*/
2013-01-07 04:52:54 +00:00
;!function(name,definition){typeof module!="undefined"?module.exports=definition():typeof define=="function"&&define.amd?define(definition):this[name]=definition()}("reqwest",function(){function handleReadyState(o,success,error){return function(){o&&o[readyState]==4&&(twoHundo.test(o.status)?success(o):error(o))}}function setHeaders(http,o){var headers=o.headers||{},h;headers.Accept=headers.Accept||defaultHeaders.accept[o.type]||defaultHeaders.accept["*"];!o.crossOrigin&&!headers[requestedWith]&&(headers[requestedWith]=defaultHeaders.requestedWith);headers[contentType]||(headers[contentType]=o.contentType||defaultHeaders.contentType);for(h in headers)headers.hasOwnProperty(h)&&http.setRequestHeader(h,headers[h])}function setCredentials(http,o){typeof o.withCredentials!="undefined"&&typeof http.withCredentials!="undefined"&&(http.withCredentials=!!o.withCredentials)}function generalCallback(data){lastValue=data}function urlappend(url,s){return url+(/\?/.test(url)?"&":"?")+s}function handleJsonp(o,fn,err,url){var reqId=uniqid++,cbkey=o.jsonpCallback||"callback",cbval=o.jsonpCallbackName||reqwest.getcallbackPrefix(reqId),cbreg=new RegExp("((^|\\?|&)"+cbkey+")=([^&]+)"),match=url.match(cbreg),script=doc.createElement("script"),loaded=0;match?match[3]==="?"?url=url.replace(cbreg,"$1="+cbval):cbval=match[3]:url=urlappend(url,cbkey+"="+cbval);win[cbval]=generalCallback;script.type="text/javascript";script.src=url;script.async=!0;if(typeof script.onreadystatechange!="undefined"){script.event="onclick";script.htmlFor=script.id="_reqwest_"+reqId}script.onload=script.onreadystatechange=function(){if(script[readyState]&&script[readyState]!=="complete"&&script[readyState]!=="loaded"||loaded)return!1;script.onload=script.onreadystatechange=null;script.onclick&&script.onclick();o.success&&o.success(lastValue);lastValue=undefined;head.removeChild(script);loaded=1};head.appendChild(script)}function getRequest(o,fn,err){var method=(o.method||"GET").toUpperCase(),url=typeof o=="string"?o:o.url,data=o.processData!==!1&&o.data&&typeof o.data!="string"?reqwest.toQueryString(o.data):o.data||null,http;if((o.type=="jsonp"||method=="GET")&&data){url=urlappend(url,data);data=null}if(o.type=="jsonp")return handleJsonp(o,fn,err,url);http=xhr();http.open(method,url,!0);setHeaders(http,o);setCredentials(http,o);http.onreadystatechange=handleReadyState(http,fn,err);o.before&&o.before(http);http.send(data);return http}function Reqwest(o,fn){this.o=o;this.fn=fn;init.apply(this,arguments)}function setType(url){var m=url.match(/\.(json|jsonp|html|xml)(\?|$)/);return m?m[1]:"js"}function init(o,fn){function complete(resp){o.timeout&&clearTimeout(self.timeout);self.timeout=null;while(self._completeHandlers.length>0)self._completeHandlers.shift()(resp)}function success(resp){var r=resp.responseText;if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML}self._responseArgs.resp=resp;self._fulfilled=!0;fn(resp);while(self._fulfillmentHandlers.length>0)self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(resp,msg,t){self._responseArgs.resp=resp;self._responseArgs.msg=msg;self._responseArgs.t=t;self._erred=!0;while(self._errorHandlers.length>0)self._errorHandlers.shift()(resp,msg,t);complete(resp)}this.url=typeof o=="string"?o:o.url;this.timeout=null;this._fulfilled=!1;this._fulfillmentHandlers=[];this._errorHandlers=[];this._completeHandlers=[];this._erred=!1;this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){};o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout));o.success&&this._fulfillmentHandlers.push(function(){o.success.apply(o,arguments)});o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)});o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)});this.request=getRequest(o,success,error)}function reqwest(o,fn){return new Reqwest(o,fn)}function normalize(s){re
/*!
2013-01-07 04:52:54 +00:00
* Bean - copyright (c) Jacob Thornton 2011-2012
* https://github.com/fat/bean
2013-01-07 04:52:54 +00:00
* MIT license
*/
2013-01-07 04:52:54 +00:00
;!function(name,context,definition){typeof module!="undefined"&&module.exports?module.exports=definition(name,context):typeof define=="function"&&typeof define.amd=="object"?define(definition):context[name]=definition(name,context)}("bean",this,function(name,context){var win=window,old=context[name],namespaceRegex=/[^\.]*(?=\..*)\.|.*/,nameRegex=/\..*/,addEvent="addEventListener",removeEvent="removeEventListener",doc=document||{},root=doc.documentElement||{},W3C_MODEL=root[addEvent],eventSupport=W3C_MODEL?addEvent:"attachEvent",ONE={},slice=Array.prototype.slice,str2arr=function(s,d){return s.split(d||" ")},isString=function(o){return typeof o=="string"},isFunction=function(o){return typeof o=="function"},standardNativeEvents="click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange message error abort scroll ",w3cNativeEvents="show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend textinputreadystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ",nativeEvents=function(hash,events,i){for(i=0;i<events.length;i++)events[i]&&(hash[events[i]]=1);return hash}({},str2arr(standardNativeEvents+(W3C_MODEL?w3cNativeEvents:""))),customEvents=function(){var isAncestor="compareDocumentPosition"in root?function(element,container){return container.compareDocumentPosition&&(container.compareDocumentPosition(element)&16)===16}:"contains"in root?function(element,container){container=container.nodeType===9||container===window?root:container;return container!==element&&container.contains(element)}:function(element,container){while(element=element.parentNode)if(element===container)return 1;return 0},check=function(event){var related=event.relatedTarget;return related?related!==this&&related.prefix!=="xul"&&!/document/.test(this.toString())&&!isAncestor(related,this):related==null};return{mouseenter:{base:"mouseover",condition:check},mouseleave:{base:"mouseout",condition:check},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),Event=function(){var commonProps=str2arr("altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which propertyName"),mouseProps=commonProps.concat(str2arr("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement")),mouseWheelProps=mouseProps.concat(str2arr("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis")),keyProps=commonProps.concat(str2arr("char charCode key keyCode keyIdentifier keyLocation location")),textProps=commonProps.concat(str2arr("data")),touchProps=commonProps.concat(str2arr("touches targetTouches changedTouches scale rotation")),messageProps=commonProps.concat(str2arr("data origin source")),stateProps=commonProps.concat(str2arr("state")),overOutRegex=/over|out/,typeFixers=[{reg:/key/i,fix:function(event,newEvent){newEvent.keyCode=event.keyCode||event.which;return keyProps}},{reg:/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,fix:function(event,newEvent,type){newEvent.rightClick=event.which===3||event.button===2;newEvent.pos={x:0,y:0};if(event.pageX||event.pageY){newEvent.clientX=event.pageX;newEvent.clientY=event.pageY}else if(event.clientX||event.clientY){newEvent.clientX=event.clientX+doc.body.scrollLeft+root.scrollLeft;newEvent.clientY=event.clientY+doc.body.scrollTop+root.scrollTop}overOutRegex.test(type)&&(newEvent.relatedTarget=event.relatedTarget||ev
/*!
2013-01-07 04:52:54 +00:00
* Bonzo: DOM Utility (c) Dustin Diaz 2012
* https://github.com/ded/bonzo
* License MIT
*/
2013-01-07 04:52:54 +00:00
(function(name,context,definition){typeof module!="undefined"&&module.exports?module.exports=definition():typeof context["define"]=="function"&&context.define.amd?define(definition):context[name]=definition()})("bonzo",this,function(){function isNode(node){return node&&node.nodeName&&(node.nodeType==1||node.nodeType==11)}function normalize(node,host,clone){var i,l,ret;if(typeof node=="string")return bonzo.create(node);isNode(node)&&(node=[node]);if(clone){ret=[];for(i=0,l=node.length;i<l;i++)ret[i]=cloneNode(host,node[i]);return ret}return node}function classReg(c){return new RegExp("(^|\\s+)"+c+"(\\s+|$)")}function each(ar,fn,opt_scope,opt_rev){var ind,i=0,l=ar.length;for(;i<l;i++){ind=opt_rev?ar.length-i-1:i;fn.call(opt_scope||ar[ind],ar[ind],ind,ar)}return ar}function deepEach(ar,fn,opt_scope){for(var i=0,l=ar.length;i<l;i++)if(isNode(ar[i])){deepEach(ar[i].childNodes,fn,opt_scope);fn.call(opt_scope||ar[i],ar[i],i,ar)}return ar}function camelize(s){return s.replace(/-(.)/g,function(m,m1){return m1.toUpperCase()})}function decamelize(s){return s?s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase():s}function data(el){el[getAttribute]("data-node-uid")||el[setAttribute]("data-node-uid",++uuids);var uid=el[getAttribute]("data-node-uid");return uidMap[uid]||(uidMap[uid]={})}function clearData(el){var uid=el[getAttribute]("data-node-uid");uid&&delete uidMap[uid]}function dataValue(d){var f;try{return d===null||d===undefined?undefined:d==="true"?!0:d==="false"?!1:d==="null"?null:(f=parseFloat(d))==d?f:d}catch(e){}return undefined}function some(ar,fn,opt_scope){for(var i=0,j=ar.length;i<j;++i)if(fn.call(opt_scope||null,ar[i],i,ar))return!0;return!1}function styleProperty(p){p=="transform"&&(p=features.transform)||/^transform-?[Oo]rigin$/.test(p)&&(p=features.transform+"Origin")||p=="float"&&(p=features.cssFloat);return p?camelize(p):null}function insert(target,host,fn,rev){var i=0,self=host||this,r=[],nodes=query&&typeof target=="string"&&target.charAt(0)!="<"?query(target):target;each(normalize(nodes),function(t,j){each(self,function(el){fn(t,r[i++]=j>0?cloneNode(self,el):el)},null,rev)},this,rev);self.length=i;each(r,function(e){self[--i]=e},null,!rev);return self}function xy(el,x,y){var $el=bonzo(el),style=$el.css("position"),offset=$el.offset(),rel="relative",isRel=style==rel,delta=[parseInt($el.css("left"),10),parseInt($el.css("top"),10)];if(style=="static"){$el.css("position",rel);style=rel}isNaN(delta[0])&&(delta[0]=isRel?0:el.offsetLeft);isNaN(delta[1])&&(delta[1]=isRel?0:el.offsetTop);x!=null&&(el.style.left=x-offset.left+delta[0]+px);y!=null&&(el.style.top=y-offset.top+delta[1]+px)}function setter(el,v){return typeof v=="function"?v(el):v}function Bonzo(elements){this.length=0;if(elements){elements=typeof elements!="string"&&!elements.nodeType&&typeof elements.length!="undefined"?elements:[elements];this.length=elements.length;for(var i=0;i<elements.length;i++)this[i]=elements[i]}}function cloneNode(host,el){var c=el.cloneNode(!0),cloneElems,elElems;if(host.$&&typeof host.cloneEvents=="function"){host.$(c).cloneEvents(el);cloneElems=host.$(c).find("*");elElems=host.$(el).find("*");for(var i=0;i<elElems.length;i++)host.$(cloneElems[i]).cloneEvents(elElems[i])}return c}function scroll(x,y,type){var el=this[0];if(!el)return this;if(x==null&&y==null)return(isBody(el)?getWindowScroll():{x:el.scrollLeft,y:el.scrollTop})[type];if(isBody(el))win.scrollTo(x,y);else{x!=null&&(el.scrollLeft=x);y!=null&&(el.scrollTop=y)}return this}function isBody(element){return element===win||/^(?:body|html)$/i.test(element.tagName)}function getWindowScroll(){return{x:win.pageXOffset||html.scrollLeft,y:win.pageYOffset||html.scrollTop}}function createScriptFromHtml(html){var scriptEl=document.createElement("script"),matches=html.match(simpleScriptTagRe);scriptEl.src=matches[1];return scriptEl}function bonzo(els){return new Bonzo(els)}var win=window,doc=win.document,html=doc.documentElement,parentNode="parentNode",specialAttributes=/^(checked|value|selected|disabled)$/i,specialTags=/^(select|fieldset|table|tbody|tfoot|td|tr|colgroup)$/i,simpleSc
/*!
* domready (c) Dustin Diaz 2012 - License MIT
*/
;!function(name,definition){typeof module!="undefined"?module.exports=definition():typeof define=="function"&&typeof define.amd=="object"?define(definition):this[name]=definition()}("domready",function(ready){function flush(f){loaded=1;while(f=fns.shift())f()}var fns=[],fn,f=!1,doc=document,testEl=doc.documentElement,hack=testEl.doScroll,domContentLoaded="DOMContentLoaded",addEventListener="addEventListener",onreadystatechange="onreadystatechange",readyState="readyState",loaded=/^loade|c/.test(doc[readyState]);doc[addEventListener]&&doc[addEventListener](domContentLoaded,fn=function(){doc.removeEventListener(domContentLoaded,fn,f);flush()},f);hack&&doc.attachEvent(onreadystatechange,fn=function(){if(/^c/.test(doc[readyState])){doc.detachEvent(onreadystatechange,fn);flush()}});return ready=hack?function(fn){self!=top?loaded?fn():fns.push(fn):function(){try{testEl.doScroll("left")}catch(e){return setTimeout(function(){ready(fn)},50)}fn()}()}:function(fn){loaded?fn():fns.push(fn)}});provide("domready",module.exports);!function($){var ready=require("domready");$.ender({domReady:ready});$.ender({ready:function(f){ready(f);return this}},!0)}(ender)})();(function(){var module={exports:{}},exports=module.exports;
/*!
2013-01-07 04:52:54 +00:00
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
2013-01-07 04:52:54 +00:00
* copyright Dustin Diaz 2012
* MIT License
*/
2013-01-07 04:52:54 +00:00
(function(name,context,definition){typeof module!="undefined"&&module.exports?module.exports=definition():typeof context["define"]=="function"&&context.define.amd?define(definition):context[name]=definition()})("qwery",this,function(){function cache(){this.c={}}function classRegex(c){return classCache.g(c)||classCache.s(c,"(^|\\s+)"+c+"(\\s+|$)",1)}function each(a,fn){var i=0,l=a.length;for(;i<l;i++)fn(a[i])}function flatten(ar){for(var r=[],i=0,l=ar.length;i<l;++i)arrayLike(ar[i])?r=r.concat(ar[i]):r[r.length]=ar[i];return r}function arrayify(ar){var i=0,l=ar.length,r=[];for(;i<l;i++)r[i]=ar[i];return r}function previous(n){while(n=n.previousSibling)if(n[nodeType]==1)break;return n}function q(query){return query.match(chunker)}function interpret(whole,tag,idsAndClasses,wholeAttribute,attribute,qualifier,value,wholePseudo,pseudo,wholePseudoVal,pseudoVal){var i,m,k,o,classes;if(this[nodeType]!==1)return!1;if(tag&&tag!=="*"&&this[tagName]&&this[tagName].toLowerCase()!==tag)return!1;if(idsAndClasses&&(m=idsAndClasses.match(id))&&m[1]!==this.id)return!1;if(idsAndClasses&&(classes=idsAndClasses.match(clas)))for(i=classes.length;i--;)if(!classRegex(classes[i].slice(1)).test(this.className))return!1;if(pseudo&&qwery.pseudos[pseudo]&&!qwery.pseudos[pseudo](this,pseudoVal))return!1;if(wholeAttribute&&!value){o=this.attributes;for(k in o)if(Object.prototype.hasOwnProperty.call(o,k)&&(o[k].name||k)==attribute)return this}return wholeAttribute&&!checkAttr(qualifier,getAttr(this,attribute)||"",value)?!1:this}function clean(s){return cleanCache.g(s)||cleanCache.s(s,s.replace(specialChars,"\\$1"))}function checkAttr(qualify,actual,val){switch(qualify){case"=":return actual==val;case"^=":return actual.match(attrCache.g("^="+val)||attrCache.s("^="+val,"^"+clean(val),1));case"$=":return actual.match(attrCache.g("$="+val)||attrCache.s("$="+val,clean(val)+"$",1));case"*=":return actual.match(attrCache.g(val)||attrCache.s(val,clean(val),1));case"~=":return actual.match(attrCache.g("~="+val)||attrCache.s("~="+val,"(?:^|\\s+)"+clean(val)+"(?:\\s+|$)",1));case"|=":return actual.match(attrCache.g("|="+val)||attrCache.s("|="+val,"^"+clean(val)+"(-|$)",1))}return 0}function _qwery(selector,_root){var r=[],ret=[],i,l,m,token,tag,els,intr,item,root=_root,tokens=tokenCache.g(selector)||tokenCache.s(selector,selector.split(tokenizr)),dividedTokens=selector.match(dividers);if(!tokens.length)return r;token=(tokens=tokens.slice(0)).pop();tokens.length&&(m=tokens[tokens.length-1].match(idOnly))&&(root=byId(_root,m[1]));if(!root)return r;intr=q(token);els=root!==_root&&root[nodeType]!==9&&dividedTokens&&/^[+~]$/.test(dividedTokens[dividedTokens.length-1])?function(r){while(root=root.nextSibling)root[nodeType]==1&&(intr[1]?intr[1]==root[tagName].toLowerCase():1)&&(r[r.length]=root);return r}([]):root[byTag](intr[1]||"*");for(i=0,l=els.length;i<l;i++)if(item=interpret.apply(els[i],intr))r[r.length]=item;if(!tokens.length)return r;each(r,function(e){ancestorMatch(e,tokens,dividedTokens)&&(ret[ret.length]=e)});return ret}function is(el,selector,root){if(isNode(selector))return el==selector;if(arrayLike(selector))return!!~flatten(selector).indexOf(el);var selectors=selector.split(","),tokens,dividedTokens;while(selector=selectors.pop()){tokens=tokenCache.g(selector)||tokenCache.s(selector,selector.split(tokenizr));dividedTokens=selector.match(dividers);tokens=tokens.slice(0);if(interpret.apply(el,q(tokens.pop()))&&(!tokens.length||ancestorMatch(el,tokens,dividedTokens,root)))return!0}return!1}function ancestorMatch(el,tokens,dividedTokens,root){function crawl(e,i,p){while(p=walker[dividedTokens[i]](p,e))if(isNode(p)&&interpret.apply(p,q(tokens[i]))){if(!i)return p;if(cand=crawl(p,i-1,p))return cand}}var cand;return(cand=crawl(el,tokens.length-1,el))&&(!root||isAncestor(cand,root))}function isNode(el,t){return el&&typeof el=="object"&&(t=el[nodeType])&&(t==1||t==9)}function uniq(ar){var a=[],i,j;e:for(i=0;i<ar.length;++i){for(j=0;j<a.length;++j)if(a[j]==ar[i])continue e;a[a.length]=ar[i]}return a}function arrayLike(o){return typeof o=="object"&&isFinite(o.lengt