');trigger.insertAfter(input);input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase','uppercase').data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase));if(o.readonly)input.prop('readonly',true);if(o.disabled)disable(input);trigger.bind('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#');show(input)});input.bind('focus.miniColors',function(event){if(input.val()==='')input.val('#');show(input)});input.bind('blur.miniColors',function(event){var hex=expandHex(input.val());input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'')});input.bind('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.bind('keyup.miniColors',function(event){setColorFromInput(input)});input.bind('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').unbind('.miniColors');$(document).unbind('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').css('opacity',1)};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').css('opacity',0.5)};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('
');selector.append('').append('').css({top:input.is(':visible')?input.offset().top+input.outerHeight():input.data('trigger').offset().top+input.data('trigger').outerHeight(),left:input.is(':visible')?input.offset().left:input.data('trigger').offset().left,display:'none'}).addClass(input.attr('class'));var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition.y+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);selector.fadeIn(100);selector.bind('selectstart',function(){return false});$(document).bind('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);if($(event.target).parents().andSelf().hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if($(event.target).parents().andSelf().hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if($(event.target).parents().andSelf().hasClass('miniColors-selector')){event.preventDefault();return}if($(event.target).parents().andSelf().hasClass('miniColors'))return;hide(input)});$(document).bind('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).bind('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event)}})};var hide=function(input){if(!input)input='.miniColors';$(input).each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){$(this).remove()})});$(document).unbind('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-5;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-5;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position={y:event.pageY};if(event.originalEvent.changedTouches){position.y=event.originalEvent.changedTouches[0].pageY}position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-1;if(position.y<=-1)position.y=-1;if(position.y>=149)position.y=149;input.data('huePosition',position);huePicker.css('top',position.y).show();var h=Math.round((150-position.y-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb);if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase')));input.data('trigger').css('backgroundColor','#'+hex);if(input.data('selector'))input.data('selector').find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));if(input.data('change')){if(hex===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,hsb2rgb(hsb));input.data('lastChange',hex)}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val()));var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var currentHSB=input.data('hsb');if(hsb.h===currentHSB.h&&hsb.s===currentHSB.s&&hsb.b===currentHSB.b)return true;var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition.y+'px');input.data('huePosition',huePosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='lowercase')return string.toLowerCase();if(letterCase==='uppercase')return string.toUpperCase();return string};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return{y:y-1}};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data);setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery);
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/jquery.mu.image.resize.degsin.js b/app/assets/Archive/javascripts/jquery.mu.image.resize.degsin.js
deleted file mode 100644
index 9c87bf78..00000000
--- a/app/assets/Archive/javascripts/jquery.mu.image.resize.degsin.js
+++ /dev/null
@@ -1,6 +0,0 @@
- var pic = $(".app-pic").length,w,h;
- for(i=0; i ';
- });
- }
-
- if (!$.browser.msie)
- {
- // Get original size for calcutation.
- ow = this.width;
- oh = this.height;
- }
-
- // if cannot get width or height.
- if (0==ow || 0==oh){
- $(this).width(_set.width);
- $(this).height(_set.height);
- }else{
-
- // Merge position settings
- var sh_margin_type='';
-
- // if original image's width > height.
- if (ow > oh) {
- p = oh / _set.height;
- oh = _set.height;
- ow = ow / p;
-
- // original image width smaller than settings.
- if (ow < _set.width){
- // need to resize again,
- // because new image size range must can cover settings' range, than we can crop it correctly.
- p = ow / _set.width;
- ow = _set.width;
- oh = oh / p;
-
- // the crop range would be in the center of new image size.
- sh = (oh-_set.height)/2;
- t=sh+'px';
- r=_set.width+'px';
- b=(_set.height+sh)+'px';
- l='0px';
-
- // need to be adjust top position latter.
- sh_margin_type = 'margin-top';
-
- // original image width bigger than settings.
- }else{
- // new image range can cover settings' range.
- sh = (ow-_set.width)/2;
- t='0px';
- r=(_set.width+sh)+'px';
- b=_set.height+'px';
- l=sh+'px';
- // need to be adjust left position latter.
- sh_margin_type = 'margin-left';
- }
- // ref above, change width to height then do same things.
- }else{
- p = ow / _set.width;
- ow = _set.width;
- oh = oh / p;
-
- if (oh < _set.height) {
- p = oh / _set.height;
- oh = _set.height;
- ow = ow / p;
-
- sh = (ow-_set.width)/2;
- t='0px';
- r=(_set.width+sh)+'px';
- b=_set.height+'px';
- l=sh+'px';
- sh_margin_type = 'margin-left';
- }else{
- sh = (oh-_set.height)/2;
- t=sh+'px';
- r=_set.width+'px';
- b=(_set.height+sh)+'px';
- l='0px';
- sh_margin_type = 'margin-top';
- }
- }
-
- // Resize img.
- $(this).width(ow);
- $(this).height(oh);
-
- // Crop img by set clip style.
- $(this).css('clip','rect('+t+' '+r+' '+b+' '+l+')');
-
- var osh = 0;
- if('auto' != $(this).css(sh_margin_type)){
- osh = parseInt($(this).css(sh_margin_type));
- }
-
- if (0 < sh) {sh*=-1;}
- sh += osh;
-
- $(this).css(sh_margin_type, sh+'px');
- $(this).css('position','absolute');
- }
- $(this).fadeIn('slow');
- })
- .one( "error", function() {
- //$(this).hide();
- })
- .each(function() {
- $(this).hide();
- // Trigger load event (for Gecko and MSIE)
- if ( this.complete || $.browser.msie ) {
- $( this ).trigger( "load" ).trigger( "error" );
- }
- });
- };
-
-})( jQuery );
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/jquery.tinyscrollbar.js b/app/assets/Archive/javascripts/jquery.tinyscrollbar.js
deleted file mode 100644
index 125c89d4..00000000
--- a/app/assets/Archive/javascripts/jquery.tinyscrollbar.js
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Tiny Scrollbar 1.8
- * http://www.baijs.nl/tinyscrollbar/
- *
- * Copyright 2012, Maarten Baijs
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.opensource.org/licenses/gpl-2.0.php
- *
- * Date: 26 / 07 / 2012
- * Depends on library: jQuery
- *
- */
-;( function( $ )
-{
- $.tiny = $.tiny || { };
-
- $.tiny.scrollbar = {
- options: {
- axis : 'y' // vertical or horizontal scrollbar? ( x || y ).
- , wheel : 40 // how many pixels must the mouswheel scroll at a time.
- , scroll : true // enable or disable the mousewheel.
- , lockscroll : true // return scrollwheel to browser if there is no more content.
- , size : 'auto' // set the size of the scrollbar to auto or a fixed number.
- , sizethumb : 'auto' // set the size of the thumb to auto or a fixed number.
- , invertscroll : false // Enable mobile invert style scrolling
- , onMove : function(){}
- }
- };
-
- $.fn.tinyscrollbar = function( params )
- {
- var options = $.extend( {}, $.tiny.scrollbar.options, params );
- this.each( function()
- {
-
- $( this ).data('tsb', new Scrollbar( $( this ), options ) );
- });
-
- return this;
- };
-
- $.fn.tinyscrollbar_update = function(sScroll)
- {
-
- return $( this ).data( 'tsb' ).update( sScroll );
- };
-
- function Scrollbar( root, options )
- {
- var oSelf = this
- , oWrapper = root
- , oViewport = { obj: $( '.viewport', root ) }
- , oContent = { obj: $( '.overview', root ) }
- , oScrollbar = { obj: $( '.scrollbar', root ) }
- , oTrack = { obj: $( '.track', oScrollbar.obj ) }
- , oThumb = { obj: $( '.thumb', oScrollbar.obj ) }
- , sAxis = options.axis === 'x'
- , sDirection = sAxis ? 'left' : 'top'
- , sSize = sAxis ? 'Width' : 'Height'
- , iScroll = 0
- , iPosition = { start: 0, now: 0 }
- , iMouse = {}
- , touchEvents = 'ontouchstart' in document.documentElement
- , UA = $.browser
- ;
-
- function initialize()
- {
- oSelf.update();
- setEvents();
-
- return oSelf;
- }
-
- this.update = function( sScroll )
- {
- oViewport[ options.axis ] = oViewport.obj[0][ 'offset'+ sSize ];
- oContent[ options.axis ] = oContent.obj[0][ 'scroll'+ sSize ];
- oContent.ratio = oViewport[ options.axis ] / oContent[ options.axis ];
-
- oScrollbar.obj.toggleClass( 'disable', oContent.ratio >= 1 );
-
- oTrack[ options.axis ] = options.size === 'auto' ? oViewport[ options.axis ] : options.size;
- oThumb[ options.axis ] = Math.min( oTrack[ options.axis ], Math.max( 0, ( options.sizethumb === 'auto' ? ( oTrack[ options.axis ] * oContent.ratio ) : options.sizethumb ) ) );
-
- oScrollbar.ratio = options.sizethumb === 'auto' ? ( oContent[ options.axis ] / oTrack[ options.axis ] ) : ( oContent[ options.axis ] - oViewport[ options.axis ] ) / ( oTrack[ options.axis ] - oThumb[ options.axis ] );
-
- iScroll = ( sScroll === 'relative' && oContent.ratio <= 1 ) ? Math.min( ( oContent[ options.axis ] - oViewport[ options.axis ] ), Math.max( 0, iScroll )) : 0;
- iScroll = ( sScroll === 'bottom' && oContent.ratio <= 1 ) ? ( oContent[ options.axis ] - oViewport[ options.axis ] ) : isNaN( parseInt( sScroll, 10 ) ) ? iScroll : parseInt( sScroll, 10 );
-
- setSize();
- };
-
- function setSize()
- {
- var sCssSize = sSize.toLowerCase();
-
- oThumb.obj.css( sDirection, iScroll / oScrollbar.ratio );
- oContent.obj.css( sDirection, -iScroll );
- iMouse.start = oThumb.obj.offset()[ sDirection ];
-
- oScrollbar.obj.css( sCssSize, oTrack[ options.axis ] );
- oTrack.obj.css( sCssSize, oTrack[ options.axis ] );
- oThumb.obj.css( sCssSize, oThumb[ options.axis ] );
- }
-
- function setEvents()
- {
- if( ! touchEvents )
- {
- oThumb.obj.bind( 'mousedown', start );
- oTrack.obj.bind( 'mouseup', drag );
- }
- else
- {
- oViewport.obj[0].ontouchstart = function( event )
- {
- if( 1 === event.touches.length )
- {
- start( event.touches[ 0 ] );
- event.stopPropagation();
- }
- };
- }
-
- if( options.scroll && window.addEventListener )
- {
- oWrapper[0].addEventListener( 'DOMMouseScroll', wheel, false );
- oWrapper[0].addEventListener( 'mousewheel', wheel, false );
- oWrapper[0].addEventListener( 'MozMousePixelScroll', function( event ){
- event.preventDefault();
- }, false);
- }
- else if( options.scroll )
- {
- oWrapper[0].onmousewheel = wheel;
- }
- }
-
- function start( event )
- {
- $( "body" ).addClass( "noSelect" );
- // Disable select text under IE10
- if ( UA.msie < 10 ){
- $( "body" ).attr({
- "onselectstart": "return false",
- "ondragstart": "return false"
- });
- }
- oScrollbar.obj.addClass( "dragging" );
-
- var oThumbDir = parseInt( oThumb.obj.css( sDirection ), 10 );
- iMouse.start = sAxis ? event.pageX : event.pageY;
- iPosition.start = oThumbDir == 'auto' ? 0 : oThumbDir;
-
- if( ! touchEvents )
- {
- $( document ).bind( 'mousemove', drag );
- $( document ).bind( 'mouseup', end );
- oThumb.obj.bind( 'mouseup', end );
- }
- else
- {
- document.ontouchmove = function( event )
- {
- event.preventDefault();
- drag( event.touches[ 0 ] );
- };
- document.ontouchend = end;
- }
- }
-
- function wheel( event )
- {
- if( oContent.ratio < 1 )
- {
- var oEvent = event || window.event
- , iDelta = oEvent.wheelDelta ? oEvent.wheelDelta / 120 : -oEvent.detail / 3
- ;
-
- iScroll -= iDelta * options.wheel;
- iScroll = Math.min( ( oContent[ options.axis ] - oViewport[ options.axis ] ), Math.max( 0, iScroll ));
-
- oThumb.obj.css( sDirection, iScroll / oScrollbar.ratio );
- oContent.obj.css( sDirection, -iScroll );
-
- if( options.lockscroll || ( iScroll !== ( oContent[ options.axis ] - oViewport[ options.axis ] ) && iScroll !== 0 ) )
- {
- oEvent = $.event.fix( oEvent );
- oEvent.preventDefault();
- }
- }
-
- options.onMove.call(this,get_destance_from_end());
- }
-
- function get_destance_from_end(){
- var distance_to_end = (oContent.obj.width() - oScrollbar.obj.width()) - iScroll;
- return distance_to_end;
- }
-
- function drag( event )
- {
- if( oContent.ratio < 1 )
- {
- if( options.invertscroll && touchEvents )
- {
- iPosition.now = Math.min( ( oTrack[ options.axis ] - oThumb[ options.axis ] ), Math.max( 0, ( iPosition.start + ( iMouse.start - ( sAxis ? event.pageX : event.pageY ) ))));
- }
- else
- {
- iPosition.now = Math.min( ( oTrack[ options.axis ] - oThumb[ options.axis ] ), Math.max( 0, ( iPosition.start + ( ( sAxis ? event.pageX : event.pageY ) - iMouse.start))));
- }
-
- iScroll = iPosition.now * oScrollbar.ratio;
- oContent.obj.css( sDirection, -iScroll );
- oThumb.obj.css( sDirection, iPosition.now );
- }
- options.onMove.call(this,get_destance_from_end());
- }
-
- function end()
- {
- $( "body" ).removeClass( "noSelect" );
- // Enable select text under IE10
- if ( UA.msie < 10 ){
- $( "body" ).removeAttr( "onselectstart", "ondragstart" );
- }
- oScrollbar.obj.removeClass( "dragging" );
- $( document ).unbind( 'mousemove', drag );
- $( document ).unbind( 'mouseup', end );
- oThumb.obj.unbind( 'mouseup', end );
- document.ontouchmove = document.ontouchend = null;
- }
-
- return initialize();
- }
-
-}(jQuery));
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/jquery.tinyscrollbar.min.js b/app/assets/Archive/javascripts/jquery.tinyscrollbar.min.js
deleted file mode 100644
index ec8be7a2..00000000
--- a/app/assets/Archive/javascripts/jquery.tinyscrollbar.min.js
+++ /dev/null
@@ -1,126 +0,0 @@
-(function(a){
- function b(b,c){
- function w(a){
- if(!(g.ratio>=1)){
- o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start)));
- n=o.now*h.ratio;
- g.obj.css(l,-n);
- j.obj.css(l,o.now)
- }
- return false
- }
- function v(b){
- a(document).unbind("mousemove",w);
- a(document).unbind("mouseup",v);
- j.obj.unbind("mouseup",v);
- document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null;
- return false
- }
- function u(b){
- if(!(g.ratio>=1)){
- var b=b||window.event;
- var d=b.wheelDelta?b.wheelDelta/120:-b.detail/3;
- n-=d*c.wheel;
- n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n));
- j.obj.css(l,n/h.ratio);
- g.obj.css(l,-n);
- b=a.event.fix(b);
- b.preventDefault()
- }
- }
- function t(b){
- p.start=k?b.pageX:b.pageY;
- var c=parseInt(j.obj.css(l));
- o.start=c=="auto"?0:c;
- a(document).bind("mousemove",w);
- document.ontouchmove=function(b){
- a(document).unbind("mousemove");
- w(b.touches[0])
- };
- a(document).bind("mouseup",v);
- j.obj.bind("mouseup",v);
- j.obj[0].ontouchend=document.ontouchend=function(b){
- a(document).unbind("mouseup");
- j.obj.unbind("mouseup");
- v(b.touches[0])};
- return false
- }
- function s(){
- j.obj.bind("mousedown",t);
- j.obj[0].ontouchstart=function(a){
- a.preventDefault();
- j.obj.unbind("mousedown");
- t(a.touches[0]);
- return false
- };
- i.obj.bind("mouseup",w);
- if(c.scroll&&this.addEventListener){
- e[0].addEventListener("DOMMouseScroll",u,false);
- e[0].addEventListener("mousewheel",u,false)
- }else if(c.scroll){
- e[0].onmousewheel=u
- }
- }
- function r(){
- j.obj.css(l,n/h.ratio);
- g.obj.css(l,-n);
- p["start"]=j.obj.offset()[l];
- var a=m.toLowerCase();
- h.obj.css(a,i[c.axis]);
- i.obj.css(a,i[c.axis]);
- j.obj.css(a,j[c.axis])
- }
- function q(){
- d.update();
- s();
- return d
- }
- var d=this;
- var e=b;
- var f={obj:a(".viewport",b)};
- var g={obj:a(".overview",b)};
- var h={obj:a(".scrollbar",b)};
- var i={obj:a(".track",h.obj)};
- var j={obj:a(".thumb",h.obj)};
- var k=c.axis=="x",
- l=k?"left":"top",
- m=k?"Width":"Height";
- var n,
- o={start:0,now:0},
- p={};
- this.update=function(a){
- f[c.axis]=f.obj[0]["offset"+m];
- g[c.axis]=g.obj[0]["scroll"+m];
- g.ratio=f[c.axis]/g[c.axis];
- h.obj.toggleClass("disable",g.ratio>=1);
- i[c.axis]=c.size=="auto"?f[c.axis]:c.size;
- j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb));
- h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]);
- n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0;
- n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a);
- r()
- };
- return q()
- }
- a.tiny=a.tiny||{};
- a.tiny.scrollbar={
- options:{
- axis:"y",
- wheel:40,
- scroll:true,
- size:"auto",
- sizethumb:"auto"
- }
- };
- a.fn.tinyscrollbar=function(c){
- var c=a.extend({},a.tiny.scrollbar.options,c);
- this.each(function(){
- a(this).data("tsb",new b(a(this),c))
- });
- return this
- };
- a.fn.tinyscrollbar_update=function(b){
- return a(this).data("tsb").update(b)
- };
- })
-(jQuery)
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/jquery.tokeninput.js b/app/assets/Archive/javascripts/jquery.tokeninput.js
deleted file mode 100644
index 830e982f..00000000
--- a/app/assets/Archive/javascripts/jquery.tokeninput.js
+++ /dev/null
@@ -1,1043 +0,0 @@
-/*
- * jQuery Plugin: Tokenizing Autocomplete Text Entry
- * Version 1.6.1
- *
- * Copyright (c) 2009 James Smith (http://loopj.com)
- * Licensed jointly under the GPL and MIT licenses,
- * choose which one suits your project best!
- *
- */
-
-(function ($) {
-// Default settings
-var DEFAULT_SETTINGS = {
- // Search settings
- method: "GET",
- queryParam: "q",
- searchDelay: 300,
- minChars: 1,
- propertyToSearch: "name",
- jsonContainer: null,
- contentType: "json",
-
- // Prepopulation settings
- prePopulate: null,
- processPrePopulate: false,
-
- // Display settings
- hintText: "Type in a search term",
- noResultsText: "No results",
- searchingText: "Searching...",
- deleteText: "×",
- animateDropdown: true,
- placeholder: null,
- theme: null,
- zindex: 999,
- resultsLimit: null,
-
- enableHTML: false,
-
- resultsFormatter: function(item) {
- var string = item[this.propertyToSearch];
- return "" + (this.enableHTML ? string : _escapeHTML(string)) + " ";
- },
-
- tokenFormatter: function(item) {
- var string = item[this.propertyToSearch];
- return "" + (this.enableHTML ? string : _escapeHTML(string)) + "
";
- },
-
- // Tokenization settings
- tokenLimit: null,
- tokenDelimiter: ",",
- preventDuplicates: false,
- tokenValue: "id",
-
- // Behavioral settings
- allowFreeTagging: false,
- allowTabOut: false,
-
- // Callbacks
- onResult: null,
- onCachedResult: null,
- onAdd: null,
- onFreeTaggingAdd: null,
- onDelete: null,
- onReady: null,
-
- // Other settings
- idPrefix: "token-input-",
-
- // Keep track if the input is currently in disabled mode
- disabled: false
-};
-
-// Default classes to use when theming
-var DEFAULT_CLASSES = {
- tokenList: "token-input-list",
- token: "token-input-token",
- tokenReadOnly: "token-input-token-readonly",
- tokenDelete: "token-input-delete-token",
- selectedToken: "token-input-selected-token",
- highlightedToken: "token-input-highlighted-token",
- dropdown: "token-input-dropdown",
- dropdownItem: "token-input-dropdown-item",
- dropdownItem2: "token-input-dropdown-item2",
- selectedDropdownItem: "token-input-selected-dropdown-item",
- inputToken: "token-input-input-token",
- focused: "token-input-focused",
- disabled: "token-input-disabled"
-};
-
-// Input box position "enum"
-var POSITION = {
- BEFORE: 0,
- AFTER: 1,
- END: 2
-};
-
-// Keys "enum"
-var KEY = {
- BACKSPACE: 8,
- TAB: 9,
- ENTER: 13,
- ESCAPE: 27,
- SPACE: 32,
- PAGE_UP: 33,
- PAGE_DOWN: 34,
- END: 35,
- HOME: 36,
- LEFT: 37,
- UP: 38,
- RIGHT: 39,
- DOWN: 40,
- NUMPAD_ENTER: 108,
- COMMA: 188
-};
-
-var HTML_ESCAPES = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- "'": ''',
- '/': '/'
-};
-
-var HTML_ESCAPE_CHARS = /[&<>"'\/]/g;
-
-function coerceToString(val) {
- return String((val === null || val === undefined) ? '' : val);
-}
-
-function _escapeHTML(text) {
- return coerceToString(text).replace(HTML_ESCAPE_CHARS, function(match) {
- return HTML_ESCAPES[match];
- });
-}
-
-// Additional public (exposed) methods
-var methods = {
- init: function(url_or_data_or_function, options) {
- var settings = $.extend({}, DEFAULT_SETTINGS, options || {});
-
- return this.each(function () {
- $(this).data("settings", settings);
- $(this).data("tokenInputObject", new $.TokenList(this, url_or_data_or_function, settings));
- });
- },
- clear: function() {
- this.data("tokenInputObject").clear();
- return this;
- },
- add: function(item) {
- this.data("tokenInputObject").add(item);
- return this;
- },
- remove: function(item) {
- this.data("tokenInputObject").remove(item);
- return this;
- },
- get: function() {
- return this.data("tokenInputObject").getTokens();
- },
- toggleDisabled: function(disable) {
- this.data("tokenInputObject").toggleDisabled(disable);
- return this;
- },
- setOptions: function(options){
- $(this).data("settings", $.extend({}, $(this).data("settings"), options || {}));
- return this;
- }
-};
-
-// Expose the .tokenInput function to jQuery as a plugin
-$.fn.tokenInput = function (method) {
- // Method calling and initialization logic
- if(methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else {
- return methods.init.apply(this, arguments);
- }
-};
-
-// TokenList class for each input
-$.TokenList = function (input, url_or_data, settings) {
- //
- // Initialization
- //
-
- // Configure the data source
- if($.type(url_or_data) === "string" || $.type(url_or_data) === "function") {
- // Set the url to query against
- $(input).data("settings").url = url_or_data;
-
- // If the URL is a function, evaluate it here to do our initalization work
- var url = computeURL();
-
- // Make a smart guess about cross-domain if it wasn't explicitly specified
- if($(input).data("settings").crossDomain === undefined && typeof url === "string") {
- if(url.indexOf("://") === -1) {
- $(input).data("settings").crossDomain = false;
- } else {
- $(input).data("settings").crossDomain = (location.href.split(/\/+/g)[1] !== url.split(/\/+/g)[1]);
- }
- }
- } else if(typeof(url_or_data) === "object") {
- // Set the local data to search through
- $(input).data("settings").local_data = url_or_data;
- }
-
- // Build class names
- if($(input).data("settings").classes) {
- // Use custom class names
- $(input).data("settings").classes = $.extend({}, DEFAULT_CLASSES, $(input).data("settings").classes);
- } else if($(input).data("settings").theme) {
- // Use theme-suffixed default class names
- $(input).data("settings").classes = {};
- $.each(DEFAULT_CLASSES, function(key, value) {
- $(input).data("settings").classes[key] = value + "-" + $(input).data("settings").theme;
- });
- } else {
- $(input).data("settings").classes = DEFAULT_CLASSES;
- }
-
-
- // Save the tokens
- var saved_tokens = [];
-
- // Keep track of the number of tokens in the list
- var token_count = 0;
-
- // Basic cache to save on db hits
- var cache = new $.TokenList.Cache();
-
- // Keep track of the timeout, old vals
- var timeout;
- var input_val;
-
- // Create a new text input an attach keyup events
- var input_box = $(" ")
- .css({
- outline: "none"
- })
- .attr("id", $(input).data("settings").idPrefix + input.id)
- .focus(function () {
- if ($(input).data("settings").disabled) {
- return false;
- } else
- if ($(input).data("settings").tokenLimit === null || $(input).data("settings").tokenLimit !== token_count) {
- show_dropdown_hint();
- }
- token_list.addClass($(input).data("settings").classes.focused);
- })
- .blur(function () {
- hide_dropdown();
-
- if ($(input).data("settings").allowFreeTagging) {
- add_freetagging_tokens();
- }
-
- $(this).val("");
- token_list.removeClass($(input).data("settings").classes.focused);
- })
- .bind("keyup keydown blur update", resize_input)
- .keydown(function (event) {
- var previous_token;
- var next_token;
-
- switch(event.keyCode) {
- case KEY.LEFT:
- case KEY.RIGHT:
- case KEY.UP:
- case KEY.DOWN:
- if(!$(this).val()) {
- previous_token = input_token.prev();
- next_token = input_token.next();
-
- if((previous_token.length && previous_token.get(0) === selected_token) || (next_token.length && next_token.get(0) === selected_token)) {
- // Check if there is a previous/next token and it is selected
- if(event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) {
- deselect_token($(selected_token), POSITION.BEFORE);
- } else {
- deselect_token($(selected_token), POSITION.AFTER);
- }
- } else if((event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) && previous_token.length) {
- // We are moving left, select the previous token if it exists
- select_token($(previous_token.get(0)));
- } else if((event.keyCode === KEY.RIGHT || event.keyCode === KEY.DOWN) && next_token.length) {
- // We are moving right, select the next token if it exists
- select_token($(next_token.get(0)));
- }
- } else {
- var dropdown_item = null;
-
- if(event.keyCode === KEY.DOWN || event.keyCode === KEY.RIGHT) {
- dropdown_item = $(selected_dropdown_item).next();
- } else {
- dropdown_item = $(selected_dropdown_item).prev();
- }
-
- if(dropdown_item.length) {
- select_dropdown_item(dropdown_item);
- }
- }
- return false;
- break;
-
- case KEY.BACKSPACE:
- previous_token = input_token.prev();
-
- if(!$(this).val().length) {
- if(selected_token) {
- delete_token($(selected_token));
- hidden_input.change();
- } else if(previous_token.length) {
- select_token($(previous_token.get(0)));
- }
-
- return false;
- } else if($(this).val().length === 1) {
- hide_dropdown();
- } else {
- // set a timeout just long enough to let this function finish.
- setTimeout(function(){do_search();}, 5);
- }
- break;
-
- case KEY.TAB:
- case KEY.ENTER:
- case KEY.NUMPAD_ENTER:
- case KEY.COMMA:
- if(selected_dropdown_item) {
- add_token($(selected_dropdown_item).data("tokeninput"));
- hidden_input.change();
- } else {
- if ($(input).data("settings").allowFreeTagging) {
- if($(input).data("settings").allowTabOut && $(this).val() === "") {
- return true;
- } else {
- add_freetagging_tokens();
- }
- } else {
- $(this).val("");
- if($(input).data("settings").allowTabOut) {
- return true;
- }
- }
- event.stopPropagation();
- event.preventDefault();
- }
- return false;
-
- case KEY.ESCAPE:
- hide_dropdown();
- return true;
-
- default:
- if(String.fromCharCode(event.which)) {
- // set a timeout just long enough to let this function finish.
- setTimeout(function(){do_search();}, 5);
- }
- break;
- }
- });
-
- // Keep reference for placeholder
- if (settings.placeholder)
- input_box.attr("placeholder", settings.placeholder)
-
- // Keep a reference to the original input box
- var hidden_input = $(input)
- .hide()
- .val("")
- .focus(function () {
- focus_with_timeout(input_box);
- })
- .blur(function () {
- input_box.blur();
- });
-
- // Keep a reference to the selected token and dropdown item
- var selected_token = null;
- var selected_token_index = 0;
- var selected_dropdown_item = null;
-
- // The list to store the token items in
- var token_list = $("")
- .addClass($(input).data("settings").classes.tokenList)
- .click(function (event) {
- var li = $(event.target).closest("li");
- if(li && li.get(0) && $.data(li.get(0), "tokeninput")) {
- toggle_select_token(li);
- } else {
- // Deselect selected token
- if(selected_token) {
- deselect_token($(selected_token), POSITION.END);
- }
-
- // Focus input box
- focus_with_timeout(input_box);
- }
- })
- .mouseover(function (event) {
- var li = $(event.target).closest("li");
- if(li && selected_token !== this) {
- li.addClass($(input).data("settings").classes.highlightedToken);
- }
- })
- .mouseout(function (event) {
- var li = $(event.target).closest("li");
- if(li && selected_token !== this) {
- li.removeClass($(input).data("settings").classes.highlightedToken);
- }
- })
- .insertBefore(hidden_input);
-
- // The token holding the input box
- var input_token = $(" ")
- .addClass($(input).data("settings").classes.inputToken)
- .appendTo(token_list)
- .append(input_box);
-
- // The list to store the dropdown items in
- var dropdown = $("")
- .addClass($(input).data("settings").classes.dropdown)
- .appendTo("body")
- .hide();
-
- // Magic element to help us resize the text input
- var input_resizer = $("
")
- .insertAfter(input_box)
- .css({
- position: "absolute",
- top: -9999,
- left: -9999,
- width: "auto",
- fontSize: input_box.css("fontSize"),
- fontFamily: input_box.css("fontFamily"),
- fontWeight: input_box.css("fontWeight"),
- letterSpacing: input_box.css("letterSpacing"),
- whiteSpace: "nowrap"
- });
-
- // Pre-populate list if items exist
- hidden_input.val("");
- var li_data = $(input).data("settings").prePopulate || hidden_input.data("pre");
- if($(input).data("settings").processPrePopulate && $.isFunction($(input).data("settings").onResult)) {
- li_data = $(input).data("settings").onResult.call(hidden_input, li_data);
- }
- if(li_data && li_data.length) {
- $.each(li_data, function (index, value) {
- insert_token(value);
- checkTokenLimit();
- input_box.attr("placeholder", null)
- });
- }
-
- // Check if widget should initialize as disabled
- if ($(input).data("settings").disabled) {
- toggleDisabled(true);
- }
-
- // Initialization is done
- if($.isFunction($(input).data("settings").onReady)) {
- $(input).data("settings").onReady.call();
- }
-
- //
- // Public functions
- //
-
- this.clear = function() {
- token_list.children("li").each(function() {
- if ($(this).children("input").length === 0) {
- delete_token($(this));
- }
- });
- };
-
- this.add = function(item) {
- add_token(item);
- };
-
- this.remove = function(item) {
- token_list.children("li").each(function() {
- if ($(this).children("input").length === 0) {
- var currToken = $(this).data("tokeninput");
- var match = true;
- for (var prop in item) {
- if (item[prop] !== currToken[prop]) {
- match = false;
- break;
- }
- }
- if (match) {
- delete_token($(this));
- }
- }
- });
- };
-
- this.getTokens = function() {
- return saved_tokens;
- };
-
- this.toggleDisabled = function(disable) {
- toggleDisabled(disable);
- };
-
- // Resize input to maximum width so the placeholder can be seen
- resize_input();
-
- //
- // Private functions
- //
-
- function escapeHTML(text) {
- return $(input).data("settings").enableHTML ? text : _escapeHTML(text);
- }
-
- // Toggles the widget between enabled and disabled state, or according
- // to the [disable] parameter.
- function toggleDisabled(disable) {
- if (typeof disable === 'boolean') {
- $(input).data("settings").disabled = disable
- } else {
- $(input).data("settings").disabled = !$(input).data("settings").disabled;
- }
- input_box.attr('disabled', $(input).data("settings").disabled);
- token_list.toggleClass($(input).data("settings").classes.disabled, $(input).data("settings").disabled);
- // if there is any token selected we deselect it
- if(selected_token) {
- deselect_token($(selected_token), POSITION.END);
- }
- hidden_input.attr('disabled', $(input).data("settings").disabled);
- }
-
- function checkTokenLimit() {
- if($(input).data("settings").tokenLimit !== null && token_count >= $(input).data("settings").tokenLimit) {
- input_box.hide();
- hide_dropdown();
- return;
- }
- }
-
- function resize_input() {
- if(input_val === (input_val = input_box.val())) {return;}
-
- // Get width left on the current line
- var width_left = token_list.width() - input_box.offset().left - token_list.offset().left;
- // Enter new content into resizer and resize input accordingly
- input_resizer.html(_escapeHTML(input_val));
- // Get maximum width, minimum the size of input and maximum the widget's width
- input_box.width(Math.min(token_list.width(),
- Math.max(width_left, input_resizer.width() + 30)));
- }
-
- function is_printable_character(keycode) {
- return ((keycode >= 48 && keycode <= 90) || // 0-1a-z
- (keycode >= 96 && keycode <= 111) || // numpad 0-9 + - / * .
- (keycode >= 186 && keycode <= 192) || // ; = , - . / ^
- (keycode >= 219 && keycode <= 222)); // ( \ ) '
- }
-
- function add_freetagging_tokens() {
- var value = $.trim(input_box.val());
- var tokens = value.split($(input).data("settings").tokenDelimiter);
- $.each(tokens, function(i, token) {
- if (!token) {
- return;
- }
-
- if ($.isFunction($(input).data("settings").onFreeTaggingAdd)) {
- token = $(input).data("settings").onFreeTaggingAdd.call(hidden_input, token);
- }
- var object = {};
- object[$(input).data("settings").tokenValue] = object[$(input).data("settings").propertyToSearch] = token;
- add_token(object);
- });
- }
-
- // Inner function to a token to the list
- function insert_token(item) {
- var $this_token = $($(input).data("settings").tokenFormatter(item));
- var readonly = item.readonly === true ? true : false;
-
- if(readonly) $this_token.addClass($(input).data("settings").classes.tokenReadOnly);
-
- $this_token.addClass($(input).data("settings").classes.token).insertBefore(input_token);
-
- // The 'delete token' button
- if(!readonly) {
- $("
" + $(input).data("settings").deleteText + " ")
- .addClass($(input).data("settings").classes.tokenDelete)
- .appendTo($this_token)
- .click(function () {
- if (!$(input).data("settings").disabled) {
- delete_token($(this).parent());
- hidden_input.change();
- return false;
- }
- });
- }
-
- // Store data on the token
- var token_data = item;
- $.data($this_token.get(0), "tokeninput", item);
-
- // Save this token for duplicate checking
- saved_tokens = saved_tokens.slice(0,selected_token_index).concat([token_data]).concat(saved_tokens.slice(selected_token_index));
- selected_token_index++;
-
- // Update the hidden input
- update_hidden_input(saved_tokens, hidden_input);
-
- token_count += 1;
-
- // Check the token limit
- if($(input).data("settings").tokenLimit !== null && token_count >= $(input).data("settings").tokenLimit) {
- input_box.hide();
- hide_dropdown();
- }
-
- return $this_token;
- }
-
- // Add a token to the token list based on user input
- function add_token (item) {
- var callback = $(input).data("settings").onAdd;
-
- // See if the token already exists and select it if we don't want duplicates
- if(token_count > 0 && $(input).data("settings").preventDuplicates) {
- var found_existing_token = null;
- token_list.children().each(function () {
- var existing_token = $(this);
- var existing_data = $.data(existing_token.get(0), "tokeninput");
- if(existing_data && existing_data[settings.tokenValue] === item[settings.tokenValue]) {
- found_existing_token = existing_token;
- return false;
- }
- });
-
- if(found_existing_token) {
- select_token(found_existing_token);
- input_token.insertAfter(found_existing_token);
- focus_with_timeout(input_box);
- return;
- }
- }
-
- // Squeeze input_box so we force no unnecessary line break
- input_box.width(0);
-
- // Insert the new tokens
- if($(input).data("settings").tokenLimit == null || token_count < $(input).data("settings").tokenLimit) {
- insert_token(item);
- // Remove the placeholder so it's not seen after you've added a token
- input_box.attr("placeholder", null)
- checkTokenLimit();
- }
-
- // Clear input box
- input_box.val("");
-
- // Don't show the help dropdown, they've got the idea
- hide_dropdown();
-
- // Execute the onAdd callback if defined
- if($.isFunction(callback)) {
- callback.call(hidden_input,item);
- }
- }
-
- // Select a token in the token list
- function select_token (token) {
- if (!$(input).data("settings").disabled) {
- token.addClass($(input).data("settings").classes.selectedToken);
- selected_token = token.get(0);
-
- // Hide input box
- input_box.val("");
-
- // Hide dropdown if it is visible (eg if we clicked to select token)
- hide_dropdown();
- }
- }
-
- // Deselect a token in the token list
- function deselect_token (token, position) {
- token.removeClass($(input).data("settings").classes.selectedToken);
- selected_token = null;
-
- if(position === POSITION.BEFORE) {
- input_token.insertBefore(token);
- selected_token_index--;
- } else if(position === POSITION.AFTER) {
- input_token.insertAfter(token);
- selected_token_index++;
- } else {
- input_token.appendTo(token_list);
- selected_token_index = token_count;
- }
-
- // Show the input box and give it focus again
- focus_with_timeout(input_box);
- }
-
- // Toggle selection of a token in the token list
- function toggle_select_token(token) {
- var previous_selected_token = selected_token;
-
- if(selected_token) {
- deselect_token($(selected_token), POSITION.END);
- }
-
- if(previous_selected_token === token.get(0)) {
- deselect_token(token, POSITION.END);
- } else {
- select_token(token);
- }
- }
-
- // Delete a token from the token list
- function delete_token (token) {
- // Remove the id from the saved list
- var token_data = $.data(token.get(0), "tokeninput");
- var callback = $(input).data("settings").onDelete;
-
- var index = token.prevAll().length;
- if(index > selected_token_index) index--;
-
- // Delete the token
- token.remove();
- selected_token = null;
-
- // Show the input box and give it focus again
- focus_with_timeout(input_box);
-
- // Remove this token from the saved list
- saved_tokens = saved_tokens.slice(0,index).concat(saved_tokens.slice(index+1));
- if (saved_tokens.length == 0) {
- input_box.attr("placeholder", settings.placeholder)
- }
- if(index < selected_token_index) selected_token_index--;
-
- // Update the hidden input
- update_hidden_input(saved_tokens, hidden_input);
-
- token_count -= 1;
-
- if($(input).data("settings").tokenLimit !== null) {
- input_box
- .show()
- .val("");
- focus_with_timeout(input_box);
- }
-
- // Execute the onDelete callback if defined
- if($.isFunction(callback)) {
- callback.call(hidden_input,token_data);
- }
- }
-
- // Update the hidden input box value
- function update_hidden_input(saved_tokens, hidden_input) {
- var token_values = $.map(saved_tokens, function (el) {
- if(typeof $(input).data("settings").tokenValue == 'function')
- return $(input).data("settings").tokenValue.call(this, el);
-
- return el[$(input).data("settings").tokenValue];
- });
- hidden_input.val(token_values.join($(input).data("settings").tokenDelimiter));
-
- }
-
- // Hide and clear the results dropdown
- function hide_dropdown () {
- dropdown.hide().empty();
- selected_dropdown_item = null;
- }
-
- function show_dropdown() {
- dropdown
- .css({
- position: "absolute",
- top: $(token_list).offset().top + $(token_list).height(),
- left: $(token_list).offset().left,
- width: $(token_list).width(),
- 'z-index': $(input).data("settings").zindex
- })
- .show();
- }
-
- function show_dropdown_searching () {
- if($(input).data("settings").searchingText) {
- dropdown.html("
" + escapeHTML($(input).data("settings").searchingText) + "
");
- show_dropdown();
- }
- }
-
- function show_dropdown_hint () {
- if($(input).data("settings").hintText) {
- dropdown.html("
" + escapeHTML($(input).data("settings").hintText) + "
");
- show_dropdown();
- }
- }
-
- var regexp_special_chars = new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]', 'g');
- function regexp_escape(term) {
- return term.replace(regexp_special_chars, '\\$&');
- }
-
- // Highlight the query part of the search term
- function highlight_term(value, term) {
- return value.replace(
- new RegExp(
- "(?![^&;]+;)(?!<[^<>]*)(" + regexp_escape(term) + ")(?![^<>]*>)(?![^&;]+;)",
- "gi"
- ), function(match, p1) {
- return "
" + escapeHTML(p1) + " ";
- }
- );
- }
-
- function find_value_and_highlight_term(template, value, term) {
- return template.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + regexp_escape(value) + ")(?![^<>]*>)(?![^&;]+;)", "g"), highlight_term(value, term));
- }
-
- // Populate the results dropdown with some results
- function populate_dropdown (query, results) {
- if(results && results.length) {
- dropdown.empty();
- var dropdown_ul = $("
")
- .appendTo(dropdown)
- .mouseover(function (event) {
- select_dropdown_item($(event.target).closest("li"));
- })
- .mousedown(function (event) {
- add_token($(event.target).closest("li").data("tokeninput"));
- hidden_input.change();
- return false;
- })
- .hide();
-
- if ($(input).data("settings").resultsLimit && results.length > $(input).data("settings").resultsLimit) {
- results = results.slice(0, $(input).data("settings").resultsLimit);
- }
-
- $.each(results, function(index, value) {
- var this_li = $(input).data("settings").resultsFormatter(value);
-
- this_li = find_value_and_highlight_term(this_li ,value[$(input).data("settings").propertyToSearch], query);
-
- this_li = $(this_li).appendTo(dropdown_ul);
-
- if(index % 2) {
- this_li.addClass($(input).data("settings").classes.dropdownItem);
- } else {
- this_li.addClass($(input).data("settings").classes.dropdownItem2);
- }
-
- if(index === 0) {
- select_dropdown_item(this_li);
- }
-
- $.data(this_li.get(0), "tokeninput", value);
- });
-
- show_dropdown();
-
- if($(input).data("settings").animateDropdown) {
- dropdown_ul.slideDown("fast");
- } else {
- dropdown_ul.show();
- }
- } else {
- if($(input).data("settings").noResultsText) {
- dropdown.html("" + escapeHTML($(input).data("settings").noResultsText) + "
");
- show_dropdown();
- }
- }
- }
-
- // Highlight an item in the results dropdown
- function select_dropdown_item (item) {
- if(item) {
- if(selected_dropdown_item) {
- deselect_dropdown_item($(selected_dropdown_item));
- }
-
- item.addClass($(input).data("settings").classes.selectedDropdownItem);
- selected_dropdown_item = item.get(0);
- }
- }
-
- // Remove highlighting from an item in the results dropdown
- function deselect_dropdown_item (item) {
- item.removeClass($(input).data("settings").classes.selectedDropdownItem);
- selected_dropdown_item = null;
- }
-
- // Do a search and show the "searching" dropdown if the input is longer
- // than $(input).data("settings").minChars
- function do_search() {
- var query = input_box.val();
-
- if(query && query.length) {
- if(selected_token) {
- deselect_token($(selected_token), POSITION.AFTER);
- }
-
- if(query.length >= $(input).data("settings").minChars) {
- show_dropdown_searching();
- clearTimeout(timeout);
-
- timeout = setTimeout(function(){
- run_search(query);
- }, $(input).data("settings").searchDelay);
- } else {
- hide_dropdown();
- }
- }
- }
-
- // Do the actual search
- function run_search(query) {
- var cache_key = query + computeURL();
- var cached_results = cache.get(cache_key);
- if(cached_results) {
- if ($.isFunction($(input).data("settings").onCachedResult)) {
- cached_results = $(input).data("settings").onCachedResult.call(hidden_input, cached_results);
- }
- populate_dropdown(query, cached_results);
- } else {
- // Are we doing an ajax search or local data search?
- if($(input).data("settings").url) {
- var url = computeURL();
- // Extract exisiting get params
- var ajax_params = {};
- ajax_params.data = {};
- if(url.indexOf("?") > -1) {
- var parts = url.split("?");
- ajax_params.url = parts[0];
-
- var param_array = parts[1].split("&");
- $.each(param_array, function (index, value) {
- var kv = value.split("=");
- ajax_params.data[kv[0]] = kv[1];
- });
- } else {
- ajax_params.url = url;
- }
-
- // Prepare the request
- ajax_params.data[$(input).data("settings").queryParam] = query;
- ajax_params.type = $(input).data("settings").method;
- ajax_params.dataType = $(input).data("settings").contentType;
- if($(input).data("settings").crossDomain) {
- ajax_params.dataType = "jsonp";
- }
-
- // Attach the success callback
- ajax_params.success = function(results) {
- cache.add(cache_key, $(input).data("settings").jsonContainer ? results[$(input).data("settings").jsonContainer] : results);
- if($.isFunction($(input).data("settings").onResult)) {
- results = $(input).data("settings").onResult.call(hidden_input, results);
- }
-
- // only populate the dropdown if the results are associated with the active search query
- if(input_box.val() === query) {
- populate_dropdown(query, $(input).data("settings").jsonContainer ? results[$(input).data("settings").jsonContainer] : results);
- }
- };
-
- // Make the request
- $.ajax(ajax_params);
- } else if($(input).data("settings").local_data) {
- // Do the search through local data
- var results = $.grep($(input).data("settings").local_data, function (row) {
- return row[$(input).data("settings").propertyToSearch].toLowerCase().indexOf(query.toLowerCase()) > -1;
- });
-
- cache.add(cache_key, results);
- if($.isFunction($(input).data("settings").onResult)) {
- results = $(input).data("settings").onResult.call(hidden_input, results);
- }
- populate_dropdown(query, results);
- }
- }
- }
-
- // compute the dynamic URL
- function computeURL() {
- var url = $(input).data("settings").url;
- if(typeof $(input).data("settings").url == 'function') {
- url = $(input).data("settings").url.call($(input).data("settings"));
- }
- return url;
- }
-
- // Bring browser focus to the specified object.
- // Use of setTimeout is to get around an IE bug.
- // (See, e.g., http://stackoverflow.com/questions/2600186/focus-doesnt-work-in-ie)
- //
- // obj: a jQuery object to focus()
- function focus_with_timeout(obj) {
- setTimeout(function() { obj.focus(); }, 50);
- }
-
-};
-
-// Really basic cache for the results
-$.TokenList.Cache = function (options) {
- var settings = $.extend({
- max_size: 500
- }, options);
-
- var data = {};
- var size = 0;
-
- var flush = function () {
- data = {};
- size = 0;
- };
-
- this.add = function (query, results) {
- if(size > settings.max_size) {
- flush();
- }
-
- if(!data[query]) {
- size += 1;
- }
-
- data[query] = results;
- };
-
- this.get = function (query) {
- return data[query];
- };
-};
-}(jQuery));
-
diff --git a/app/assets/Archive/javascripts/lib/bootstrap-datetimepicker.js b/app/assets/Archive/javascripts/lib/bootstrap-datetimepicker.js
deleted file mode 100644
index 4c5e6c9d..00000000
--- a/app/assets/Archive/javascripts/lib/bootstrap-datetimepicker.js
+++ /dev/null
@@ -1,1164 +0,0 @@
-/**
- * @license
- * =========================================================
- * bootstrap-datetimepicker.js
- * http://www.eyecon.ro/bootstrap-datepicker
- * =========================================================
- * Copyright 2012 Stefan Petre
- *
- * Contributions:
- * - Andrew Rowls
- * - Thiago de Arruda
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * =========================================================
- */
-
-(function($) {
-
- // Picker object
- var smartPhone = (window.orientation != undefined);
- var DateTimePicker = function(element, options) {
- this.id = dpgId++;
- this.init(element, options);
- };
-
- DateTimePicker.prototype = {
- constructor: DateTimePicker,
-
- init: function(element, options) {
- var icon;
- if (!(options.pickTime || options.pickDate))
- throw new Error('Must choose at least one picker');
- this.options = options;
- this.$element = $(element);
- this.language = options.language in dates ? options.language : 'en'
- this.pickDate = options.pickDate;
- this.pickTime = options.pickTime;
- this.isInput = this.$element.is('input');
- // this.component = this.$element.is('.input-prepend') ? this.$element.find('.iconbtn') : false;
- this.component = this.$element.is('.input-append') ? this.$element.find('.iconbtn') : false;
- this.clearDate = this.$element.is('.input-append') ? this.$element.find('.clearDate') : false;
- this.format = options.format;
- if (!this.format) {
- if (this.isInput) this.format = this.$element.data('format');
- else this.format = this.$element.find('input').data('format');
- if (!this.format) this.format = 'MM/dd/yyyy';
- }
- this._compileFormat();
- if (this.component) {
- icon = this.component.find('i');
- }
- if (this.pickTime) {
- if (icon && icon.length) this.timeIcon = icon.data('time-icon');
- if (!this.timeIcon) this.timeIcon = 'icon-time';
- icon.addClass(this.timeIcon);
- }
- if (this.pickDate) {
- if (icon && icon.length) this.dateIcon = icon.data('date-icon');
- if (!this.dateIcon) this.dateIcon = 'icon-calendar';
- icon.removeClass(this.timeIcon);
- icon.addClass(this.dateIcon);
- }
- this.widget = $(getTemplate(this.timeIcon, options.pickDate, options.pickTime, options.pick12HourFormat)).appendTo('body');
- this.minViewMode = options.minViewMode||this.$element.data('date-minviewmode')||0;
- if (typeof this.minViewMode === 'string') {
- switch (this.minViewMode) {
- case 'months':
- this.minViewMode = 1;
- break;
- case 'years':
- this.minViewMode = 2;
- break;
- default:
- this.minViewMode = 0;
- break;
- }
- }
- this.viewMode = options.viewMode||this.$element.data('date-viewmode')||0;
- if (typeof this.viewMode === 'string') {
- switch (this.viewMode) {
- case 'months':
- this.viewMode = 1;
- break;
- case 'years':
- this.viewMode = 2;
- break;
- default:
- this.viewMode = 0;
- break;
- }
- }
- this.startViewMode = this.viewMode;
- this.weekStart = options.weekStart||this.$element.data('date-weekstart')||0;
- this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
- this.fillDow();
- this.fillMonths();
- this.fillHours();
- this.fillMinutes();
- this.fillSeconds();
- this.update();
- this.showMode();
- this._attachDatePickerEvents();
- },
-
- show: function(e) {
- this.widget.show();
- this.height = this.component ? this.component.outerHeight() : this.$element.outerHeight();
- this.width = this.component ? this.component.outerWidth() : this.$element.outerWidth();
- this.place();
- this.$element.trigger({
- type: 'show',
- date: this._date
- });
- this._attachDatePickerGlobalEvents();
- if (e) {
- e.stopPropagation();
- e.preventDefault();
- }
- },
-
- hide: function() {
- // Ignore event if in the middle of a picker transition
- var collapse = this.widget.find('.collapse')
- for (var i = 0; i < collapse.length; i++) {
- var collapseData = collapse.eq(i).data('collapse');
- if (collapseData && collapseData.transitioning)
- return;
- }
- this.widget.hide();
- this.viewMode = this.startViewMode;
- this.showMode();
- // this.set();
- this.$element.trigger({
- type: 'hide',
- date: this._date
- });
- this.actions.showPicker.call(this);
- this._detachDatePickerGlobalEvents();
- },
-
- set: function() {
- var formatted = '';
- if (!this._unset) formatted = this.formatDate(this._date);
- if (!this.isInput) {
- if (this.component){
- var input = this.$element.find('input');
- input.val(formatted);
- this._resetMaskPos(input);
- }
- this.$element.data('date', formatted);
- } else {
- this.$element.val(formatted);
- this._resetMaskPos(this.$element);
- }
- },
-
- setValue: function(newDate) {
- if (!newDate) {
- this._unset = true;
- } else {
- this._unset = false;
- }
- if (typeof newDate === 'string') {
- this._date = this.parseDate(newDate);
- } else {
- this._date = new Date(newDate);
- }
- this.set();
- this.viewDate = UTCDate(this._date.getUTCFullYear(), this._date.getUTCMonth(), 1, 0, 0, 0, 0);
- this.fillDate();
- this.fillTime();
- },
-
- getDate: function() {
- if (this._unset) return null;
- return new Date(this._date.valueOf());
- },
-
- setDate: function(date) {
- if (!date) this.setValue(null);
- else this.setValue(date.valueOf());
- },
-
- getLocalDate: function() {
- if (this._unset) return null;
- var d = this._date;
- return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(),
- d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
- },
-
- setLocalDate: function(localDate) {
- if (!localDate) this.setValue(null);
- else
- this.setValue(Date.UTC(
- localDate.getFullYear(),
- localDate.getMonth(),
- localDate.getDate(),
- localDate.getHours(),
- localDate.getMinutes(),
- localDate.getSeconds(),
- localDate.getMilliseconds()));
- },
-
- place: function(){
- var offset = this.component ? this.component.offset() : this.$element.offset(),
- input = this.$element.find('input');
- this.widget.css({
- top: offset.top + this.height,
- left: offset.left - input.outerWidth() - this.width,
- });
- },
-
- notifyChange: function(){
- this.$element.trigger({
- type: 'changeDate',
- date: this.getDate(),
- localDate: this.getLocalDate()
- });
- },
-
- update: function(newDate){
- var dateStr = newDate;
- if (!dateStr) {
- if (this.isInput) {
- dateStr = this.$element.val();
- } else {
- dateStr = this.$element.find('input').val();
- }
- if (!dateStr) {
- var tmp = new Date()
- this._date = UTCDate(tmp.getFullYear(),
- tmp.getMonth(),
- tmp.getDate(),
- tmp.getHours(),
- tmp.getMinutes(),
- tmp.getSeconds(),
- tmp.getMilliseconds())
- } else {
- this._date = this.parseDate(dateStr);
- }
- }
- this.viewDate = UTCDate(this._date.getUTCFullYear(), this._date.getUTCMonth(), 1, 0, 0, 0, 0);
- this.fillDate();
- this.fillTime();
- },
-
- fillDow: function() {
- var dowCnt = this.weekStart;
- var html = '';
- while (dowCnt < this.weekStart + 7) {
- html += '' + dates[this.language].daysMin[(dowCnt++) % 7] + ' ';
- }
- html += ' ';
- this.widget.find('.datepicker-days thead').append(html);
- },
-
- fillMonths: function() {
- var html = '';
- var i = 0
- while (i < 12) {
- html += '' + dates[this.language].monthsShort[i++] + ' ';
- }
- this.widget.find('.datepicker-months td').append(html);
- },
-
- fillDate: function() {
- var year = this.viewDate.getUTCFullYear();
- var month = this.viewDate.getUTCMonth();
- var currentDate = UTCDate(
- this._date.getUTCFullYear(),
- this._date.getUTCMonth(),
- this._date.getUTCDate(),
- 0, 0, 0, 0
- );
- this.widget.find('.datepicker-days th:eq(1)').text(
- dates[this.language].months[month] + ' ' + year);
- var prevMonth = UTCDate(year, month-1, 28, 0, 0, 0, 0);
- var day = DPGlobal.getDaysInMonth(
- prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
- prevMonth.setUTCDate(day);
- prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7);
- var nextMonth = new Date(prevMonth.valueOf());
- nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
- nextMonth = nextMonth.valueOf();
- var html = [];
- var clsName;
- while (prevMonth.valueOf() < nextMonth) {
- if (prevMonth.getUTCDay() === this.weekStart) {
- html.push('');
- }
- clsName = '';
- if (prevMonth.getUTCFullYear() < year ||
- (prevMonth.getUTCFullYear() == year &&
- prevMonth.getUTCMonth() < month)) {
- clsName += ' old';
- } else if (prevMonth.getUTCFullYear() > year ||
- (prevMonth.getUTCFullYear() == year &&
- prevMonth.getUTCMonth() > month)) {
- clsName += ' new';
- }
- if (prevMonth.valueOf() === currentDate.valueOf()) {
- clsName += ' active';
- }
- html.push('' + prevMonth.getUTCDate() + ' ');
- if (prevMonth.getUTCDay() === this.weekEnd) {
- html.push(' ');
- }
- prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
- }
- this.widget.find('.datepicker-days tbody').empty().append(html.join(''));
- var currentYear = this._date.getUTCFullYear();
-
- var months = this.widget.find('.datepicker-months').find(
- 'th:eq(1)').text(year).end().find('span').removeClass('active');
- if (currentYear === year) {
- months.eq(this._date.getUTCMonth()).addClass('active');
- }
-
- html = '';
- year = parseInt(year/10, 10) * 10;
- var yearCont = this.widget.find('.datepicker-years').find(
- 'th:eq(1)').text(year + '-' + (year + 9)).end().find('td');
- year -= 1;
- for (var i = -1; i < 11; i++) {
- html += '' + year + ' ';
- year += 1;
- }
- yearCont.html(html);
- },
-
- fillHours: function() {
- var table = this.widget.find(
- '.timepicker .timepicker-hours table');
- table.parent().hide();
- var html = '';
- if (this.options.pick12HourFormat) {
- var current = 1;
- for (var i = 0; i < 3; i += 1) {
- html += '';
- for (var j = 0; j < 4; j += 1) {
- var c = current.toString();
- html += '' + padLeft(c, 2, '0') + ' ';
- current++;
- }
- html += ' '
- }
- } else {
- var current = 0;
- for (var i = 0; i < 6; i += 1) {
- html += '';
- for (var j = 0; j < 4; j += 1) {
- var c = current.toString();
- html += '' + padLeft(c, 2, '0') + ' ';
- current++;
- }
- html += ' '
- }
- }
- table.html(html);
- },
-
- fillMinutes: function() {
- var table = this.widget.find(
- '.timepicker .timepicker-minutes table');
- table.parent().hide();
- var html = '';
- var current = 0;
- for (var i = 0; i < 3; i++) {
- html += '';
- for (var j = 0; j < 4; j += 1) {
- var c = current.toString();
- html += '' + padLeft(c, 2, '0') + ' ';
- current += 5;
- }
- html += ' ';
- }
- table.html(html);
- },
-
- fillSeconds: function() {
- var table = this.widget.find(
- '.timepicker .timepicker-seconds table');
- table.parent().hide();
- var html = '';
- var current = 0;
- for (var i = 0; i < 5; i++) {
- html += '';
- for (var j = 0; j < 4; j += 1) {
- var c = current.toString();
- html += '' + padLeft(c, 2, '0') + ' ';
- current += 3;
- }
- html += ' ';
- }
- table.html(html);
- },
-
- fillTime: function() {
- if (!this._date)
- return;
- var timeComponents = this.widget.find('.timepicker span[data-time-component]');
- var table = timeComponents.closest('table');
- var is12HourFormat = this.options.pick12HourFormat;
- var hour = this._date.getUTCHours();
- var period = 'AM';
- if (is12HourFormat) {
- if (hour >= 12) period = 'PM';
- if (hour === 0) hour = 12;
- else if (hour != 12) hour = hour % 12;
- this.widget.find(
- '.timepicker [data-action=togglePeriod]').text(period);
- }
- hour = padLeft(hour.toString(), 2, '0');
- var minute = padLeft(this._date.getUTCMinutes().toString(), 2, '0');
- var second = padLeft(this._date.getUTCSeconds().toString(), 2, '0');
- timeComponents.filter('[data-time-component=hours]').text(hour);
- timeComponents.filter('[data-time-component=minutes]').text(minute);
- timeComponents.filter('[data-time-component=seconds]').text(second);
- },
-
- click: function(e) {
- e.stopPropagation();
- e.preventDefault();
- var target = $(e.target).closest('span, td, th');
- if (target.length === 1) {
- switch(target[0].nodeName.toLowerCase()) {
- case 'th':
- switch(target[0].className) {
- case 'switch':
- this.showMode(1);
- break;
- case 'prev':
- case 'next':
- var vd = this.viewDate;
- var navFnc = DPGlobal.modes[this.viewMode].navFnc;
- var step = DPGlobal.modes[this.viewMode].navStep;
- if (target[0].className === 'prev') step = step * -1;
- vd['set' + navFnc](vd['get' + navFnc]() + step);
- this.fillDate();
- this.set();
- break;
- }
- break;
- case 'span':
- if (target.is('.month')) {
- var month = target.parent().find('span').index(target);
- this.viewDate.setUTCMonth(month);
- } else {
- var year = parseInt(target.text(), 10) || 0;
- this.viewDate.setUTCFullYear(year);
- }
- if (this.viewMode !== 0) {
- this._date = UTCDate(
- this.viewDate.getUTCFullYear(),
- this.viewDate.getUTCMonth(),
- this.viewDate.getUTCDate(),
- this._date.getUTCHours(),
- this._date.getUTCMinutes(),
- this._date.getUTCSeconds(),
- this._date.getUTCMilliseconds()
- );
- this.notifyChange();
- }
- this.showMode(-1);
- this.fillDate();
- this.set();
- break;
- case 'td':
- if (target.is('.day')) {
- var day = parseInt(target.text(), 10) || 1;
- var month = this.viewDate.getUTCMonth();
- var year = this.viewDate.getUTCFullYear();
- if (target.is('.old')) {
- if (month === 0) {
- month = 11;
- year -= 1;
- } else {
- month -= 1;
- }
- } else if (target.is('.new')) {
- if (month == 11) {
- month = 0;
- year += 1;
- } else {
- month += 1;
- }
- }
- this._date = UTCDate(
- year, month, day,
- this._date.getUTCHours(),
- this._date.getUTCMinutes(),
- this._date.getUTCSeconds(),
- this._date.getUTCMilliseconds()
- );
- this.viewDate = UTCDate(
- year, month, Math.min(28, day) , 0, 0, 0, 0);
- this.fillDate();
- this.set();
- this.notifyChange();
- this.widget.hide();
- }
- break;
- }
- }
- },
-
- actions: {
- incrementHours: function(e) {
- this._date.setUTCHours(this._date.getUTCHours() + 1);
- },
-
- incrementMinutes: function(e) {
- this._date.setUTCMinutes(this._date.getUTCMinutes() + 1);
- },
-
- // incrementSeconds: function(e) {
- // this._date.setUTCSeconds(this._date.getUTCSeconds() + 1);
- // },
-
- decrementHours: function(e) {
- this._date.setUTCHours(this._date.getUTCHours() - 1);
- },
-
- decrementMinutes: function(e) {
- this._date.setUTCMinutes(this._date.getUTCMinutes() - 1);
- },
-
- // decrementSeconds: function(e) {
- // this._date.setUTCSeconds(this._date.getUTCSeconds() - 1);
- // },
-
- togglePeriod: function(e) {
- var hour = this._date.getUTCHours();
- if (hour >= 12) hour -= 12;
- else hour += 12;
- this._date.setUTCHours(hour);
- },
-
- showPicker: function() {
- this.widget.find('.timepicker > div:not(.timepicker-picker)').hide();
- this.widget.find('.timepicker .timepicker-picker').show();
- },
-
- showHours: function() {
- this.widget.find('.timepicker .timepicker-picker').hide();
- this.widget.find('.timepicker .timepicker-hours').show();
- },
-
- showMinutes: function() {
- this.widget.find('.timepicker .timepicker-picker').hide();
- this.widget.find('.timepicker .timepicker-minutes').show();
- },
-
- // showSeconds: function() {
- // this.widget.find('.timepicker .timepicker-picker').hide();
- // this.widget.find('.timepicker .timepicker-seconds').show();
- // },
-
- selectHour: function(e) {
- var tgt = $(e.target);
- var value = parseInt(tgt.text(), 10);
- if (this.options.pick12HourFormat) {
- var current = this._date.getUTCHours();
- if (current >= 12) {
- if (value != 12) value = (value + 12) % 24;
- } else {
- if (value === 12) value = 0;
- else value = value % 12;
- }
- }
- this._date.setUTCHours(value);
- this.actions.showPicker.call(this);
- },
-
- selectMinute: function(e) {
- var tgt = $(e.target);
- var value = parseInt(tgt.text(), 10);
- this._date.setUTCMinutes(value);
- this.actions.showPicker.call(this);
- },
-
- // selectSecond: function(e) {
- // var tgt = $(e.target);
- // var value = parseInt(tgt.text(), 10);
- // this._date.setUTCSeconds(value);
- // this.actions.showPicker.call(this);
- // }
- },
-
- doAction: function(e) {
- e.stopPropagation();
- e.preventDefault();
- if (!this._date) this._date = UTCDate(1970, 0, 0, 0, 0, 0, 0);
- var action = $(e.currentTarget).data('action');
- var rv = this.actions[action].apply(this, arguments);
- this.set();
- this.fillTime();
- this.notifyChange();
- return rv;
- },
-
- stopEvent: function(e) {
- e.stopPropagation();
- e.preventDefault();
- },
-
- // part of the following code was taken from
- // http://cloud.github.com/downloads/digitalBush/jquery.maskedinput/jquery.maskedinput-1.3.js
- keydown: function(e) {
- var self = this, k = e.which, input = $(e.target);
- if (k == 8 || k == 46) {
- // backspace and delete cause the maskPosition
- // to be recalculated
- setTimeout(function() {
- self._resetMaskPos(input);
- });
- }
- },
-
- keypress: function(e) {
- var k = e.which;
- if (k == 8 || k == 46) {
- // For those browsers which will trigger
- // keypress on backspace/delete
- return;
- }
- var input = $(e.target);
- var c = String.fromCharCode(k);
- var val = input.val() || '';
- val += c;
- var mask = this._mask[this._maskPos];
- if (!mask) {
- return false;
- }
- if (mask.end != val.length) {
- return;
- }
- if (!mask.pattern.test(val.slice(mask.start))) {
- val = val.slice(0, val.length - 1);
- while ((mask = this._mask[this._maskPos]) && mask.character) {
- val += mask.character;
- // advance mask position past static
- // part
- this._maskPos++;
- }
- val += c;
- if (mask.end != val.length) {
- input.val(val);
- return false;
- } else {
- if (!mask.pattern.test(val.slice(mask.start))) {
- input.val(val.slice(0, mask.start));
- return false;
- } else {
- input.val(val);
- this._maskPos++;
- return false;
- }
- }
- } else {
- this._maskPos++;
- }
- },
-
- change: function(e) {
- var input = $(e.target);
- var val = input.val();
- if (this._formatPattern.test(val)) {
- this.update();
- this.setValue(this._date.getTime());
- this.notifyChange();
- this.set();
- } else if (val && val.trim()) {
- this.setValue(this._date.getTime());
- if (this._date) this.set();
- else input.val('');
- } else {
- if (this._date) {
- this.setValue(null);
- // unset the date when the input is
- // erased
- this.notifyChange();
- }
- }
- this._resetMaskPos(input);
- },
-
- clear: function(e) {
- if (this.isInput) this.$element.val(null);
- else this.$element.find('input').val(null);
- this.notifyChange();
- },
-
- showMode: function(dir) {
- if (dir) {
- this.viewMode = Math.max(this.minViewMode, Math.min(
- 2, this.viewMode + dir));
- }
- this.widget.find('.datepicker > div').hide().filter(
- '.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
- },
-
- destroy: function() {
- this._detachDatePickerEvents();
- this._detachDatePickerGlobalEvents();
- this.widget.remove();
- this.$element.removeData('datetimepicker');
- this.component.removeData('datetimepicker');
- },
-
- formatDate: function(d) {
- return this.format.replace(formatReplacer, function(match) {
- var methodName, property, rv, len = match.length;
- if (match === 'ms')
- len = 1;
- property = dateFormatComponents[match].property
- if (property === 'Hours12') {
- rv = d.getUTCHours();
- if (rv === 0) rv = 12;
- else if (rv !== 12) rv = rv % 12;
- } else if (property === 'Period12') {
- if (d.getUTCHours() >= 12) return 'PM';
- else return 'AM';
- } else {
- methodName = 'get' + property;
- rv = d[methodName]();
- }
- if (methodName === 'getUTCMonth') rv = rv + 1;
- if (methodName === 'getUTCYear') rv = rv + 1900 - 2000;
- return padLeft(rv.toString(), len, '0');
- });
- },
-
- parseDate: function(str) {
- var match, i, property, methodName, value, parsed = {};
- if (!(match = this._formatPattern.exec(str)))
- return null;
- for (i = 1; i < match.length; i++) {
- property = this._propertiesByIndex[i];
- if (!property)
- continue;
- value = match[i];
- if (/^\d+$/.test(value))
- value = parseInt(value, 10);
- parsed[property] = value;
- }
- return this._finishParsingDate(parsed);
- },
-
- _resetMaskPos: function(input) {
- var val = input.val();
- for (var i = 0; i < this._mask.length; i++) {
- if (this._mask[i].end > val.length) {
- // If the mask has ended then jump to
- // the next
- this._maskPos = i;
- break;
- } else if (this._mask[i].end === val.length) {
- this._maskPos = i + 1;
- break;
- }
- }
- },
-
- _finishParsingDate: function(parsed) {
- var year, month, date, hours, minutes, seconds, milliseconds;
- year = parsed.UTCFullYear;
- if (parsed.UTCYear) year = 2000 + parsed.UTCYear;
- if (!year) year = 1970;
- if (parsed.UTCMonth) month = parsed.UTCMonth - 1;
- else month = 0;
- date = parsed.UTCDate || 1;
- hours = parsed.UTCHours || 0;
- minutes = parsed.UTCMinutes || 0;
- seconds = parsed.UTCSeconds || 0;
- milliseconds = parsed.UTCMilliseconds || 0;
- if (parsed.Hours12) {
- hours = parsed.Hours12;
- }
- if (parsed.Period12) {
- if (/pm/i.test(parsed.Period12)) {
- if (hours != 12) hours = (hours + 12) % 24;
- } else {
- hours = hours % 12;
- }
- }
- return UTCDate(year, month, date, hours, minutes, seconds, milliseconds);
- },
-
- _compileFormat: function () {
- var match, component, components = [], mask = [],
- str = this.format, propertiesByIndex = {}, i = 0, pos = 0;
- while (match = formatComponent.exec(str)) {
- component = match[0];
- if (component in dateFormatComponents) {
- i++;
- propertiesByIndex[i] = dateFormatComponents[component].property;
- components.push('\\s*' + dateFormatComponents[component].getPattern(
- this) + '\\s*');
- mask.push({
- pattern: new RegExp(dateFormatComponents[component].getPattern(
- this)),
- property: dateFormatComponents[component].property,
- start: pos,
- end: pos += component.length
- });
- }
- else {
- components.push(escapeRegExp(component));
- mask.push({
- pattern: new RegExp(escapeRegExp(component)),
- character: component,
- start: pos,
- end: ++pos
- });
- }
- str = str.slice(component.length);
- }
- this._mask = mask;
- this._maskPos = 0;
- this._formatPattern = new RegExp(
- '^\\s*' + components.join('') + '\\s*$');
- this._propertiesByIndex = propertiesByIndex;
- },
-
- _attachDatePickerEvents: function() {
- var self = this;
- // this handles date picker clicks
- this.widget.on('click', '.datepicker *', $.proxy(this.click, this));
- // this handles time picker clicks
- this.widget.on('click', '[data-action]', $.proxy(this.doAction, this));
- this.widget.on('mousedown', $.proxy(this.stopEvent, this));
- this.clearDate.on('click', $.proxy(this.clear, this));
- if (this.pickDate && this.pickTime) {
- this.widget.on('click.togglePicker', '.accordion-toggle', function(e) {
- e.stopPropagation();
- var $this = $(this);
- var $parent = $this.closest('ul');
- var expanded = $parent.find('.collapse.in');
- var closed = $parent.find('.collapse:not(.in)');
-
- if (expanded && expanded.length) {
- var collapseData = expanded.data('collapse');
- if (collapseData && collapseData.transitioning) return;
- expanded.collapse('hide');
- closed.collapse('show')
- $this.find('i').toggleClass(self.timeIcon + ' ' + self.dateIcon);
- self.$element.find('.iconbtn i').toggleClass(self.timeIcon + ' ' + self.dateIcon);
- }
- });
- }
- if (this.isInput) {
- this.$element.on({
- 'focus': $.proxy(this.show, this),
- 'blur': $.proxy(this.hide, this),
- 'change': $.proxy(this.change, this),
- });
- if (this.options.maskInput) {
- this.$element.on({
- 'keydown': $.proxy(this.keydown, this),
- 'keypress': $.proxy(this.keypress, this)
- });
- }
- } else {
- this.$element.on({
- 'focus': $.proxy(this.show, this),
- 'blur': $.proxy(this.hide, this),
- 'change': $.proxy(this.change, this),
- }, 'input');
- if (this.options.maskInput) {
- this.$element.on({
- 'keydown': $.proxy(this.keydown, this),
- 'keypress': $.proxy(this.keypress, this)
- }, 'input');
- }
- if (this.component){
- this.component.on('click', $.proxy(this.show, this));
- } else {
- this.$element.on('click', $.proxy(this.show, this));
- }
- }
- },
-
- _attachDatePickerGlobalEvents: function() {
- $(window).on(
- 'resize.datetimepicker' + this.id, $.proxy(this.place, this));
- if (!this.isInput) {
- $(document).on(
- 'mousedown.datetimepicker' + this.id, $.proxy(this.hide, this));
- }
- },
-
- _detachDatePickerEvents: function() {
- this.widget.off('click', '.datepicker *', this.click);
- this.widget.off('click', '[data-action]');
- this.widget.off('mousedown', this.stopEvent);
- if (this.pickDate && this.pickTime) {
- this.widget.off('click.togglePicker');
- }
- if (this.isInput) {
- this.$element.off({
- 'focus': this.show,
- 'change': this.change,
- });
- if (this.options.maskInput) {
- this.$element.off({
- 'keydown': this.keydown,
- 'keypress': this.keypress
- });
- }
- } else {
- this.$element.off({
- 'change': this.change,
- }, 'input');
- if (this.options.maskInput) {
- this.$element.off({
- 'keydown': this.keydown,
- 'keypress': this.keypress
- }, 'input');
- }
- if (this.component){
- this.component.off('click', this.show);
- } else {
- this.$element.off('click', this.show);
- }
- }
- },
-
- _detachDatePickerGlobalEvents: function () {
- $(window).off('resize.datetimepicker' + this.id);
- if (!this.isInput) {
- $(document).off('mousedown.datetimepicker' + this.id);
- }
- }
- };
-
- $.fn.datetimepicker = function ( option, val ) {
- return this.each(function () {
- var $this = $(this),
- data = $this.data('datetimepicker'),
- options = typeof option === 'object' && option;
- if (!data) {
- $this.data('datetimepicker', (data = new DateTimePicker(
- this, $.extend({}, $.fn.datetimepicker.defaults,options))));
- }
- if (typeof option === 'string') data[option](val);
- });
- };
-
- $.fn.datetimepicker.defaults = {
- maskInput: true,
- pickDate: true,
- pickTime: true,
- pick12HourFormat: false
- };
- $.fn.datetimepicker.Constructor = DateTimePicker;
- var dpgId = 0;
- var dates = $.fn.datetimepicker.dates = {
- en: {
- days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
- "Friday", "Saturday", "Sunday"],
- daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
- daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
- months: ["January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December"],
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
- "Aug", "Sep", "Oct", "Nov", "Dec"]
- }
- };
-
- var dateFormatComponents = {
- dd: {property: 'UTCDate', getPattern: function() { return '(0?[1-9]|[1-2][0-9]|3[0-1])\\b';}},
- MM: {property: 'UTCMonth', getPattern: function() {return '(0?[1-9]|1[0-2])\\b';}},
- yy: {property: 'UTCYear', getPattern: function() {return '(\\d{2})\\b'}},
- yyyy: {property: 'UTCFullYear', getPattern: function() {return '(\\d{4})\\b';}},
- hh: {property: 'UTCHours', getPattern: function() {return '(0?[0-9]|1[0-9]|2[0-3])\\b';}},
- mm: {property: 'UTCMinutes', getPattern: function() {return '(0?[0-9]|[1-5][0-9])\\b';}},
- ss: {property: 'UTCSeconds', getPattern: function() {return '(0?[0-9]|[1-5][0-9])\\b';}},
- ms: {property: 'UTCMilliseconds', getPattern: function() {return '([0-9]{1,3})\\b';}},
- HH: {property: 'Hours12', getPattern: function() {return '(0?[1-9]|1[0-2])\\b';}},
- PP: {property: 'Period12', getPattern: function() {return '(AM|PM|am|pm|Am|aM|Pm|pM)\\b';}}
- };
-
- var keys = [];
- for (var k in dateFormatComponents) keys.push(k);
- keys[keys.length - 1] += '\\b';
- keys.push('.');
-
- var formatComponent = new RegExp(keys.join('\\b|'));
- keys.pop();
- var formatReplacer = new RegExp(keys.join('\\b|'), 'g');
-
- function escapeRegExp(str) {
- // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
- return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
- }
-
- function padLeft(s, l, c) {
- if (l < s.length) return s;
- else return Array(l - s.length + 1).join(c || ' ') + s;
- }
-
- function getTemplate(timeIcon, pickDate, pickTime, is12Hours) {
- if (pickDate && pickTime) {
- return (
- ''
- );
- } else if (pickTime) {
- return (
- ''
- );
- } else {
- return (
- ''
- );
- }
- }
-
- function UTCDate() {
- return new Date(Date.UTC.apply(Date, arguments));
- }
-
- var DPGlobal = {
- modes: [
- {
- clsName: 'days',
- navFnc: 'UTCMonth',
- navStep: 1
- },
- {
- clsName: 'months',
- navFnc: 'UTCFullYear',
- navStep: 1
- },
- {
- clsName: 'years',
- navFnc: 'UTCFullYear',
- navStep: 10
- }],
- isLeapYear: function (year) {
- return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
- },
- getDaysInMonth: function (year, month) {
- return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
- },
- headTemplate:
- '' +
- '' +
- '‹ ' +
- ' ' +
- '› ' +
- ' ' +
- ' ',
- contTemplate: ' '
- };
- DPGlobal.template =
- '' +
- '
' +
- DPGlobal.headTemplate +
- ' ' +
- '
' +
- '
' +
- '' +
- '
' +
- DPGlobal.headTemplate +
- DPGlobal.contTemplate+
- '
'+
- '
'+
- ''+
- '
'+
- DPGlobal.headTemplate+
- DPGlobal.contTemplate+
- '
'+
- '
';
- var TPGlobal = {
- hourTemplate: ' ',
- minuteTemplate: ' ',
- // secondTemplate: ' ',
- };
- TPGlobal.getTemplate = function(is12Hours) {
- return (
- '' +
- '
' +
- '' +
- ' ' +
- ' ' +
- ' ' +
- // ' ' +
- // ' ' +
- // (is12Hours ? ' ' : '') +
- ' ' +
- '' +
- '' + TPGlobal.hourTemplate + ' ' +
- ': ' +
- '' + TPGlobal.minuteTemplate + ' ' +
- // ': ' +
- // '' + TPGlobal.secondTemplate + ' ' +
- (is12Hours ?
- ' ' +
- '' +
- ' ' +
- ' ' : '') +
- ' ' +
- '' +
- ' ' +
- ' ' +
- ' ' +
- // ' ' +
- // ' ' +
- // (is12Hours ? ' ' : '') +
- ' ' +
- '
' +
- '
' +
- ''+
- ''+
- // ''
- );
- }
-
-
-})(window.jQuery)
diff --git a/app/assets/Archive/javascripts/lib/contenteditable.js.erb b/app/assets/Archive/javascripts/lib/contenteditable.js.erb
deleted file mode 100644
index 9d35acbe..00000000
--- a/app/assets/Archive/javascripts/lib/contenteditable.js.erb
+++ /dev/null
@@ -1,56 +0,0 @@
-<%#= encoding: utf-8 %>
-$(function() {
- var content_holder, content;
- var selector = 'a[contenteditable="true"]';
- // prevent clicks inside editable area to fire
- // a click event on the body
- // and therefor saving our content before we even edit it
-
-$(".nav-tabs").find(".icons-pencil").click(function(){
- $(this).css({
- "display" : "none"
- })
- $(this).next().attr("contenteditable",true).addClass("edit");
- // $(selector).click(function(e) {
- // e.stopPropagation();
- // });
-
- // initialize the "save" function
- $(selector).focus(function(e) {
- content_holder = $(this);
- content = content_holder.html();
- // one click outside the editable area saves the content
- $(selector).keypress( function(e) {
- // but not if the content didn't change
- //alert('out!!');
- if(e.keyCode == 13){
- $(".nav-tabs>li>a").removeClass("edit");
- $(this).prev(".icons-pencil").css({
- "display" : "block"
- })
- e.preventDefault();
- // if ($(e.target).is(selector) || content == content_holder.html()) {
- // return;
- // }
-
- $.ajax({
- url: content_holder.data('edit-url'),
- type: 'POST',
- dataType: 'json',
- data: { body: content_holder.html() },
- success: function(json) {
- $(selector).attr("contenteditable",false)
- alert("<%= I18n.t('update.success_') %>");
- //content_holder.effect('highlight', {'color': '#0f0'}, 3000);
- },
- error: function() {
- alert("<%= I18n.t('update.fail') %>");
- //content_holder.effect('highlight', {'color': '#f00'}, 3000);
- content_holder.html(content);
- }
- });
- }
- });
- });
-});
-});
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/lib/date.format.js b/app/assets/Archive/javascripts/lib/date.format.js
deleted file mode 100644
index 3eb3d1cc..00000000
--- a/app/assets/Archive/javascripts/lib/date.format.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Date Format 1.2.3
- * (c) 2007-2009 Steven Levithan
- * MIT license
- *
- * Includes enhancements by Scott Trenda
- * and Kris Kowal
- *
- * Accepts a date, a mask, or a date and a mask.
- * Returns a formatted version of the given date.
- * The date defaults to the current date/time.
- * The mask defaults to dateFormat.masks.default.
- */
-
-var dateFormat = function () {
- var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
- timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
- timezoneClip = /[^-+\dA-Z]/g,
- pad = function (val, len) {
- val = String(val);
- len = len || 2;
- while (val.length < len) val = "0" + val;
- return val;
- };
-
- // Regexes and supporting functions are cached through closure
- return function (date, mask, utc) {
- var dF = dateFormat;
-
- // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
- if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
- mask = date;
- date = undefined;
- }
-
- // Passing date through Date applies Date.parse, if necessary
- date = date ? new Date(date) : new Date;
- if (isNaN(date)) throw SyntaxError("invalid date");
-
- mask = String(dF.masks[mask] || mask || dF.masks["default"]);
-
- // Allow setting the utc argument via the mask
- if (mask.slice(0, 4) == "UTC:") {
- mask = mask.slice(4);
- utc = true;
- }
-
- var _ = utc ? "getUTC" : "get",
- d = date[_ + "Date"](),
- D = date[_ + "Day"](),
- m = date[_ + "Month"](),
- y = date[_ + "FullYear"](),
- H = date[_ + "Hours"](),
- M = date[_ + "Minutes"](),
- s = date[_ + "Seconds"](),
- L = date[_ + "Milliseconds"](),
- o = utc ? 0 : date.getTimezoneOffset(),
- flags = {
- d: d,
- dd: pad(d),
- ddd: dF.i18n.dayNames[D],
- dddd: dF.i18n.dayNames[D + 7],
- m: m + 1,
- mm: pad(m + 1),
- mmm: dF.i18n.monthNames[m],
- mmmm: dF.i18n.monthNames[m + 12],
- yy: String(y).slice(2),
- yyyy: y,
- h: H % 12 || 12,
- hh: pad(H % 12 || 12),
- H: H,
- HH: pad(H),
- M: M,
- MM: pad(M),
- s: s,
- ss: pad(s),
- l: pad(L, 3),
- L: pad(L > 99 ? Math.round(L / 10) : L),
- t: H < 12 ? "a" : "p",
- tt: H < 12 ? "am" : "pm",
- T: H < 12 ? "A" : "P",
- TT: H < 12 ? "AM" : "PM",
- Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
- o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
- S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
- };
-
- return mask.replace(token, function ($0) {
- return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
- });
- };
-}();
-
-// Some common format strings
-dateFormat.masks = {
- "default": "ddd mmm dd yyyy HH:MM:ss",
- shortDate: "m/d/yy",
- mediumDate: "mmm d, yyyy",
- longDate: "mmmm d, yyyy",
- fullDate: "dddd, mmmm d, yyyy",
- shortTime: "h:MM TT",
- mediumTime: "h:MM:ss TT",
- longTime: "h:MM:ss TT Z",
- isoDate: "yyyy / mm / dd",
- isoTime: "HH:MM:ss",
- isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
- isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
-};
-
-// Internationalization strings
-dateFormat.i18n = {
- dayNames: [
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
- ],
- monthNames: [
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- ]
-};
-
-// For convenience...
-Date.prototype.format = function (mask, utc) {
- return dateFormat(this, mask, utc);
-};
-
diff --git a/app/assets/Archive/javascripts/lib/datepicker.js b/app/assets/Archive/javascripts/lib/datepicker.js
deleted file mode 100644
index 7c8d4b03..00000000
--- a/app/assets/Archive/javascripts/lib/datepicker.js
+++ /dev/null
@@ -1,891 +0,0 @@
-/**
- *
- * Date picker
- * Author: Stefan Petre www.eyecon.ro
- *
- * Dual licensed under the MIT and GPL licenses
- *
- */
-(function ($) {
- var DatePicker = function () {
- var ids = {},
- views = {
- years: 'datepickerViewYears',
- moths: 'datepickerViewMonths',
- days: 'datepickerViewDays'
- },
- tpl = {
- wrapper: '',
- head: [
- '',
- '',
- '',
- '',
- '<%=prev%> ',
- ' ',
- '<%=next%> ',
- ' ',
- '',
- '<%=week%> ',
- '<%=day1%> ',
- '<%=day2%> ',
- '<%=day3%> ',
- '<%=day4%> ',
- '<%=day5%> ',
- '<%=day6%> ',
- '<%=day7%> ',
- ' ',
- ' ',
- '
'
- ],
- space : '
',
- days: [
- '',
- '',
- '<%=weeks[0].week%> ',
- '<%=weeks[0].days[0].text%> ',
- '<%=weeks[0].days[1].text%> ',
- '<%=weeks[0].days[2].text%> ',
- '<%=weeks[0].days[3].text%> ',
- '<%=weeks[0].days[4].text%> ',
- '<%=weeks[0].days[5].text%> ',
- '<%=weeks[0].days[6].text%> ',
- ' ',
- '',
- '<%=weeks[1].week%> ',
- '<%=weeks[1].days[0].text%> ',
- '<%=weeks[1].days[1].text%> ',
- '<%=weeks[1].days[2].text%> ',
- '<%=weeks[1].days[3].text%> ',
- '<%=weeks[1].days[4].text%> ',
- '<%=weeks[1].days[5].text%> ',
- '<%=weeks[1].days[6].text%> ',
- ' ',
- '',
- '<%=weeks[2].week%> ',
- '<%=weeks[2].days[0].text%> ',
- '<%=weeks[2].days[1].text%> ',
- '<%=weeks[2].days[2].text%> ',
- '<%=weeks[2].days[3].text%> ',
- '<%=weeks[2].days[4].text%> ',
- '<%=weeks[2].days[5].text%> ',
- '<%=weeks[2].days[6].text%> ',
- ' ',
- '',
- '<%=weeks[3].week%> ',
- '<%=weeks[3].days[0].text%> ',
- '<%=weeks[3].days[1].text%> ',
- '<%=weeks[3].days[2].text%> ',
- '<%=weeks[3].days[3].text%> ',
- '<%=weeks[3].days[4].text%> ',
- '<%=weeks[3].days[5].text%> ',
- '<%=weeks[3].days[6].text%> ',
- ' ',
- '',
- '<%=weeks[4].week%> ',
- '<%=weeks[4].days[0].text%> ',
- '<%=weeks[4].days[1].text%> ',
- '<%=weeks[4].days[2].text%> ',
- '<%=weeks[4].days[3].text%> ',
- '<%=weeks[4].days[4].text%> ',
- '<%=weeks[4].days[5].text%> ',
- '<%=weeks[4].days[6].text%> ',
- ' ',
- '',
- '<%=weeks[5].week%> ',
- '<%=weeks[5].days[0].text%> ',
- '<%=weeks[5].days[1].text%> ',
- '<%=weeks[5].days[2].text%> ',
- '<%=weeks[5].days[3].text%> ',
- '<%=weeks[5].days[4].text%> ',
- '<%=weeks[5].days[5].text%> ',
- '<%=weeks[5].days[6].text%> ',
- ' ',
- ' '
- ],
- months: [
- '',
- '',
- '<%=data[0]%> ',
- '<%=data[1]%> ',
- '<%=data[2]%> ',
- '<%=data[3]%> ',
- ' ',
- '',
- '<%=data[4]%> ',
- '<%=data[5]%> ',
- '<%=data[6]%> ',
- '<%=data[7]%> ',
- ' ',
- '',
- '<%=data[8]%> ',
- '<%=data[9]%> ',
- '<%=data[10]%> ',
- '<%=data[11]%> ',
- ' ',
- ' '
- ]
- },
- defaults = {
- flat: false,
- starts: 1,
- prev: '◀',
- next: '▶',
- lastSel: false,
- mode: 'single',
- view: 'days',
- calendars: 1,
- format: 'Y-m-d',
- position: 'bottom',
- eventName: 'click',
- onRender: function(){return {};},
- onChange: function(){return true;},
- onShow: function(){return true;},
- onBeforeShow: function(){return true;},
- onHide: function(){return true;},
- locale: {
- days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
- daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
- daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
- weekMin: 'wk'
- }
- },
- fill = function(el) {
- var options = $(el).data('datepicker');
- var cal = $(el);
- var currentCal = Math.floor(options.calendars/2), date, data, dow, month, cnt = 0, week, days, indic, indic2, html, tblCal;
- cal.find('td>table tbody').remove();
- for (var i = 0; i < options.calendars; i++) {
- date = new Date(options.current);
- date.addMonths(-currentCal + i);
- tblCal = cal.find('table').eq(i+1);
- switch (tblCal[0].className) {
- case 'datepickerViewDays':
- dow = formatDate(date, 'B, Y');
- break;
- case 'datepickerViewMonths':
- dow = date.getFullYear();
- break;
- case 'datepickerViewYears':
- dow = (date.getFullYear()-6) + ' - ' + (date.getFullYear()+5);
- break;
- }
- tblCal.find('thead tr:first th:eq(1) span').text(dow);
- dow = date.getFullYear()-6;
- data = {
- data: [],
- className: 'datepickerYears'
- }
- for ( var j = 0; j < 12; j++) {
- data.data.push(dow + j);
- }
- html = tmpl(tpl.months.join(''), data);
- date.setDate(1);
- data = {weeks:[], test: 10};
- month = date.getMonth();
- var dow = (date.getDay() - options.starts) % 7;
- date.addDays(-(dow + (dow < 0 ? 7 : 0)));
- week = -1;
- cnt = 0;
- while (cnt < 42) {
- indic = parseInt(cnt/7,10);
- indic2 = cnt%7;
- if (!data.weeks[indic]) {
- week = date.getWeekNumber();
- data.weeks[indic] = {
- week: week,
- days: []
- };
- }
- data.weeks[indic].days[indic2] = {
- text: date.getDate(),
- classname: []
- };
- if (month != date.getMonth()) {
- data.weeks[indic].days[indic2].classname.push('datepickerNotInMonth');
- }
- if (date.getDay() == 0) {
- data.weeks[indic].days[indic2].classname.push('datepickerSunday');
- }
- if (date.getDay() == 6) {
- data.weeks[indic].days[indic2].classname.push('datepickerSaturday');
- }
- var fromUser = options.onRender(date);
- var val = date.valueOf();
- if (fromUser.selected || options.date == val || $.inArray(val, options.date) > -1 || (options.mode == 'range' && val >= options.date[0] && val <= options.date[1])) {
- data.weeks[indic].days[indic2].classname.push('datepickerSelected');
- }
- if (fromUser.disabled) {
- data.weeks[indic].days[indic2].classname.push('datepickerDisabled');
- }
- if (fromUser.className) {
- data.weeks[indic].days[indic2].classname.push(fromUser.className);
- }
- data.weeks[indic].days[indic2].classname = data.weeks[indic].days[indic2].classname.join(' ');
- cnt++;
- date.addDays(1);
- }
- html = tmpl(tpl.days.join(''), data) + html;
- data = {
- data: options.locale.monthsShort,
- className: 'datepickerMonths'
- };
- html = tmpl(tpl.months.join(''), data) + html;
- tblCal.append(html);
- }
- },
- parseDate = function (date, format) {
- if (date.constructor == Date) {
- return new Date(date);
- }
- var parts = date.split(/\W+/);
- var against = format.split(/\W+/), d, m, y, h, min, now = new Date();
- for (var i = 0; i < parts.length; i++) {
- switch (against[i]) {
- case 'd':
- case 'e':
- d = parseInt(parts[i],10);
- break;
- case 'm':
- m = parseInt(parts[i], 10)-1;
- break;
- case 'Y':
- case 'y':
- y = parseInt(parts[i], 10);
- y += y > 100 ? 0 : (y < 29 ? 2000 : 1900);
- break;
- case 'H':
- case 'I':
- case 'k':
- case 'l':
- h = parseInt(parts[i], 10);
- break;
- case 'P':
- case 'p':
- if (/pm/i.test(parts[i]) && h < 12) {
- h += 12;
- } else if (/am/i.test(parts[i]) && h >= 12) {
- h -= 12;
- }
- break;
- case 'M':
- min = parseInt(parts[i], 10);
- break;
- }
- }
- return new Date(
- y === undefined ? now.getFullYear() : y,
- m === undefined ? now.getMonth() : m,
- d === undefined ? now.getDate() : d,
- h === undefined ? now.getHours() : h,
- min === undefined ? now.getMinutes() : min,
- 0
- );
- },
- formatDate = function(date, format) {
- var m = date.getMonth();
- var d = date.getDate();
- var y = date.getFullYear();
- var wn = date.getWeekNumber();
- var w = date.getDay();
- var s = {};
- var hr = date.getHours();
- var pm = (hr >= 12);
- var ir = (pm) ? (hr - 12) : hr;
- var dy = date.getDayOfYear();
- if (ir == 0) {
- ir = 12;
- }
- var min = date.getMinutes();
- var sec = date.getSeconds();
- var parts = format.split(''), part;
- for ( var i = 0; i < parts.length; i++ ) {
- part = parts[i];
- switch (parts[i]) {
- case 'a':
- part = date.getDayName();
- break;
- case 'A':
- part = date.getDayName(true);
- break;
- case 'b':
- part = date.getMonthName();
- break;
- case 'B':
- part = date.getMonthName(true);
- break;
- case 'C':
- part = 1 + Math.floor(y / 100);
- break;
- case 'd':
- part = (d < 10) ? ("0" + d) : d;
- break;
- case 'e':
- part = d;
- break;
- case 'H':
- part = (hr < 10) ? ("0" + hr) : hr;
- break;
- case 'I':
- part = (ir < 10) ? ("0" + ir) : ir;
- break;
- case 'j':
- part = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy;
- break;
- case 'k':
- part = hr;
- break;
- case 'l':
- part = ir;
- break;
- case 'm':
- part = (m < 9) ? ("0" + (1+m)) : (1+m);
- break;
- case 'M':
- part = (min < 10) ? ("0" + min) : min;
- break;
- case 'p':
- case 'P':
- part = pm ? "PM" : "AM";
- break;
- case 's':
- part = Math.floor(date.getTime() / 1000);
- break;
- case 'S':
- part = (sec < 10) ? ("0" + sec) : sec;
- break;
- case 'u':
- part = w + 1;
- break;
- case 'w':
- part = w;
- break;
- case 'y':
- part = ('' + y).substr(2, 2);
- break;
- case 'Y':
- part = y;
- break;
- }
- parts[i] = part;
- }
- return parts.join('');
- },
- extendDate = function(options) {
- if (Date.prototype.tempDate) {
- return;
- }
- Date.prototype.tempDate = null;
- Date.prototype.months = options.months;
- Date.prototype.monthsShort = options.monthsShort;
- Date.prototype.days = options.days;
- Date.prototype.daysShort = options.daysShort;
- Date.prototype.getMonthName = function(fullName) {
- return this[fullName ? 'months' : 'monthsShort'][this.getMonth()];
- };
- Date.prototype.getDayName = function(fullName) {
- return this[fullName ? 'days' : 'daysShort'][this.getDay()];
- };
- Date.prototype.addDays = function (n) {
- this.setDate(this.getDate() + n);
- this.tempDate = this.getDate();
- };
- Date.prototype.addMonths = function (n) {
- if (this.tempDate == null) {
- this.tempDate = this.getDate();
- }
- this.setDate(1);
- this.setMonth(this.getMonth() + n);
- this.setDate(Math.min(this.tempDate, this.getMaxDays()));
- };
- Date.prototype.addYears = function (n) {
- if (this.tempDate == null) {
- this.tempDate = this.getDate();
- }
- this.setDate(1);
- this.setFullYear(this.getFullYear() + n);
- this.setDate(Math.min(this.tempDate, this.getMaxDays()));
- };
- Date.prototype.getMaxDays = function() {
- var tmpDate = new Date(Date.parse(this)),
- d = 28, m;
- m = tmpDate.getMonth();
- d = 28;
- while (tmpDate.getMonth() == m) {
- d ++;
- tmpDate.setDate(d);
- }
- return d - 1;
- };
- Date.prototype.getFirstDay = function() {
- var tmpDate = new Date(Date.parse(this));
- tmpDate.setDate(1);
- return tmpDate.getDay();
- };
- Date.prototype.getWeekNumber = function() {
- var tempDate = new Date(this);
- tempDate.setDate(tempDate.getDate() - (tempDate.getDay() + 6) % 7 + 3);
- var dms = tempDate.valueOf();
- tempDate.setMonth(0);
- tempDate.setDate(4);
- return Math.round((dms - tempDate.valueOf()) / (604800000)) + 1;
- };
- Date.prototype.getDayOfYear = function() {
- var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
- var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
- var time = now - then;
- return Math.floor(time / 24*60*60*1000);
- };
- },
- layout = function (el) {
- var options = $(el).data('datepicker');
- var cal = $('#' + options.id);
- if (!options.extraHeight) {
- var divs = $(el).find('div');
- //options.extraHeight = divs.get(0).offsetHeight + divs.get(1).offsetHeight;
- //options.extraWidth = divs.get(2).offsetWidth + divs.get(3).offsetWidth;
- }
- var tbl = cal.find('table:first').get(0);
- var width = tbl.offsetWidth;
- var height = tbl.offsetHeight;
- cal.css({
- width: width + options.extraWidth + 'px',
- height: height + options.extraHeight + 'px'
- }).find('div.datepickerContainer').css({
- width: width + 'px',
- height: height + 'px'
- });
- },
- click = function(ev) {
- if ($(ev.target).is('span')) {
- ev.target = ev.target.parentNode;
- }
- var el = $(ev.target);
- if (el.is('a')) {
- ev.target.blur();
- if (el.hasClass('datepickerDisabled')) {
- return false;
- }
- var options = $(this).data('datepicker');
- var parentEl = el.parent();
- var tblEl = parentEl.parent().parent().parent();
- var tblIndex = $('table', this).index(tblEl.get(0)) - 1;
- var tmp = new Date(options.current);
- var changed = false;
- var fillIt = false;
- if (parentEl.is('th')) {
- if (parentEl.hasClass('datepickerWeek') && options.mode == 'range' && !parentEl.next().hasClass('datepickerDisabled')) {
- var val = parseInt(parentEl.next().text(), 10);
- tmp.addMonths(tblIndex - Math.floor(options.calendars/2));
- if (parentEl.next().hasClass('datepickerNotInMonth')) {
- tmp.addMonths(val > 15 ? -1 : 1);
- }
- tmp.setDate(val);
- options.date[0] = (tmp.setHours(0,0,0,0)).valueOf();
- tmp.setHours(23,59,59,0);
- tmp.addDays(6);
- options.date[1] = tmp.valueOf();
- fillIt = true;
- changed = true;
- options.lastSel = false;
- } else if (parentEl.hasClass('datepickerMonth')) {
- tmp.addMonths(tblIndex - Math.floor(options.calendars/2));
- switch (tblEl.get(0).className) {
- case 'datepickerViewDays':
- tblEl.get(0).className = 'datepickerViewMonths';
- el.find('span').text(tmp.getFullYear());
- break;
- case 'datepickerViewMonths':
- tblEl.get(0).className = 'datepickerViewYears';
- el.find('span').text((tmp.getFullYear()-6) + ' - ' + (tmp.getFullYear()+5));
- break;
- case 'datepickerViewYears':
- tblEl.get(0).className = 'datepickerViewDays';
- el.find('span').text(formatDate(tmp, 'B, Y'));
- break;
- }
- } else if (parentEl.parent().parent().is('thead')) {
- switch (tblEl.get(0).className) {
- case 'datepickerViewDays':
- options.current.addMonths(parentEl.hasClass('datepickerGoPrev') ? -1 : 1);
- break;
- case 'datepickerViewMonths':
- options.current.addYears(parentEl.hasClass('datepickerGoPrev') ? -1 : 1);
- break;
- case 'datepickerViewYears':
- options.current.addYears(parentEl.hasClass('datepickerGoPrev') ? -12 : 12);
- break;
- }
- fillIt = true;
- }
- } else if (parentEl.is('td') && !parentEl.hasClass('datepickerDisabled')) {
- switch (tblEl.get(0).className) {
- case 'datepickerViewMonths':
- options.current.setMonth(tblEl.find('tbody.datepickerMonths td').index(parentEl));
- options.current.setFullYear(parseInt(tblEl.find('thead th.datepickerMonth span').text(), 10));
- options.current.addMonths(Math.floor(options.calendars/2) - tblIndex);
- tblEl.get(0).className = 'datepickerViewDays';
- break;
- case 'datepickerViewYears':
- options.current.setFullYear(parseInt(el.text(), 10));
- tblEl.get(0).className = 'datepickerViewMonths';
- break;
- default:
- var val = parseInt(el.text(), 10);
- tmp.addMonths(tblIndex - Math.floor(options.calendars/2));
- if (parentEl.hasClass('datepickerNotInMonth')) {
- tmp.addMonths(val > 15 ? -1 : 1);
- }
- tmp.setDate(val);
- switch (options.mode) {
- case 'multiple':
- val = (tmp.setHours(0,0,0,0)).valueOf();
- if ($.inArray(val, options.date) > -1) {
- $.each(options.date, function(nr, dat){
- if (dat == val) {
- options.date.splice(nr,1);
- return false;
- }
- });
- } else {
- options.date.push(val);
- }
- break;
- case 'range':
- if (!options.lastSel) {
- options.date[0] = (tmp.setHours(0,0,0,0)).valueOf();
- }
- val = (tmp.setHours(23,59,59,0)).valueOf();
- if (val < options.date[0]) {
- options.date[1] = options.date[0] + 86399000;
- options.date[0] = val - 86399000;
- } else {
- options.date[1] = val;
- }
- options.lastSel = !options.lastSel;
- break;
- default:
- options.date = tmp.valueOf();
- break;
- }
- break;
- }
- fillIt = true;
- changed = true;
- }
- if (fillIt) {
- fill(this);
- }
- if (changed) {
- options.onChange.apply(this, prepareDate(options));
- }
- }
- return false;
- },
- prepareDate = function (options) {
- var tmp;
- if (options.mode == 'single') {
- tmp = new Date(options.date);
- return [formatDate(tmp, options.format), tmp, options.el];
- } else {
- tmp = [[],[], options.el];
- $.each(options.date, function(nr, val){
- var date = new Date(val);
- tmp[0].push(formatDate(date, options.format));
- tmp[1].push(date);
- });
- return tmp;
- }
- },
- getViewport = function () {
- var m = document.compatMode == 'CSS1Compat';
- return {
- l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
- t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
- w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
- h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
- };
- },
- isChildOf = function(parentEl, el, container) {
- if (parentEl == el) {
- return true;
- }
- if (parentEl.contains) {
- return parentEl.contains(el);
- }
- if ( parentEl.compareDocumentPosition ) {
- return !!(parentEl.compareDocumentPosition(el) & 16);
- }
- var prEl = el.parentNode;
- while(prEl && prEl != container) {
- if (prEl == parentEl)
- return true;
- prEl = prEl.parentNode;
- }
- return false;
- },
- show = function (ev) {
- var cal = $('#' + $(this).data('datepickerId'));
- if (!cal.is(':visible')) {
- var calEl = cal.get(0);
- fill(calEl);
- var options = cal.data('datepicker');
- options.onBeforeShow.apply(this, [cal.get(0)]);
- var pos = $(this).offset();
- var viewPort = getViewport();
- var top = pos.top;
- var left = pos.left;
- var oldDisplay = $.curCSS(calEl, 'display');
- cal.css({
- visibility: 'hidden',
- display: 'block'
- });
- layout(calEl);
- switch (options.position){
- case 'top':
- top -= calEl.offsetHeight;
- break;
- case 'left':
- left -= calEl.offsetWidth;
- break;
- case 'right':
- left += this.offsetWidth;
- break;
- case 'bottom':
- top += this.offsetHeight;
- break;
- }
- if (top + calEl.offsetHeight > viewPort.t + viewPort.h) {
- top = pos.top - calEl.offsetHeight;
- }
- if (top < viewPort.t) {
- top = pos.top + this.offsetHeight + calEl.offsetHeight;
- }
- if (left + calEl.offsetWidth > viewPort.l + viewPort.w) {
- left = pos.left - calEl.offsetWidth;
- }
- if (left < viewPort.l) {
- left = pos.left + this.offsetWidth
- }
- cal.css({
- visibility: 'visible',
- display: 'block',
- top: top + 'px',
- left: left + 'px'
- });
- if (options.onShow.apply(this, [cal.get(0)]) != false) {
- cal.show();
- }
- $(document).bind('mousedown', {cal: cal, trigger: this}, hide);
- }
- return false;
- },
- hide = function (ev) {
- if (ev.target != ev.data.trigger && !isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
- if (ev.data.cal.data('datepicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
- ev.data.cal.hide();
- }
- $(document).unbind('mousedown', hide);
- }
- };
- return {
- init: function(options){
- options = $.extend({}, defaults, options||{});
- extendDate(options.locale);
- options.calendars = Math.max(1, parseInt(options.calendars,10)||1);
- options.mode = /single|multiple|range/.test(options.mode) ? options.mode : 'single';
- return this.each(function(){
- if (!$(this).data('datepicker')) {
- options.el = this;
- if (options.date.constructor == String) {
- options.date = parseDate(options.date, options.format);
- options.date.setHours(0,0,0,0);
- }
- if (options.mode != 'single') {
- if (options.date.constructor != Array) {
- options.date = [options.date.valueOf()];
- if (options.mode == 'range') {
- options.date.push(((new Date(options.date[0])).setHours(23,59,59,0)).valueOf());
- }
- } else {
- for (var i = 0; i < options.date.length; i++) {
- options.date[i] = (parseDate(options.date[i], options.format).setHours(0,0,0,0)).valueOf();
- }
- if (options.mode == 'range') {
- options.date[1] = ((new Date(options.date[1])).setHours(23,59,59,0)).valueOf();
- }
- }
- } else {
- options.date = options.date.valueOf();
- }
- if (!options.current) {
- options.current = new Date();
- } else {
- options.current = parseDate(options.current, options.format);
- }
- options.current.setDate(1);
- options.current.setHours(0,0,0,0);
- var id = 'datepicker_' + parseInt(Math.random() * 1000), cnt;
- options.id = id;
- $(this).data('datepickerId', options.id);
- var cal = $(tpl.wrapper).attr('id', id).bind('click', click).data('datepicker', options);
- if (options.className) {
- cal.addClass(options.className);
- }
- var html = '';
- for (var i = 0; i < options.calendars; i++) {
- cnt = options.starts;
- if (i > 0) {
- html += tpl.space;
- }
- html += tmpl(tpl.head.join(''), {
- week: options.locale.weekMin,
- prev: options.prev,
- next: options.next,
- day1: options.locale.daysMin[(cnt++)%7],
- day2: options.locale.daysMin[(cnt++)%7],
- day3: options.locale.daysMin[(cnt++)%7],
- day4: options.locale.daysMin[(cnt++)%7],
- day5: options.locale.daysMin[(cnt++)%7],
- day6: options.locale.daysMin[(cnt++)%7],
- day7: options.locale.daysMin[(cnt++)%7]
- });
- }
- cal
- .find('tr:first').append(html)
- .find('table').addClass(views[options.view]);
- fill(cal.get(0));
- if (options.flat) {
- cal.appendTo(this).show().css('position', 'relative');
- layout(cal.get(0));
- } else {
- cal.appendTo(document.body);
- $(this).bind(options.eventName, show);
- }
- }
- });
- },
- showPicker: function() {
- return this.each( function () {
- if ($(this).data('datepickerId')) {
- show.apply(this);
- }
- });
- },
- hidePicker: function() {
- return this.each( function () {
- if ($(this).data('datepickerId')) {
- $('#' + $(this).data('datepickerId')).hide();
- }
- });
- },
- setDate: function(date, shiftTo){
- return this.each(function(){
- if ($(this).data('datepickerId')) {
- var cal = $('#' + $(this).data('datepickerId'));
- var options = cal.data('datepicker');
- options.date = date;
- if (options.date.constructor == String) {
- options.date = parseDate(options.date, options.format);
- options.date.setHours(0,0,0,0);
- }
- if (options.mode != 'single') {
- if (options.date.constructor != Array) {
- options.date = [options.date.valueOf()];
- if (options.mode == 'range') {
- options.date.push(((new Date(options.date[0])).setHours(23,59,59,0)).valueOf());
- }
- } else {
- for (var i = 0; i < options.date.length; i++) {
- options.date[i] = (parseDate(options.date[i], options.format).setHours(0,0,0,0)).valueOf();
- }
- if (options.mode == 'range') {
- options.date[1] = ((new Date(options.date[1])).setHours(23,59,59,0)).valueOf();
- }
- }
- } else {
- options.date = options.date.valueOf();
- }
- if (shiftTo) {
- options.current = new Date (options.mode != 'single' ? options.date[0] : options.date);
- }
- fill(cal.get(0));
- }
- });
- },
- getDate: function(formated) {
- if (this.size() > 0) {
- return prepareDate($('#' + $(this).data('datepickerId')).data('datepicker'))[formated ? 0 : 1];
- }
- },
- clear: function(){
- return this.each(function(){
- if ($(this).data('datepickerId')) {
- var cal = $('#' + $(this).data('datepickerId'));
- var options = cal.data('datepicker');
- if (options.mode != 'single') {
- options.date = [];
- fill(cal.get(0));
- }
- }
- });
- },
- fixLayout: function(){
- return this.each(function(){
- if ($(this).data('datepickerId')) {
- var cal = $('#' + $(this).data('datepickerId'));
- var options = cal.data('datepicker');
- if (options.flat) {
- layout(cal.get(0));
- }
- }
- });
- }
- };
- }();
- $.fn.extend({
- DatePicker: DatePicker.init,
- DatePickerHide: DatePicker.hidePicker,
- DatePickerShow: DatePicker.showPicker,
- DatePickerSetDate: DatePicker.setDate,
- DatePickerGetDate: DatePicker.getDate,
- DatePickerClear: DatePicker.clear,
- DatePickerLayout: DatePicker.fixLayout
- });
-})(jQuery);
-
-(function(){
- var cache = {};
-
- this.tmpl = function tmpl(str, data){
- // Figure out if we're getting a template, or if we need to
- // load the template - and be sure to cache the result.
- var fn = !/\W/.test(str) ?
- cache[str] = cache[str] ||
- tmpl(document.getElementById(str).innerHTML) :
-
- // Generate a reusable function that will serve as a template
- // generator (and which will be cached).
- new Function("obj",
- "var p=[],print=function(){p.push.apply(p,arguments);};" +
-
- // Introduce the data as local variables using with(){}
- "with(obj){p.push('" +
-
- // Convert the template into pure JavaScript
- str
- .replace(/[\r\t\n]/g, " ")
- .split("<%").join("\t")
- .replace(/((^|%>)[^\t]*)'/g, "$1\r")
- .replace(/\t=(.*?)%>/g, "',$1,'")
- .split("\t").join("');")
- .split("%>").join("p.push('")
- .split("\r").join("\\'")
- + "');}return p.join('');");
-
- // Provide some basic currying to the user
- return data ? fn( data ) : fn;
- };
-})();
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/lib/jquery.cycle.all.latest.js b/app/assets/Archive/javascripts/lib/jquery.cycle.all.latest.js
deleted file mode 100644
index 75d7ab98..00000000
--- a/app/assets/Archive/javascripts/lib/jquery.cycle.all.latest.js
+++ /dev/null
@@ -1,1331 +0,0 @@
-/*!
- * jQuery Cycle Plugin (with Transition Definitions)
- * Examples and documentation at: http://jquery.malsup.com/cycle/
- * Copyright (c) 2007-2010 M. Alsup
- * Version: 2.88 (08-JUN-2010)
- * Dual licensed under the MIT and GPL licenses.
- * http://jquery.malsup.com/license.html
- * Requires: jQuery v1.2.6 or later
- */
-;(function($) {
-
-var ver = '2.88';
-
-// if $.support is not defined (pre jQuery 1.3) add what I need
-if ($.support == undefined) {
- $.support = {
- opacity: !($.browser.msie)
- };
-}
-
-function debug(s) {
- if ($.fn.cycle.debug)
- log(s);
-}
-function log() {
- if (window.console && window.console.log)
- window.console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
-};
-
-// the options arg can be...
-// a number - indicates an immediate transition should occur to the given slide index
-// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
-// an object - properties to control the slideshow
-//
-// the arg2 arg can be...
-// the name of an fx (only used in conjunction with a numeric value for 'options')
-// the value true (only used in first arg == 'resume') and indicates
-// that the resume should occur immediately (not wait for next timeout)
-
-$.fn.cycle = function(options, arg2) {
- var o = { s: this.selector, c: this.context };
-
- // in 1.3+ we can fix mistakes with the ready state
- if (this.length === 0 && options != 'stop') {
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing slideshow');
- $(function() {
- $(o.s,o.c).cycle(options,arg2);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- // iterate the matched nodeset
- return this.each(function() {
- var opts = handleArguments(this, options, arg2);
- if (opts === false)
- return;
-
- opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
-
- // stop existing slideshow for this container (if there is one)
- if (this.cycleTimeout)
- clearTimeout(this.cycleTimeout);
- this.cycleTimeout = this.cyclePause = 0;
-
- var $cont = $(this);
- var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
- var els = $slides.get();
- if (els.length < 2) {
- log('terminating; too few slides: ' + els.length);
- return;
- }
-
- var opts2 = buildOptions($cont, $slides, els, opts, o);
- if (opts2 === false)
- return;
-
- var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.rev);
-
- // if it's an auto slideshow, kick it off
- if (startTime) {
- startTime += (opts2.delay || 0);
- if (startTime < 10)
- startTime = 10;
- debug('first timeout: ' + startTime);
- this.cycleTimeout = setTimeout(function(){go(els,opts2,0,(!opts2.rev && !opts.backwards))}, startTime);
- }
- });
-};
-
-// process the args that were passed to the plugin fn
-function handleArguments(cont, options, arg2) {
- if (cont.cycleStop == undefined)
- cont.cycleStop = 0;
- if (options === undefined || options === null)
- options = {};
- if (options.constructor == String) {
- switch(options) {
- case 'destroy':
- case 'stop':
- var opts = $(cont).data('cycle.opts');
- if (!opts)
- return false;
- cont.cycleStop++; // callbacks look for change
- if (cont.cycleTimeout)
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- $(cont).removeData('cycle.opts');
- if (options == 'destroy')
- destroy(opts);
- return false;
- case 'toggle':
- cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
- checkInstantResume(cont.cyclePause, arg2, cont);
- return false;
- case 'pause':
- cont.cyclePause = 1;
- return false;
- case 'resume':
- cont.cyclePause = 0;
- checkInstantResume(false, arg2, cont);
- return false;
- case 'prev':
- case 'next':
- var opts = $(cont).data('cycle.opts');
- if (!opts) {
- log('options not found, "prev/next" ignored');
- return false;
- }
- $.fn.cycle[options](opts);
- return false;
- default:
- options = { fx: options };
- };
- return options;
- }
- else if (options.constructor == Number) {
- // go to the requested slide
- var num = options;
- options = $(cont).data('cycle.opts');
- if (!options) {
- log('options not found, can not advance slide');
- return false;
- }
- if (num < 0 || num >= options.elements.length) {
- log('invalid slide index: ' + num);
- return false;
- }
- options.nextSlide = num;
- if (cont.cycleTimeout) {
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- }
- if (typeof arg2 == 'string')
- options.oneTimeFx = arg2;
- go(options.elements, options, 1, num >= options.currSlide);
- return false;
- }
- return options;
-
- function checkInstantResume(isPaused, arg2, cont) {
- if (!isPaused && arg2 === true) { // resume now!
- var options = $(cont).data('cycle.opts');
- if (!options) {
- log('options not found, can not resume');
- return false;
- }
- if (cont.cycleTimeout) {
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- }
- go(options.elements, options, 1, (!opts.rev && !opts.backwards));
- }
- }
-};
-
-function removeFilter(el, opts) {
- if (!$.support.opacity && opts.cleartype && el.style.filter) {
- try { el.style.removeAttribute('filter'); }
- catch(smother) {} // handle old opera versions
- }
-};
-
-// unbind event handlers
-function destroy(opts) {
- if (opts.next)
- $(opts.next).unbind(opts.prevNextEvent);
- if (opts.prev)
- $(opts.prev).unbind(opts.prevNextEvent);
-
- if (opts.pager || opts.pagerAnchorBuilder)
- $.each(opts.pagerAnchors || [], function() {
- this.unbind().remove();
- });
- opts.pagerAnchors = null;
- if (opts.destroy) // callback
- opts.destroy(opts);
-};
-
-// one-time initialization
-function buildOptions($cont, $slides, els, options, o) {
- // support metadata plugin (v1.0 and v2.0)
- var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
- if (opts.autostop)
- opts.countdown = opts.autostopCount || els.length;
-
- var cont = $cont[0];
- $cont.data('cycle.opts', opts);
- opts.$cont = $cont;
- opts.stopCount = cont.cycleStop;
- opts.elements = els;
- opts.before = opts.before ? [opts.before] : [];
- opts.after = opts.after ? [opts.after] : [];
- opts.after.unshift(function(){ opts.busy=0; });
-
- // push some after callbacks
- if (!$.support.opacity && opts.cleartype)
- opts.after.push(function() { removeFilter(this, opts); });
- if (opts.continuous)
- opts.after.push(function() { go(els,opts,0,(!opts.rev && !opts.backwards)); });
-
- saveOriginalOpts(opts);
-
- // clearType corrections
- if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
- clearTypeFix($slides);
-
- // container requires non-static position so that slides can be position within
- if ($cont.css('position') == 'static')
- $cont.css('position', 'relative');
- if (opts.width)
- $cont.width(opts.width);
- if (opts.height && opts.height != 'auto')
- $cont.height(opts.height);
-
- if (opts.startingSlide)
- opts.startingSlide = parseInt(opts.startingSlide);
- else if (opts.backwards)
- opts.startingSlide = els.length - 1;
-
- // if random, mix up the slide array
- if (opts.random) {
- opts.randomMap = [];
- for (var i = 0; i < els.length; i++)
- opts.randomMap.push(i);
- opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
- opts.randomIndex = 1;
- opts.startingSlide = opts.randomMap[1];
- }
- else if (opts.startingSlide >= els.length)
- opts.startingSlide = 0; // catch bogus input
- opts.currSlide = opts.startingSlide || 0;
- var first = opts.startingSlide;
-
- // set position and zIndex on all the slides
- $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
- var z;
- if (opts.backwards)
- z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
- else
- z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
- $(this).css('z-index', z)
- });
-
- // make sure first slide is visible
- $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
- removeFilter(els[first], opts);
-
- // stretch slides
- if (opts.fit && opts.width)
- $slides.width(opts.width);
- if (opts.fit && opts.height && opts.height != 'auto')
- $slides.height(opts.height);
-
- // stretch container
- var reshape = opts.containerResize && !$cont.innerHeight();
- if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
- var maxw = 0, maxh = 0;
- for(var j=0; j < els.length; j++) {
- var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
- if (!w) w = e.offsetWidth || e.width || $e.attr('width')
- if (!h) h = e.offsetHeight || e.height || $e.attr('height');
- maxw = w > maxw ? w : maxw;
- maxh = h > maxh ? h : maxh;
- }
- if (maxw > 0 && maxh > 0)
- $cont.css({width:maxw+'px',height:maxh+'px'});
- }
-
- if (opts.pause)
- $cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});
-
- if (supportMultiTransitions(opts) === false)
- return false;
-
- // apparently a lot of people use image slideshows without height/width attributes on the images.
- // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
- var requeue = false;
- options.requeueAttempts = options.requeueAttempts || 0;
- $slides.each(function() {
- // try to get height/width of each slide
- var $el = $(this);
- this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
- this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
-
- if ( $el.is('img') ) {
- // sigh.. sniffing, hacking, shrugging... this crappy hack tries to account for what browsers do when
- // an image is being downloaded and the markup did not include sizing info (height/width attributes);
- // there seems to be some "default" sizes used in this situation
- var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
- var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
- var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
- var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
- // don't requeue for images that are still loading but have a valid size
- if (loadingIE || loadingFF || loadingOp || loadingOther) {
- if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
- log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
- setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
- requeue = true;
- return false; // break each loop
- }
- else {
- log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
- }
- }
- }
- return true;
- });
-
- if (requeue)
- return false;
-
- opts.cssBefore = opts.cssBefore || {};
- opts.animIn = opts.animIn || {};
- opts.animOut = opts.animOut || {};
-
- $slides.not(':eq('+first+')').css(opts.cssBefore);
- if (opts.cssFirst)
- $($slides[first]).css(opts.cssFirst);
-
- if (opts.timeout) {
- opts.timeout = parseInt(opts.timeout);
- // ensure that timeout and speed settings are sane
- if (opts.speed.constructor == String)
- opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed);
- if (!opts.sync)
- opts.speed = opts.speed / 2;
-
- var buffer = opts.fx == 'shuffle' ? 500 : 250;
- while((opts.timeout - opts.speed) < buffer) // sanitize timeout
- opts.timeout += opts.speed;
- }
- if (opts.easing)
- opts.easeIn = opts.easeOut = opts.easing;
- if (!opts.speedIn)
- opts.speedIn = opts.speed;
- if (!opts.speedOut)
- opts.speedOut = opts.speed;
-
- opts.slideCount = els.length;
- opts.currSlide = opts.lastSlide = first;
- if (opts.random) {
- if (++opts.randomIndex == els.length)
- opts.randomIndex = 0;
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else if (opts.backwards)
- opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1;
- else
- opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
-
- // run transition init fn
- if (!opts.multiFx) {
- var init = $.fn.cycle.transitions[opts.fx];
- if ($.isFunction(init))
- init($cont, $slides, opts);
- else if (opts.fx != 'custom' && !opts.multiFx) {
- log('unknown transition: ' + opts.fx,'; slideshow terminating');
- return false;
- }
- }
-
- // fire artificial events
- var e0 = $slides[first];
- if (opts.before.length)
- opts.before[0].apply(e0, [e0, e0, opts, true]);
- if (opts.after.length > 1)
- opts.after[1].apply(e0, [e0, e0, opts, true]);
-
- if (opts.next)
- $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1)});
- if (opts.prev)
- $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1)});
- if (opts.pager || opts.pagerAnchorBuilder)
- buildPager(els,opts);
-
- exposeAddSlide(opts, els);
-
- return opts;
-};
-
-// save off original opts so we can restore after clearing state
-function saveOriginalOpts(opts) {
- opts.original = { before: [], after: [] };
- opts.original.cssBefore = $.extend({}, opts.cssBefore);
- opts.original.cssAfter = $.extend({}, opts.cssAfter);
- opts.original.animIn = $.extend({}, opts.animIn);
- opts.original.animOut = $.extend({}, opts.animOut);
- $.each(opts.before, function() { opts.original.before.push(this); });
- $.each(opts.after, function() { opts.original.after.push(this); });
-};
-
-function supportMultiTransitions(opts) {
- var i, tx, txs = $.fn.cycle.transitions;
- // look for multiple effects
- if (opts.fx.indexOf(',') > 0) {
- opts.multiFx = true;
- opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
- // discard any bogus effect names
- for (i=0; i < opts.fxs.length; i++) {
- var fx = opts.fxs[i];
- tx = txs[fx];
- if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
- log('discarding unknown transition: ',fx);
- opts.fxs.splice(i,1);
- i--;
- }
- }
- // if we have an empty list then we threw everything away!
- if (!opts.fxs.length) {
- log('No valid transitions named; slideshow terminating.');
- return false;
- }
- }
- else if (opts.fx == 'all') { // auto-gen the list of transitions
- opts.multiFx = true;
- opts.fxs = [];
- for (p in txs) {
- tx = txs[p];
- if (txs.hasOwnProperty(p) && $.isFunction(tx))
- opts.fxs.push(p);
- }
- }
- if (opts.multiFx && opts.randomizeEffects) {
- // munge the fxs array to make effect selection random
- var r1 = Math.floor(Math.random() * 20) + 30;
- for (i = 0; i < r1; i++) {
- var r2 = Math.floor(Math.random() * opts.fxs.length);
- opts.fxs.push(opts.fxs.splice(r2,1)[0]);
- }
- debug('randomized fx sequence: ',opts.fxs);
- }
- return true;
-};
-
-// provide a mechanism for adding slides after the slideshow has started
-function exposeAddSlide(opts, els) {
- opts.addSlide = function(newSlide, prepend) {
- var $s = $(newSlide), s = $s[0];
- if (!opts.autostopCount)
- opts.countdown++;
- els[prepend?'unshift':'push'](s);
- if (opts.els)
- opts.els[prepend?'unshift':'push'](s); // shuffle needs this
- opts.slideCount = els.length;
-
- $s.css('position','absolute');
- $s[prepend?'prependTo':'appendTo'](opts.$cont);
-
- if (prepend) {
- opts.currSlide++;
- opts.nextSlide++;
- }
-
- if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
- clearTypeFix($s);
-
- if (opts.fit && opts.width)
- $s.width(opts.width);
- if (opts.fit && opts.height && opts.height != 'auto')
- $slides.height(opts.height);
- s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
- s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
-
- $s.css(opts.cssBefore);
-
- if (opts.pager || opts.pagerAnchorBuilder)
- $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
-
- if ($.isFunction(opts.onAddSlide))
- opts.onAddSlide($s);
- else
- $s.hide(); // default behavior
- };
-}
-
-// reset internal state; we do this on every pass in order to support multiple effects
-$.fn.cycle.resetState = function(opts, fx) {
- fx = fx || opts.fx;
- opts.before = []; opts.after = [];
- opts.cssBefore = $.extend({}, opts.original.cssBefore);
- opts.cssAfter = $.extend({}, opts.original.cssAfter);
- opts.animIn = $.extend({}, opts.original.animIn);
- opts.animOut = $.extend({}, opts.original.animOut);
- opts.fxFn = null;
- $.each(opts.original.before, function() { opts.before.push(this); });
- $.each(opts.original.after, function() { opts.after.push(this); });
-
- // re-init
- var init = $.fn.cycle.transitions[fx];
- if ($.isFunction(init))
- init(opts.$cont, $(opts.elements), opts);
-};
-
-// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
-function go(els, opts, manual, fwd) {
- // opts.busy is true if we're in the middle of an animation
- if (manual && opts.busy && opts.manualTrump) {
- // let manual transitions requests trump active ones
- debug('manualTrump in go(), stopping active transition');
- $(els).stop(true,true);
- opts.busy = false;
- }
- // don't begin another timeout-based transition if there is one active
- if (opts.busy) {
- debug('transition active, ignoring new tx request');
- return;
- }
-
- var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
-
- // stop cycling if we have an outstanding stop request
- if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
- return;
-
- // check to see if we should stop cycling based on autostop options
- if (!manual && !p.cyclePause && !opts.bounce &&
- ((opts.autostop && (--opts.countdown <= 0)) ||
- (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
- if (opts.end)
- opts.end(opts);
- return;
- }
-
- // if slideshow is paused, only transition on a manual trigger
- var changed = false;
- if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
- changed = true;
- var fx = opts.fx;
- // keep trying to get the slide size if we don't have it yet
- curr.cycleH = curr.cycleH || $(curr).height();
- curr.cycleW = curr.cycleW || $(curr).width();
- next.cycleH = next.cycleH || $(next).height();
- next.cycleW = next.cycleW || $(next).width();
-
- // support multiple transition types
- if (opts.multiFx) {
- if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length)
- opts.lastFx = 0;
- fx = opts.fxs[opts.lastFx];
- opts.currFx = fx;
- }
-
- // one-time fx overrides apply to: $('div').cycle(3,'zoom');
- if (opts.oneTimeFx) {
- fx = opts.oneTimeFx;
- opts.oneTimeFx = null;
- }
-
- $.fn.cycle.resetState(opts, fx);
-
- // run the before callbacks
- if (opts.before.length)
- $.each(opts.before, function(i,o) {
- if (p.cycleStop != opts.stopCount) return;
- o.apply(next, [curr, next, opts, fwd]);
- });
-
- // stage the after callacks
- var after = function() {
- $.each(opts.after, function(i,o) {
- if (p.cycleStop != opts.stopCount) return;
- o.apply(next, [curr, next, opts, fwd]);
- });
- };
-
- debug('tx firing; currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
-
- // get ready to perform the transition
- opts.busy = 1;
- if (opts.fxFn) // fx function provided?
- opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
- $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- else
- $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- }
-
- if (changed || opts.nextSlide == opts.currSlide) {
- // calculate the next slide
- opts.lastSlide = opts.currSlide;
- if (opts.random) {
- opts.currSlide = opts.nextSlide;
- if (++opts.randomIndex == els.length)
- opts.randomIndex = 0;
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- if (opts.nextSlide == opts.currSlide)
- opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
- }
- else if (opts.backwards) {
- var roll = (opts.nextSlide - 1) < 0;
- if (roll && opts.bounce) {
- opts.backwards = !opts.backwards;
- opts.nextSlide = 1;
- opts.currSlide = 0;
- }
- else {
- opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
- opts.currSlide = roll ? 0 : opts.nextSlide+1;
- }
- }
- else { // sequence
- var roll = (opts.nextSlide + 1) == els.length;
- if (roll && opts.bounce) {
- opts.backwards = !opts.backwards;
- opts.nextSlide = els.length-2;
- opts.currSlide = els.length-1;
- }
- else {
- opts.nextSlide = roll ? 0 : opts.nextSlide+1;
- opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
- }
- }
- }
- if (changed && opts.pager)
- opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
-
- // stage the next transition
- var ms = 0;
- if (opts.timeout && !opts.continuous)
- ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
- else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
- ms = 10;
- if (ms > 0)
- p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, (!opts.rev && !opts.backwards)) }, ms);
-};
-
-// invoked after transition
-$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
- $(pager).each(function() {
- $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
- });
-};
-
-// calculate timeout value for current transition
-function getTimeout(curr, next, opts, fwd) {
- if (opts.timeoutFn) {
- // call user provided calc fn
- var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
- while ((t - opts.speed) < 250) // sanitize timeout
- t += opts.speed;
- debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
- if (t !== false)
- return t;
- }
- return opts.timeout;
-};
-
-// expose next/prev function, caller must pass in state
-$.fn.cycle.next = function(opts) { advance(opts, opts.rev?-1:1); };
-$.fn.cycle.prev = function(opts) { advance(opts, opts.rev?1:-1);};
-
-// advance slide forward or back
-function advance(opts, val) {
- var els = opts.elements;
- var p = opts.$cont[0], timeout = p.cycleTimeout;
- if (timeout) {
- clearTimeout(timeout);
- p.cycleTimeout = 0;
- }
- if (opts.random && val < 0) {
- // move back to the previously display slide
- opts.randomIndex--;
- if (--opts.randomIndex == -2)
- opts.randomIndex = els.length-2;
- else if (opts.randomIndex == -1)
- opts.randomIndex = els.length-1;
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else if (opts.random) {
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else {
- opts.nextSlide = opts.currSlide + val;
- if (opts.nextSlide < 0) {
- if (opts.nowrap) return false;
- opts.nextSlide = els.length - 1;
- }
- else if (opts.nextSlide >= els.length) {
- if (opts.nowrap) return false;
- opts.nextSlide = 0;
- }
- }
-
- var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
- if ($.isFunction(cb))
- cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
- go(els, opts, 1, val>=0);
- return false;
-};
-
-function buildPager(els, opts) {
- var $p = $(opts.pager);
- $.each(els, function(i,o) {
- $.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
- });
- opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
-};
-
-$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
- var a;
- if ($.isFunction(opts.pagerAnchorBuilder)) {
- a = opts.pagerAnchorBuilder(i,el);
- debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
- }
- else
- a = ''+(i+1)+' ';
-
- if (!a)
- return;
- var $a = $(a);
- // don't reparent if anchor is in the dom
- if ($a.parents('body').length === 0) {
- var arr = [];
- if ($p.length > 1) {
- $p.each(function() {
- var $clone = $a.clone(true);
- $(this).append($clone);
- arr.push($clone[0]);
- });
- $a = $(arr);
- }
- else {
- $a.appendTo($p);
- }
- }
-
- opts.pagerAnchors = opts.pagerAnchors || [];
- opts.pagerAnchors.push($a);
- $a.bind(opts.pagerEvent, function(e) {
- e.preventDefault();
- opts.nextSlide = i;
- var p = opts.$cont[0], timeout = p.cycleTimeout;
- if (timeout) {
- clearTimeout(timeout);
- p.cycleTimeout = 0;
- }
- var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
- if ($.isFunction(cb))
- cb(opts.nextSlide, els[opts.nextSlide]);
- go(els,opts,1,opts.currSlide < i); // trigger the trans
-// return false; // <== allow bubble
- });
-
- if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
- $a.bind('click.cycle', function(){return false;}); // suppress click
-
- if (opts.pauseOnPagerHover)
- $a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; } );
-};
-
-// helper fn to calculate the number of slides between the current and the next
-$.fn.cycle.hopsFromLast = function(opts, fwd) {
- var hops, l = opts.lastSlide, c = opts.currSlide;
- if (fwd)
- hops = c > l ? c - l : opts.slideCount - l;
- else
- hops = c < l ? l - c : l + opts.slideCount - c;
- return hops;
-};
-
-// fix clearType problems in ie6 by setting an explicit bg color
-// (otherwise text slides look horrible during a fade transition)
-function clearTypeFix($slides) {
- debug('applying clearType background-color hack');
- function hex(s) {
- s = parseInt(s).toString(16);
- return s.length < 2 ? '0'+s : s;
- };
- function getBg(e) {
- for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
- var v = $.css(e,'background-color');
- if (v.indexOf('rgb') >= 0 ) {
- var rgb = v.match(/\d+/g);
- return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
- }
- if (v && v != 'transparent')
- return v;
- }
- return '#ffffff';
- };
- $slides.each(function() { $(this).css('background-color', getBg(this)); });
-};
-
-// reset common props before the next transition
-$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
- $(opts.elements).not(curr).hide();
- opts.cssBefore.opacity = 1;
- opts.cssBefore.display = 'block';
- if (w !== false && next.cycleW > 0)
- opts.cssBefore.width = next.cycleW;
- if (h !== false && next.cycleH > 0)
- opts.cssBefore.height = next.cycleH;
- opts.cssAfter = opts.cssAfter || {};
- opts.cssAfter.display = 'none';
- $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
- $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
-};
-
-// the actual fn for effecting a transition
-$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
- var $l = $(curr), $n = $(next);
- var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
- $n.css(opts.cssBefore);
- if (speedOverride) {
- if (typeof speedOverride == 'number')
- speedIn = speedOut = speedOverride;
- else
- speedIn = speedOut = 1;
- easeIn = easeOut = null;
- }
- var fn = function() {$n.animate(opts.animIn, speedIn, easeIn, cb)};
- $l.animate(opts.animOut, speedOut, easeOut, function() {
- if (opts.cssAfter) $l.css(opts.cssAfter);
- if (!opts.sync) fn();
- });
- if (opts.sync) fn();
-};
-
-// transition definitions - only fade is defined here, transition pack defines the rest
-$.fn.cycle.transitions = {
- fade: function($cont, $slides, opts) {
- $slides.not(':eq('+opts.currSlide+')').css('opacity',0);
- opts.before.push(function(curr,next,opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.opacity = 0;
- });
- opts.animIn = { opacity: 1 };
- opts.animOut = { opacity: 0 };
- opts.cssBefore = { top: 0, left: 0 };
- }
-};
-
-$.fn.cycle.ver = function() { return ver; };
-
-// override these globally if you like (they are all optional)
-$.fn.cycle.defaults = {
- fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
- timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance)
- timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag)
- continuous: 0, // true to start next transition immediately after current one completes
- speed: 1000, // speed of the transition (any valid fx speed value)
- speedIn: null, // speed of the 'in' transition
- speedOut: null, // speed of the 'out' transition
- next: null, // selector for element to use as event trigger for next slide
- prev: null, // selector for element to use as event trigger for previous slide
-// prevNextClick: null, // @deprecated; please use onPrevNextEvent instead
- onPrevNextEvent: null, // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
- prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide
- pager: null, // selector for element to use as pager container
- //pagerClick null, // @deprecated; please use onPagerEvent instead
- onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
- pagerEvent: 'click.cycle', // name of event which drives the pager navigation
- allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
- pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement)
- before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
- after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
- end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
- easing: null, // easing method for both in and out transitions
- easeIn: null, // easing for "in" transition
- easeOut: null, // easing for "out" transition
- shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 }
- animIn: null, // properties that define how the slide animates in
- animOut: null, // properties that define how the slide animates out
- cssBefore: null, // properties that define the initial state of the slide before transitioning in
- cssAfter: null, // properties that defined the state of the slide after transitioning out
- fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
- height: 'auto', // container height
- startingSlide: 0, // zero-based index of the first slide to be displayed
- sync: 1, // true if in/out transitions should occur simultaneously
- random: 0, // true for random, false for sequence (not applicable to shuffle fx)
- fit: 0, // force slides to fit container
- containerResize: 1, // resize container to fit largest slide
- pause: 0, // true to enable "pause on hover"
- pauseOnPagerHover: 0, // true to pause when hovering over pager link
- autostop: 0, // true to end slideshow after X transitions (where X == slide count)
- autostopCount: 0, // number of transitions (optionally used with autostop to define X)
- delay: 0, // additional delay (in ms) for first transition (hint: can be negative)
- slideExpr: null, // expression for selecting slides (if something other than all children is required)
- cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE)
- cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
- nowrap: 0, // true to prevent slideshow from wrapping
- fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
- randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random
- rev: 0, // causes animations to transition in reverse
- manualTrump: true, // causes manual transition to stop an active transition instead of being ignored
- requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
- requeueTimeout: 250, // ms delay for requeue
- activePagerClass: 'activeSlide', // class name used for the active pager link
- updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style)
- backwards: false // true to start slideshow at last slide and move backwards through the stack
-};
-
-})(jQuery);
-
-
-/*!
- * jQuery Cycle Plugin Transition Definitions
- * This script is a plugin for the jQuery Cycle Plugin
- * Examples and documentation at: http://malsup.com/jquery/cycle/
- * Copyright (c) 2007-2010 M. Alsup
- * Version: 2.72
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-(function($) {
-
-//
-// These functions define one-time slide initialization for the named
-// transitions. To save file size feel free to remove any of these that you
-// don't need.
-//
-$.fn.cycle.transitions.none = function($cont, $slides, opts) {
- opts.fxFn = function(curr,next,opts,after){
- $(next).show();
- $(curr).hide();
- after();
- };
-}
-
-// scrollUp/Down/Left/Right
-$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var h = $cont.height();
- opts.cssBefore ={ top: h, left: 0 };
- opts.cssFirst = { top: 0 };
- opts.animIn = { top: 0 };
- opts.animOut = { top: -h };
-};
-$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var h = $cont.height();
- opts.cssFirst = { top: 0 };
- opts.cssBefore= { top: -h, left: 0 };
- opts.animIn = { top: 0 };
- opts.animOut = { top: h };
-};
-$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var w = $cont.width();
- opts.cssFirst = { left: 0 };
- opts.cssBefore= { left: w, top: 0 };
- opts.animIn = { left: 0 };
- opts.animOut = { left: 0-w };
-};
-$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var w = $cont.width();
- opts.cssFirst = { left: 0 };
- opts.cssBefore= { left: -w, top: 0 };
- opts.animIn = { left: 0 };
- opts.animOut = { left: w };
-};
-$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
- $cont.css('overflow','hidden').width();
- opts.before.push(function(curr, next, opts, fwd) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
- opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
- });
- opts.cssFirst = { left: 0 };
- opts.cssBefore= { top: 0 };
- opts.animIn = { left: 0 };
- opts.animOut = { top: 0 };
-};
-$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push(function(curr, next, opts, fwd) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
- opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
- });
- opts.cssFirst = { top: 0 };
- opts.cssBefore= { left: 0 };
- opts.animIn = { top: 0 };
- opts.animOut = { left: 0 };
-};
-
-// slideX/slideY
-$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $(opts.elements).not(curr).hide();
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.animIn.width = next.cycleW;
- });
- opts.cssBefore = { left: 0, top: 0, width: 0 };
- opts.animIn = { width: 'show' };
- opts.animOut = { width: 0 };
-};
-$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $(opts.elements).not(curr).hide();
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.animIn.height = next.cycleH;
- });
- opts.cssBefore = { left: 0, top: 0, height: 0 };
- opts.animIn = { height: 'show' };
- opts.animOut = { height: 0 };
-};
-
-// shuffle
-$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
- var i, w = $cont.css('overflow', 'visible').width();
- $slides.css({left: 0, top: 0});
- opts.before.push(function(curr,next,opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- });
- // only adjust speed once!
- if (!opts.speedAdjusted) {
- opts.speed = opts.speed / 2; // shuffle has 2 transitions
- opts.speedAdjusted = true;
- }
- opts.random = 0;
- opts.shuffle = opts.shuffle || {left:-w, top:15};
- opts.els = [];
- for (i=0; i < $slides.length; i++)
- opts.els.push($slides[i]);
-
- for (i=0; i < opts.currSlide; i++)
- opts.els.push(opts.els.shift());
-
- // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
- opts.fxFn = function(curr, next, opts, cb, fwd) {
- var $el = fwd ? $(curr) : $(next);
- $(next).css(opts.cssBefore);
- var count = opts.slideCount;
- $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
- var hops = $.fn.cycle.hopsFromLast(opts, fwd);
- for (var k=0; k < hops; k++)
- fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
- if (fwd) {
- for (var i=0, len=opts.els.length; i < len; i++)
- $(opts.els[i]).css('z-index', len-i+count);
- }
- else {
- var z = $(curr).css('z-index');
- $el.css('z-index', parseInt(z)+1+count);
- }
- $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
- $(fwd ? this : curr).hide();
- if (cb) cb();
- });
- });
- };
- opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
-};
-
-// turnUp/Down/Left/Right
-$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.cssBefore.top = next.cycleH;
- opts.animIn.height = next.cycleH;
- });
- opts.cssFirst = { top: 0 };
- opts.cssBefore = { left: 0, height: 0 };
- opts.animIn = { top: 0 };
- opts.animOut = { height: 0 };
-};
-$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssFirst = { top: 0 };
- opts.cssBefore = { left: 0, top: 0, height: 0 };
- opts.animOut = { height: 0 };
-};
-$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.cssBefore.left = next.cycleW;
- opts.animIn.width = next.cycleW;
- });
- opts.cssBefore = { top: 0, width: 0 };
- opts.animIn = { left: 0 };
- opts.animOut = { width: 0 };
-};
-$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.animIn.width = next.cycleW;
- opts.animOut.left = curr.cycleW;
- });
- opts.cssBefore = { top: 0, left: 0, width: 0 };
- opts.animIn = { left: 0 };
- opts.animOut = { width: 0 };
-};
-
-// zoom
-$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,false,true);
- opts.cssBefore.top = next.cycleH/2;
- opts.cssBefore.left = next.cycleW/2;
- opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
- opts.animOut = { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 };
- });
- opts.cssFirst = { top:0, left: 0 };
- opts.cssBefore = { width: 0, height: 0 };
-};
-
-// fadeZoom
-$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,false);
- opts.cssBefore.left = next.cycleW/2;
- opts.cssBefore.top = next.cycleH/2;
- opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
- });
- opts.cssBefore = { width: 0, height: 0 };
- opts.animOut = { opacity: 0 };
-};
-
-// blindX
-$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
- var w = $cont.css('overflow','hidden').width();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.width = next.cycleW;
- opts.animOut.left = curr.cycleW;
- });
- opts.cssBefore = { left: w, top: 0 };
- opts.animIn = { left: 0 };
- opts.animOut = { left: w };
-};
-// blindY
-$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
- var h = $cont.css('overflow','hidden').height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssBefore = { top: h, left: 0 };
- opts.animIn = { top: 0 };
- opts.animOut = { top: h };
-};
-// blindZ
-$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
- var h = $cont.css('overflow','hidden').height();
- var w = $cont.width();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssBefore = { top: h, left: w };
- opts.animIn = { top: 0, left: 0 };
- opts.animOut = { top: h, left: w };
-};
-
-// growX - grow horizontally from centered 0 width
-$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.cssBefore.left = this.cycleW/2;
- opts.animIn = { left: 0, width: this.cycleW };
- opts.animOut = { left: 0 };
- });
- opts.cssBefore = { width: 0, top: 0 };
-};
-// growY - grow vertically from centered 0 height
-$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.cssBefore.top = this.cycleH/2;
- opts.animIn = { top: 0, height: this.cycleH };
- opts.animOut = { top: 0 };
- });
- opts.cssBefore = { height: 0, left: 0 };
-};
-
-// curtainX - squeeze in both edges horizontally
-$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true,true);
- opts.cssBefore.left = next.cycleW/2;
- opts.animIn = { left: 0, width: this.cycleW };
- opts.animOut = { left: curr.cycleW/2, width: 0 };
- });
- opts.cssBefore = { top: 0, width: 0 };
-};
-// curtainY - squeeze in both edges vertically
-$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false,true);
- opts.cssBefore.top = next.cycleH/2;
- opts.animIn = { top: 0, height: next.cycleH };
- opts.animOut = { top: curr.cycleH/2, height: 0 };
- });
- opts.cssBefore = { left: 0, height: 0 };
-};
-
-// cover - curr slide covered by next slide
-$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
- var d = opts.direction || 'left';
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- if (d == 'right')
- opts.cssBefore.left = -w;
- else if (d == 'up')
- opts.cssBefore.top = h;
- else if (d == 'down')
- opts.cssBefore.top = -h;
- else
- opts.cssBefore.left = w;
- });
- opts.animIn = { left: 0, top: 0};
- opts.animOut = { opacity: 1 };
- opts.cssBefore = { top: 0, left: 0 };
-};
-
-// uncover - curr slide moves off next slide
-$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
- var d = opts.direction || 'left';
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- if (d == 'right')
- opts.animOut.left = w;
- else if (d == 'up')
- opts.animOut.top = -h;
- else if (d == 'down')
- opts.animOut.top = h;
- else
- opts.animOut.left = -w;
- });
- opts.animIn = { left: 0, top: 0 };
- opts.animOut = { opacity: 1 };
- opts.cssBefore = { top: 0, left: 0 };
-};
-
-// toss - move top slide and fade away
-$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
- var w = $cont.css('overflow','visible').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- // provide default toss settings if animOut not provided
- if (!opts.animOut.left && !opts.animOut.top)
- opts.animOut = { left: w*2, top: -h/2, opacity: 0 };
- else
- opts.animOut.opacity = 0;
- });
- opts.cssBefore = { left: 0, top: 0 };
- opts.animIn = { left: 0 };
-};
-
-// wipe - clip animation
-$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.cssBefore = opts.cssBefore || {};
- var clip;
- if (opts.clip) {
- if (/l2r/.test(opts.clip))
- clip = 'rect(0px 0px '+h+'px 0px)';
- else if (/r2l/.test(opts.clip))
- clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
- else if (/t2b/.test(opts.clip))
- clip = 'rect(0px '+w+'px 0px 0px)';
- else if (/b2t/.test(opts.clip))
- clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
- else if (/zoom/.test(opts.clip)) {
- var top = parseInt(h/2);
- var left = parseInt(w/2);
- clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
- }
- }
-
- opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
-
- var d = opts.cssBefore.clip.match(/(\d+)/g);
- var t = parseInt(d[0]), r = parseInt(d[1]), b = parseInt(d[2]), l = parseInt(d[3]);
-
- opts.before.push(function(curr, next, opts) {
- if (curr == next) return;
- var $curr = $(curr), $next = $(next);
- $.fn.cycle.commonReset(curr,next,opts,true,true,false);
- opts.cssAfter.display = 'block';
-
- var step = 1, count = parseInt((opts.speedIn / 13)) - 1;
- (function f() {
- var tt = t ? t - parseInt(step * (t/count)) : 0;
- var ll = l ? l - parseInt(step * (l/count)) : 0;
- var bb = b < h ? b + parseInt(step * ((h-b)/count || 1)) : h;
- var rr = r < w ? r + parseInt(step * ((w-r)/count || 1)) : w;
- $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
- (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
- })();
- });
- opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
- opts.animIn = { left: 0 };
- opts.animOut = { left: 0 };
-};
-
-})(jQuery);
diff --git a/app/assets/Archive/javascripts/lib/jquery.masonry.min.js b/app/assets/Archive/javascripts/lib/jquery.masonry.min.js
deleted file mode 100644
index 67be9886..00000000
--- a/app/assets/Archive/javascripts/lib/jquery.masonry.min.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * jQuery Masonry v2.1.05
- * A dynamic layout plugin for jQuery
- * The flip-side of CSS Floats
- * http://masonry.desandro.com
- *
- * Licensed under the MIT license.
- * Copyright 2012 David DeSandro
- */
-(function(a,b,c){"use strict";var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,c){var d=this,f=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){b.event.handle.apply(d,f)},c==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()},b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[];var d=this.element[0].style;this.originalStyle={height:d.height||""};var e=this.options.containerStyle;for(var f in e)this.originalStyle[f]=d[f]||"";this.element.css(e),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={x:parseInt(this.element.css("padding-"+this.horizontalDirection),10),y:parseInt(this.element.css("padding-top"),10)},this.isFluid=this.options.columnWidth&&typeof this.options.columnWidth=="function";var g=this;setTimeout(function(){g.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){g.resize()}),this.reloadItems()},_init:function(a){this._getColumns(),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,b){for(var c=0,d=a.length;c')).load(handler).error(handler).bind('abort',handler).each(fetch);function handler(e){data.element=this;data.found=e.type=='load';data.image=this.src;data.index=this.index;var a=data.original=c[this.index];data[data.found?'loaded':'failed']++;data.done++;if(d.enforceCache)h.cache.push($(' ').attr('src',data.image)[0]);if(d.placeholder&&a.src)a.src=data.found?data.image:d.notFound||a.src;if(d.onComplete)d.onComplete(data);if(data.done= 0; i--) {
-
- //Cache variables and intersection, continue if no intersection
- var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
- if (!intersection) continue;
-
- if(itemElement != this.currentItem[0] //cannot intersect with itself
- && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
- && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
- && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
- //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
- ) {
-
- $(itemElement).mouseenter();
-
- this.direction = intersection == 1 ? "down" : "up";
-
- if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
- $(itemElement).mouseleave();
- this._rearrange(event, item);
- } else {
- break;
- }
-
- // Clear emtpy ul's/ol's
- this._clearEmpty(itemElement);
-
- this._trigger("change", event, this._uiHash());
- break;
- }
- }
-
- var parentItem = (this.placeholder[0].parentNode.parentNode
- && $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length)
- ? $(this.placeholder[0].parentNode.parentNode)
- : null,
- level = this._getLevel(this.placeholder),
- childLevels = this._getChildLevels(this.helper),
- previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
-
- if (previousItem != null) {
- while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0]) {
- if (previousItem[0].previousSibling) {
- previousItem = $(previousItem[0].previousSibling);
- } else {
- previousItem = null;
- break;
- }
- }
- }
-
- newList = document.createElement(o.listType);
-
- this.beyondMaxLevels = 0;
-
- // If the item is moved to the left, send it to its parent level
- if (parentItem != null && this.positionAbs.left < parentItem.offset().left) {
- parentItem.after(this.placeholder[0]);
- this._clearEmpty(parentItem[0]);
- this._trigger("change", event, this._uiHash());
- }
- // If the item is below another one and is moved to the right, make it a children of it
- else if (previousItem != null && this.positionAbs.left > previousItem.offset().left + o.tabSize) {
- this._isAllowed(previousItem, level+childLevels+1);
- if (!previousItem.children(o.listType).length) {
- previousItem[0].appendChild(newList);
- }
- previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
- this._trigger("change", event, this._uiHash());
- }
- else {
- this._isAllowed(parentItem, level+childLevels);
- }
-
- //Post events to containers
- this._contactContainers(event);
-
- //Interconnect with droppables
- if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
-
- //Call callbacks
- this._trigger('sort', event, this._uiHash());
-
- this.lastPositionAbs = this.positionAbs;
- return false;
-
- },
-
- _mouseStop: function(event, noPropagation) {
-
- // If the item is in a position not allowed, send it back
- if (this.beyondMaxLevels) {
-
- this.placeholder.removeClass(this.options.errorClass);
-
- if (this.options.revertOnError) {
- if (this.domPosition.prev) {
- $(this.domPosition.prev).after(this.placeholder);
- } else {
- $(this.domPosition.parent).prepend(this.placeholder);
- }
- this._trigger("revert", event, this._uiHash());
- } else {
- var parent = this.placeholder.parent().closest(this.options.items);
-
- for (var i = this.beyondMaxLevels - 1; i > 0; i--) {
- parent = parent.parent().closest(this.options.items);
- }
-
- parent.after(this.placeholder);
- this._trigger("change", event, this._uiHash());
- }
-
- }
-
- // Clean last empty ul/ol
- for (var i = this.items.length - 1; i >= 0; i--) {
- var item = this.items[i].item[0];
- this._clearEmpty(item);
- }
-
- $.ui.sortable.prototype._mouseStop.apply(this, arguments);
-
- },
-
- serialize: function(o) {
-
- var items = this._getItemsAsjQuery(o && o.connected),
- str = []; o = o || {};
-
- $(items).each(function() {
- var res = ($(o.item || this).attr(o.attribute || 'id') || '')
- .match(o.expression || (/(.+)[-=_](.+)/)),
- pid = ($(o.item || this).parent(o.listType)
- .parent('li')
- .attr(o.attribute || 'id') || '')
- .match(o.expression || (/(.+)[-=_](.+)/));
-
- if (res) {
- str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
- + '='
- + (pid ? (o.key && o.expression ? pid[1] : pid[2]) : 'root'));
- }
- });
-
- if(!str.length && o.key) {
- str.push(o.key + '=');
- }
-
- return str.join('&');
-
- },
-
- toHierarchy: function(o) {
-
- o = o || {};
- var sDepth = o.startDepthCount || 0,
- ret = [];
-
- $(this.element).children('li').each(function () {
- var level = _recursiveItems($(this));
- ret.push(level);
- });
-
- return ret;
-
- function _recursiveItems(li) {
- var id = ($(li).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
- if (id) {
- var item = {"id" : id[2]};
- if ($(li).children(o.listType).children('li').length > 0) {
- item.children = [];
- $(li).children(o.listType).children('li').each(function() {
- var level = _recursiveItems($(this));
- item.children.push(level);
- });
- }
- return item;
- }
- }
- },
-
- toArray: function(o) {
-
- o = o || {};
- var sDepth = o.startDepthCount || 0,
- ret = [],
- left = 2;
-
- ret.push({
- "item_id": 'root',
- "parent_id": 'none',
- "depth": sDepth,
- "left": '1',
- "right": ($('li', this.element).length + 1) * 2
- });
-
- $(this.element).children('li').each(function () {
- left = _recursiveArray(this, sDepth + 1, left);
- });
-
- ret = ret.sort(function(a,b){ return (a.left - b.left); });
-
- return ret;
-
- function _recursiveArray(item, depth, left) {
-
- var right = left + 1,
- id,
- pid;
-
- if ($(item).children(o.listType).children('li').length > 0) {
- depth ++;
- $(item).children(o.listType).children('li').each(function () {
- right = _recursiveArray($(this), depth, right);
- });
- depth --;
- }
-
- id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
-
- if (depth === sDepth + 1) {
- pid = 'root';
- } else {
- var parentItem = ($(item).parent(o.listType)
- .parent('li')
- .attr(o.attribute || 'id'))
- .match(o.expression || (/(.+)[-=_](.+)/));
- pid = parentItem[2];
- }
-
- if (id) {
- ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
- }
-
- left = right + 1;
- return left;
- }
-
- },
-
- _clearEmpty: function(item) {
-
- var emptyList = $(item).children(this.options.listType);
- if (emptyList.length && !emptyList.children().length) {
- emptyList.remove();
- }
-
- },
-
- _getLevel: function(item) {
-
- var level = 1;
-
- if (this.options.listType) {
- var list = item.closest(this.options.listType);
- while (!list.is('.ui-sortable')) {
- level++;
- list = list.parent().closest(this.options.listType);
- }
- }
-
- return level;
- },
-
- _getChildLevels: function(parent, depth) {
- var self = this,
- o = this.options,
- result = 0;
- depth = depth || 0;
-
- $(parent).children(o.listType).children(o.items).each(function (index, child) {
- result = Math.max(self._getChildLevels(child, depth + 1), result);
- });
-
- return depth ? result + 1 : result;
- },
-
- _isAllowed: function(parentItem, levels) {
- var o = this.options;
- // Are we trying to nest under a no-nest or are we nesting too deep?
- if (parentItem == null || !(parentItem.hasClass(o.disableNesting))) {
- if (o.maxLevels < levels && o.maxLevels != 0) {
- this.placeholder.addClass(o.errorClass);
- this.beyondMaxLevels = levels - o.maxLevels;
- } else {
- this.placeholder.removeClass(o.errorClass);
- this.beyondMaxLevels = 0;
- }
- } else {
- this.placeholder.addClass(o.errorClass);
- if (o.maxLevels < levels && o.maxLevels != 0) {
- this.beyondMaxLevels = levels - o.maxLevels;
- } else {
- this.beyondMaxLevels = 1;
- }
- }
- }
-
- }));
-
- $.ui.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.ui.nestedSortable.prototype.options);
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/lib/social-share-button.coffee b/app/assets/Archive/javascripts/lib/social-share-button.coffee
deleted file mode 100644
index cec9fcbc..00000000
--- a/app/assets/Archive/javascripts/lib/social-share-button.coffee
+++ /dev/null
@@ -1,33 +0,0 @@
-window.SocialShareButton =
- openUrl : (url) ->
- window.open(url)
- false
-
- share : (el) ->
- site = $(el).data('site')
- title = encodeURIComponent($(el).parent().data('title'))
- img = encodeURIComponent($(el).parent().data("img"))
- fb_url = encodeURIComponent($(el).parent().data("fb_url"))
- url = encodeURIComponent(location.href)
- switch site
- when "weibo"
- SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
- when "twitter"
- SocialShareButton.openUrl("https://twitter.com/home?status=#{title}: #{url}")
- when "douban"
- SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}")
- when "facebook"
- SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{fb_url}")
- when "qq"
- SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}")
- when "tqq"
- SocialShareButton.openUrl("http://share.v.t.qq.com/index.php?c=share&a=index&url=#{url}&title=#{title}&pic=#{img}")
- when "baidu"
- SocialShareButton.openUrl("http://apps.hi.baidu.com/share/?url=#{url}&title=#{title}&content=")
- when "kaixin001"
- SocialShareButton.openUrl("http://www.kaixin001.com/rest/records.php?url=#{url}&content=#{title}&style=11&pic=#{img}")
- when "renren"
- SocialShareButton.openUrl("http://widget.renren.com/dialog/share?resourceUrl=#{url}&title=#{title}&description=")
- when "google_plus"
- SocialShareButton.openUrl("https://plus.google.com/share?url=#{url}&t=#{title}")
- false
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/mobile.js b/app/assets/Archive/javascripts/mobile.js
deleted file mode 100644
index 7aa929c3..00000000
--- a/app/assets/Archive/javascripts/mobile.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// This is a manifest file that'll be compiled into including all the files listed below.
-// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
-// be included in the compiled file accessible from http://example.com/assets/application.js
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// the compiled file.
-//
-//= require jquery
-//= require cycle2
-//= require mobile/jquery.mu.image.resize
-//= require mobile/orbit.mobile
-//= require mobile/jquery.mobile-1.2.0.min
-//= require mobile/jquery.swipeplanes-1.2.min
-//= require mobile/add2home
-//= require mobile/gmAPI
-//= require mobile/jquery.ui.map
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/mobile/add2home.js b/app/assets/Archive/javascripts/mobile/add2home.js
deleted file mode 100644
index 38b35bfa..00000000
--- a/app/assets/Archive/javascripts/mobile/add2home.js
+++ /dev/null
@@ -1,350 +0,0 @@
-/*!
- * Add to Homescreen v2.0.4 ~ Copyright (c) 2012 Matteo Spinelli, http://cubiq.org
- * Released under MIT license, http://cubiq.org/license
- */
-var addToHome = (function (w) {
- var nav = w.navigator,
- isIDevice = 'platform' in nav && (/iphone|ipod|ipad/gi).test(nav.platform),
- isIPad,
- isRetina,
- isSafari,
- isStandalone,
- OSVersion,
- startX = 0,
- startY = 0,
- lastVisit = 0,
- isExpired,
- isSessionActive,
- isReturningVisitor,
- balloon,
- overrideChecks,
-
- positionInterval,
- closeTimeout,
-
- options = {
- autostart: true, // Automatically open the balloon
- returningVisitor: false, // Show the balloon to returning visitors only (setting this to true is HIGHLY RECCOMENDED)
- animationIn: 'bubble', // drop || bubble || fade
- animationOut: 'drop', // drop || bubble || fade
- startDelay: 2000, // 2 seconds from page load before the balloon appears
- lifespan: 10000, // 15 seconds before it is automatically destroyed
- bottomOffset: 14, // Distance of the balloon from bottom
- expire: 0, // Minutes to wait before showing the popup again (0 = always displayed)
- message: '', // Customize your message or force a language ('' = automatic)
- touchIcon: true, // Display the touch icon
- arrow: true, // Display the balloon arrow
- hookOnLoad: true, // Should we hook to onload event? (really advanced usage)
- iterations: 100 // Internal/debug use
- },
-
- intl = {
- ca_es: 'Per instal·lar aquesta aplicació al vostre %device premeu %icon i llavors Afegir a pantalla d\'inici .',
- cs_cz: 'Pro instalaci aplikace na Váš %device, stiskněte %icon a v nabídce Přidat na plochu .',
- da_dk: 'Tilføj denne side til din %device: tryk på %icon og derefter Føj til hjemmeskærm .',
- de_de: 'Installieren Sie diese App auf Ihrem %device: %icon antippen und dann Zum Home-Bildschirm .',
- el_gr: 'Εγκαταστήσετε αυτήν την Εφαρμογή στήν συσκευή σας %device: %icon μετά πατάτε Προσθήκη σε Αφετηρία .',
- en_us: 'Install this web app on your %device: tap %icon and then Add to Home Screen .',
- es_es: 'Para instalar esta app en su %device, pulse %icon y seleccione Añadir a pantalla de inicio .',
- fi_fi: 'Asenna tämä web-sovellus laitteeseesi %device: paina %icon ja sen jälkeen valitse Lisää Koti-valikkoon .',
- fr_fr: 'Ajoutez cette application sur votre %device en cliquant sur %icon, puis Ajouter à l\'écran d\'accueil .',
- he_il: 'התקן אפליקציה זו על ה-%device שלך: הקש %icon ואז הוסף למסך הבית . ',
- hr_hr: 'Instaliraj ovu aplikaciju na svoj %device: klikni na %icon i odaberi Dodaj u početni zaslon .',
- hu_hu: 'Telepítse ezt a web-alkalmazást az Ön %device-jára: nyomjon a %icon-ra majd a Főképernyőhöz adás gombra.',
- it_it: 'Installa questa applicazione sul tuo %device: premi su %icon e poi Aggiungi a Home .',
- ja_jp: 'このウェブアプリをあなたの%deviceにインストールするには%iconをタップしてホーム画面に追加 を選んでください。',
- ko_kr: '%device에 웹앱을 설치하려면 %icon을 터치 후 "홈화면에 추가"를 선택하세요',
- nb_no: 'Installer denne appen på din %device: trykk på %icon og deretter Legg til på Hjem-skjerm ',
- nl_nl: 'Installeer deze webapp op uw %device: tik %icon en dan Zet in beginscherm .',
- pl_pl: 'Aby zainstalować tę aplikacje na %device: naciśnij %icon a następnie Dodaj jako ikonę .',
- pt_br: 'Instale este web app em seu %device: aperte %icon e selecione Adicionar à Tela Inicio .',
- pt_pt: 'Para instalar esta aplicação no seu %device, prima o %icon e depois o Adicionar ao ecrã principal .',
- ru_ru: 'Установите это веб-приложение на ваш %device: нажмите %icon, затем Добавить в «Домой» .',
- sv_se: 'Lägg till denna webbapplikation på din %device: tryck på %icon och därefter Lägg till på hemskärmen .',
- th_th: 'ติดตั้งเว็บแอพฯ นี้บน %device ของคุณ: แตะ %icon และ เพิ่มที่หน้าจอโฮม ',
- tr_tr: '%device için bu uygulamayı kurduktan sonra %icon simgesine dokunarak Ana Ekrana Ekle yin.',
- zh_cn: '您可以将此应用程式安装到您的 %device 上。请按 %icon 然后点选添加至主屏幕 。',
- zh_tw: '您可以將此應用程式安裝到您的 %device 上。請按 %icon 然後點選加入主畫面螢幕 。'
- };
-
- function init () {
- // Preliminary check, all further checks are performed on iDevices only
- if ( !isIDevice ) return;
-
- var now = Date.now(),
- i;
-
- // Merge local with global options
- if ( w.addToHomeConfig ) {
- for ( i in w.addToHomeConfig ) {
- options[i] = w.addToHomeConfig[i];
- }
- }
- if ( !options.autostart ) options.hookOnLoad = false;
-
- isIPad = (/ipad/gi).test(nav.platform);
- isRetina = w.devicePixelRatio && w.devicePixelRatio > 1;
- isSafari = (/Safari/i).test(nav.appVersion) && !(/CriOS/i).test(nav.appVersion);
- isStandalone = nav.standalone;
- OSVersion = nav.appVersion.match(/OS (\d+_\d+)/i);
- OSVersion = OSVersion[1] ? +OSVersion[1].replace('_', '.') : 0;
-
- lastVisit = +w.localStorage.getItem('addToHome');
-
- isSessionActive = w.sessionStorage.getItem('addToHomeSession');
- isReturningVisitor = options.returningVisitor ? lastVisit && lastVisit + 28*24*60*60*1000 > now : true;
-
- if ( !lastVisit ) lastVisit = now;
-
- // If it is expired we need to reissue a new balloon
- isExpired = isReturningVisitor && lastVisit <= now;
-
- if ( options.hookOnLoad ) w.addEventListener('load', loaded, false);
- else if ( !options.hookOnLoad && options.autostart ) loaded();
- }
-
- function loaded () {
- w.removeEventListener('load', loaded, false);
-
- if ( !isReturningVisitor ) w.localStorage.setItem('addToHome', Date.now());
- else if ( options.expire && isExpired ) w.localStorage.setItem('addToHome', Date.now() + options.expire * 60000);
-
- if ( !overrideChecks && ( !isSafari || !isExpired || isSessionActive || isStandalone || !isReturningVisitor ) ) return;
-
- var icons = options.touchIcon ? document.querySelectorAll('head link[rel=apple-touch-icon],head link[rel=apple-touch-icon-precomposed]') : [],
- sizes,
- touchIcon = '',
- closeButton,
- platform = nav.platform.split(' ')[0],
- language = nav.language.replace('-', '_'),
- i, l;
-
- balloon = document.createElement('div');
- balloon.id = 'addToHomeScreen';
- balloon.style.cssText += 'left:-9999px;-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0;-webkit-transform:translate3d(0,0,0);position:' + (OSVersion < 5 ? 'absolute' : 'fixed');
-
- // Localize message
- if ( options.message in intl ) { // You may force a language despite the user's locale
- language = options.message;
- options.message = '';
- }
- if ( options.message === '' ) { // We look for a suitable language (defaulted to en_us)
- options.message = language in intl ? intl[language] : intl['en_us'];
- }
-
- // Search for the apple-touch-icon
- if ( icons.length ) {
- for ( i = 0, l = icons.length; i < l; i++ ) {
- sizes = icons[i].getAttribute('sizes');
-
- if ( sizes ) {
- if ( isRetina && sizes == '114x114' ) {
- touchIcon = icons[i].href;
- break;
- }
- } else {
- touchIcon = icons[i].href;
- }
- }
-
- touchIcon = ' ';
- }
-
- balloon.className = (isIPad ? 'addToHomeIpad' : 'addToHomeIphone') + (touchIcon ? ' addToHomeWide' : '');
- balloon.innerHTML = touchIcon +
- options.message.replace('%device', platform).replace('%icon', OSVersion >= 4.2 ? ' ' : '+ ') +
- (options.arrow ? ' ' : '') +
- '\u00D7 ';
-
- document.body.appendChild(balloon);
-
- // Add the close action
- closeButton = balloon.querySelector('.addToHomeClose');
- if ( closeButton ) closeButton.addEventListener('click', clicked, false);
-
- if ( !isIPad && OSVersion >= 6 ) window.addEventListener('orientationchange', orientationCheck, false);
-
- setTimeout(show, options.startDelay);
- }
-
- function show () {
- var duration,
- iPadXShift = 208;
-
- // Set the initial position
- if ( isIPad ) {
- if ( OSVersion < 5 ) {
- startY = w.scrollY;
- startX = w.scrollX;
- } else if ( OSVersion < 6 ) {
- iPadXShift = 160;
- }
-
- balloon.style.top = startY + options.bottomOffset + 'px';
- balloon.style.left = startX + iPadXShift - Math.round(balloon.offsetWidth / 2) + 'px';
-
- switch ( options.animationIn ) {
- case 'drop':
- duration = '0.6s';
- balloon.style.webkitTransform = 'translate3d(0,' + -(w.scrollY + options.bottomOffset + balloon.offsetHeight) + 'px,0)';
- break;
- case 'bubble':
- duration = '0.6s';
- balloon.style.opacity = '0';
- balloon.style.webkitTransform = 'translate3d(0,' + (startY + 50) + 'px,0)';
- break;
- default:
- duration = '1s';
- balloon.style.opacity = '0';
- }
- } else {
- startY = w.innerHeight + w.scrollY;
-
- if ( OSVersion < 5 ) {
- startX = Math.round((w.innerWidth - balloon.offsetWidth) / 2) + w.scrollX;
- balloon.style.left = startX + 'px';
- balloon.style.top = startY - balloon.offsetHeight - options.bottomOffset + 'px';
- } else {
- balloon.style.left = '50%';
- balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px';
- balloon.style.bottom = options.bottomOffset + 'px';
- }
-
- switch (options.animationIn) {
- case 'drop':
- duration = '1s';
- balloon.style.webkitTransform = 'translate3d(0,' + -(startY + options.bottomOffset) + 'px,0)';
- break;
- case 'bubble':
- duration = '0.6s';
- balloon.style.webkitTransform = 'translate3d(0,' + (balloon.offsetHeight + options.bottomOffset + 50) + 'px,0)';
- break;
- default:
- duration = '1s';
- balloon.style.opacity = '0';
- }
- }
-
- balloon.offsetHeight; // repaint trick
- balloon.style.webkitTransitionDuration = duration;
- balloon.style.opacity = '1';
- balloon.style.webkitTransform = 'translate3d(0,0,0)';
- balloon.addEventListener('webkitTransitionEnd', transitionEnd, false);
-
- closeTimeout = setTimeout(close, options.lifespan);
- }
-
- function manualShow (override) {
- if ( !isIDevice || balloon ) return;
-
- overrideChecks = override;
- loaded();
- }
-
- function close () {
- clearInterval( positionInterval );
- clearTimeout( closeTimeout );
- closeTimeout = null;
-
- var posY = 0,
- posX = 0,
- opacity = '1',
- duration = '0',
- closeButton = balloon.querySelector('.addToHomeClose');
-
- if ( closeButton ) closeButton.removeEventListener('click', close, false);
- if ( !isIPad && OSVersion >= 6 ) window.removeEventListener('orientationchange', orientationCheck, false);
-
- if ( OSVersion < 5 ) {
- posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY;
- posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth)/2) - startX;
- }
-
- balloon.style.webkitTransitionProperty = '-webkit-transform,opacity';
-
- switch ( options.animationOut ) {
- case 'drop':
- if ( isIPad ) {
- duration = '0.4s';
- opacity = '0';
- posY = posY + 50;
- } else {
- duration = '0.6s';
- posY = posY + balloon.offsetHeight + options.bottomOffset + 50;
- }
- break;
- case 'bubble':
- if ( isIPad ) {
- duration = '0.8s';
- posY = posY - balloon.offsetHeight - options.bottomOffset - 50;
- } else {
- duration = '0.4s';
- opacity = '0';
- posY = posY - 50;
- }
- break;
- default:
- duration = '0.8s';
- opacity = '0';
- }
-
- balloon.addEventListener('webkitTransitionEnd', transitionEnd, false);
- balloon.style.opacity = opacity;
- balloon.style.webkitTransitionDuration = duration;
- balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)';
- }
-
-
- function clicked () {
- w.sessionStorage.setItem('addToHomeSession', '1');
- isSessionActive = true;
- close();
- }
-
- function transitionEnd () {
- balloon.removeEventListener('webkitTransitionEnd', transitionEnd, false);
-
- balloon.style.webkitTransitionProperty = '-webkit-transform';
- balloon.style.webkitTransitionDuration = '0.2s';
-
- // We reached the end!
- if ( !closeTimeout ) {
- balloon.parentNode.removeChild(balloon);
- balloon = null;
- return;
- }
-
- // On iOS 4 we start checking the element position
- if ( OSVersion < 5 && closeTimeout ) positionInterval = setInterval(setPosition, options.iterations);
- }
-
- function setPosition () {
- var matrix = new WebKitCSSMatrix(w.getComputedStyle(balloon, null).webkitTransform),
- posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY,
- posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth) / 2) - startX;
-
- // Screen didn't move
- if ( posY == matrix.m42 && posX == matrix.m41 ) return;
-
- balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)';
- }
-
- // Clear local and session storages (this is useful primarily in development)
- function reset () {
- w.localStorage.removeItem('addToHome');
- w.sessionStorage.removeItem('addToHomeSession');
- }
-
- function orientationCheck () {
- balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px';
- }
-
- // Bootstrap!
- init();
-
- return {
- show: manualShow,
- close: close,
- reset: reset
- };
-})(window);
diff --git a/app/assets/Archive/javascripts/mobile/gmAPI.js b/app/assets/Archive/javascripts/mobile/gmAPI.js
deleted file mode 100644
index ab078c3a..00000000
--- a/app/assets/Archive/javascripts/mobile/gmAPI.js
+++ /dev/null
@@ -1,34 +0,0 @@
- String.prototype.format = function() { a = this; for ( k in arguments ) { a = a.replace("{" + k + "}", arguments[k]); } return a; };
- window.gmAPI = {
- 'version': '3.0-rc1',
- 'ga': '',
- 'primaryUrl': 'http://code.google.com/p/jquery-ui-map/',
- 'url': 'http://jquery-ui-map.googlecode.com/',
- 'forum': 'http://groups.google.com/group/jquery-ui-map-discuss/feed/rss_v2_0_msgs.xml',
- 'subscribe': 'http://groups.google.com/group/jquery-ui-map-discuss/boxsubscribe',
- 'exception': 'Unable to load due to either poor internet connection or some CDN\'s aren\'t as responsive as we would like them to be. Try refreshing the page :D.',
- 'init': function() {
- //window._gaq = [['_setAccount', this.ga], ['_trackPageview'], ['_trackPageLoadTime']];
- //Modernizr.load({ 'test': ( location.href.indexOf(this.url) > -1 ), 'yep': 'http://www.google-analytics.com/ga.js' });
- this.test('Backbone', function() {
- $('#forum').append('Forum Subscribe ');
- ForumCollection = Backbone.Collection.extend({ 'url': 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q={0}'.format(encodeURIComponent(gmAPI.forum)), 'parse': function(response) { return response.responseData.feed.entries; } });
- ForumPost = Backbone.View.extend({ 'tagName': 'li', 'className': 'group-item', 'template': _.template('<%=title%> '), 'render': function() { $(this.el).html(this.template(this.model.toJSON())); return this; } });
- Forum = Backbone.View.extend({ 'el': $("#forum"), 'initialize': function() { this.col = new ForumCollection(); this.col.bind('reset', this.load, this); this.col.fetch(); }, 'add': function(post) { var view = new ForumPost({'model': post}); $('#forum_posts').append(view.render().el); }, 'load': function () { this.col.each(this.add); $('#forum_subscribe').attr('action', gmAPI.subscribe); $(this.el).show(); } });
- var app = new Forum();
- });
- this.test('prettyPrint', function() { prettyPrint(); });
- $('#version').text(this.version);
- },
- 'redirect': function(url) { alert('This page is deprecated. Please update your URL. Redirecting to new page.'); window.location = url; },
- 'col': [],
- 'tests': [],
- 'test': function(a, b) { if ( window[a] ) { b(); } },
- 'add': function(a, b) { if (b) { this.col[a] = b; } else { this.col.push(a); } return this; },
- 'load': function(a) { var self = this; if (a) { self.col[a](); } else { $.each(self.col, function(i,d) { try { d(); } catch (err) { alert(self.exception); } }); } },
- 'timeStart': function(key, desc) { this.tests[key] = { 'start': new Date().getTime(), 'desc': desc }; },
- 'timeEnd': function(key) { this.tests[key].elapsed = new Date().getTime(); },
- 'report': function(id) { var i = 1; for ( var k in this.tests ) { var t = this.tests[k]; $(id).append('' + (t.elapsed - t.start) + ' ms
Benchmark case ' + i + '
' + t.desc + '
'); i++; }; }
- };
-
- gmAPI.init();
\ No newline at end of file
diff --git a/app/assets/Archive/javascripts/mobile/jquery.cycle.all.js b/app/assets/Archive/javascripts/mobile/jquery.cycle.all.js
deleted file mode 100644
index 89d583eb..00000000
--- a/app/assets/Archive/javascripts/mobile/jquery.cycle.all.js
+++ /dev/null
@@ -1,1551 +0,0 @@
-/*!
- * jQuery Cycle Plugin (with Transition Definitions)
- * Examples and documentation at: http://jquery.malsup.com/cycle/
- * Copyright (c) 2007-2010 M. Alsup
- * Version: 2.9999.8 (26-OCT-2012)
- * Dual licensed under the MIT and GPL licenses.
- * http://jquery.malsup.com/license.html
- * Requires: jQuery v1.3.2 or later
- */
-;(function($, undefined) {
-"use strict";
-
-var ver = '2.9999.8';
-
-// if $.support is not defined (pre jQuery 1.3) add what I need
-if ($.support === undefined) {
- $.support = {
- opacity: !($.browser.msie)
- };
-}
-
-function debug(s) {
- if ($.fn.cycle.debug)
- log(s);
-}
-function log() {
- if (window.console && console.log)
- console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
-}
-$.expr[':'].paused = function(el) {
- return el.cyclePause;
-};
-
-
-// the options arg can be...
-// a number - indicates an immediate transition should occur to the given slide index
-// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
-// an object - properties to control the slideshow
-//
-// the arg2 arg can be...
-// the name of an fx (only used in conjunction with a numeric value for 'options')
-// the value true (only used in first arg == 'resume') and indicates
-// that the resume should occur immediately (not wait for next timeout)
-
-$.fn.cycle = function(options, arg2) {
- var o = { s: this.selector, c: this.context };
-
- // in 1.3+ we can fix mistakes with the ready state
- if (this.length === 0 && options != 'stop') {
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing slideshow');
- $(function() {
- $(o.s,o.c).cycle(options,arg2);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- // iterate the matched nodeset
- return this.each(function() {
- var opts = handleArguments(this, options, arg2);
- if (opts === false)
- return;
-
- opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
-
- // stop existing slideshow for this container (if there is one)
- if (this.cycleTimeout)
- clearTimeout(this.cycleTimeout);
- this.cycleTimeout = this.cyclePause = 0;
- this.cycleStop = 0; // issue #108
-
- var $cont = $(this);
- var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
- var els = $slides.get();
-
- if (els.length < 2) {
- log('terminating; too few slides: ' + els.length);
- return;
- }
-
- var opts2 = buildOptions($cont, $slides, els, opts, o);
- if (opts2 === false)
- return;
-
- var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
-
- // if it's an auto slideshow, kick it off
- if (startTime) {
- startTime += (opts2.delay || 0);
- if (startTime < 10)
- startTime = 10;
- debug('first timeout: ' + startTime);
- this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards);}, startTime);
- }
- });
-};
-
-function triggerPause(cont, byHover, onPager) {
- var opts = $(cont).data('cycle.opts');
- if (!opts)
- return;
- var paused = !!cont.cyclePause;
- if (paused && opts.paused)
- opts.paused(cont, opts, byHover, onPager);
- else if (!paused && opts.resumed)
- opts.resumed(cont, opts, byHover, onPager);
-}
-
-// process the args that were passed to the plugin fn
-function handleArguments(cont, options, arg2) {
- if (cont.cycleStop === undefined)
- cont.cycleStop = 0;
- if (options === undefined || options === null)
- options = {};
- if (options.constructor == String) {
- switch(options) {
- case 'destroy':
- case 'stop':
- var opts = $(cont).data('cycle.opts');
- if (!opts)
- return false;
- cont.cycleStop++; // callbacks look for change
- if (cont.cycleTimeout)
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- if (opts.elements)
- $(opts.elements).stop();
- $(cont).removeData('cycle.opts');
- if (options == 'destroy')
- destroy(cont, opts);
- return false;
- case 'toggle':
- cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
- checkInstantResume(cont.cyclePause, arg2, cont);
- triggerPause(cont);
- return false;
- case 'pause':
- cont.cyclePause = 1;
- triggerPause(cont);
- return false;
- case 'resume':
- cont.cyclePause = 0;
- checkInstantResume(false, arg2, cont);
- triggerPause(cont);
- return false;
- case 'prev':
- case 'next':
- opts = $(cont).data('cycle.opts');
- if (!opts) {
- log('options not found, "prev/next" ignored');
- return false;
- }
- $.fn.cycle[options](opts);
- return false;
- default:
- options = { fx: options };
- }
- return options;
- }
- else if (options.constructor == Number) {
- // go to the requested slide
- var num = options;
- options = $(cont).data('cycle.opts');
- if (!options) {
- log('options not found, can not advance slide');
- return false;
- }
- if (num < 0 || num >= options.elements.length) {
- log('invalid slide index: ' + num);
- return false;
- }
- options.nextSlide = num;
- if (cont.cycleTimeout) {
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- }
- if (typeof arg2 == 'string')
- options.oneTimeFx = arg2;
- go(options.elements, options, 1, num >= options.currSlide);
- return false;
- }
- return options;
-
- function checkInstantResume(isPaused, arg2, cont) {
- if (!isPaused && arg2 === true) { // resume now!
- var options = $(cont).data('cycle.opts');
- if (!options) {
- log('options not found, can not resume');
- return false;
- }
- if (cont.cycleTimeout) {
- clearTimeout(cont.cycleTimeout);
- cont.cycleTimeout = 0;
- }
- go(options.elements, options, 1, !options.backwards);
- }
- }
-}
-
-function removeFilter(el, opts) {
- if (!$.support.opacity && opts.cleartype && el.style.filter) {
- try { el.style.removeAttribute('filter'); }
- catch(smother) {} // handle old opera versions
- }
-}
-
-// unbind event handlers
-function destroy(cont, opts) {
- if (opts.next)
- $(opts.next).unbind(opts.prevNextEvent);
- if (opts.prev)
- $(opts.prev).unbind(opts.prevNextEvent);
-
- if (opts.pager || opts.pagerAnchorBuilder)
- $.each(opts.pagerAnchors || [], function() {
- this.unbind().remove();
- });
- opts.pagerAnchors = null;
- $(cont).unbind('mouseenter.cycle mouseleave.cycle');
- if (opts.destroy) // callback
- opts.destroy(opts);
-}
-
-// one-time initialization
-function buildOptions($cont, $slides, els, options, o) {
- var startingSlideSpecified;
- // support metadata plugin (v1.0 and v2.0)
- var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
- var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
- if (meta)
- opts = $.extend(opts, meta);
- if (opts.autostop)
- opts.countdown = opts.autostopCount || els.length;
-
- var cont = $cont[0];
- $cont.data('cycle.opts', opts);
- opts.$cont = $cont;
- opts.stopCount = cont.cycleStop;
- opts.elements = els;
- opts.before = opts.before ? [opts.before] : [];
- opts.after = opts.after ? [opts.after] : [];
-
- // push some after callbacks
- if (!$.support.opacity && opts.cleartype)
- opts.after.push(function() { removeFilter(this, opts); });
- if (opts.continuous)
- opts.after.push(function() { go(els,opts,0,!opts.backwards); });
-
- saveOriginalOpts(opts);
-
- // clearType corrections
- if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
- clearTypeFix($slides);
-
- // container requires non-static position so that slides can be position within
- if ($cont.css('position') == 'static')
- $cont.css('position', 'relative');
- if (opts.width)
- $cont.width(opts.width);
- if (opts.height && opts.height != 'auto')
- $cont.height(opts.height);
-
- if (opts.startingSlide !== undefined) {
- opts.startingSlide = parseInt(opts.startingSlide,10);
- if (opts.startingSlide >= els.length || opts.startSlide < 0)
- opts.startingSlide = 0; // catch bogus input
- else
- startingSlideSpecified = true;
- }
- else if (opts.backwards)
- opts.startingSlide = els.length - 1;
- else
- opts.startingSlide = 0;
-
- // if random, mix up the slide array
- if (opts.random) {
- opts.randomMap = [];
- for (var i = 0; i < els.length; i++)
- opts.randomMap.push(i);
- opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
- if (startingSlideSpecified) {
- // try to find the specified starting slide and if found set start slide index in the map accordingly
- for ( var cnt = 0; cnt < els.length; cnt++ ) {
- if ( opts.startingSlide == opts.randomMap[cnt] ) {
- opts.randomIndex = cnt;
- }
- }
- }
- else {
- opts.randomIndex = 1;
- opts.startingSlide = opts.randomMap[1];
- }
- }
- else if (opts.startingSlide >= els.length)
- opts.startingSlide = 0; // catch bogus input
- opts.currSlide = opts.startingSlide || 0;
- var first = opts.startingSlide;
-
- // set position and zIndex on all the slides
- $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
- var z;
- if (opts.backwards)
- z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
- else
- z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
- $(this).css('z-index', z);
- });
-
- // make sure first slide is visible
- $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
- removeFilter(els[first], opts);
-
- // stretch slides
- if (opts.fit) {
- if (!opts.aspect) {
- if (opts.width)
- $slides.width(opts.width);
- if (opts.height && opts.height != 'auto')
- $slides.height(opts.height);
- } else {
- $slides.each(function(){
- var $slide = $(this);
- var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
- if( opts.width && $slide.width() != opts.width ) {
- $slide.width( opts.width );
- $slide.height( opts.width / ratio );
- }
-
- if( opts.height && $slide.height() < opts.height ) {
- $slide.height( opts.height );
- $slide.width( opts.height * ratio );
- }
- });
- }
- }
-
- if (opts.center && ((!opts.fit) || opts.aspect)) {
- $slides.each(function(){
- var $slide = $(this);
- $slide.css({
- "margin-left": opts.width ?
- ((opts.width - $slide.width()) / 2) + "px" :
- 0,
- "margin-top": opts.height ?
- ((opts.height - $slide.height()) / 2) + "px" :
- 0
- });
- });
- }
-
- if (opts.center && !opts.fit && !opts.slideResize) {
- $slides.each(function(){
- var $slide = $(this);
- $slide.css({
- "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
- "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
- });
- });
- }
-
- // stretch container
- var reshape = (opts.containerResize || opts.containerResizeHeight) && !$cont.innerHeight();
- if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
- var maxw = 0, maxh = 0;
- for(var j=0; j < els.length; j++) {
- var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
- if (!w) w = e.offsetWidth || e.width || $e.attr('width');
- if (!h) h = e.offsetHeight || e.height || $e.attr('height');
- maxw = w > maxw ? w : maxw;
- maxh = h > maxh ? h : maxh;
- }
- if (opts.containerResize && maxw > 0 && maxh > 0)
- $cont.css({width:maxw+'px',height:maxh+'px'});
- if (opts.containerResizeHeight && maxh > 0)
- $cont.css({height:maxh+'px'});
- }
-
- var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
- if (opts.pause)
- $cont.bind('mouseenter.cycle', function(){
- pauseFlag = true;
- this.cyclePause++;
- triggerPause(cont, true);
- }).bind('mouseleave.cycle', function(){
- if (pauseFlag)
- this.cyclePause--;
- triggerPause(cont, true);
- });
-
- if (supportMultiTransitions(opts) === false)
- return false;
-
- // apparently a lot of people use image slideshows without height/width attributes on the images.
- // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
- var requeue = false;
- options.requeueAttempts = options.requeueAttempts || 0;
- $slides.each(function() {
- // try to get height/width of each slide
- var $el = $(this);
- this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
- this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
-
- if ( $el.is('img') ) {
- // sigh.. sniffing, hacking, shrugging... this crappy hack tries to account for what browsers do when
- // an image is being downloaded and the markup did not include sizing info (height/width attributes);
- // there seems to be some "default" sizes used in this situation
- var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
- var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
- var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
- var loadingOther = (this.cycleH === 0 && this.cycleW === 0 && !this.complete);
- // don't requeue for images that are still loading but have a valid size
- if (loadingIE || loadingFF || loadingOp || loadingOther) {
- if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
- log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
- setTimeout(function() {$(o.s,o.c).cycle(options);}, opts.requeueTimeout);
- requeue = true;
- return false; // break each loop
- }
- else {
- log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
- }
- }
- }
- return true;
- });
-
- if (requeue)
- return false;
-
- opts.cssBefore = opts.cssBefore || {};
- opts.cssAfter = opts.cssAfter || {};
- opts.cssFirst = opts.cssFirst || {};
- opts.animIn = opts.animIn || {};
- opts.animOut = opts.animOut || {};
-
- $slides.not(':eq('+first+')').css(opts.cssBefore);
- $($slides[first]).css(opts.cssFirst);
-
- if (opts.timeout) {
- opts.timeout = parseInt(opts.timeout,10);
- // ensure that timeout and speed settings are sane
- if (opts.speed.constructor == String)
- opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
- if (!opts.sync)
- opts.speed = opts.speed / 2;
-
- var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
- while((opts.timeout - opts.speed) < buffer) // sanitize timeout
- opts.timeout += opts.speed;
- }
- if (opts.easing)
- opts.easeIn = opts.easeOut = opts.easing;
- if (!opts.speedIn)
- opts.speedIn = opts.speed;
- if (!opts.speedOut)
- opts.speedOut = opts.speed;
-
- opts.slideCount = els.length;
- opts.currSlide = opts.lastSlide = first;
- if (opts.random) {
- if (++opts.randomIndex == els.length)
- opts.randomIndex = 0;
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else if (opts.backwards)
- opts.nextSlide = opts.startingSlide === 0 ? (els.length-1) : opts.startingSlide-1;
- else
- opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
-
- // run transition init fn
- if (!opts.multiFx) {
- var init = $.fn.cycle.transitions[opts.fx];
- if ($.isFunction(init))
- init($cont, $slides, opts);
- else if (opts.fx != 'custom' && !opts.multiFx) {
- log('unknown transition: ' + opts.fx,'; slideshow terminating');
- return false;
- }
- }
-
- // fire artificial events
- var e0 = $slides[first];
- if (!opts.skipInitializationCallbacks) {
- if (opts.before.length)
- opts.before[0].apply(e0, [e0, e0, opts, true]);
- if (opts.after.length)
- opts.after[0].apply(e0, [e0, e0, opts, true]);
- }
- if (opts.next)
- $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});
- if (opts.prev)
- $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});
- if (opts.pager || opts.pagerAnchorBuilder)
- buildPager(els,opts);
-
- exposeAddSlide(opts, els);
-
- return opts;
-}
-
-// save off original opts so we can restore after clearing state
-function saveOriginalOpts(opts) {
- opts.original = { before: [], after: [] };
- opts.original.cssBefore = $.extend({}, opts.cssBefore);
- opts.original.cssAfter = $.extend({}, opts.cssAfter);
- opts.original.animIn = $.extend({}, opts.animIn);
- opts.original.animOut = $.extend({}, opts.animOut);
- $.each(opts.before, function() { opts.original.before.push(this); });
- $.each(opts.after, function() { opts.original.after.push(this); });
-}
-
-function supportMultiTransitions(opts) {
- var i, tx, txs = $.fn.cycle.transitions;
- // look for multiple effects
- if (opts.fx.indexOf(',') > 0) {
- opts.multiFx = true;
- opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
- // discard any bogus effect names
- for (i=0; i < opts.fxs.length; i++) {
- var fx = opts.fxs[i];
- tx = txs[fx];
- if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
- log('discarding unknown transition: ',fx);
- opts.fxs.splice(i,1);
- i--;
- }
- }
- // if we have an empty list then we threw everything away!
- if (!opts.fxs.length) {
- log('No valid transitions named; slideshow terminating.');
- return false;
- }
- }
- else if (opts.fx == 'all') { // auto-gen the list of transitions
- opts.multiFx = true;
- opts.fxs = [];
- for (var p in txs) {
- if (txs.hasOwnProperty(p)) {
- tx = txs[p];
- if (txs.hasOwnProperty(p) && $.isFunction(tx))
- opts.fxs.push(p);
- }
- }
- }
- if (opts.multiFx && opts.randomizeEffects) {
- // munge the fxs array to make effect selection random
- var r1 = Math.floor(Math.random() * 20) + 30;
- for (i = 0; i < r1; i++) {
- var r2 = Math.floor(Math.random() * opts.fxs.length);
- opts.fxs.push(opts.fxs.splice(r2,1)[0]);
- }
- debug('randomized fx sequence: ',opts.fxs);
- }
- return true;
-}
-
-// provide a mechanism for adding slides after the slideshow has started
-function exposeAddSlide(opts, els) {
- opts.addSlide = function(newSlide, prepend) {
- var $s = $(newSlide), s = $s[0];
- if (!opts.autostopCount)
- opts.countdown++;
- els[prepend?'unshift':'push'](s);
- if (opts.els)
- opts.els[prepend?'unshift':'push'](s); // shuffle needs this
- opts.slideCount = els.length;
-
- // add the slide to the random map and resort
- if (opts.random) {
- opts.randomMap.push(opts.slideCount-1);
- opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
- }
-
- $s.css('position','absolute');
- $s[prepend?'prependTo':'appendTo'](opts.$cont);
-
- if (prepend) {
- opts.currSlide++;
- opts.nextSlide++;
- }
-
- if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
- clearTypeFix($s);
-
- if (opts.fit && opts.width)
- $s.width(opts.width);
- if (opts.fit && opts.height && opts.height != 'auto')
- $s.height(opts.height);
- s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
- s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
-
- $s.css(opts.cssBefore);
-
- if (opts.pager || opts.pagerAnchorBuilder)
- $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
-
- if ($.isFunction(opts.onAddSlide))
- opts.onAddSlide($s);
- else
- $s.hide(); // default behavior
- };
-}
-
-// reset internal state; we do this on every pass in order to support multiple effects
-$.fn.cycle.resetState = function(opts, fx) {
- fx = fx || opts.fx;
- opts.before = []; opts.after = [];
- opts.cssBefore = $.extend({}, opts.original.cssBefore);
- opts.cssAfter = $.extend({}, opts.original.cssAfter);
- opts.animIn = $.extend({}, opts.original.animIn);
- opts.animOut = $.extend({}, opts.original.animOut);
- opts.fxFn = null;
- $.each(opts.original.before, function() { opts.before.push(this); });
- $.each(opts.original.after, function() { opts.after.push(this); });
-
- // re-init
- var init = $.fn.cycle.transitions[fx];
- if ($.isFunction(init))
- init(opts.$cont, $(opts.elements), opts);
-};
-
-// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
-function go(els, opts, manual, fwd) {
- var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
-
- // opts.busy is true if we're in the middle of an animation
- if (manual && opts.busy && opts.manualTrump) {
- // let manual transitions requests trump active ones
- debug('manualTrump in go(), stopping active transition');
- $(els).stop(true,true);
- opts.busy = 0;
- clearTimeout(p.cycleTimeout);
- }
-
- // don't begin another timeout-based transition if there is one active
- if (opts.busy) {
- debug('transition active, ignoring new tx request');
- return;
- }
-
-
- // stop cycling if we have an outstanding stop request
- if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
- return;
-
- // check to see if we should stop cycling based on autostop options
- if (!manual && !p.cyclePause && !opts.bounce &&
- ((opts.autostop && (--opts.countdown <= 0)) ||
- (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
- if (opts.end)
- opts.end(opts);
- return;
- }
-
- // if slideshow is paused, only transition on a manual trigger
- var changed = false;
- if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
- changed = true;
- var fx = opts.fx;
- // keep trying to get the slide size if we don't have it yet
- curr.cycleH = curr.cycleH || $(curr).height();
- curr.cycleW = curr.cycleW || $(curr).width();
- next.cycleH = next.cycleH || $(next).height();
- next.cycleW = next.cycleW || $(next).width();
-
- // support multiple transition types
- if (opts.multiFx) {
- if (fwd && (opts.lastFx === undefined || ++opts.lastFx >= opts.fxs.length))
- opts.lastFx = 0;
- else if (!fwd && (opts.lastFx === undefined || --opts.lastFx < 0))
- opts.lastFx = opts.fxs.length - 1;
- fx = opts.fxs[opts.lastFx];
- }
-
- // one-time fx overrides apply to: $('div').cycle(3,'zoom');
- if (opts.oneTimeFx) {
- fx = opts.oneTimeFx;
- opts.oneTimeFx = null;
- }
-
- $.fn.cycle.resetState(opts, fx);
-
- // run the before callbacks
- if (opts.before.length)
- $.each(opts.before, function(i,o) {
- if (p.cycleStop != opts.stopCount) return;
- o.apply(next, [curr, next, opts, fwd]);
- });
-
- // stage the after callacks
- var after = function() {
- opts.busy = 0;
- $.each(opts.after, function(i,o) {
- if (p.cycleStop != opts.stopCount) return;
- o.apply(next, [curr, next, opts, fwd]);
- });
- if (!p.cycleStop) {
- // queue next transition
- queueNext();
- }
- };
-
- debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
-
- // get ready to perform the transition
- opts.busy = 1;
- if (opts.fxFn) // fx function provided?
- opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
- $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- else
- $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
- }
- else {
- queueNext();
- }
-
- if (changed || opts.nextSlide == opts.currSlide) {
- // calculate the next slide
- var roll;
- opts.lastSlide = opts.currSlide;
- if (opts.random) {
- opts.currSlide = opts.nextSlide;
- if (++opts.randomIndex == els.length) {
- opts.randomIndex = 0;
- opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
- }
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- if (opts.nextSlide == opts.currSlide)
- opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
- }
- else if (opts.backwards) {
- roll = (opts.nextSlide - 1) < 0;
- if (roll && opts.bounce) {
- opts.backwards = !opts.backwards;
- opts.nextSlide = 1;
- opts.currSlide = 0;
- }
- else {
- opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
- opts.currSlide = roll ? 0 : opts.nextSlide+1;
- }
- }
- else { // sequence
- roll = (opts.nextSlide + 1) == els.length;
- if (roll && opts.bounce) {
- opts.backwards = !opts.backwards;
- opts.nextSlide = els.length-2;
- opts.currSlide = els.length-1;
- }
- else {
- opts.nextSlide = roll ? 0 : opts.nextSlide+1;
- opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
- }
- }
- }
- if (changed && opts.pager)
- opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
-
- function queueNext() {
- // stage the next transition
- var ms = 0, timeout = opts.timeout;
- if (opts.timeout && !opts.continuous) {
- ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
- if (opts.fx == 'shuffle')
- ms -= opts.speedOut;
- }
- else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
- ms = 10;
- if (ms > 0)
- p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms);
- }
-}
-
-// invoked after transition
-$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
- $(pager).each(function() {
- $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
- });
-};
-
-// calculate timeout value for current transition
-function getTimeout(curr, next, opts, fwd) {
- if (opts.timeoutFn) {
- // call user provided calc fn
- var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
- while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
- t += opts.speed;
- debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
- if (t !== false)
- return t;
- }
- return opts.timeout;
-}
-
-// expose next/prev function, caller must pass in state
-$.fn.cycle.next = function(opts) { advance(opts,1); };
-$.fn.cycle.prev = function(opts) { advance(opts,0);};
-
-// advance slide forward or back
-function advance(opts, moveForward) {
- var val = moveForward ? 1 : -1;
- var els = opts.elements;
- var p = opts.$cont[0], timeout = p.cycleTimeout;
- if (timeout) {
- clearTimeout(timeout);
- p.cycleTimeout = 0;
- }
- if (opts.random && val < 0) {
- // move back to the previously display slide
- opts.randomIndex--;
- if (--opts.randomIndex == -2)
- opts.randomIndex = els.length-2;
- else if (opts.randomIndex == -1)
- opts.randomIndex = els.length-1;
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else if (opts.random) {
- opts.nextSlide = opts.randomMap[opts.randomIndex];
- }
- else {
- opts.nextSlide = opts.currSlide + val;
- if (opts.nextSlide < 0) {
- if (opts.nowrap) return false;
- opts.nextSlide = els.length - 1;
- }
- else if (opts.nextSlide >= els.length) {
- if (opts.nowrap) return false;
- opts.nextSlide = 0;
- }
- }
-
- var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
- if ($.isFunction(cb))
- cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
- go(els, opts, 1, moveForward);
- return false;
-}
-
-function buildPager(els, opts) {
- var $p = $(opts.pager);
- $.each(els, function(i,o) {
- $.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
- });
- opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
-}
-
-$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
- var a;
- if ($.isFunction(opts.pagerAnchorBuilder)) {
- a = opts.pagerAnchorBuilder(i,el);
- debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
- }
- else
- a = ''+(i+1)+' ';
-
- if (!a)
- return;
- var $a = $(a);
- // don't reparent if anchor is in the dom
- if ($a.parents('body').length === 0) {
- var arr = [];
- if ($p.length > 1) {
- $p.each(function() {
- var $clone = $a.clone(true);
- $(this).append($clone);
- arr.push($clone[0]);
- });
- $a = $(arr);
- }
- else {
- $a.appendTo($p);
- }
- }
-
- opts.pagerAnchors = opts.pagerAnchors || [];
- opts.pagerAnchors.push($a);
-
- var pagerFn = function(e) {
- e.preventDefault();
- opts.nextSlide = i;
- var p = opts.$cont[0], timeout = p.cycleTimeout;
- if (timeout) {
- clearTimeout(timeout);
- p.cycleTimeout = 0;
- }
- var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
- if ($.isFunction(cb))
- cb(opts.nextSlide, els[opts.nextSlide]);
- go(els,opts,1,opts.currSlide < i); // trigger the trans
-// return false; // <== allow bubble
- };
-
- if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
- $a.hover(pagerFn, function(){/* no-op */} );
- }
- else {
- $a.bind(opts.pagerEvent, pagerFn);
- }
-
- if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
- $a.bind('click.cycle', function(){return false;}); // suppress click
-
- var cont = opts.$cont[0];
- var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
- if (opts.pauseOnPagerHover) {
- $a.hover(
- function() {
- pauseFlag = true;
- cont.cyclePause++;
- triggerPause(cont,true,true);
- }, function() {
- if (pauseFlag)
- cont.cyclePause--;
- triggerPause(cont,true,true);
- }
- );
- }
-};
-
-// helper fn to calculate the number of slides between the current and the next
-$.fn.cycle.hopsFromLast = function(opts, fwd) {
- var hops, l = opts.lastSlide, c = opts.currSlide;
- if (fwd)
- hops = c > l ? c - l : opts.slideCount - l;
- else
- hops = c < l ? l - c : l + opts.slideCount - c;
- return hops;
-};
-
-// fix clearType problems in ie6 by setting an explicit bg color
-// (otherwise text slides look horrible during a fade transition)
-function clearTypeFix($slides) {
- debug('applying clearType background-color hack');
- function hex(s) {
- s = parseInt(s,10).toString(16);
- return s.length < 2 ? '0'+s : s;
- }
- function getBg(e) {
- for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
- var v = $.css(e,'background-color');
- if (v && v.indexOf('rgb') >= 0 ) {
- var rgb = v.match(/\d+/g);
- return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
- }
- if (v && v != 'transparent')
- return v;
- }
- return '#ffffff';
- }
- $slides.each(function() { $(this).css('background-color', getBg(this)); });
-}
-
-// reset common props before the next transition
-$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
- $(opts.elements).not(curr).hide();
- if (typeof opts.cssBefore.opacity == 'undefined')
- opts.cssBefore.opacity = 1;
- opts.cssBefore.display = 'block';
- if (opts.slideResize && w !== false && next.cycleW > 0)
- opts.cssBefore.width = next.cycleW;
- if (opts.slideResize && h !== false && next.cycleH > 0)
- opts.cssBefore.height = next.cycleH;
- opts.cssAfter = opts.cssAfter || {};
- opts.cssAfter.display = 'none';
- $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
- $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
-};
-
-// the actual fn for effecting a transition
-$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
- var $l = $(curr), $n = $(next);
- var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
- $n.css(opts.cssBefore);
- if (speedOverride) {
- if (typeof speedOverride == 'number')
- speedIn = speedOut = speedOverride;
- else
- speedIn = speedOut = 1;
- easeIn = easeOut = null;
- }
- var fn = function() {
- $n.animate(opts.animIn, speedIn, easeIn, function() {
- cb();
- });
- };
- $l.animate(opts.animOut, speedOut, easeOut, function() {
- $l.css(opts.cssAfter);
- if (!opts.sync)
- fn();
- });
- if (opts.sync) fn();
-};
-
-// transition definitions - only fade is defined here, transition pack defines the rest
-$.fn.cycle.transitions = {
- fade: function($cont, $slides, opts) {
- $slides.not(':eq('+opts.currSlide+')').css('opacity',0);
- opts.before.push(function(curr,next,opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.opacity = 0;
- });
- opts.animIn = { opacity: 1 };
- opts.animOut = { opacity: 0 };
- opts.cssBefore = { top: 0, left: 0 };
- }
-};
-
-$.fn.cycle.ver = function() { return ver; };
-
-// override these globally if you like (they are all optional)
-$.fn.cycle.defaults = {
- activePagerClass: 'activeSlide', // class name used for the active pager link
- after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
- allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
- animIn: null, // properties that define how the slide animates in
- animOut: null, // properties that define how the slide animates out
- aspect: false, // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
- autostop: 0, // true to end slideshow after X transitions (where X == slide count)
- autostopCount: 0, // number of transitions (optionally used with autostop to define X)
- backwards: false, // true to start slideshow at last slide and move backwards through the stack
- before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
- center: null, // set to true to have cycle add top/left margin to each slide (use with width and height options)
- cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE)
- cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
- containerResize: 1, // resize container to fit largest slide
- containerResizeHeight: 0, // resize containers height to fit the largest slide but leave the width dynamic
- continuous: 0, // true to start next transition immediately after current one completes
- cssAfter: null, // properties that defined the state of the slide after transitioning out
- cssBefore: null, // properties that define the initial state of the slide before transitioning in
- delay: 0, // additional delay (in ms) for first transition (hint: can be negative)
- easeIn: null, // easing for "in" transition
- easeOut: null, // easing for "out" transition
- easing: null, // easing method for both in and out transitions
- end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
- fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
- fit: 0, // force slides to fit container
- fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
- fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
- height: 'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well)
- manualTrump: true, // causes manual transition to stop an active transition instead of being ignored
- metaAttr: 'cycle', // data- attribute that holds the option data for the slideshow
- next: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
- nowrap: 0, // true to prevent slideshow from wrapping
- onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
- onPrevNextEvent: null, // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
- pager: null, // element, jQuery object, or jQuery selector string for the element to use as pager container
- pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement)
- pagerEvent: 'click.cycle', // name of event which drives the pager navigation
- pause: 0, // true to enable "pause on hover"
- pauseOnPagerHover: 0, // true to pause when hovering over pager link
- prev: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
- prevNextEvent: 'click.cycle',// event which drives the manual transition to the previous or next slide
- random: 0, // true for random, false for sequence (not applicable to shuffle fx)
- randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random
- requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
- requeueTimeout: 250, // ms delay for requeue
- rev: 0, // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
- shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 }
- skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
- slideExpr: null, // expression for selecting slides (if something other than all children is required)
- slideResize: 1, // force slide width/height to fixed size before every transition
- speed: 1000, // speed of the transition (any valid fx speed value)
- speedIn: null, // speed of the 'in' transition
- speedOut: null, // speed of the 'out' transition
- startingSlide: undefined,// zero-based index of the first slide to be displayed
- sync: 1, // true if in/out transitions should occur simultaneously
- timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance)
- timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag)
- updateActivePagerLink: null,// callback fn invoked to update the active pager link (adds/removes activePagerClass style)
- width: null // container width (if the 'fit' option is true, the slides will be set to this width as well)
-};
-
-})(jQuery);
-
-
-/*!
- * jQuery Cycle Plugin Transition Definitions
- * This script is a plugin for the jQuery Cycle Plugin
- * Examples and documentation at: http://malsup.com/jquery/cycle/
- * Copyright (c) 2007-2010 M. Alsup
- * Version: 2.73
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-(function($) {
-"use strict";
-
-//
-// These functions define slide initialization and properties for the named
-// transitions. To save file size feel free to remove any of these that you
-// don't need.
-//
-$.fn.cycle.transitions.none = function($cont, $slides, opts) {
- opts.fxFn = function(curr,next,opts,after){
- $(next).show();
- $(curr).hide();
- after();
- };
-};
-
-// not a cross-fade, fadeout only fades out the top slide
-$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
- $slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
- opts.before.push(function(curr,next,opts,w,h,rev) {
- $(curr).css('zIndex',opts.slideCount + (rev !== true ? 1 : 0));
- $(next).css('zIndex',opts.slideCount + (rev !== true ? 0 : 1));
- });
- opts.animIn.opacity = 1;
- opts.animOut.opacity = 0;
- opts.cssBefore.opacity = 1;
- opts.cssBefore.display = 'block';
- opts.cssAfter.zIndex = 0;
-};
-
-// scrollUp/Down/Left/Right
-$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var h = $cont.height();
- opts.cssBefore.top = h;
- opts.cssBefore.left = 0;
- opts.cssFirst.top = 0;
- opts.animIn.top = 0;
- opts.animOut.top = -h;
-};
-$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var h = $cont.height();
- opts.cssFirst.top = 0;
- opts.cssBefore.top = -h;
- opts.cssBefore.left = 0;
- opts.animIn.top = 0;
- opts.animOut.top = h;
-};
-$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var w = $cont.width();
- opts.cssFirst.left = 0;
- opts.cssBefore.left = w;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.left = 0-w;
-};
-$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push($.fn.cycle.commonReset);
- var w = $cont.width();
- opts.cssFirst.left = 0;
- opts.cssBefore.left = -w;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.left = w;
-};
-$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
- $cont.css('overflow','hidden').width();
- opts.before.push(function(curr, next, opts, fwd) {
- if (opts.rev)
- fwd = !fwd;
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
- opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
- });
- opts.cssFirst.left = 0;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.top = 0;
-};
-$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
- $cont.css('overflow','hidden');
- opts.before.push(function(curr, next, opts, fwd) {
- if (opts.rev)
- fwd = !fwd;
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
- opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
- });
- opts.cssFirst.top = 0;
- opts.cssBefore.left = 0;
- opts.animIn.top = 0;
- opts.animOut.left = 0;
-};
-
-// slideX/slideY
-$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $(opts.elements).not(curr).hide();
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.animIn.width = next.cycleW;
- });
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
- opts.animIn.width = 'show';
- opts.animOut.width = 0;
-};
-$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $(opts.elements).not(curr).hide();
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.animIn.height = next.cycleH;
- });
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.height = 0;
- opts.animIn.height = 'show';
- opts.animOut.height = 0;
-};
-
-// shuffle
-$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
- var i, w = $cont.css('overflow', 'visible').width();
- $slides.css({left: 0, top: 0});
- opts.before.push(function(curr,next,opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- });
- // only adjust speed once!
- if (!opts.speedAdjusted) {
- opts.speed = opts.speed / 2; // shuffle has 2 transitions
- opts.speedAdjusted = true;
- }
- opts.random = 0;
- opts.shuffle = opts.shuffle || {left:-w, top:15};
- opts.els = [];
- for (i=0; i < $slides.length; i++)
- opts.els.push($slides[i]);
-
- for (i=0; i < opts.currSlide; i++)
- opts.els.push(opts.els.shift());
-
- // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
- opts.fxFn = function(curr, next, opts, cb, fwd) {
- if (opts.rev)
- fwd = !fwd;
- var $el = fwd ? $(curr) : $(next);
- $(next).css(opts.cssBefore);
- var count = opts.slideCount;
- $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
- var hops = $.fn.cycle.hopsFromLast(opts, fwd);
- for (var k=0; k < hops; k++) {
- if (fwd)
- opts.els.push(opts.els.shift());
- else
- opts.els.unshift(opts.els.pop());
- }
- if (fwd) {
- for (var i=0, len=opts.els.length; i < len; i++)
- $(opts.els[i]).css('z-index', len-i+count);
- }
- else {
- var z = $(curr).css('z-index');
- $el.css('z-index', parseInt(z,10)+1+count);
- }
- $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
- $(fwd ? this : curr).hide();
- if (cb) cb();
- });
- });
- };
- $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
-};
-
-// turnUp/Down/Left/Right
-$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.cssBefore.top = next.cycleH;
- opts.animIn.height = next.cycleH;
- opts.animOut.width = next.cycleW;
- });
- opts.cssFirst.top = 0;
- opts.cssBefore.left = 0;
- opts.cssBefore.height = 0;
- opts.animIn.top = 0;
- opts.animOut.height = 0;
-};
-$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssFirst.top = 0;
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.height = 0;
- opts.animOut.height = 0;
-};
-$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.cssBefore.left = next.cycleW;
- opts.animIn.width = next.cycleW;
- });
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
- opts.animIn.left = 0;
- opts.animOut.width = 0;
-};
-$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.animIn.width = next.cycleW;
- opts.animOut.left = curr.cycleW;
- });
- $.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
- opts.animIn.left = 0;
- opts.animOut.width = 0;
-};
-
-// zoom
-$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,false,true);
- opts.cssBefore.top = next.cycleH/2;
- opts.cssBefore.left = next.cycleW/2;
- $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
- $.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
- });
- opts.cssFirst.top = 0;
- opts.cssFirst.left = 0;
- opts.cssBefore.width = 0;
- opts.cssBefore.height = 0;
-};
-
-// fadeZoom
-$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,false);
- opts.cssBefore.left = next.cycleW/2;
- opts.cssBefore.top = next.cycleH/2;
- $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
- });
- opts.cssBefore.width = 0;
- opts.cssBefore.height = 0;
- opts.animOut.opacity = 0;
-};
-
-// blindX
-$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
- var w = $cont.css('overflow','hidden').width();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.width = next.cycleW;
- opts.animOut.left = curr.cycleW;
- });
- opts.cssBefore.left = w;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
- opts.animOut.left = w;
-};
-// blindY
-$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
- var h = $cont.css('overflow','hidden').height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssBefore.top = h;
- opts.cssBefore.left = 0;
- opts.animIn.top = 0;
- opts.animOut.top = h;
-};
-// blindZ
-$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
- var h = $cont.css('overflow','hidden').height();
- var w = $cont.width();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH;
- });
- opts.cssBefore.top = h;
- opts.cssBefore.left = w;
- opts.animIn.top = 0;
- opts.animIn.left = 0;
- opts.animOut.top = h;
- opts.animOut.left = w;
-};
-
-// growX - grow horizontally from centered 0 width
-$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true);
- opts.cssBefore.left = this.cycleW/2;
- opts.animIn.left = 0;
- opts.animIn.width = this.cycleW;
- opts.animOut.left = 0;
- });
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
-};
-// growY - grow vertically from centered 0 height
-$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false);
- opts.cssBefore.top = this.cycleH/2;
- opts.animIn.top = 0;
- opts.animIn.height = this.cycleH;
- opts.animOut.top = 0;
- });
- opts.cssBefore.height = 0;
- opts.cssBefore.left = 0;
-};
-
-// curtainX - squeeze in both edges horizontally
-$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,false,true,true);
- opts.cssBefore.left = next.cycleW/2;
- opts.animIn.left = 0;
- opts.animIn.width = this.cycleW;
- opts.animOut.left = curr.cycleW/2;
- opts.animOut.width = 0;
- });
- opts.cssBefore.top = 0;
- opts.cssBefore.width = 0;
-};
-// curtainY - squeeze in both edges vertically
-$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,false,true);
- opts.cssBefore.top = next.cycleH/2;
- opts.animIn.top = 0;
- opts.animIn.height = next.cycleH;
- opts.animOut.top = curr.cycleH/2;
- opts.animOut.height = 0;
- });
- opts.cssBefore.height = 0;
- opts.cssBefore.left = 0;
-};
-
-// cover - curr slide covered by next slide
-$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
- var d = opts.direction || 'left';
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts);
- opts.cssAfter.display = '';
- if (d == 'right')
- opts.cssBefore.left = -w;
- else if (d == 'up')
- opts.cssBefore.top = h;
- else if (d == 'down')
- opts.cssBefore.top = -h;
- else
- opts.cssBefore.left = w;
- });
- opts.animIn.left = 0;
- opts.animIn.top = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.left = 0;
-};
-
-// uncover - curr slide moves off next slide
-$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
- var d = opts.direction || 'left';
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- if (d == 'right')
- opts.animOut.left = w;
- else if (d == 'up')
- opts.animOut.top = -h;
- else if (d == 'down')
- opts.animOut.top = h;
- else
- opts.animOut.left = -w;
- });
- opts.animIn.left = 0;
- opts.animIn.top = 0;
- opts.cssBefore.top = 0;
- opts.cssBefore.left = 0;
-};
-
-// toss - move top slide and fade away
-$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
- var w = $cont.css('overflow','visible').width();
- var h = $cont.height();
- opts.before.push(function(curr, next, opts) {
- $.fn.cycle.commonReset(curr,next,opts,true,true,true);
- // provide default toss settings if animOut not provided
- if (!opts.animOut.left && !opts.animOut.top)
- $.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
- else
- opts.animOut.opacity = 0;
- });
- opts.cssBefore.left = 0;
- opts.cssBefore.top = 0;
- opts.animIn.left = 0;
-};
-
-// wipe - clip animation
-$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
- var w = $cont.css('overflow','hidden').width();
- var h = $cont.height();
- opts.cssBefore = opts.cssBefore || {};
- var clip;
- if (opts.clip) {
- if (/l2r/.test(opts.clip))
- clip = 'rect(0px 0px '+h+'px 0px)';
- else if (/r2l/.test(opts.clip))
- clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
- else if (/t2b/.test(opts.clip))
- clip = 'rect(0px '+w+'px 0px 0px)';
- else if (/b2t/.test(opts.clip))
- clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
- else if (/zoom/.test(opts.clip)) {
- var top = parseInt(h/2,10);
- var left = parseInt(w/2,10);
- clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
- }
- }
-
- opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
-
- var d = opts.cssBefore.clip.match(/(\d+)/g);
- var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
-
- opts.before.push(function(curr, next, opts) {
- if (curr == next) return;
- var $curr = $(curr), $next = $(next);
- $.fn.cycle.commonReset(curr,next,opts,true,true,false);
- opts.cssAfter.display = 'block';
-
- var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
- (function f() {
- var tt = t ? t - parseInt(step * (t/count),10) : 0;
- var ll = l ? l - parseInt(step * (l/count),10) : 0;
- var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
- var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
- $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
- (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
- })();
- });
- $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
- opts.animIn = { left: 0 };
- opts.animOut = { left: 0 };
-};
-
-})(jQuery);
diff --git a/app/assets/Archive/javascripts/mobile/jquery.mobile-1.2.0.min.js b/app/assets/Archive/javascripts/mobile/jquery.mobile-1.2.0.min.js
deleted file mode 100644
index e0d02a9b..00000000
--- a/app/assets/Archive/javascripts/mobile/jquery.mobile-1.2.0.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! jQuery Mobile vGit Build: SHA1: b49cc06499abf8f987cf90f35349cfac0918c939 <> Date: Tue Oct 2 11:22:34 2012 -0700 jquerymobile.com | jquery.org/license !*/
-(function(a,b,c){typeof define=="function"&&define.amd?define(["jquery"],function(d){return c(d,a,b),d.mobile}):c(a.jQuery,a,b)})(this,document,function(a,b,c,d){(function(a,b,d){var e={};a.mobile=a.extend({},{version:"1.2.0",ns:"",subPageUrlKey:"ui-page",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",focusClass:"ui-focus",ajaxEnabled:!0,hashListeningEnabled:!0,linkBindingEnabled:!0,defaultPageTransition:"fade",maxTransitionWidth:!1,minScrollBack:250,touchOverflowEnabled:!1,defaultDialogTransition:"pop",pageLoadErrorMessage:"Error Loading Page",pageLoadErrorMessageTheme:"e",phonegapNavigationEnabled:!1,autoInitializePage:!0,pushStateEnabled:!0,ignoreContentEnabled:!1,orientationChangeEnabled:!0,buttonMarkup:{hoverDelay:200},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},silentScroll:function(d){a.type(d)!=="number"&&(d=a.mobile.defaultHomeScroll),a.event.special.scrollstart.enabled=!1,setTimeout(function(){b.scrollTo(0,d),a(c).trigger("silentscroll",{x:0,y:d})},20),setTimeout(function(){a.event.special.scrollstart.enabled=!0},150)},nsNormalizeDict:e,nsNormalize:function(b){if(!b)return;return e[b]||(e[b]=a.camelCase(a.mobile.ns+b))},getInheritedTheme:function(a,b){var c=a[0],d="",e=/ui-(bar|body|overlay)-([a-z])\b/,f,g;while(c){f=c.className||"";if(f&&(g=e.exec(f))&&(d=g[2]))break;c=c.parentNode}return d||b||"a"},closestPageData:function(a){return a.closest(':jqmData(role="page"), :jqmData(role="dialog")').data("page")},enhanceable:function(a){return this.haveParents(a,"enhance")},hijackable:function(a){return this.haveParents(a,"ajax")},haveParents:function(b,c){if(!a.mobile.ignoreContentEnabled)return b;var d=b.length,e=a(),f,g,h;for(var i=0;i ").text(a(this).text()).html()},a.fn.jqmEnhanceable=function(){return a.mobile.enhanceable(this)},a.fn.jqmHijackable=function(){return a.mobile.hijackable(this)};var f=a.find,g=/:jqmData\(([^)]*)\)/g;a.find=function(b,c,d,e){return b=b.replace(g,"[data-"+(a.mobile.ns||"")+"$1]"),f.call(this,b,c,d,e)},a.extend(a.find,f),a.find.matches=function(b,c){return a.find(b,null,null,c)},a.find.matchesSelector=function(b,c){return a.find(c,null,null,[b]).length>0}})(a,this),function(a,b){var c=0,d=Array.prototype.slice,e=a.cleanData;a.cleanData=function(b){for(var c=0,d;(d=b[c])!=null;c++)try{a(d).triggerHandler("remove")}catch(f){}e(b)},a.widget=function(b,c,d){var e,f,g,h,i=b.split(".")[0];b=b.split(".")[1],e=i+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e]=function(b){return!!a.data(b,e)},a[i]=a[i]||{},f=a[i][b],g=a[i][b]=function(a,b){if(!this._createWidget)return new g(a,b);arguments.length&&this._createWidget(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,e){a.isFunction(e)&&(d[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},d=function(a){return c.prototype[b].apply(this,a)};return function(){var b=this._super,c=this._superApply,f;return this._super=a,this._superApply=d,f=e.apply(this,arguments),this._super=b,this._superApply=c,f}}())}),g.prototype=a.widget.extend(h,{widgetEventPrefix:b},d,{constructor:g,namespace:i,widgetName:b,widgetBaseClass:e,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g)},a.widget.extend=function(c){var e=d.call(arguments,1),f=0,g=e.length,h,i;for(;f",options:{disabled:!1,create:null},_createWidget:function(b,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetName,this),a.data(d,this.widgetFullName,this),this._on({remove:"destroy"}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(c,d){var e=c,f,g,h;if(arguments.length===0)return a.widget.extend({},this.options);if(typeof c=="string"){e={},f=c.split("."),c=f.shift();if(f.length){g=e[c]=a.widget.extend({},this.options[c]);for(h=0;h"+" "+" "+" ",fakeFixLoader:function(){var b=a("."+a.mobile.activeBtnClass).first();this.element.css({top:a.support.scrollTop&&f.scrollTop()+f.height()/2||b.length&&b.offset().top||100})},checkLoaderPosition:function(){var b=this.element.offset(),c=f.scrollTop(),d=a.mobile.getScreenHeight();if(b.topd)this.element.addClass("ui-loader-fakefix"),this.fakeFixLoader(),f.unbind("scroll",this.checkLoaderPosition).bind("scroll",this.fakeFixLoader)},resetHtml:function(){this.element.html(a(this.defaultHtml).html())},show:function(b,g,h){var i,j,k,l;this.resetHtml(),a.type(b)==="object"?(l=a.extend({},this.options,b),b=l.theme||a.mobile.loadingMessageTheme):(l=this.options,b=b||a.mobile.loadingMessageTheme||l.theme),j=g||a.mobile.loadingMessage||l.text,e.addClass("ui-loading");if(a.mobile.loadingMessage!==!1||l.html)a.mobile.loadingMessageTextVisible!==d?i=a.mobile.loadingMessageTextVisible:i=l.textVisible,this.element.attr("class",c+" ui-corner-all ui-body-"+b+" ui-loader-"+(i||g||b.text?"verbose":"default")+(l.textonly||h?" ui-loader-textonly":"")),l.html?this.element.html(l.html):this.element.find("h1").text(j),this.element.appendTo(a.mobile.pageContainer),this.checkLoaderPosition(),f.bind("scroll",a.proxy(this.checkLoaderPosition,this))},hide:function(){e.removeClass("ui-loading"),a.mobile.loadingMessage&&this.element.removeClass("ui-loader-fakefix"),a(b).unbind("scroll",a.proxy(this.fakeFixLoader,this)),a(b).unbind("scroll",a.proxy(this.checkLoaderPosition,this))}}),f.bind("pagecontainercreate",function(){a.mobile.loaderWidget=a.mobile.loaderWidget||a(a.mobile.loader.prototype.defaultHtml).loader()})}(a,this),function(a,b,c,d){function x(a){while(a&&typeof a.originalEvent!="undefined")a=a.originalEvent;return a}function y(b,c){var e=b.type,f,g,i,k,l,m,n,o,p;b=a.Event(b),b.type=c,f=b.originalEvent,g=a.event.props,e.search(/^(mouse|click)/)>-1&&(g=j);if(f)for(n=g.length,k;n;)k=g[--n],b[k]=f[k];e.search(/mouse(down|up)|click/)>-1&&!b.which&&(b.which=1);if(e.search(/^touch/)!==-1){i=x(f),e=i.touches,l=i.changedTouches,m=e&&e.length?e[0]:l&&l.length?l[0]:d;if(m)for(o=0,p=h.length;oe||Math.abs(c.pageY-n)>e,o&&!d&&H("vmousecancel",b,f),H("vmousemove",b,f),F()}function M(a){if(r)return;C();var b=z(a.target),c;H("vmouseup",a,b);if(!o){var d=H("vclick",a,b);d&&d.isDefaultPrevented()&&(c=x(a).changedTouches[0],p.push({touchID:v,x:c.clientX,y:c.clientY}),q=!0)}H("vmouseout",a,b),o=!1,F()}function N(b){var c=a.data(b,e),d;if(c)for(d in c)if(c[d])return!0;return!1}function O(){}function P(b){var c=b.substr(1);return{setup:function(d,f){N(this)||a.data(this,e,{});var g=a.data(this,e);g[b]=!0,k[b]=(k[b]||0)+1,k[b]===1&&t.bind(c,I),a(this).bind(c,O),s&&(k.touchstart=(k.touchstart||0)+1,k.touchstart===1&&t.bind("touchstart",J).bind("touchend",M).bind("touchmove",L).bind("scroll",K))},teardown:function(d,f){--k[b],k[b]||t.unbind(c,I),s&&(--k.touchstart,k.touchstart||t.unbind("touchstart",J).unbind("touchmove",L).unbind("touchend",M).unbind("scroll",K));var g=a(this),h=a.data(this,e);h&&(h[b]=!1),g.unbind(c,O),N(this)||g.removeData(e)}}}var e="virtualMouseBindings",f="virtualTouchID",g="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),h="clientX clientY pageX pageY screenX screenY".split(" "),i=a.event.mouseHooks?a.event.mouseHooks.props:[],j=a.event.props.concat(i),k={},l=0,m=0,n=0,o=!1,p=[],q=!1,r=!1,s="addEventListener"in c,t=a(c),u=1,v=0,w;a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(var Q=0;Qa.event.special.swipe.scrollSupressionThreshold&&b.preventDefault()}var e=b.originalEvent.touches?b.originalEvent.touches[0]:b,f={time:(new Date).getTime(),coords:[e.pageX,e.pageY],origin:a(b.target)},g;c.bind(i,j).one(h,function(b){c.unbind(i,j),f&&g&&g.time-f.timea.event.special.swipe.horizontalDistanceThreshold&&Math.abs(f.coords[1]-g.coords[1])g.coords[0]?"swipeleft":"swiperight"),f=g=d})})}},a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)}}})}(a,this),function(a,c){a.extend(a.support,{orientation:"orientation"in b&&"onorientationchange"in b})}(a),function(a){a.event.special.throttledresize={setup:function(){a(this).bind("resize",c)},teardown:function(){a(this).unbind("resize",c)}};var b=250,c=function(){f=(new Date).getTime(),g=f-d,g>=b?(d=f,a(this).trigger("throttledresize")):(e&&clearTimeout(e),e=setTimeout(c,b-g))},d=0,e,f,g}(a),function(a,b){function o(){var a=g();a!==h&&(h=a,d.trigger(e))}var d=a(b),e="orientationchange",f,g,h,i,j,k={0:!0,180:!0};if(a.support.orientation){var l=b.innerWidth||a(b).width(),m=b.innerHeight||a(b).height(),n=50;i=l>m&&l-m>n,j=k[b.orientation];if(i&&j||!i&&!j)k={"-90":!0,90:!0}}a.event.special.orientationchange=a.extend({},a.event.special.orientationchange,{setup:function(){if(a.support.orientation&&!a.event.special.orientationchange.disabled)return!1;h=g(),d.bind("throttledresize",o)},teardown:function(){if(a.support.orientation&&!a.event.special.orientationchange.disabled)return!1;d.unbind("throttledresize",o)},add:function(a){var b=a.handler;a.handler=function(a){return a.orientation=g(),b.apply(this,arguments)}}}),a.event.special.orientationchange.orientation=g=function(){var d=!0,e=c.documentElement;return a.support.orientation?d=k[b.orientation]:d=e&&e.clientWidth/e.clientHeight<1.1,d?"portrait":"landscape"},a.fn[e]=function(a){return a?this.bind(e,a):this.trigger(e)},a.attrFn&&(a.attrFn[e]=!0)}(a,this),function(a,d){var e=a(b),f=a("html");a.mobile.media=function(){var b={},d=a("
"),e=a("").append(d);return function(a){if(!(a in b)){var g=c.createElement("style"),h="@media "+a+" { #jquery-mediatest { position:absolute; } }";g.type="text/css",g.styleSheet?g.styleSheet.cssText=h:g.appendChild(c.createTextNode(h)),f.prepend(e).prepend(g),b[a]=d.css("position")==="absolute",e.add(g).remove()}return b[a]}}()}(a),function(a,d){function e(a){var b=a.charAt(0).toUpperCase()+a.substr(1),c=(a+" "+h.join(b+" ")+b).split(" ");for(var e in c)if(g[c[e]]!==d)return!0}function m(a,b,d){var e=c.createElement("div"),f=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},g=function(a){return"-"+a.charAt(0).toLowerCase()+a.substr(1)+"-"},i=function(c){var d=g(c)+a+": "+b+";",h=f(c),i=h+f(a);e.setAttribute("style",d),!e.style[i]||(k=!0)},j=d?[d]:h,k;for(var l=0;l",{href:b}).appendTo("head"),g=a(" ").prependTo(f),h=g[0].href,c[0].href=e||location.pathname,d&&d.remove(),h.indexOf(b)===0}function p(){var a=c.createElement("x"),d=c.documentElement,e=b.getComputedStyle,f;return"pointerEvents"in a.style?(a.style.pointerEvents="auto",a.style.pointerEvents="x",d.appendChild(a),f=e&&e(a,"").pointerEvents==="auto",d.removeChild(a),!!f):!1}function q(){var a=c.createElement("div");return typeof a.getBoundingClientRect!="undefined"}var f=a("").prependTo("html"),g=f[0].style,h=["Webkit","Moz","O"],i="palmGetResource"in b,j=b.opera,k=b.operamini&&{}.toString.call(b.operamini)==="[object OperaMini]",l=b.blackberry&&!e("-webkit-transform");a.extend(a.mobile,{browser:{}}),a.mobile.browser.ie=function(){var a=3,b=c.createElement("div"),d=b.all||[];do b.innerHTML="";while(d[0]);return a>4?a:!a}(),a.extend(a.support,{cssTransitions:"WebKitTransitionEvent"in b||m("transition","height 100ms linear")&&!j,pushState:"pushState"in history&&"replaceState"in history,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!e("content"),touchOverflow:!!e("overflowScrolling"),cssTransform3d:n(),boxShadow:!!e("boxShadow")&&!l,scrollTop:("pageXOffset"in b||"scrollTop"in c.documentElement||"scrollTop"in f[0])&&!i&&!k,dynamicBaseTag:o(),cssPointerEvents:p(),boundingRect:q()}),f.remove();var r=function(){var a=b.navigator.userAgent;return a.indexOf("Nokia")>-1&&(a.indexOf("Symbian/3")>-1||a.indexOf("Series60/5")>-1)&&a.indexOf("AppleWebKit")>-1&&a.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/)}();a.mobile.gradeA=function(){return(a.support.mediaquery||a.mobile.browser.ie&&a.mobile.browser.ie>=7)&&(a.support.boundingRect||a.fn.jquery.match(/1\.[0-7+]\.[0-9+]?/)!==null)},a.mobile.ajaxBlacklist=b.blackberry&&!b.WebKitPoint||k||r,r&&a(function(){a("head link[rel='stylesheet']").attr("rel","alternate stylesheet").attr("rel","stylesheet")}),a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")}(a),function(a,b){a.widget("mobile.page",a.mobile.widget,{options:{theme:"c",domCache:!1,keepNativeDefault:":jqmData(role='none'), :jqmData(role='nojs')"},_create:function(){var a=this;if(a._trigger("beforecreate")===!1)return!1;a.element.attr("tabindex","0").addClass("ui-page ui-body-"+a.options.theme).bind("pagebeforehide",function(){a.removeContainerBackground()}).bind("pagebeforeshow",function(){a.setContainerBackground()})},removeContainerBackground:function(){a.mobile.pageContainer.removeClass("ui-overlay-"+a.mobile.getInheritedTheme(this.element.parent()))},setContainerBackground:function(b){this.options.theme&&a.mobile.pageContainer.addClass("ui-overlay-"+(b||this.options.theme))},keepNativeSelector:function(){var b=this.options,c=b.keepNative&&a.trim(b.keepNative);return c&&b.keepNative!==b.keepNativeDefault?[b.keepNative,b.keepNativeDefault].join(", "):b.keepNativeDefault}})}(a),function(a,b,d){function k(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e="hashchange",f=c,g,h=a.event.special,i=f.documentMode,j="on"+e in b&&(i===d||i>7);a.fn[e]=function(a){return a?this.bind(e,a):this.trigger(e)},a.fn[e].delay=50,h[e]=a.extend(h[e],{setup:function(){if(j)return!1;a(g.start)},teardown:function(){if(j)return!1;a(g.stop)}}),g=function(){function n(){var c=k(),d=m(h);c!==h?(l(h=c,d),a(b).trigger(e)):d!==h&&(location.href=location.href.replace(/#.*/,"")+d),g=setTimeout(n,a.fn[e].delay)}var c={},g,h=k(),i=function(a){return a},l=i,m=i;return c.start=function(){g||n()},c.stop=function(){g&&clearTimeout(g),g=d},a.browser.msie&&!j&&function(){var b,d;c.start=function(){b||(d=a.fn[e].src,d=d&&d+k(),b=a('').hide().one("load",function(){d||l(k()),n()}).attr("src",d||"javascript:0").insertAfter("body")[0].contentWindow,f.onpropertychange=function(){try{event.propertyName==="title"&&(b.document.title=f.title)}catch(a){}})},c.stop=i,m=function(){return k(b.location.href)},l=function(c,d){var g=b.document,h=a.fn[e].domain;c!==d&&(g.title=f.title,g.open(),h&&g.write(''),g.close(),b.location.hash=c)}}(),c}()}(a,this),function(a,b,c){var d=function(d){return d===c&&(d=!0),function(c,e,f,g){var h=new a.Deferred,i=e?" reverse":"",j=a.mobile.urlHistory.getActive(),k=j.lastScroll||a.mobile.defaultHomeScroll,l=a.mobile.getScreenHeight(),m=a.mobile.maxTransitionWidth!==!1&&a(b).width()>a.mobile.maxTransitionWidth,n=!a.support.cssTransitions||m||!c||c==="none"||Math.max(a(b).scrollTop(),k)>a.mobile.getMaxScrollForTransition(),o=" ui-page-pre-in",p=function(){a.mobile.pageContainer.toggleClass("ui-mobile-viewport-transitioning viewport-"+c)},q=function(){a.event.special.scrollstart.enabled=!1,b.scrollTo(0,k),setTimeout(function(){a.event.special.scrollstart.enabled=!0},150)},r=function(){g.removeClass(a.mobile.activePageClass+" out in reverse "+c).height("")},s=function(){d?g.animationComplete(t):t(),g.height(l+a(b).scrollTop()).addClass(c+" out"+i)},t=function(){g&&d&&r(),u()},u=function(){f.css("z-index",-10),f.addClass(a.mobile.activePageClass+o),a.mobile.focusPage(f),f.height(l+k),q(),f.css("z-index",""),n||f.animationComplete(v),f.removeClass(o).addClass(c+" in"+i),n&&v()},v=function(){d||g&&r(),f.removeClass("out in reverse "+c).height(""),p(),a(b).scrollTop()!==k&&q(),h.resolve(c,e,f,g,!0)};return p(),g&&!n?s():t(),h.promise()}},e=d(),f=d(!1),g=function(){return a.mobile.getScreenHeight()*3};a.mobile.defaultTransitionHandler=e,a.mobile.transitionHandlers={"default":a.mobile.defaultTransitionHandler,sequential:e,simultaneous:f},a.mobile.transitionFallbacks={},a.mobile._maybeDegradeTransition=function(b){return b&&!a.support.cssTransform3d&&a.mobile.transitionFallbacks[b]&&(b=a.mobile.transitionFallbacks[b]),b},a.mobile.getMaxScrollForTransition=a.mobile.getMaxScrollForTransition||g}(a,this),function(a,d){function u(b){!!i&&(!i.closest("."+a.mobile.activePageClass).length||b)&&i.removeClass(a.mobile.activeBtnClass),i=null}function v(){m=!1,l.length>0&&a.mobile.changePage.apply(null,l.pop())}function z(b,c,d,e){c&&c.data("page")._trigger("beforehide",null,{nextPage:b}),b.data("page")._trigger("beforeshow",null,{prevPage:c||a("")}),a.mobile.hidePageLoadingMsg(),d=a.mobile._maybeDegradeTransition(d);var f=a.mobile.transitionHandlers[d||"default"]||a.mobile.defaultTransitionHandler,g=f(d,e,b,c);return g.done(function(){c&&c.data("page")._trigger("hide",null,{nextPage:b}),b.data("page")._trigger("show",null,{prevPage:c||a("")})}),g}function A(){var b=a("."+a.mobile.activePageClass),c=parseFloat(b.css("padding-top")),d=parseFloat(b.css("padding-bottom")),e=parseFloat(b.css("border-top-width")),f=parseFloat(b.css("border-bottom-width"));b.css("min-height",s()-c-d-e-f)}function B(b,c){c&&b.attr("data-"+a.mobile.ns+"role",c),b.page()}function C(a){while(a){if(typeof a.nodeName=="string"&&a.nodeName.toLowerCase()==="a")break;a=a.parentNode}return a}function D(b){var c=a(b).closest(".ui-page").jqmData("url"),d=q.hrefNoHash;if(!c||!h.isPath(c))c=d;return h.makeUrlAbsolute(c,d)}var e=a(b),f=a("html"),g=a("head"),h={urlParseRE:/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,getLocation:function(a){var b=a?this.parseUrl(a):location,c=this.parseUrl(a||location.href).hash;return c=c==="#"?"":c,b.protocol+"//"+b.host+b.pathname+b.search+c},parseLocation:function(){return this.parseUrl(this.getLocation())},parseUrl:function(b){if(a.type(b)==="object")return b;var c=h.urlParseRE.exec(b||"")||[];return{href:c[0]||"",hrefNoHash:c[1]||"",hrefNoSearch:c[2]||"",domain:c[3]||"",protocol:c[4]||"",doubleSlash:c[5]||"",authority:c[6]||"",username:c[8]||"",password:c[9]||"",host:c[10]||"",hostname:c[11]||"",port:c[12]||"",pathname:c[13]||"",directory:c[14]||"",filename:c[15]||"",search:c[16]||"",hash:c[17]||""}},makePathAbsolute:function(a,b){if(a&&a.charAt(0)==="/")return a;a=a||"",b=b?b.replace(/^\/|(\/[^\/]*|[^\/]+)$/g,""):"";var c=b?b.split("/"):[],d=a.split("/");for(var e=0;e",{href:q.hrefNoHash}).prependTo(g),set:function(a){t.element.attr("href",h.makeUrlAbsolute(a,q))},reset:function(){t.element.attr("href",q.hrefNoHash)}}:d;a.mobile.back=function(){var a=b.navigator;this.phonegapNavigationEnabled&&a&&a.app&&a.app.backHistory?a.app.backHistory():b.history.back()},a.mobile.focusPage=function(a){var b=a.find("[autofocus]"),c=a.find(".ui-title:eq(0)");if(b.length){b.focus();return}c.length?c.focus():a.focus()};var w=!0,x,y;x=function(){if(!w)return;var b=a.mobile.urlHistory.getActive();if(b){var c=e.scrollTop();b.lastScroll=c"),p=d.match(/]*>([^<]*)/)&&RegExp.$1,q=new RegExp("(<[^>]+\\bdata-"+a.mobile.ns+"role=[\"']?page[\"']?[^>]*>)"),s=new RegExp("\\bdata-"+a.mobile.ns+"url=[\"']?([^\"'>]*)[\"']?");q.test(d)&&RegExp.$1&&s.test(RegExp.$1)&&RegExp.$1&&(b=l=h.getFilePath(a(""+RegExp.$1+"
").text())),t&&t.set(l),o.get(0).innerHTML=d,g=o.find(":jqmData(role='page'), :jqmData(role='dialog')").first(),g.length||(g=a(""+d.split(/<\/?body[^>]*>/gmi)[1]+"
")),p&&!g.jqmData("title")&&(~p.indexOf("&")&&(p=a(""+p+"
").text()),g.jqmData("title",p));if(!a.support.dynamicBaseTag){var v=h.get(l);g.find("[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]").each(function(){var b=a(this).is("[href]")?"href":a(this).is("[src]")?"src":"action",c=a(this).attr(b);c=c.replace(location.protocol+"//"+location.host+location.pathname,""),/^(\w+:|#|\/)/.test(c)||a(this).attr(b,v+c)})}g.attr("data-"+a.mobile.ns+"url",h.convertUrlToDataUrl(l)).attr("data-"+a.mobile.ns+"external-page",!0).appendTo(f.pageContainer),g.one("pagecreate",a.mobile._bindPageRemove),B(g,f.role),k.indexOf("&"+a.mobile.subPageUrlKey)>-1&&(g=f.pageContainer.children("[data-"+a.mobile.ns+"url='"+m+"']")),f.showLoadMsg&&u(),r.xhr=n,r.textStatus=j,r.page=g,f.pageContainer.trigger("pageload",r),e.resolve(k,c,g,i)},error:function(b,d,g){t&&t.set(h.get()),r.xhr=b,r.textStatus=d,r.errorThrown=g;var i=new a.Event("pageloadfailed");f.pageContainer.trigger(i,r);if(i.isDefaultPrevented())return;f.showLoadMsg&&(u(),a.mobile.showPageLoadingMsg(a.mobile.pageLoadErrorMessageTheme,a.mobile.pageLoadErrorMessage,!0),setTimeout(a.mobile.hidePageLoadingMsg,1500)),e.reject(k,c)}}),e.promise()},a.mobile.loadPage.defaults={type:"get",data:d,reloadPage:!1,role:d,showLoadMsg:!1,pageContainer:d,loadMsgDelay:50},a.mobile.changePage=function(b,e){if(m){l.unshift(arguments);return}var f=a.extend({},a.mobile.changePage.defaults,e);f.pageContainer=f.pageContainer||a.mobile.pageContainer,f.fromPage=f.fromPage||a.mobile.activePage;var g=f.pageContainer,i=new a.Event("pagebeforechange"),k={toPage:b,options:f};g.trigger(i,k);if(i.isDefaultPrevented())return;b=k.toPage,m=!0;if(typeof b=="string"){a.mobile.loadPage(b,f).done(function(b,c,d,e){m=!1,c.duplicateCachedPage=e,a.mobile.changePage(d,c)}).fail(function(a,b){m=!1,u(!0),v(),f.pageContainer.trigger("pagechangefailed",k)});return}b[0]===a.mobile.firstPage[0]&&!f.dataUrl&&(f.dataUrl=p.hrefNoHash);var o=f.fromPage,q=f.dataUrl&&h.convertUrlToDataUrl(f.dataUrl)||b.jqmData("url"),r=q,s=h.getFilePath(q),t=j.getActive(),w=j.activeIndex===0,x=0,y=c.title,A=f.role==="dialog"||b.jqmData("role")==="dialog";if(o&&o[0]===b[0]&&!f.allowSamePageTransition){m=!1,g.trigger("pagechange",k),f.fromHashChange&&j.directHashChange({currentUrl:q,isBack:function(){},isForward:function(){}});return}B(b,f.role),f.fromHashChange&&j.directHashChange({currentUrl:q,isBack:function(){x=-1},isForward:function(){x=1}});try{c.activeElement&&c.activeElement.nodeName.toLowerCase()!=="body"?a(c.activeElement).blur():a("input:focus, textarea:focus, select:focus").blur()}catch(C){}var D=!1;A&&t&&(t.url.indexOf(n)>-1&&!a.mobile.activePage.is(".ui-dialog")&&(f.changeHash=!1,D=!0),q=(t.url||"")+(D?"":n),j.activeIndex===0&&q===j.initialDst&&(q+=n)),f.changeHash!==!1&&q&&(j.ignoreNextHashChange=!0,h.set(q));var E=t?b.jqmData("title")||b.children(":jqmData(role='header')").find(".ui-title").getEncodedText():y;!!E&&y===c.title&&(y=E),b.jqmData("title")||b.jqmData("title",y),f.transition=f.transition||(x&&!w?t.transition:d)||(A?a.mobile.defaultDialogTransition:a.mobile.defaultPageTransition),x||(D&&(j.activeIndex=Math.max(0,j.activeIndex-1)),j.addNew(q,f.transition,y,r,f.role)),c.title=j.getActive().title,a.mobile.activePage=b,f.reverse=f.reverse||x<0,z(b,o,f.transition,f.reverse).done(function(c,d,e,h,i){u(),f.duplicateCachedPage&&f.duplicateCachedPage.remove(),i||a.mobile.focusPage(b),v(),g.trigger("pagechange",k)})},a.mobile.changePage.defaults={transition:d,reverse:!1,changeHash:!0,fromHashChange:!1,role:d,duplicateCachedPage:d,pageContainer:d,showLoadMsg:!0,dataUrl:d,fromPage:d,allowSamePageTransition:!1},a.mobile.navreadyDeferred=a.Deferred(),a.mobile.navreadyDeferred.done(function(){a(c).delegate("form","submit",function(b){var c=a(this);if(!a.mobile.ajaxEnabled||c.is(":jqmData(ajax='false')")||!c.jqmHijackable().length)return;var d=c.attr("method"),e=c.attr("target"),f=c.attr("action");f||(f=D(c),f===q.hrefNoHash&&(f=p.hrefNoSearch)),f=h.makeUrlAbsolute(f,D(c));if(h.isExternal(f)&&!h.isPermittedCrossDomainRequest(p,f)||e)return;a.mobile.changePage(f,{type:d&&d.length&&d.toLowerCase()||"get",data:c.serialize(),transition:c.jqmData("transition"),reverse:c.jqmData("direction")==="reverse",reloadPage:!0}),b.preventDefault()}),a(c).bind("vclick",function(b){if(b.which>1||!a.mobile.linkBindingEnabled)return;var c=C(b.target);if(!a(c).jqmHijackable().length)return;c&&h.parseUrl(c.getAttribute("href")||"#").hash!=="#"&&(u(!0),i=a(c).closest(".ui-btn").not(".ui-disabled"),i.addClass(a.mobile.activeBtnClass))}),a(c).bind("click",function(c){if(!a.mobile.linkBindingEnabled)return;var e=C(c.target),f=a(e),g;if(!e||c.which>1||!f.jqmHijackable().length)return;g=function(){b.setTimeout(function(){u(!0)},200)};if(f.is(":jqmData(rel='back')"))return a.mobile.back(),!1;var i=D(f),j=h.makeUrlAbsolute(f.attr("href")||"#",i);if(!a.mobile.ajaxEnabled&&!h.isEmbeddedPage(j)){g();return}if(j.search("#")!==-1){j=j.replace(/[^#]*#/,"");if(!j){c.preventDefault();return}h.isPath(j)?j=h.makeUrlAbsolute(j,i):j=h.makeUrlAbsolute("#"+j,p.hrefNoHash)}var k=f.is("[rel='external']")||f.is(":jqmData(ajax='false')")||f.is("[target]"),l=k||h.isExternal(j)&&!h.isPermittedCrossDomainRequest(p,j);if(l){g();return}var m=f.jqmData("transition"),n=f.jqmData("direction")==="reverse"||f.jqmData("back"),o=f.attr("data-"+a.mobile.ns+"rel")||d;a.mobile.changePage(j,{transition:m,reverse:n,role:o,link:f}),c.preventDefault()}),a(c).delegate(".ui-page","pageshow.prefetch",function(){var b=[];a(this).find("a:jqmData(prefetch)").each(function(){var c=a(this),d=c.attr("href");d&&a.inArray(d,b)===-1&&(b.push(d),a.mobile.loadPage(d,{role:c.attr("data-"+a.mobile.ns+"rel")}))})}),a.mobile._handleHashChange=function(c){var e=h.stripHash(c),f=a.mobile.urlHistory.stack.length===0?"none":d,g=new a.Event("navigate"),i={transition:f,changeHash:!1,fromHashChange:!0};0===j.stack.length&&(j.initialDst=e),a.mobile.pageContainer.trigger(g);if(g.isDefaultPrevented())return;if(!a.mobile.hashListeningEnabled||j.ignoreNextHashChange){j.ignoreNextHashChange=!1;return}if(j.stack.length>1&&e.indexOf(n)>-1&&j.initialDst!==e){if(!a.mobile.activePage.is(".ui-dialog")){j.directHashChange({currentUrl:e,isBack:function(){a.mobile.back()},isForward:function(){b.history.forward()}});return}j.directHashChange({currentUrl:e,either:function(b){var c=a.mobile.urlHistory.getActive();e=c.pageUrl,a.extend(i,{role:c.role,transition:c.transition,reverse:b})}})}e?(e=typeof e=="string"&&!h.isPath(e)?h.makeUrlAbsolute("#"+e,q):e,e===h.makeUrlAbsolute("#"+j.initialDst,q)&&j.stack.length&&j.stack[0].url!==j.initialDst.replace(n,"")&&(e=a.mobile.firstPage),a.mobile.changePage(e,i)):a.mobile.changePage(a.mobile.firstPage,i)},e.bind("hashchange",function(b,c){a.mobile._handleHashChange(h.parseLocation().hash)}),a(c).bind("pageshow",A),a(b).bind("throttledresize",A)})}(a),function(a,b){var e={},f=e,g=a(b),h=a.mobile.path.parseLocation(),i=a.Deferred(),j=a.Deferred();a(c).ready(a.proxy(j,"resolve")),a(c).one("mobileinit",a.proxy(i,"resolve")),a.extend(e,{initialFilePath:function(){return h.pathname+h.search}(),hashChangeTimeout:200,hashChangeEnableTimer:d,initialHref:h.hrefNoHash,state:function(){return{hash:a.mobile.path.parseLocation().hash||"#"+f.initialFilePath,title:c.title,initialHref:f.initialHref}},resetUIKeys:function(b){var c=a.mobile.dialogHashKey,d="&"+a.mobile.subPageUrlKey,e=b.indexOf(c);return e>-1?b=b.slice(0,e)+"#"+b.slice(e):b.indexOf(d)>-1&&(b=b.split(d).join("#"+d)),b},nextHashChangePrevented:function(b){a.mobile.urlHistory.ignoreNextHashChange=b,f.onHashChangeDisabled=b},onHashChange:function(b){if(f.onHashChangeDisabled)return;var d,e,g=a.mobile.path.parseLocation().hash,h=a.mobile.path.isPath(g),i=h?a.mobile.path.getLocation():a.mobile.getDocumentUrl();g=h?g.replace("#",""):g,e=f.state(),d=a.mobile.path.makeUrlAbsolute(g,i),h&&(d=f.resetUIKeys(d)),history.replaceState(e,c.title,d)},onPopState:function(b){var c=b.originalEvent.state,d,e,g;c&&(clearTimeout(f.hashChangeEnableTimer),f.nextHashChangePrevented(!1),a.mobile._handleHashChange(c.hash),f.nextHashChangePrevented(!0),f.hashChangeEnableTimer=setTimeout(function(){f.nextHashChangePrevented(!1)},f.hashChangeTimeout))},init:function(){g.bind("hashchange",f.onHashChange),g.bind("popstate",f.onPopState),location.hash===""&&history.replaceState(f.state(),c.title,a.mobile.path.getLocation())}}),a.when(j,i,a.mobile.navreadyDeferred).done(function(){a.mobile.pushStateEnabled&&a.support.pushState&&e.init()})}(a,this),function(a,b,c){a.mobile.transitionFallbacks.flip="fade"}(a,this),function(a,b,c){a.mobile.transitionFallbacks.flow="fade"}(a,this),function(a,b,c){a.mobile.transitionFallbacks.pop="fade"}(a,this),function(a,b,c){a.mobile.transitionHandlers.slide=a.mobile.transitionHandlers.simultaneous,a.mobile.transitionFallbacks.slide="fade"}(a,this),function(a,b,c){a.mobile.transitionFallbacks.slidedown="fade"}(a,this),function(a,b,c){a.mobile.transitionFallbacks.slidefade="fade"}(a,this),function(a,b,c){a.mobile.transitionFallbacks.slideup="fade"}(a,this),function(a,b,c){a.mobile.transitionFallbacks.turn="fade"}(a,this),function(a,b){a.mobile.page.prototype.options.degradeInputs={color:!1,date:!1,datetime:!1,"datetime-local":!1,email:!1,month:!1,number:!1,range:"number",search:"text",tel:!1,time:!1,url:!1,week:!1},a(c).bind("pagecreate create",function(b){var c=a.mobile.closestPageData(a(b.target)),d;if(!c)return;d=c.options,a(b.target).find("input").not(c.keepNativeSelector()).each(function(){var b=a(this),c=this.getAttribute("type"),e=d.degradeInputs[c]||"text";if(d.degradeInputs[c]){var f=a("