From 4324fb55ecd9c1a6528f098c13fd339917ff3937 Mon Sep 17 00:00:00 2001 From: Benjamin Kiessling Date: Fri, 20 Jan 2012 12:48:45 +0100 Subject: Use rightjs again --- slideshows/advanced/template.html | 10 +- slideshows/advanced/template/billboard.js | 564 ++++++++++++++++++++++++++++++ slideshows/advanced/template/right.js | 7 + slideshows/advanced/template/slides.js | 7 - slideshows/advanced/template/styles.css | 77 ++-- 5 files changed, 627 insertions(+), 38 deletions(-) create mode 100644 slideshows/advanced/template/billboard.js create mode 100644 slideshows/advanced/template/right.js delete mode 100644 slideshows/advanced/template/slides.js (limited to 'slideshows') diff --git a/slideshows/advanced/template.html b/slideshows/advanced/template.html index f5fef1f..f10efa3 100644 --- a/slideshows/advanced/template.html +++ b/slideshows/advanced/template.html @@ -2,17 +2,17 @@ - - + + + -
-
+
    $IMAGES -
+
$EVENTS diff --git a/slideshows/advanced/template/billboard.js b/slideshows/advanced/template/billboard.js new file mode 100644 index 0000000..d0da2ca --- /dev/null +++ b/slideshows/advanced/template/billboard.js @@ -0,0 +1,564 @@ +/** + * RightJS-UI Billboard v2.2.0 + * http://rightjs.org/ui/billboard + * + * Copyright (C) 2010-2011 Nikolay Nemshilov + */ +var Billboard = RightJS.Billboard = (function(RightJS) { +/** + * This module defines the basic widgets constructor + * it creates an abstract proxy with the common functionality + * which then we reuse and override in the actual widgets + * + * Copyright (C) 2010-2011 Nikolay Nemshilov + */ + +/** + * The widget units constructor + * + * @param String tag-name or Object methods + * @param Object methods + * @return Widget wrapper + */ +function Widget(tag_name, methods) { + if (!methods) { + methods = tag_name; + tag_name = 'DIV'; + } + + /** + * An Abstract Widget Unit + * + * Copyright (C) 2010 Nikolay Nemshilov + */ + var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, { + /** + * The common constructor + * + * @param Object options + * @param String optional tag name + * @return void + */ + initialize: function(key, options) { + this.key = key; + var args = [{'class': 'rui-' + key}]; + + // those two have different constructors + if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) { + args.unshift(tag_name); + } + this.$super.apply(this, args); + + if (RightJS.isString(options)) { + options = RightJS.$(options); + } + + // if the options is another element then + // try to dynamically rewrap it with our widget + if (options instanceof RightJS.Element) { + this._ = options._; + if ('$listeners' in options) { + options.$listeners = options.$listeners; + } + options = {}; + } + this.setOptions(options, this); + + return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this); + }, + + // protected + + /** + * Catches the options + * + * @param Object user-options + * @param Element element with contextual options + * @return void + */ + setOptions: function(options, element) { + if (element) { + options = RightJS.Object.merge(options, new Function("return "+( + element.get('data-'+ this.key) || '{}' + ))()); + } + + if (options) { + RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options)); + } + + return this; + } + }); + + /** + * Creating the actual widget class + * + */ + var Klass = new RightJS.Class(AbstractWidget, methods); + + // creating the widget related shortcuts + RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([])); + + return Klass; +} + + +/** + * Billboard initialization script + * + * Copyright (C) 2010 Nikolay Nemshilov + */ +var R = RightJS, + $ = RightJS.$, + $$ = RightJS.$$, + $w = RightJS.$w, + $E = RightJS.$E, + Fx = RightJS.Fx, + Class = RightJS.Class, + Object = RightJS.Object; + + + + +/** + * Billboards basic class + * + * Copyright (C) 2010-2011 Nikolay Nemshilov + */ +var Billboard = new Widget('UL', { + extend: { + version: '2.2.0', + + EVENTS: $w('change first last'), + + Options: { + fxName: 'stripe', // visual effect name + fxDuration: 'long', // visual effect duration + + autostart: true, // if it should automatically start rotate things + delay: 4000, // delay between item shows + loop: true, // loop after reaching the last one + + showButtons: true, // should it show the next/prev buttons or not + prevButton: 'native', // prev item button, 'native' or an ID of your own + nextButton: 'native', // next item button, 'native' or an ID of your own + + stripes: 10, // the number of stripes + + cssRule: '*.rui-billboard' + } + }, + + /** + * Basic constructor + * + * @param mixed an element reference + * @return void + */ + initialize: function(element) { + this.$super('billboard', element); + + // initializing the buttons + if (this.options.showButtons) { + this.prevButton = this.options.prevButton !== 'native' ? $(this.options.prevButton) : + $E('div', {'class': 'rui-billboard-button-prev', 'html': '‹'}).insertTo(this); + this.nextButton = this.options.nextButton !== 'native' ? $(this.options.nextButton) : + $E('div', {'class': 'rui-billboard-button-next', 'html': '›'}).insertTo(this); + + this.prevButton.onClick(R(function(event) { + event.stop(); this.showPrev(); + }).bind(this)); + this.nextButton.onClick(R(function(event) { + event.stop(); this.showNext(); + }).bind(this)); + } + + // catching the 'first'/'last' events + this.onChange(function(event) { + if (event.item === this.items().first()) { + this.fire('first'); + } else if (event.item === this.items().last()) { + this.fire('last'); + } + }); + + // stopping/starting the slideshow with mouse over/out events + this.on({ + mouseover: function() { + this.stop(); + }, + + mouseout: function(event) { + if (this.options.autostart && !event.find('.rui-billboard')) { + this.start(); + } + } + }); + + // autostart + if (this.options.autostart) { + this.start(); + } + }, + + /** + * Returns the list of items to swap + * + * @return Array swappable items + */ + items: function() { + return this.children().without(this.prevButton, this.nextButton); + }, + + /** + * Show next item on the list + * + * @return Billboard this + */ + showNext: function() { + var items = this.items(), index = items.indexOf(this.current()) + 1; + + if (index == items.length && this.options.loop) { + index = 0; + } + + return this.current(index); + }, + + /** + * Show prev item on the list + * + * @return Billboard this + */ + showPrev: function() { + var items = this.items(), index = items.indexOf(this.current()) - 1; + + if (index < 0 && this.options.loop) { + index = items.length - 1; + } + + return this.current(index); + }, + + /** + * Gets/sets the current item + * + * @param mixed integer index or a LI element reference + * @return Billboard this or current LI element + */ + current: function(index) { + var items = this.items(); + + if (arguments.length) { + if (index instanceof Element) { + index = items.indexOf(index); + } + + this.runFx(items[index]); + } else { + return items.length ? ( + items.first('hasClass', 'rui-billboard-current') || + items.first().addClass('rui-billboard-current') + ) : null; + } + + return this; + }, + + /** + * Starts the slide show + * + * @return Billboard this + */ + start: function() { + this.timer = R(this.showNext).bind(this).periodical(this.options.delay); + }, + + /** + * stops the slideshow + * + * @return Billboard this + */ + stop: function() { + if (this.timer) { + this.timer.stop(); + } + }, + + /** + * Wrapping the event trigger so it always sent the + * current element references + * + * @param String event name + * @param Object options + * @return Billboard this + */ + fire: function(name, options) { + return this.$super(name, Object.merge({ + index: this.items().indexOf(this.current()), + item: this.current() + }, options)); + }, + +// protected + + /** + * Runs the fx transition + * + * @param Element new LI element + * @return void + */ + runFx: function(item) { + if (item && !this._running) { + var Fx = Billboard.Fx[R(this.options.fxName || '').capitalize()]; + + if (Fx) { + new Fx(this).start(this.current(), item); + } else { + this.current().removeClass('rui-billboard-current'); + item.addClass('rui-billboard-current'); + } + } + } +}); + +/** + * Basic billboard visual effect + * + * Copyright (C) 2010 Nikolay Nemshilov + */ +Billboard.Fx = new Class(Fx, { + + /** + * basic constructor + * + * @param Billboard billboard + * @return void + */ + initialize: function(billboard) { + this.container = $E('div', {'class': 'rui-billboard-fx-container'}); + + this.$super(billboard, { + duration: billboard.options.fxDuration, + onStart: function() { + billboard._running = true; + billboard.insert(this.container); + }, + onFinish: function() { + this.container.remove(); + billboard._running = false; + billboard.fire('change'); + } + }); + }, + + /** + * Starts an fx on the given item + * + * @param {Element} old LI element + * @param {Element} new LI element + * @return void + */ + prepare: function(old_item, new_item) { + old_item.removeClass('rui-billboard-current'); + new_item.addClass('rui-billboard-current'); + + this.clone = old_item.clone(); + + this.container.update(this.clone); + } + +}); + +/** + * Fade visual effects class + * + * Copyright (C) 2010 Nikolay Nemshilov + */ +Billboard.Fx.Fade = new Class(Billboard.Fx, { + + /** + * Starts an fx on the given item + * + * @param {Element} old LI element + * @param {Element} new LI element + * @return void + */ + prepare: function(old_item, new_item) { + this.$super(old_item, new_item); + }, + + /** + * Rendering the effect + * + * @param Float delta value + * @return void + */ + render: function(delta) { + this.container.setStyle({opacity: 1 - delta}); + } + +}); + +/** + * The slide visual effects class + * + * Copyright (C) 2010 Nikolay Nemshilov + */ +Billboard.Fx.Slide = new Class(Billboard.Fx, { + + /** + * overloading the 'prepare' method to add some stuff + * to the container depending on which direction do we slide + * + * @param {Element} old LI element + * @param {Element} new LI element + * @return void + */ + prepare: function(old_item, new_item) { + this._width = this.element.current().size().x; + this._direction = old_item.nextSiblings().include(new_item) ? -1 : 1; + + this.$super(old_item, new_item); + + this.clone.setStyle({width: this._width + 'px'}); + }, + + /** + * Rendering the Fx + * + * @param Float delta + * @return void + */ + render: function(delta) { + this.clone._.style.left = this._direction * this._width * delta + 'px'; + } + +}); + +/** + * Stripe visual effects class + * + * Copyright (C) 2010-2011 Nikolay Nemshilov + */ +Billboard.Fx.Stripe = new Class(Billboard.Fx, { + + directions: ['down', 'up', 'left', 'right'], + + /** + * Breaking the original element onto sripes in here + * + * @param {Element} old LI element + * @param {Element} new LI element + * @return void + */ + prepare: function(old_item, new_item) { + this.$super(old_item, new_item); + + var length = this.element.options.stripes, + width = this.element.items()[0].size().x / length, + delay = 100, + direction = this.directions.shift(); + + this.directions.push(direction); + this.container.clean(); + + for (var i=0; i < length; i++) { + var stripe = $E('div', { + 'class': 'rui-billboard-stripe', + 'style': { + width: width + 1 + 'px', + left: i * width + 'px' + } + }).insert(old_item.clone().setStyle({ + width: width * length + 'px', + left: - i * width + 'px' + })); + + this.container.append(stripe); + var options = { + duration: this.options.duration + }; + + if (direction !== 'right' && i === (length - 1) || (direction === 'right' && i === 0)) { + options.onFinish = R(this.finish).bind(this, true); + } + + switch (direction) { + case 'up': + R(function(stripe, options) { + stripe.setHeight(stripe.size().y); + stripe.morph({height: '0px'}, options); + }).bind(this, stripe, options).delay(i * delay); + break; + + case 'down': + stripe.setStyle('top: auto; bottom: 0px'); + R(function(stripe, options) { + stripe.setHeight(stripe.size().y); + stripe.morph({height: '0px'}, options); + }).bind(this, stripe, options).delay(i * delay); + break; + + case 'left': + R(function(stripe, options) { + stripe.morph({width: '0px'}, options); + }).bind(this, stripe, options).delay(i * delay); + break; + + case 'right': + R(function(stripe, options) { + stripe.morph({width: '0px'}, options); + }).bind(this, stripe, options).delay((length - i -1) * delay); + break; + + default: + this.finish(true); + } + } + }, + + + /** + * Stubbing the finish method so it didn't finish prematurely + * + * @return Fx this + */ + finish: function(for_sure) { + if (for_sure) { + this.$super(); + } + return this; + } + +}); + +/** + * Document level hooks for billboards + * + * Copyright (C) 2010 Nikolay Nemshilov + */ +$(document).onReady(function() { + $$(Billboard.Options.cssRule).each(function(element) { + if (!(element instanceof Billboard)) { + element = new Billboard(element); + } + }); +}); + +var embed_style = document.createElement('style'), + embed_rules = document.createTextNode("*.rui-billboard, *.rui-billboard> *{margin:0;padding:0;list-style:none} *.rui-billboard{display:inline-block; *display:inline; *zoom:1;position:relative} *.rui-billboard> *{display:none;width:100%;height:100%} *.rui-billboard> *:first-child, *.rui-billboard> *.rui-billboard-current:first-child{display:block;position:relative} *.rui-billboard> *>img{margin:0;padding:0} *.rui-billboard-current{position:absolute;left:0;top:0;display:block;z-index:999} *.rui-billboard-button-prev, *.rui-billboard-button-next{position:absolute;z-index:99999;left:.25em;top:auto;bottom:.25em;display:block;width:.5em;height:auto;text-align:center;font-size:200%;font-family:Arial;font-weight:bold;padding:0em .5em .2em .5em;background:white;opacity:0;filter:alpha(opacity:0);cursor:pointer;border:.12em solid #888;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;user-select:none;-moz-user-select:none;-webkit-user-select:none;transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out} *.rui-billboard-button-next{left:auto;right:.25em;text-align:right} *.rui-billboard-button-prev:active{text-indent:-.1em} *.rui-billboard-button-next:active{text-indent:.2em} *.rui-billboard:hover *.rui-billboard-button-prev, *.rui-billboard:hover *.rui-billboard-button-next{opacity:0.4;filter:alpha(opacity:40)} *.rui-billboard:hover *.rui-billboard-button-prev:hover, *.rui-billboard:hover *.rui-billboard-button-next:hover{opacity:0.7;filter:alpha(opacity:70)}.rui-billboard-fx-container{position:absolute;left:0;top:0;display:block;z-index:9999;overflow:hidden}.rui-billboard-fx-container> *{position:absolute;left:0;top:0}.rui-billboard-stripe{overflow:hidden}.rui-billboard-stripe> *{position:relative}"); + +embed_style.type = 'text/css'; +document.getElementsByTagName('head')[0].appendChild(embed_style); + +if(embed_style.styleSheet) { + embed_style.styleSheet.cssText = embed_rules.nodeValue; +} else { + embed_style.appendChild(embed_rules); +} + + +return Billboard; +})(RightJS); diff --git a/slideshows/advanced/template/right.js b/slideshows/advanced/template/right.js new file mode 100644 index 0000000..1996290 --- /dev/null +++ b/slideshows/advanced/template/right.js @@ -0,0 +1,7 @@ +/** + * RightJS v2.2.3 - http://rightjs.org + * Released under the terms of MIT license + * + * Copyright (C) 2008-2011 Nikolay Nemshilov + */ +var RightJS=function(a,b,c,d,e,f,g,h,i){function cH(a,b,c,d){var e={},f=a.marginLeft.toFloat()||0,g=a.marginTop.toFloat()||0,h=c==="right",i=c==="bottom",j=c==="top"||i;d==="out"?(e[j?"height":"width"]="0px",h?e.marginLeft=f+b.x+"px":i&&(e.marginTop=g+b.y+"px")):(j?(e.height=b.y+"px",a.height="0px"):(e.width=b.x+"px",a.width="0px"),h?(e.marginLeft=f+"px",a.marginLeft=f+b.x+"px"):i&&(e.marginTop=g+"px",a.marginTop=g+b.y+"px"));return e}function cG(a,b,c){var d=a.clone().setStyle("position:absolute;z-index:-1;visibility:hidden").setWidth(a.size().x).setStyle(b),e;a.parent()&&a.insert(d,"before"),e=cF(d,c),d.remove();return e}function cF(a,b){var c=0,d=b.length,e=a.computedStyles(),f={},g;for(;cd?a.finish():(a.render(b(e/d)),e++)},c)}function cn(a){var b=I(a._);(ch[b]||[]).each("cancel"),(cg[b]||[]).splice(0)}function cm(a){var b=a.ch,c=b.shift();if(c=b[0])c[1].$ch=!0,c[1].start.apply(c[1],c[0])}function cl(a){var b=a.cr;b&&b.splice(b.indexOf(a),1)}function ck(a){a.cr&&a.cr.push(a)}function cj(a,b){var c=a.ch,d=a.options.queue;if(!c||a.$ch)return a.$ch=!1;d&&c.push([b,a]);return d&&c[0][1]!==a}function ci(a){var b=I((a.element||{})._||{});a.ch=cg[b]=cg[b]||[],a.cr=ch[b]=ch[b]||[]}function ce(a,b){a.stop(),this.send(b)}function cb(a,b){var d=a[0],e,f,g=ca(a),h=!c.keys(g).length;return(b.$listeners||[]).filter(function(a){return a.dr&&a.n===d&&(h||function(){for(var b in g)if(a.dr===b)for(e=0,f=g[b];e"+b+""+e[1];while(f--!==0)d=d.firstChild;b=d.childNodes;while(b.length!==0)bN.appendChild(b[0])}else for(var g=0,h=b.length,i;gb?1:a-1;c--)if(a.call(b,this[c],c,this))return this[c];return i};d.include({indexOf:k.indexOf||function(a,b){for(var c=b<0?h.max(0,this.length+b):b||0,d=this.length;c-1;b--)if(this[b]===a)return b;return-1},first:function(){return arguments.length?$(W,this,arguments):this[0]},last:function(){return arguments.length?$(X,this,arguments):this[this.length-1]},random:function(){return this.length===0?i:this[h.random(this.length-1)]},size:function(){return this.length},clean:function(){this.length=0;return this},empty:function(){return this.length===0},clone:function(){return this.slice(0)},each:function(){$(Q,this,arguments);return this},forEach:Q,map:function(){return $(T,this,arguments)},filter:function(){return $(R,this,arguments)},reject:function(){return $(S,this,arguments)},some:function(a){return $(U,this,a?arguments:[_])},every:function(a){return $(V,this,a?arguments:[_])},walk:function(){this.map.apply(this,arguments).forEach(function(a,b){this[b]=a},this);return this},merge:function(){for(var a=this.clone(),b,c=0;c0;b=h.random(d-1),c=a[--d],a[d]=a[b],a[b]=c){}return a},sort:function(a){return P.apply(this,a||!z(this[0])?arguments:[ba])},sortBy:function(){var a=Y(arguments,this);return this.sort(function(b,c){return ba(a[0].call(a[1],b),a[0].call(a[1],c))})},min:function(){return h.min.apply(h,this)},max:function(){return h.max.apply(h,this)},sum:function(){for(var a=0,b=0,c=this.length;b]+>/ig,"")},stripScripts:function(a){var b="",c=this.replace(/]*>([\s\S]*?)<\/script>/img,function(a,c){b+=c+"\n";return""});a===!0?t(b):x(a)&&a(b,c);return c},extractScripts:function(){var a="";this.stripScripts(function(b){a=b});return a},evalScripts:function(){this.stripScripts(!0);return this},camelize:function(){return this.replace(/(\-|_)+(.)?/g,function(a,b,c){return c?c.toUpperCase():""})},underscored:function(){return this.replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/\-/g,"_").toLowerCase()},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},includes:function(a){return this.indexOf(a)!=-1},startsWith:function(a,b){return(b!==!0?this.indexOf(a):this.toLowerCase().indexOf(a.toLowerCase()))===0},endsWith:function(a,b){return this.length-(b!==!0?this.lastIndexOf(a):this.toLowerCase().lastIndexOf(a.toLowerCase()))===a.length},toInt:function(a){return parseInt(this,a===i?10:a)},toFloat:function(a){return parseFloat(a===!0?this:this.replace(",",".").replace(/(\d)-(\d)/,"$1.$2"))}}),e.prototype.include=e.prototype.includes,f.include({bind:function(){var a=J(arguments),b=a.shift(),c=this;return function(){return c.apply(b,a.length!==0||arguments.length!==0?a.concat(J(arguments)):a)}},bindAsEventListener:function(){var a=J(arguments),b=a.shift(),c=this;return function(d){return c.apply(b,[d].concat(a).concat(J(arguments)))}},curry:function(){return this.bind.apply(this,[this].concat(J(arguments)))},rcurry:function(){var a=J(arguments),b=this;return function(){return b.apply(b,J(arguments).concat(a))}},delay:function(){var a=J(arguments),b=a.shift(),c=new g(setTimeout(this.bind.apply(this,[this].concat(a)),b));c.cancel=function(){clearTimeout(this)};return c},periodical:function(){var a=J(arguments),b=a.shift(),c=new g(setInterval(this.bind.apply(this,[this].concat(a)),b));c.stop=function(){clearInterval(this)};return c},chain:function(){var a=J(arguments),b=a.shift(),c=this;return function(){var d=c.apply(c,arguments);b.apply(b,a);return d}}}),g.include({times:function(a,b){for(var c=0;c=a;d--)b.call(c,d);return this},abs:function(){return h.abs(this)},round:function(a){return a?parseFloat(this.toFixed(a)):h.round(this)},ceil:function(){return h.ceil(this)},floor:function(){return h.floor(this)},min:function(a){return thisa?a:this+0}}),RegExp.escape=function(a){return(""+a).replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1")};var bb=j.Class=function(){var a=J(arguments).slice(0,2),b=a.pop()||{},c=a.pop(),d=arguments[2],e=function(){};!a.length&&!A(b)&&(c=b,b={}),!d&&c&&(c===bv||c.ancestors.include(bv))&&(d=bw()),d=s(d||function(){bh(this);return"initialize"in this?this.initialize.apply(this,arguments):this},bc),c=c||bb,e.prototype=c.prototype,d.prototype=new e,d.parent=c,d.prototype.constructor=d,d.ancestors=[];while(c)d.ancestors.push(c),c=c.parent;["extend","include"].each(function(a){a in b&&d[a].apply(d,N(b[a]))});return d.include(b)},bc={extend:function(){J(arguments).filter(A).each(function(a){s(this,be(a,!0)),bf(this,a,!0)},this);return this},include:function(){var a=[this].concat(this.ancestors);J(arguments).filter(A).each(function(b){c.each(be(b,!1),function(b,c){for(var d,e=0,f=a.length;e"),br.OLD=br.IE8L=bs=!0}catch(bu){}var bv=j.Wrapper=new bb({_:i,initialize:function(a){this._=a}});bv.Cache=q,bv.Cast=function(a){return a.tagName in bG?bG[a.tagName]:i};var bA=j.Document=new bb(bv,{win:function(){return bz(this._.defaultView||this._.parentWindow)}}),bB=bz(b),bC=j.Window=new bb(bv,{win:function(){return this},size:function(){var a=this._,b=a.document.documentElement;return a.innerWidth?{x:a.innerWidth,y:a.innerHeight}:{x:b.clientWidth,y:b.clientHeight}},scrolls:function(){var a=this._,b=a.document,c=b.body,d=b.documentElement;return a.pageXOffset||a.pageYOffset?{x:a.pageXOffset,y:a.pageYOffset}:c&&(c.scrollLeft||c.scrollTop)?{x:c.scrollLeft,y:c.scrollTop}:{x:d.scrollLeft,y:d.scrollTop}},scrollTo:function(a,b,c){var d=a,e=b,f=z(a)?null:E(a);f instanceof bF&&(a=f.position()),A(a)&&(e=a.y,d=a.x),A(c=c||b)&&j.Fx?(new cf.Scroll(this,c)).start({x:d,y:e}):this._.scrollTo(d,e);return this}}),bD=j.Event=new bb(bv,{type:null,which:null,keyCode:null,target:null,currentTarget:null,relatedTarget:null,pageX:null,pageY:null,initialize:by,stopPropagation:function(){this._.stopPropagation?this._.stopPropagation():this._.cancelBubble=!0,this.stopped=!0;return this},preventDefault:function(){this._.preventDefault?this._.preventDefault():this._.returnValue=!1;return this},stop:function(){return this.stopPropagation().preventDefault()},position:function(){return{x:this.pageX,y:this.pageY}},offset:function(){if(this.target instanceof bF){var a=this.target.position();return{x:this.pageX-a.x,y:this.pageY-a.y}}return null},find:function(a){if(this.target instanceof bv&&this.currentTarget instanceof bv){var b=this.target._,c=this.currentTarget.find(a,!0);while(b){if(c.indexOf(b)!==-1)return bz(b);b=b.parentNode}}return i}},by),bE=[],bF=j.Element=new bb(bv,{initialize:function(a,b){bJ(this,a,b)}},bx),bG=bF.Wrappers={},bH={},bI=function(a,c){return(a in bH?bH[a]:bH[a]=b.createElement(a)).cloneNode(!1)};bs&&(bI=function(a,c){a==="input"&&c!==i&&(a='',"after"),E(this.id).on("load",this.onLoad.bind(this))},send:function(){this.form.set("target",this.id).submit()},onLoad:function(){this.status=200,this.readyState=4,this.form.set("target","");try{this.responseText=a[this.id].document.documentElement.innerHTML}catch(b){}this.onreadystatechange()},abort:function(){E(this.id).set("src","about:blank")}}),cd.JSONP=new bb({include:cd.Dummy,prefix:"jsonp",initialize:function(a){this.xhr=a,this.name=this.prefix+(new Date).getTime(),this.param=(y(a.jsonp)?a.jsonp:"callback")+"="+this.name,this.script=G("script",{charset:a.encoding,async:a.async})},open:function(a,b,c){this.url=b,this.method=a},send:function(b){a[this.name]=this.finish.bind(this),this.script.set("src",this.url+(this.url.include("?")?"&":"?")+this.param+"&"+b).insertTo(F("script").last(),"after")},finish:function(a){this.status=200,this.readyState=4,this.xhr.json=this.xhr.responseJSON=a,this.onreadystatechange()},abort:function(){a[this.name]=function(){}}});var cf=j.Fx=new bb(bj,{extend:{EVENTS:H("start finish cancel"),Durations:{"short":200,normal:400,"long":800},Options:{fps:bs?40:60,duration:"normal",transition:"Sin",queue:!0},Transitions:{Sin:function(a){return-(h.cos(h.PI*a)-1)/2},Cos:function(a){return h.asin((a-.5)*2)/h.PI+.5},Exp:function(a){return h.pow(2,8*(a-1))},Log:function(a){return 1-h.pow(2,-8*a)},Lin:function(a){return a}}},initialize:function(a,b){this.$super(b),this.element=E(a),ci(this)},start:function(){if(cj(this,arguments))return this;var a=this.options,b=cf.Durations[a.duration]||a.duration,c=cf.Transitions[a.transition]||a.transition,d=(b/1e3*this.options.fps).ceil(),e=(1e3/this.options.fps).round();ck(this),this.prepare.apply(this,arguments),co(this,c,e,d);return this.fire("start",this)},finish:function(){cp(this),cl(this),this.fire("finish"),cm(this);return this},cancel:function(){cp(this),cl(this);return this.fire("cancel")},prepare:function(){},render:function(){}}),cg=[],ch=[];e.COLORS={maroon:"#800000",red:"#ff0000",orange:"#ffA500",yellow:"#ffff00",olive:"#808000",purple:"#800080",fuchsia:"#ff00ff",white:"#ffffff",lime:"#00ff00",green:"#008000",navy:"#000080",blue:"#0000ff",aqua:"#00ffff",teal:"#008080",black:"#000000",silver:"#c0c0c0",gray:"#808080",brown:"#a52a2a"},e.include({toHex:function(){var a=/^#(\w)(\w)(\w)$/.exec(this);a?a="#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:(a=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(this))?a="#"+a.slice(1).map(function(a){a=(a-0).toString(16);return a.length==1?"0"+a:a}).join(""):a=e.COLORS[this]||this;return a},toRgb:function(a){var b=/#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/i.exec(this.toHex()||"");b&&(b=b.slice(1).map("toInt",16),b=a?b:"rgb("+b+")");return b}}),bF.include({stop:function(){cn(this);return this},hide:function(a,b){return a&&this.visible()?cq(this,a,["out",b]):this.$super()},show:function(a,b){return a&&!this.visible()?cq(this,a,["in",b]):this.$super()},toggle:function(a,b){return a?cq(this,a,["toggle",b]):this.$super()},remove:function(a,b){return a&&this.visible()?cq(this,a,["out",s(b||{},{onFinish:this.$super.bind(this)})]):this.$super()},morph:function(a,b){return cq(this,"morph",[a,b||{}])},highlight:function(){return cq(this,"highlight",arguments)},fade:function(){return cq(this,"fade",arguments)},slide:function(){return cq(this,"slide",arguments)},scroll:function(a,b){return cq(this,"scroll",[a,b||{}])},scrollTo:function(a,b){return A(b)?this.scroll(a,b):this.$super.apply(this,arguments)}});var cr=["WebkitT","OT","MozT","MsT","t"].first(function(a){return a+"ransition"in o.style}),cs=cr+"ransition",ct=cs+"Property",cu=cs+"Duration",cv=cs+"TimingFunction",cw={Sin:"cubic-bezier(.3,0,.6,1)",Cos:"cubic-bezier(0,.3,.6,0)",Log:"cubic-bezier(0.6,.3,.8)",Exp:"cubic-bezier(.6,0,.8,.3)",Lin:"cubic-bezier(0,0,1,1)"};cf.Options.engine=cr===i||bp?"javascript":"native",cf.Morph=new bb(cf,{prepare:function(a){if(this.options.engine==="native"&&cr!==i)this.render=this.transition=function(){},cx.call(this,a);else{var b=cA(a),c=cF(this.element,b),d=cG(this.element,a,b);cE(this.element,c,d),this.before=cD(c),this.after=cD(d)}},render:function(a){var b,c,d,e=this.element._.style,f,g,i;for(f in this.after){b=this.before[f],c=this.after[f];for(g=0,i=c.length;g