/*! * pbjs JavaScript Framework v0.6.2 * http://saartje87.github.com/pbjs * * Includes Qwery * https://github.com/ded/qwery * * Copyright 2014 Niek Saarberg * Licensed MIT * * Build date 2014-10-01 12:11 */ !function(a,b,c){this[a]=c(b)}("PB",this,function(a){"use strict";function b(a,b){return function(){return this.parent=b,a.apply(this,arguments)}}function c(a){var b=0;if(a.nodeName||a===r)this[0]=a,b=1;else if("length"in a)for(b=0;bb;b++)c[b]=a[b];return c},m.type=function(a){var b=q.call(a);return b.substr(8,b.length-9).toLowerCase()},m.log=function(){if("undefined"!=typeof console&&"function"==typeof console.log){var a,b,c,d,e,f=m.toArray(arguments),g=Error.apply(this,arguments);g&&g.stack?(a=g.stack.replace(/\n+$/g,"").split("\n"),b=a[a.length-2],c=b.split(":")[2],d=b.split(":")[1].split("/"),e=d[d.length-1],f.unshift("pbjs: "+e+" (line "+c+"): ")):f.unshift("pbjs: "),console.log.apply(console,f)}},m.noConflict=function(){return r.PB===m&&(r.PB=n),m},m.Class=function(a,c){var d,e,f,g,h,i,j,k;c||(c=a,a=null),(c.construct||c.constructor.toString().indexOf("Function()")>-1)&&(f=c.construct||c.constructor),a&&(j=a.prototype,f?k=a:f=a),d=f?function(){return k&&(this.parent=k),f.apply(this,arguments)}:function(){},e=d.prototype;for(g in c)c.hasOwnProperty(g)&&"construct"!==g&&(h=c[g],i=a?j[g]:null,i&&"function"==typeof h&&"function"==typeof i&&(h=b(h,i)),e[g]=h);return m.extend(e,j),d},m.Observer=m.Class({construct:function(){this.listeners={}},on:function(a,b,c){var d=a.split(" "),e=d.length;if("function"!=typeof b)throw new TypeError("PB.Observer error, fn is not a function");for(;e--;)a=d[e],this.listeners[a]||(this.listeners[a]=[]),this.listeners[a].push({fn:b,context:c});return this},off:function(a,b){var c,d=this.listeners[a];if(!a)return this.listeners={},this;if(!d)return this;if(!b)return d.length=0,this;for(c=d.length;c--;)d[c].fn===b&&d.splice(c,1);return d.length||delete this.listeners[a],this},emit:function(a){var b=this.listeners[a],c=p.call(arguments,1),d=0;if(!b)return this;for(;d"===a.charAt(a.length-1)?m.$.buildFragment(a):u.find(a,!0):null:null},m.$$=function(a){return m.log("Usage of PB.$$ is deprecated"),a instanceof c?a:u.find(a)},c.prototype.constructor=c,m.$.fn=c.prototype,m.$.cache={},m.$.hooks={},m.$.hook=function(a,b){if("function"!=typeof b)throw new TypeError("fn must be a function");m.$.hooks[a]=b},m.overwrite(m.$.fn,{setAttr:function(a){var b,c=0;for(a=e(arguments);c"+a+"").firstChild().appendTo(this[c]):/^"+a+"").firstChild().children().appendTo(this[c]):/^"+a+"").firstChild().firstChild().children().appendTo(this[c]):m.$(a).appendTo(this[c])}return this},getHtml:function(){return this[0].innerHTML},setText:function(a){for(var b=0;b=0},addClass:function(a){for(var b,c,d=0,e=a.split(" ");d=0||(this[d].className+=(this[d].className?" ":"")+e[c]);return this},removeClass:function(a){for(var b,c,d=0,e=a.split(" "),f=e.length;dc;c++)b.indexOf(" "+e[c]+" ")>=0&&(b=b.replace(" "+e[c]+" "," "));b=b.replace(/^\s|\s$/g,""),b?this[d].className=b:this[d].removeAttribute("class")}return this},show:function(){for(var a=0;a0}}),m.overwrite(m.$.fn,{parent:function(){return m.$(this[0].parentNode)},children:function(){var a=this[0].firstElementChild||this[0].firstChild,b=0,c=[];if(!a)return null;do 1===a.nodeType&&(c[b++]=a);while(a=a.nextSibling);return c.length?new this.constructor(c):null},childAt:function(a){var b=this.children();return b&&b[a]?m.$(b[a]):null},firstChild:function(){return m.$(this[0].firstElementChild||this[0].firstChild)},lastChild:function(){return m.$(this[0].lastElementChild||this[0].lastChild)},get:function(a){return m.$(this[a])},first:function(){return m.$(this[0])},last:function(){return m.$(this[this.length-1])},next:function(){return m.$(this[0].nextElementSibling||this[0].nextSibling)},prev:function(){return m.$(this[0].previousElementSibling||this[0].previousSibling)},closest:function(a,b){var c=this[0];b=b||50;do{if(m.$.selector.matches(c,a))return m.$(c);if(!--b)break}while(c=c.parentNode);return null},indexOf:function(a){var b=0;if(a=m.$(a),!a)return-1;for(;bc;c++)-1===g.indexOf(f[c])&&(g[d++]=f[c]);return g&&g.length||!b?new this.constructor(g):null},matches:function(a){for(var b=0;bb;b++)this[a[b]]=this.originalEvent[a[b]]},preventDefault:function(){this.defaultPrevented=!0,this.originalEvent.preventDefault()},stopPropagation:function(){this.originalEvent.stopPropagation()},stop:function(){this.preventDefault(),this.stopPropagation()},matchesSelector:function(a){var b=this.target;do{if(m.$.selector.matches(b,a))return this.currentTarget=b,!0;if(b===this.currentTarget)return!1}while(b=b.parentNode);return!1}},f.hooks={mouse:{matches:/(!?mouse|click|drag|focusin|focusout)/,hook:function(a,b){a.extend(E),b.relatedTarget&&(a.relatedTarget=b.relatedTarget)}},mousewheel:{matches:/^(?:DOMMouseScroll|mousewheel|wheel)$/,hook:function(a,b){a.wheelDelta=b.wheelDelta?b.wheelDelta/120:-(b.detail||0)/3}}},m.$.Event=f,m.overwrite(m.$.fn,{on:function(a,b,c,d){var e,f=a.split(" "),h=f.length,i=0;if("function"==typeof b&&(d=c,c=b,b=null),"function"!=typeof c)throw new TypeError;for(;ie;e++)g(this[i],f[e],c,d,b);return this},off:function(a,b){for(var e,f,g=0;g=this.endAt?(this.onTick(1,this.data,this),void this.stop()):(this.onTick(c,this.data,this),void(this.timer=setTimeout(function(){b.tick()},1e3/60)))}}),m.Animation.effects={linear:function(a){return a},ease:function(a){return a},"ease-in":function(a){return a*a},"ease-out":function(a){return-1*a*(a-2)},"ease-in-out":function(a){return a},bounce:function(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}},m.Queue=m.Class({construct:function(){this.stack=[],this.length=0,this.state=m.Queue.STATE_IDLE,this._next=this.next.bind(this)},add:function(a,b){return this.length++,this.stack.unshift(a.bind(b||a,this._next)),this},run:function(){var a,b=this.stack;return this.state!==m.Queue.STATE_INPROGRESS&&b.length?(this.state=m.Queue.STATE_INPROGRESS,a=this.stack.pop(),a(),this):this},next:function(){this.state=m.Queue.STATE_IDLE,this.run()},empty:function(){this.stack.length=0,this.state=m.Queue.STATE_IDLE}}),m.Queue.STATE_IDLE=0,m.Queue.STATE_INPROGRESS=1,m.$.fn.transition=function(a){var b=j(arguments);return b.properties=a,m.$.hooks.transition.call(this,b),this},m.$.hook("transition",function(a){return this.each(function(){var b=m.$(this),c=b.getData("pbjs-fx-queue"),d=a.properties;c||(c=new m.Queue,b.setData("pbjs-fx-queue",c)),c.add(function(c,e){var e={},f={transition:"all "+a.duration+"s "+a.effect+" 0s"};e.end=d,e.fn=a.fn,m.each(d,function(a){f[a]=b.getStyle(a,!0)}),b.setStyle(f),this.offsetHeight,b.setStyle(d),e.timer=setTimeout(function(){b[0].parentNode&&(e.running=!1,b.setStyle({transition:""}),e.fn&&e.fn(b),c())},1e3*a.duration+50)}),c.run()})}),z.transition||m.$.hook("transition",function(a,b){var c=0;if(this.setStyle(a),b.fn)for(;c0&&(this.abortTimer=setTimeout(this.abort.bind(this),1e3*a.timeout)),b||this.onreadystatechange(),this},abort:function(){return this.xhr.onreadystatechange=null,this.xhr.abort(),this.emit("abort"),this},set:function(a,b){return"header"===a.substr(0,6)?m.overwrite(this.options.headers,b):this.options[a]=b,this},getTransport:function(){return this.xhr&&G?this.xhr:(this.xhr&&this.xhr.abort(),this.xhr=G?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),this.xhr)},onreadystatechange:function(){var a,b=this.xhr,c=this.options;if(4===b.readyState){switch(clearTimeout(this.abortTimer),b.responseJSON=null,b.status){case 200:case 201:case 204:case 304:if(a="success",c.json||b.getResponseHeader("Content-type").indexOf("application/json")>=0)try{b.responseJSON=JSON.parse(b.responseText)}catch(d){}break;default:a="error"}this.xhr.onreadystatechange=null,this.emit(a,b,b.status),this.emit("end",b,b.status)}}}),m.Request.defaults={url:"",method:"GET",async:!0,json:!1,xml:!1,data:null,auth:null,headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},encoding:"UTF-8",timeout:0,crossdomain:!1},m.overwrite(m.Request,{buildQueryString:k,parseQueryString:l}),m}),function(a){function b(){c.$.cache=null,a.detachEvent("onunload",b)}{var c=a.PB,d=Array.prototype.slice;Object.prototype.toString}c.extend(Date,{now:function(){return+new Date}}),c.extend(Function.prototype,{bind:function(a){var b=d.call(arguments,1),c=this;if("function"!=typeof this)throw new TypeError;return function(){return c.apply(a,b.concat(d.call(arguments,0)))}}}),c.extend(Object,{keys:function(a){var b,d=[];if(null===this||"object"===c.type(a))throw new TypeError;for(b in a)a.hasOwnProperty(b)&&d.push(b);return d}}),c.extend(Array,{isArray:function(a){return"array"===c.type(a)}}),c.extend(Array.prototype,{forEach:function(a,b){if(null===this||"function"!=typeof a)throw new TypeError;for(var c=this.length,d=0;c>d;)a.call(b,this[d],d,this),d++},indexOf:function(a,b){if(null===this)throw new TypeError;var c=this.length;if(b=b||0,b>=c||0===c)return-1;for(;c>b;){if(this[b]===a)return b;b++}return-1},lastIndexOf:function(a,b){if(null===this)throw new TypeError;var c=this.length;if(b=b||0,b>=c||0===c)return-1;for(;c>=b;)if(c--,this[c]===a)return c;return-1},filter:function(a,b){if(null===this||"function"!=typeof a)throw new TypeError;for(var c=[],d=0,e=this.length;e>d;)a.call(b,this[d],d,this)&&c.push(this[d]),d++;return c},map:function(a,b){if(null===this||"function"!=typeof a)throw new TypeError;for(var c=this.length,d=new Array(c),e=0;c>e;)e in this&&(d[e]=a.call(b,this[e],e,this)),e++;return d}});var e=a.document,f=e.documentElement,g=e.body,h=document.createElement("div"),i=h.style;legacyEventModel=a.attachEvent&&!a.addEventListener,supportsTextContent=void 0!==h.textContent,supportsOpacityProperty=void 0!==i.opacity,supportsGetComputedStyle=!!window.getComputedStyle,supportsCssTransition="transition"in i||"MozTransition"in i||"WebkitTransition"in i,supportQuerySelectorAll=!!document.querySelectorAll,supportMatchesSelector=!!(f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector),h=null,c.ready(function(){g=e.body});var j=/alpha\(opacity=(.*)\)/i,k=/^-?[\d.]+px$/i;supportsOpacityProperty||(c.$.hook("setStyle.opacity",function(a,b){a.currentStyle&&a.currentStyle.hasLayout||(a.style.zoom=1),a.style.filter="alpha(opacity="+100*b+")"}),c.$.hook("getStyle.opacity",function(a){var b=a.style.filter||a.currentStyle.filter,c=b&&b.match(j);return c&&c[1]?parseFloat(c[1])/100:1})),supportsGetComputedStyle||(c.$.fn.getStyle=function(a,b){var d,e,f,g=c.$.hooks["getStyle."+a],h=this[0];if(g)return g(h);if(d=h.style[a],b||!d||"auto"===d){if("width"===a)return h.offsetWidth-this.getStyle("borderLeftWidth",!0)-this.getStyle("borderRightWidth",!0);if("height"===a)return h.offsetHeight-this.getStyle("borderTopWidth",!0)-this.getStyle("borderBottomWidth",!0);if(d=h.currentStyle[a],d&&(/em|%|pt/.test(d)||/border/.test(a)))return e=document.createElement("div"),e.style.cssText="visbility: hidden; position: absolute; line-height: 0;","auto"===d||d.lastIndexOf("%")>0?(f=h.parentNode,e.style.height=d):(e.style.borderStyle="solid",e.style.borderBottomWidth="0",e.style.borderTopWidth=d),f=f||document.body,f.appendChild(e),d=e.offsetHeight,f.removeChild(e),e=null,d}return k.test(d)?parseInt(d,10):d}),supportsCssTransition||(c.$.hook("transition",function(a){return this.stop(!1),this.each(function(){var b=c.$(this),d=b.getData("pbjs-fx-queue"),e=a.properties;d||(d=new c.Queue,b.setData("pbjs-fx-queue",d)),d.add(function(d){var f,g={},h={};c.each(e,function(a){g[a]=b.getStyle(a,!0)}),c.each(e,function(a){var b=e[a];b=/^-?[\d.]+px$/i.test(b)?parseInt(b,10):b,h[a]=b-g[a]}),f=new c.Animation({duration:a.duration,effect:a.effect,onTick:function(e){c.each(h,function(a,c){b.setStyle(a,g[a]+c*e)}),1===e&&(a.fn&&a.fn(b),d())}}).start(),b.setData("morph",f)}),d.run()})}),c.$.fn.stop=function(a){return this.each(function(){var b=c.$(this),d=b.getData("morph");d&&d.running&&(a=void 0===a?!0:!!a,d.stop(),a&&d.fn&&d.fn(this))})}),legacyEventModel&&(c.overwrite(c.$.Event.hooks,{fixes:{matches:/(!?)/,hook:function(a,b){a.target=b.srcElement||b.toElement,a.which=void 0===a.keyCode?a.charCode:a.keyCode,a.which=0===a.which?1:4===a.which?2:2===a.which?3:a.which}},mouseIe:{matches:/(!?mouse|click|focus|drag)/,hook:function(a,b){a.pageX=b.clientX+(f.scrollLeft||g.scrollLeft)-(f.clientLeft||0),a.pageY=b.clientY+(f.scrollTop||g.scrollTop)-(f.clientTop||0),b.fromElement&&(a.relatedTarget=b.fromElement),a.which=b.keyCode||b.charCode,a.which=0===a.which?1:4===a.which?2:2===a.which?3:a.which}}}),c.$.Event.prototype.stopPropagation=function(){this.originalEvent.defaultPrevented=!0,this.originalEvent.cancelBubble=!0},c.$.Event.prototype.preventDefault=function(){this.originalEvent.returnValue=!1},a.attachEvent("onunload",b)),supportQuerySelectorAll||(c.$.selector.find=function(a,b){return qwery(a,b)}),supportMatchesSelector||(c.$.selector.matches=function(a,b){return qwery.is(a,b)}),supportsTextContent||(c.$.fn.setText=function(a){var b=0;for(this.setHtml("");bc;c++)b(a[c])}function d(a){for(var b=[],c=0,d=a.length;d>c;++c)p(a[c])?b=b.concat(a[c]):b[b.length]=a[c];return b}function e(a){for(var b=0,c=a.length,d=[];c>b;b++)d[b]=a[b];return d}function f(a){for(;(a=a.previousSibling)&&1!=a[C];);return a}function g(a){return a.match(U)}function h(a,c,d,e,f,g,h,i,k,l,m){var n,o,p,q,r;if(1!==this[C])return!1;if(c&&"*"!==c&&this[B]&&this[B].toLowerCase()!==c)return!1;if(d&&(o=d.match(D))&&o[1]!==this.id)return!1;if(d&&(r=d.match(E)))for(n=r.length;n--;)if(!b(r[n].slice(1)).test(this.className))return!1;if(k&&s.pseudos[k]&&!s.pseudos[k](this,m))return!1;if(e&&!h){q=this.attributes;for(p in q)if(Object.prototype.hasOwnProperty.call(q,p)&&(q[p].name||p)==f)return this}return e&&!j(g,_(this,f)||"",h)?!1:this}function i(a){return X.g(a)||X.s(a,a.replace(N,"\\$1"))}function j(a,b,c){switch(a){case"=":return b==c;case"^=":return b.match(Y.g("^="+c)||Y.s("^="+c,"^"+i(c),1));case"$=":return b.match(Y.g("$="+c)||Y.s("$="+c,i(c)+"$",1));case"*=":return b.match(Y.g(c)||Y.s(c,i(c),1));case"~=":return b.match(Y.g("~="+c)||Y.s("~="+c,"(?:^|\\s+)"+i(c)+"(?:\\s+|$)",1));case"|=":return b.match(Y.g("|="+c)||Y.s("|="+c,"^"+i(c)+"(-|$)",1))}return 0}function k(a,b){var d,e,f,i,j,k,l,n=[],o=[],p=b,q=Z.g(a)||Z.s(a,a.split(T)),s=a.match(S);if(!q.length)return n;if(i=(q=q.slice(0)).pop(),q.length&&(f=q[q.length-1].match(F))&&(p=r(b,f[1])),!p)return n;for(k=g(i),j=p!==b&&9!==p[C]&&s&&/^[+~]$/.test(s[s.length-1])?function(a){for(;p=p.nextSibling;)1==p[C]&&(k[1]?k[1]==p[B].toLowerCase():1)&&(a[a.length]=p);return a}([]):p[y](k[1]||"*"),d=0,e=j.length;e>d;d++)(l=h.apply(j[d],k))&&(n[n.length]=l);return q.length?(c(n,function(a){m(a,q,s)&&(o[o.length]=a)}),o):n}function l(a,b,c){if(n(b))return a==b;if(p(b))return!!~d(b).indexOf(a);for(var e,f,i=b.split(",");b=i.pop();)if(e=Z.g(b)||Z.s(b,b.split(T)),f=b.match(S),e=e.slice(0),h.apply(a,g(e.pop()))&&(!e.length||m(a,e,f,c)))return!0;return!1}function m(a,b,c,d){function e(a,d,i){for(;i=V[c[d]](i,a);)if(n(i)&&h.apply(i,g(b[d]))){if(!d)return i;if(f=e(i,d-1,i))return f}}var f;return(f=e(a,b.length-1,a))&&(!d||$(f,d))}function n(a,b){return a&&"object"==typeof a&&(b=a[C])&&(1==b||9==b)}function o(a){var b,c,d=[];a:for(b=0;b~+]/,K=/^\s+|\s*([,\s\+\~>]|$)\s*/g,L=/[\s\>\+\~]/,M=/(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\]|[\s\w\+\-]*\))/,N=/([.*+?\^=!:${}()|\[\]\/\\])/g,O=/^(\*|[a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,P=/\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,Q=/:([\w\-]+)(\(['"]?([^()]+)['"]?\))?/,R=new RegExp(F.source+"|"+H.source+"|"+G.source),S=new RegExp("("+L.source+")"+M.source,"g"),T=new RegExp(L.source+M.source),U=new RegExp(O.source+"("+P.source+")?("+Q.source+")?"),V={" ":function(a){return a&&a!==w&&a.parentNode},">":function(a,b){return a&&a.parentNode==b.parentNode&&a.parentNode},"~":function(a){return a&&a.previousSibling},"+":function(a,b,c,d){return a?(c=f(a))&&(d=f(b))&&c==d&&c:!1}};a.prototype={g:function(a){return this.c[a]||void 0},s:function(a,b,c){return b=c?new RegExp(b):b,this.c[a]=b}};var W=new a,X=new a,Y=new a,Z=new a,$="compareDocumentPosition"in w?function(a,b){return 16==(16&b.compareDocumentPosition(a))}:"contains"in w?function(a,b){return b=9===b[C]||b==window?w:b,b!==a&&b.contains(a)}:function(a,b){for(;a=a.parentNode;)if(a===b)return 1;return 0},_=function(){var a=v.createElement("p");return(a.innerHTML='x')&&"#x"!=a.firstChild.getAttribute("href")?function(a,b){return"class"===b?a.className:"href"===b||"src"===b?a.getAttribute(b,2):a.getAttribute(b)}:function(a,b){return a.getAttribute(b)}}(),ab=!!v[x],bb=v.querySelector&&v[z],cb=function(a,b){var d,f,g=[];try{return 9!==b[C]&&J.test(a)?(c(d=a.split(","),t(b,function(a,b){f=a[z](b),1==f.length?g[g.length]=f.item(0):f.length&&(g=g.concat(e(f)))})),d.length>1&&g.length>1?o(g):g):e(b[z](a))}catch(h){}return db(a,b)},db=function(a,d){var e,f,g,h,i,j,l=[];if(a=a.replace(K,"$1"),f=a.match(I)){for(i=b(f[2]),e=d[y](f[1]||"*"),g=0,h=e.length;h>g;g++)i.test(e[g].className)&&(l[l.length]=e[g]);return l}return c(j=a.split(","),t(d,function(a,b,c){for(i=k(b,a),g=0,h=i.length;h>g;g++)(9===a[C]||c||$(i[g],d))&&(l[l.length]=i[g])})),j.length>1&&l.length>1?o(l):l},eb=function(a){"undefined"!=typeof a[A]&&(u=a[A]&&bb?cb:db)};return eb({useNativeQSA:!0}),s.configure=eb,s.uniq=o,s.is=l,s.pseudos={},s});