// JavaScript Document /* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { //alert(jQuery.easing.default); return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright © 2001 Robert Penner * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ /**********************************************************************************************************/ // jquery.events.frame.js // 1.1 - lite // Stephen Band // // Project home: // webdev.stephband.info/events/frame/ // // Source: // http://github.com/stephband/jquery.event.frame (function(jQuery, undefined){ var timer; // Timer constructor // fn - callback to call on each frame, with context set to the timer object // fd - frame duration in milliseconds function Timer( fn, fd ) { var self = this, clock; function update(){ self.frameCount++; fn.call(self); } this.frameDuration = fd || 25 ; this.frameCount = -1 ; this.start = function(){ update(); clock = setInterval(update, this.frameDuration); }; this.stop = function(){ clearInterval( clock ); clock = null; }; } // callHandler() is the callback given to the timer object, // it makes the event object and calls the handler // context is the timer object function callHandler(){ var fn = jQuery.event.special.frame.handler, event = jQuery.Event("frame"), array = this.array, l = array.length; // Give event object properties event.frameCount = this.frameCount; // Call handler on each elem in array while (l--) { fn.call(array[l], event); } } if (!jQuery.event.special.frame) { jQuery.event.special.frame = { // Fires the first time an event is bound per element setup: function(data, namespaces) { if ( timer ) { timer.array.push(this); } else { timer = new Timer( callHandler, data && data.frameDuration ); timer.array = [this]; // Queue timer to start as soon as this thread has finished var t = setTimeout(function(){ timer.start(); clearTimeout(t); t = null; }, 0); } return; }, // Fires last time event is unbound per element teardown: function(namespaces) { var array = timer.array, l = array.length; // Remove element from list while (l--) { if (array[l] === this) { array.splice(l, 1); break; } } // Stop and remove timer when no elems left if (array.length === 0) { timer.stop(); timer = undefined; } return; }, handler: function(event){ // let jQuery handle the calling of event handlers jQuery.event.handle.apply(this, arguments); } }; } })(jQuery); /********************************************************************************************************/ /* * jQuery Mobile Framework v1.2.0 * http://jquerymobile.com * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * */ (function ( root, doc, factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define( [ "jquery" ], function ( $ ) { factory( $, root, doc ); return $.mobile; }); } else { // Browser globals factory( root.jQuery, root, doc ); } }( this, document, function ( jQuery, window, document, undefined ) { (function( $, undefined ) { var support = { touch: "ontouchend" in document }; $.mobile = $.mobile || {}; $.mobile.support = $.mobile.support || {}; $.extend( $.support, support ); $.extend( $.mobile.support, support ); }( jQuery )); // This plugin is an experiment for abstracting away the touch and mouse // events so that developers don't have to worry about which method of input // the device their document is loaded on supports. // // The idea here is to allow the developer to register listeners for the // basic mouse events, such as mousedown, mousemove, mouseup, and click, // and the plugin will take care of registering the correct listeners // behind the scenes to invoke the listener at the fastest possible time // for that device, while still retaining the order of event firing in // the traditional mouse environment, should multiple handlers be registered // on the same element for different events. // // The current version exposes the following virtual events to jQuery bind methods: // "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel" (function( $, window, document, undefined ) { var dataPropertyName = "virtualMouseBindings", touchTargetPropertyName = "virtualTouchID", virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ), touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ), mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [], mouseEventProps = $.event.props.concat( mouseHookProps ), activeDocHandlers = {}, resetTimerID = 0, startX = 0, startY = 0, didScroll = false, clickBlockList = [], blockMouseTriggers = false, blockTouchTriggers = false, eventCaptureSupported = "addEventListener" in document, $document = $( document ), nextTouchID = 1, lastTouchID = 0, threshold; $.vmouse = { moveDistanceThreshold: 10, clickDistanceThreshold: 10, resetTimerDuration: 1500 }; function getNativeEvent( event ) { while ( event && typeof event.originalEvent !== "undefined" ) { event = event.originalEvent; } return event; } function createVirtualEvent( event, eventType ) { var t = event.type, oe, props, ne, prop, ct, touch, i, j, len; event = $.Event( event ); event.type = eventType; oe = event.originalEvent; props = $.event.props; // addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280 // https://github.com/jquery/jquery-mobile/issues/3280 if ( t.search( /^(mouse|click)/ ) > -1 ) { props = mouseEventProps; } // copy original event properties over to the new event // this would happen if we could call $.event.fix instead of $.Event // but we don't have a way to force an event to be fixed multiple times if ( oe ) { for ( i = props.length, prop; i; ) { prop = props[ --i ]; event[ prop ] = oe[ prop ]; } } // make sure that if the mouse and click virtual events are generated // without a .which one is defined if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ) { event.which = 1; } if ( t.search(/^touch/) !== -1 ) { ne = getNativeEvent( oe ); t = ne.touches; ct = ne.changedTouches; touch = ( t && t.length ) ? t[0] : ( ( ct && ct.length ) ? ct[ 0 ] : undefined ); if ( touch ) { for ( j = 0, len = touchEventProps.length; j < len; j++) { prop = touchEventProps[ j ]; event[ prop ] = touch[ prop ]; } } } return event; } function getVirtualBindingFlags( element ) { var flags = {}, b, k; while ( element ) { b = $.data( element, dataPropertyName ); for ( k in b ) { if ( b[ k ] ) { flags[ k ] = flags.hasVirtualBinding = true; } } element = element.parentNode; } return flags; } function getClosestElementWithVirtualBinding( element, eventType ) { var b; while ( element ) { b = $.data( element, dataPropertyName ); if ( b && ( !eventType || b[ eventType ] ) ) { return element; } element = element.parentNode; } return null; } function enableTouchBindings() { blockTouchTriggers = false; } function disableTouchBindings() { blockTouchTriggers = true; } function enableMouseBindings() { lastTouchID = 0; clickBlockList.length = 0; blockMouseTriggers = false; // When mouse bindings are enabled, our // touch bindings are disabled. disableTouchBindings(); } function disableMouseBindings() { // When mouse bindings are disabled, our // touch bindings are enabled. enableTouchBindings(); } function startResetTimer() { clearResetTimer(); resetTimerID = setTimeout( function() { resetTimerID = 0; enableMouseBindings(); }, $.vmouse.resetTimerDuration ); } function clearResetTimer() { if ( resetTimerID ) { clearTimeout( resetTimerID ); resetTimerID = 0; } } function triggerVirtualEvent( eventType, event, flags ) { var ve; if ( ( flags && flags[ eventType ] ) || ( !flags && getClosestElementWithVirtualBinding( event.target, eventType ) ) ) { ve = createVirtualEvent( event, eventType ); $( event.target).trigger( ve ); } return ve; } function mouseEventCallback( event ) { var touchID = $.data( event.target, touchTargetPropertyName ); if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ) { var ve = triggerVirtualEvent( "v" + event.type, event ); if ( ve ) { if ( ve.isDefaultPrevented() ) { event.preventDefault(); } if ( ve.isPropagationStopped() ) { event.stopPropagation(); } if ( ve.isImmediatePropagationStopped() ) { event.stopImmediatePropagation(); } } } } function handleTouchStart( event ) { var touches = getNativeEvent( event ).touches, target, flags; if ( touches && touches.length === 1 ) { target = event.target; flags = getVirtualBindingFlags( target ); if ( flags.hasVirtualBinding ) { lastTouchID = nextTouchID++; $.data( target, touchTargetPropertyName, lastTouchID ); clearResetTimer(); disableMouseBindings(); didScroll = false; var t = getNativeEvent( event ).touches[ 0 ]; startX = t.pageX; startY = t.pageY; triggerVirtualEvent( "vmouseover", event, flags ); triggerVirtualEvent( "vmousedown", event, flags ); } } } function handleScroll( event ) { if ( blockTouchTriggers ) { return; } if ( !didScroll ) { triggerVirtualEvent( "vmousecancel", event, getVirtualBindingFlags( event.target ) ); } didScroll = true; startResetTimer(); } function handleTouchMove( event ) { if ( blockTouchTriggers ) { return; } var t = getNativeEvent( event ).touches[ 0 ], didCancel = didScroll, moveThreshold = $.vmouse.moveDistanceThreshold, flags = getVirtualBindingFlags( event.target ); didScroll = didScroll || ( Math.abs( t.pageX - startX ) > moveThreshold || Math.abs( t.pageY - startY ) > moveThreshold ); if ( didScroll && !didCancel ) { triggerVirtualEvent( "vmousecancel", event, flags ); } triggerVirtualEvent( "vmousemove", event, flags ); startResetTimer(); } function handleTouchEnd( event ) { if ( blockTouchTriggers ) { return; } disableTouchBindings(); var flags = getVirtualBindingFlags( event.target ), t; triggerVirtualEvent( "vmouseup", event, flags ); if ( !didScroll ) { var ve = triggerVirtualEvent( "vclick", event, flags ); if ( ve && ve.isDefaultPrevented() ) { // The target of the mouse events that follow the touchend // event don't necessarily match the target used during the // touch. This means we need to rely on coordinates for blocking // any click that is generated. t = getNativeEvent( event ).changedTouches[ 0 ]; clickBlockList.push({ touchID: lastTouchID, x: t.clientX, y: t.clientY }); // Prevent any mouse events that follow from triggering // virtual event notifications. blockMouseTriggers = true; } } triggerVirtualEvent( "vmouseout", event, flags); didScroll = false; startResetTimer(); } function hasVirtualBindings( ele ) { var bindings = $.data( ele, dataPropertyName ), k; if ( bindings ) { for ( k in bindings ) { if ( bindings[ k ] ) { return true; } } } return false; } function dummyMouseHandler() {} function getSpecialEventObject( eventType ) { var realType = eventType.substr( 1 ); return { setup: function( data, namespace ) { // If this is the first virtual mouse binding for this element, // add a bindings object to its data. if ( !hasVirtualBindings( this ) ) { $.data( this, dataPropertyName, {} ); } // If setup is called, we know it is the first binding for this // eventType, so initialize the count for the eventType to zero. var bindings = $.data( this, dataPropertyName ); bindings[ eventType ] = true; // If this is the first virtual mouse event for this type, // register a global handler on the document. activeDocHandlers[ eventType ] = ( activeDocHandlers[ eventType ] || 0 ) + 1; if ( activeDocHandlers[ eventType ] === 1 ) { $document.bind( realType, mouseEventCallback ); } // Some browsers, like Opera Mini, won't dispatch mouse/click events // for elements unless they actually have handlers registered on them. // To get around this, we register dummy handlers on the elements. $( this ).bind( realType, dummyMouseHandler ); // For now, if event capture is not supported, we rely on mouse handlers. if ( eventCaptureSupported ) { // If this is the first virtual mouse binding for the document, // register our touchstart handler on the document. activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1; if ( activeDocHandlers[ "touchstart" ] === 1 ) { $document.bind( "touchstart", handleTouchStart ) .bind( "touchend", handleTouchEnd ) // On touch platforms, touching the screen and then dragging your finger // causes the window content to scroll after some distance threshold is // exceeded. On these platforms, a scroll prevents a click event from being // dispatched, and on some platforms, even the touchend is suppressed. To // mimic the suppression of the click event, we need to watch for a scroll // event. Unfortunately, some platforms like iOS don't dispatch scroll // events until *AFTER* the user lifts their finger (touchend). This means // we need to watch both scroll and touchmove events to figure out whether // or not a scroll happenens before the touchend event is fired. .bind( "touchmove", handleTouchMove ) .bind( "scroll", handleScroll ); } } }, teardown: function( data, namespace ) { // If this is the last virtual binding for this eventType, // remove its global handler from the document. --activeDocHandlers[ eventType ]; if ( !activeDocHandlers[ eventType ] ) { $document.unbind( realType, mouseEventCallback ); } if ( eventCaptureSupported ) { // If this is the last virtual mouse binding in existence, // remove our document touchstart listener. --activeDocHandlers[ "touchstart" ]; if ( !activeDocHandlers[ "touchstart" ] ) { $document.unbind( "touchstart", handleTouchStart ) .unbind( "touchmove", handleTouchMove ) .unbind( "touchend", handleTouchEnd ) .unbind( "scroll", handleScroll ); } } var $this = $( this ), bindings = $.data( this, dataPropertyName ); // teardown may be called when an element was // removed from the DOM. If this is the case, // jQuery core may have already stripped the element // of any data bindings so we need to check it before // using it. if ( bindings ) { bindings[ eventType ] = false; } // Unregister the dummy event handler. $this.unbind( realType, dummyMouseHandler ); // If this is the last virtual mouse binding on the // element, remove the binding data from the element. if ( !hasVirtualBindings( this ) ) { $this.removeData( dataPropertyName ); } } }; } // Expose our custom events to the jQuery bind/unbind mechanism. for ( var i = 0; i < virtualEventNames.length; i++ ) { $.event.special[ virtualEventNames[ i ] ] = getSpecialEventObject( virtualEventNames[ i ] ); } // Add a capture click handler to block clicks. // Note that we require event capture support for this so if the device // doesn't support it, we punt for now and rely solely on mouse events. if ( eventCaptureSupported ) { document.addEventListener( "click", function( e ) { var cnt = clickBlockList.length, target = e.target, x, y, ele, i, o, touchID; if ( cnt ) { x = e.clientX; y = e.clientY; threshold = $.vmouse.clickDistanceThreshold; // The idea here is to run through the clickBlockList to see if // the current click event is in the proximity of one of our // vclick events that had preventDefault() called on it. If we find // one, then we block the click. // // Why do we have to rely on proximity? // // Because the target of the touch event that triggered the vclick // can be different from the target of the click event synthesized // by the browser. The target of a mouse/click event that is syntehsized // from a touch event seems to be implementation specific. For example, // some browsers will fire mouse/click events for a link that is near // a touch event, even though the target of the touchstart/touchend event // says the user touched outside the link. Also, it seems that with most // browsers, the target of the mouse/click event is not calculated until the // time it is dispatched, so if you replace an element that you touched // with another element, the target of the mouse/click will be the new // element underneath that point. // // Aside from proximity, we also check to see if the target and any // of its ancestors were the ones that blocked a click. This is necessary // because of the strange mouse/click target calculation done in the // Android 2.1 browser, where if you click on an element, and there is a // mouse/click handler on one of its ancestors, the target will be the // innermost child of the touched element, even if that child is no where // near the point of touch. ele = target; while ( ele ) { for ( i = 0; i < cnt; i++ ) { o = clickBlockList[ i ]; touchID = 0; if ( ( ele === target && Math.abs( o.x - x ) < threshold && Math.abs( o.y - y ) < threshold ) || $.data( ele, touchTargetPropertyName ) === o.touchID ) { // XXX: We may want to consider removing matches from the block list // instead of waiting for the reset timer to fire. e.preventDefault(); e.stopPropagation(); return; } } ele = ele.parentNode; } } }, true); } })( jQuery, window, document ); (function( $, window, undefined ) { // add new event shortcuts $.each( ( "touchstart touchmove touchend " + "tap taphold " + "swipe swipeleft swiperight " + "scrollstart scrollstop" ).split( " " ), function( i, name ) { $.fn[ name ] = function( fn ) { return fn ? this.bind( name, fn ) : this.trigger( name ); }; // jQuery < 1.8 if ( $.attrFn ) { $.attrFn[ name ] = true; } }); var supportTouch = $.mobile.support.touch, scrollEvent = "touchmove scroll", touchStartEvent = supportTouch ? "touchstart" : "mousedown", touchStopEvent = supportTouch ? "touchend" : "mouseup", touchMoveEvent = supportTouch ? "touchmove" : "mousemove"; function triggerCustomEvent( obj, eventType, event ) { var originalType = event.type; event.type = eventType; $.event.handle.call( obj, event ); event.type = originalType; } // also handles scrollstop $.event.special.scrollstart = { enabled: true, setup: function() { var thisObject = this, $this = $( thisObject ), scrolling, timer; function trigger( event, state ) { scrolling = state; triggerCustomEvent( thisObject, scrolling ? "scrollstart" : "scrollstop", event ); } // iPhone triggers scroll after a small delay; use touchmove instead $this.bind( scrollEvent, function( event ) { if ( !$.event.special.scrollstart.enabled ) { return; } if ( !scrolling ) { trigger( event, true ); } clearTimeout( timer ); timer = setTimeout( function() { trigger( event, false ); }, 50 ); }); } }; // also handles taphold $.event.special.tap = { tapholdThreshold: 750, setup: function() { var thisObject = this, $this = $( thisObject ); $this.bind( "vmousedown", function( event ) { if ( event.which && event.which !== 1 ) { return false; } var origTarget = event.target, origEvent = event.originalEvent, timer; function clearTapTimer() { clearTimeout( timer ); } function clearTapHandlers() { clearTapTimer(); $this.unbind( "vclick", clickHandler ) .unbind( "vmouseup", clearTapTimer ); $( document ).unbind( "vmousecancel", clearTapHandlers ); } function clickHandler( event ) { clearTapHandlers(); // ONLY trigger a 'tap' event if the start target is // the same as the stop target. if ( origTarget === event.target ) { triggerCustomEvent( thisObject, "tap", event ); } } $this.bind( "vmouseup", clearTapTimer ) .bind( "vclick", clickHandler ); $( document ).bind( "vmousecancel", clearTapHandlers ); timer = setTimeout( function() { triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) ); }, $.event.special.tap.tapholdThreshold ); }); } }; // also handles swipeleft, swiperight $.event.special.swipe = { scrollSupressionThreshold: 30, // More than this horizontal displacement, and we will suppress scrolling. durationThreshold: 1000, // More time than this, and it isn't a swipe. horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this. verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this. setup: function() { var thisObject = this, $this = $( thisObject ); $this.bind( touchStartEvent, function( event ) { var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event, start = { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ], origin: $( event.target ) }, stop; function moveHandler( event ) { if ( !start ) { return; } var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; stop = { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ] }; // prevent scrolling if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) { event.preventDefault(); } } $this.bind( touchMoveEvent, moveHandler ) .one( touchStopEvent, function( event ) { $this.unbind( touchMoveEvent, moveHandler ); if ( start && stop ) { if ( stop.time - start.time < $.event.special.swipe.durationThreshold && Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold && Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) { start.origin.trigger( "swipe" ) .trigger( start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight" ); } } start = stop = undefined; }); }); } }; $.each({ scrollstop: "scrollstart", taphold: "tap", swipeleft: "swipe", swiperight: "swipe" }, function( event, sourceEvent ) { $.event.special[ event ] = { setup: function() { $( this ).bind( sourceEvent, $.noop ); } }; }); })( jQuery, this ); })); /***************************************************************************************************************************/ /* * jQuery UI Accordion 1.6 * * Copyright (c) 2007 Jörn Zaefferer * * http://docs.jquery.com/UI/Accordion * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Revision: $Id: jquery.accordion.js 4876 2008-03-08 11:49:04Z joern.zaefferer $ * */ jQuery(document).ready( function($) { // If the UI scope is not available, add it $.ui = $.ui || {}; $.fn.extend({ accordion: function(options, data) { var args = Array.prototype.slice.call(arguments, 1); return this.each(function() { if (typeof options == "string") { var accordion = $.data(this, "ui-accordion"); accordion[options].apply(accordion, args); // INIT with optional options } else if (!$(this).is(".ui-accordion")) $.data(this, "ui-accordion", new $.ui.accordion(this, options)); }); }, // deprecated, use accordion("activate", index) instead activate: function(index) { return this.accordion("activate", index); } }); $.ui.accordion = function(container, options) { // setup configuration this.options = options = $.extend({}, $.ui.accordion.defaults, options); this.element = container; $(container).addClass("ui-accordion"); if ( options.navigation ) { var current = $(container).find(".accord > a").filter(options.navigationFilter); if ( current.length ) { if ( current.filter(options.header).length ) { options.active = current; } else { options.active = current.parent().parent().prev(); current.addClass("current"); } } } // calculate active if not specified, using the first header options.headers = $(container).find(options.header); options.active = findActive(options.headers, options.active); if ( options.fillSpace ) { var maxHeight = $(container).parent().height(); options.headers.each(function() { maxHeight -= $(this).outerHeight(); }); var maxPadding = 0; options.headers.next().each(function() { maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height()); }).height(maxHeight - maxPadding); } else if ( options.autoheight ) { var maxHeight = 0; options.headers.next().each(function() { maxHeight = Math.max(maxHeight, $(this).outerHeight()); }).height(maxHeight); } options.headers .not(options.active || "") .next() .hide(); options.active.parent().andSelf().addClass(options.selectedClass); if (options.event) $(container).bind((options.event) + ".ui-accordion", clickHandler); }; $.ui.accordion.prototype = { activate: function(index) { // call clickHandler with custom event clickHandler.call(this.element, { target: findActive( this.options.headers, index )[0] }); }, enable: function() { this.options.disabled = false; }, disable: function() { this.options.disabled = true; }, destroy: function() { this.options.headers.next().css("display", ""); if ( this.options.fillSpace || this.options.autoheight ) { this.options.headers.next().css("height", ""); } $.removeData(this.element, "ui-accordion"); $(this.element).removeClass("ui-accordion").unbind(".ui-accordion"); } } function scopeCallback(callback, scope) { return function() { return callback.apply(scope, arguments); }; } function completed(cancel) { // if removed while animated data can be empty if (!$.data(this, "ui-accordion")) return; var instance = $.data(this, "ui-accordion"); var options = instance.options; options.running = cancel ? 0 : --options.running; if ( options.running ) return; if ( options.clearStyle ) { options.toShow.add(options.toHide).css({ height: "", overflow: "" }); } $(this).triggerHandler("change.ui-accordion", [options.data], options.change); } function toggle(toShow, toHide, data, clickedActive, down) { var options = $.data(this, "ui-accordion").options; options.toShow = toShow; options.toHide = toHide; options.data = data; var complete = scopeCallback(completed, this); // count elements to animate options.running = toHide.size() == 0 ? toShow.size() : toHide.size(); if ( options.animated ) { if ( !options.alwaysOpen && clickedActive ) { $.ui.accordion.animations[options.animated]({ toShow: jQuery([]), toHide: toHide, complete: complete, down: down, autoheight: options.autoheight }); } else { $.ui.accordion.animations[options.animated]({ toShow: toShow, toHide: toHide, complete: complete, down: down, autoheight: options.autoheight }); } } else { if ( !options.alwaysOpen && clickedActive ) { toShow.toggle(); } else { toHide.hide(); toShow.show(); } complete(true); } } function clickHandler(event) { var options = $.data(this, "ui-accordion").options; if (options.disabled) return false; // called only when using activate(false) to close all parts programmatically if ( !event.target && !options.alwaysOpen ) { options.active.parent().andSelf().toggleClass(options.selectedClass); var toHide = options.active.next(), data = { instance: this, options: options, newHeader: jQuery([]), oldHeader: options.active, newContent: jQuery([]), oldContent: toHide }, toShow = options.active = $([]); toggle.call(this, toShow, toHide, data ); return false; } // get the click target var clicked = $(event.target); // due to the event delegation model, we have to check if one // of the parent elements is our actual header, and find that if ( clicked.parents(options.header).length ) while ( !clicked.is(options.header) ) clicked = clicked.parent(); var clickedActive = clicked[0] == options.active[0]; // if animations are still active, or the active header is the target, ignore click if (options.running || (options.alwaysOpen && clickedActive)) return false; if (!clicked.is(options.header)) return; // switch classes options.active.parent().andSelf().toggleClass(options.selectedClass); if ( !clickedActive ) { clicked.parent().andSelf().addClass(options.selectedClass); } // find elements to show and hide var toShow = clicked.next(), toHide = options.active.next(), //data = [clicked, options.active, toShow, toHide], data = { instance: this, options: options, newHeader: clicked, oldHeader: options.active, newContent: toShow, oldContent: toHide }, down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] ); options.active = clickedActive ? $([]) : clicked; toggle.call(this, toShow, toHide, data, clickedActive, down ); return false; }; function findActive(headers, selector) { return selector != undefined ? typeof selector == "number" ? headers.filter(":eq(" + selector + ")") : headers.not(headers.not(selector)) : selector === false ? $([]) : headers.filter(":eq(0)"); } $.extend($.ui.accordion, { defaults: { selectedClass: "selected", alwaysOpen: true, animated: 'slide', event: "click", header: ".accord > a", autoheight: true, running: 0, navigationFilter: function() { return this.href.toLowerCase() == location.href.toLowerCase(); } }, animations: { slide: function(options, additions) { options = $.extend({ easing: "swing", duration: 300 }, options, additions); if ( !options.toHide.size() ) { options.toShow.animate({height: "show"}, options); return; } var hideHeight = options.toHide.height(), showHeight = options.toShow.height(), difference = showHeight / hideHeight; options.toShow.css({ height: 0, overflow: 'hidden' }).show(); options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{ step: function(now) { var current = (hideHeight - now) * difference; if ($.browser.msie || $.browser.opera) { current = Math.ceil(current); } options.toShow.height( current ); }, duration: options.duration, easing: options.easing, complete: function() { if ( !options.autoheight ) { options.toShow.css("height", "auto"); } options.complete(); } }); }, bounceslide: function(options) { this.slide(options, { easing: options.down ? "bounceout" : "swing", duration: options.down ? 1000 : 200 }); }, easeslide: function(options) { this.slide(options, { easing: "easeinout", duration: 700 }) } } }); }); /*********************************************************************************************************************************/ jQuery(document).ready( function($) { $.organicTabs = function(el, options) { var base = this; base.$el = $(el); base.$nav = base.$el.find(".nav-tab"); base.init = function() { base.options = $.extend({},$.organicTabs.defaultOptions, options); var curList = base.$el.find("a.current"); if( !curList || !curList.length ) base.$el.find("a:first").addClass('current'); base.$el.find("li:first").addClass('current'); // Accessible hiding fix $(".hide").css({ "position": "relative", "top": 0, "left": 0, "display": "none" }); base.$nav.delegate("li > a", "click", function() { // Figure out current list via CSS class var curList = base.$el.find("a.current").attr("href").substring(1), // List moving to $newList = $(this), // Figure out ID of new list listID = $newList.attr("href").substring(1), // Set outer wrapper height to (static) height of current inner list $allListWrap = base.$el.find(".list-wrap"), curListHeight = $allListWrap.height(); //$allListWrap.height(curListHeight); if ((listID != curList) && ( base.$el.find(":animated").length == 0)) { // Fade out current list base.$el.find("."+curList).fadeOut(base.options.speed, function() { // Fade in new list on callback base.$el.find("."+listID).fadeIn(base.options.speed); // Adjust outer wrapper to fit new list snuggly var newHeight = base.$el.find("."+listID).height(); /*$allListWrap.animate({ height: newHeight });*/ // Remove highlighting - Add to just-clicked tab base.$el.find(".nav-tab li a").removeClass("current"); base.$el.find(".nav-tab li").removeClass("current"); $newList.addClass("current"); $newList.parent('li').addClass("current"); }); } // Don't behave like a regular link // Stop propegation and bubbling return false; }); }; base.init(); }; $.organicTabs.defaultOptions = { "speed": 300 }; $.fn.organicTabs = function(options) { return this.each(function() { (new $.organicTabs(this, options)); }); }; }); /*********************************************************************************************************************************/ /** * jQuery bxSlider v3.0 * http://bxslider.com * * Copyright 2011, Steven Wanderski * http://bxcreative.com * * Free to use and abuse under the MIT license. * http://www.opensource.org/licenses/mit-license.php * */ (function($){ $.fn.bxSlider = function(options){ var defaults = { mode: 'horizontal', // 'horizontal', 'vertical', 'fade' childSelector: '', // jQuery selector - elements to be used as slides infiniteLoop: true, // true, false - display first slide after last hideControlOnEnd: false, // true, false - if true, will hide 'next' control on last slide and 'prev' control on first controls: true, // true, false - previous and next controls speed: 500, // integer - in ms, duration of time slide transitions will occupy easing: 'swing', // used with jquery.easing.1.3.js - see http://gsgd.co.uk/sandbox/jquery/easing/ for available options pager: false, // true / false - display a pager pagerSelector: null, // jQuery selector - element to contain the pager. ex: '#pager' pagerType: 'full', // 'full', 'short' - if 'full' pager displays 1,2,3... if 'short' pager displays 1 / 4 pagerLocation: 'bottom', // 'bottom', 'top' - location of pager pagerShortSeparator: '/', // string - ex: 'of' pager would display 1 of 4 pagerActiveClass: 'pager-active', // string - classname attached to the active pager link nextText: '', // string - text displayed for 'next' control nextImage: '', // string - filepath of image used for 'next' control. ex: 'images/next.jpg' nextSelector: null, // jQuery selector - element to contain the next control. ex: '#next' prevText: '', // string - text displayed for 'previous' control prevImage: '', // string - filepath of image used for 'previous' control. ex: 'images/prev.jpg' prevSelector: null, // jQuery selector - element to contain the previous control. ex: '#next' captions: false, // true, false - display image captions (reads the image 'title' tag) captionsSelector: null, // jQuery selector - element to contain the captions. ex: '#captions' auto: false, // true, false - make slideshow change automatically autoDirection: 'next', // 'next', 'prev' - direction in which auto show will traverse autoControls: false, // true, false - show 'start' and 'stop' controls for auto show autoControlsSelector: null, // jQuery selector - element to contain the auto controls. ex: '#auto-controls' autoStart: true, // true, false - if false show will wait for 'start' control to activate autoHover: true, // true, false - if true show will pause on mouseover autoDelay: 0, // integer - in ms, the amount of time before starting the auto show pause: 3000, // integer - in ms, the duration between each slide transition startText: 'start', // string - text displayed for 'start' control startImage: '', // string - filepath of image used for 'start' control. ex: 'images/start.jpg' stopText: 'stop', // string - text displayed for 'stop' control stopImage: '', // string - filepath of image used for 'stop' control. ex: 'images/stop.jpg' ticker: false, // true, false - continuous motion ticker mode (think news ticker) // note: autoControls, autoControlsSelector, and autoHover apply to ticker! tickerSpeed: 5000, // float - use value between 1 and 5000 to determine ticker speed - the smaller the value the faster the ticker speed tickerDirection: 'next', // 'next', 'prev' - direction in which ticker show will traverse tickerHover: false, // true, false - if true ticker will pause on mouseover wrapperClass: 'bx-wrapper', // string - classname attached to the slider wraper startingSlide: 0, // integer - show will start on specified slide. note: slides are zero based! displaySlideQty: 1, // integer - number of slides to display at once moveSlideQty: 1, // integer - number of slides to move at once randomStart: false, // true, false - if true show will start on a random slide onBeforeSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager onAfterSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager onLastSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager onFirstSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager onNextSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager onPrevSlide: function(){}, onInit: function(){}, onDestroy: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager buildPager: null // function(slideIndex, slideHtmlObject){ return string; } - advanced use only! see the tutorial here: http://bxslider.com/custom-pager }; var options = $.extend(defaults, options); // cache the base element var base = this; // initialize (and localize) all variables var $parent = ''; var $origElement = ''; var $children = ''; var this_children_Length = ''; var $outerWrapper = ''; var $firstChild = ''; var childrenWidth = ''; var childrenOuterWidth = ''; var wrapperWidth = ''; var wrapperHeight = ''; var $pager = ''; var interval = ''; var $autoControls = ''; var $stopHtml = ''; var $startContent = ''; var $stopContent = ''; var autoPlaying = true; var loaded = false; var childrenMaxWidth = 0; var childrenMaxHeight = 0; var currentSlide = 0; var origLeft = 0; var origTop = 0; var origShowWidth = 0; var origShowHeight = 0; var tickerLeft = 0; var tickerTop = 0; var isWorking = false; var firstSlide = 0; var lastSlide = $children.length - 1; // PUBLIC FUNCTIONS /** * Go to specified slide */ this.goToSlide = function(number, stopAuto){ if(!isWorking){ isWorking = true; // set current slide to argument currentSlide = number; options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide)); // check if stopAuto argument is supplied if(typeof(stopAuto) == 'undefined'){ var stopAuto = true; } if(stopAuto){ // if show is auto playing, stop it if(options.auto){ base.stopShow(true); } } slide = number; // check for first slide callback if(slide == firstSlide){ options.onFirstSlide(currentSlide, $children.length, $children.eq(currentSlide)); } // check for last slide callback if(slide == lastSlide){ options.onLastSlide(currentSlide, $children.length, $children.eq(currentSlide)); } // horizontal if(options.mode == 'horizontal'){ $parent.animate({'left': '-'+getSlidePosition(slide, 'left')+'px'}, options.speed, options.easing, function(){ isWorking = false; // perform the callback function options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide)); }); // vertical }else if(options.mode == 'vertical'){ $parent.animate({'top': '-'+getSlidePosition(slide, 'top')+'px'}, options.speed, options.easing, function(){ isWorking = false; // perform the callback function options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide)); }); // fade }else if(options.mode == 'fade'){ setChildrenFade(); } // check to remove controls on last/first slide checkEndControls(); // accomodate multi slides if(options.moveSlideQty > 1){ number = Math.floor(number / options.moveSlideQty); } // make the current slide active makeSlideActive(number); // display the caption showCaptions(); } } /** * Go to next slide */ this.goToNextSlide = function(stopAuto){ // check if stopAuto argument is supplied if(typeof(stopAuto) == 'undefined'){ var stopAuto = true; } if(stopAuto){ // if show is auto playing, stop it if(options.auto){ base.stopShow(true); } } // makes slideshow finite if(!options.infiniteLoop){ if(!isWorking){ var slideLoop = false; // make current slide the old value plus moveSlideQty currentSlide = (currentSlide + (options.moveSlideQty)); // if current slide has looped on itself if(currentSlide <= lastSlide){ checkEndControls(); // next slide callback options.onNextSlide(currentSlide, $children.length, $children.eq(currentSlide)); // move to appropriate slide base.goToSlide(currentSlide); }else{ currentSlide -= options.moveSlideQty; } } // end if(!isWorking) }else{ if(!isWorking){ isWorking = true; var slideLoop = false; // make current slide the old value plus moveSlideQty currentSlide = (currentSlide + options.moveSlideQty); // if current slide has looped on itself if(currentSlide > lastSlide){ currentSlide = currentSlide % $children.length; slideLoop = true; } // next slide callback options.onNextSlide(currentSlide, $children.length, $children.eq(currentSlide)); // slide before callback options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide)); if(options.mode == 'horizontal'){ // get the new 'left' property for $parent var parentLeft = (options.moveSlideQty * childrenOuterWidth); // animate to the new 'left' $parent.animate({'left': '-='+parentLeft+'px'}, options.speed, options.easing, function(){ isWorking = false; // if its time to loop, reset the $parent if(slideLoop){ $parent.css('left', '-'+getSlidePosition(currentSlide, 'left')+'px'); } // perform the callback function options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide)); }); }else if(options.mode == 'vertical'){ // get the new 'left' property for $parent var parentTop = (options.moveSlideQty * childrenMaxHeight); // animate to the new 'left' $parent.animate({'top': '-='+parentTop+'px'}, options.speed, options.easing, function(){ isWorking = false; // if its time to loop, reset the $parent if(slideLoop){ $parent.css('top', '-'+getSlidePosition(currentSlide, 'top')+'px'); } // perform the callback function options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide)); }); }else if(options.mode == 'fade'){ setChildrenFade(); } // make the current slide active if(options.moveSlideQty > 1){ makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty)); }else{ makeSlideActive(currentSlide); } // display the caption showCaptions(); } // end if(!isWorking) } } // end function /** * Go to previous slide */ this.goToPreviousSlide = function(stopAuto){ // check if stopAuto argument is supplied if(typeof(stopAuto) == 'undefined'){ var stopAuto = true; } if(stopAuto){ // if show is auto playing, stop it if(options.auto){ base.stopShow(true); } } // makes slideshow finite if(!options.infiniteLoop){ if(!isWorking){ var slideLoop = false; // make current slide the old value plus moveSlideQty currentSlide = currentSlide - options.moveSlideQty; // if current slide has looped on itself if(currentSlide < 0){ currentSlide = 0; // if specified, hide the control on the last slide if(options.hideControlOnEnd){ $outerWrapper.children('.prev').hide(); } } checkEndControls(); // next slide callback options.onPrevSlide(currentSlide, $children.length, $children.eq(currentSlide)); // move to appropriate slide base.goToSlide(currentSlide); } }else{ if(!isWorking){ isWorking = true; var slideLoop = false; // make current slide the old value plus moveSlideQty currentSlide = (currentSlide - (options.moveSlideQty)); // if current slide has looped on itself if(currentSlide < 0){ negativeOffset = (currentSlide % $children.length); if(negativeOffset == 0){ currentSlide = 0; }else{ currentSlide = ($children.length) + negativeOffset; } slideLoop = true; } // next slide callback options.onPrevSlide(currentSlide, $children.length, $children.eq(currentSlide)); // slide before callback options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide)); if(options.mode == 'horizontal'){ // get the new 'left' property for $parent var parentLeft = (options.moveSlideQty * childrenOuterWidth); // animate to the new 'left' $parent.animate({'left': '+='+parentLeft+'px'}, options.speed, options.easing, function(){ isWorking = false; // if its time to loop, reset the $parent if(slideLoop){ $parent.css('left', '-'+getSlidePosition(currentSlide, 'left')+'px'); } // perform the callback function options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide)); }); }else if(options.mode == 'vertical'){ // get the new 'left' property for $parent var parentTop = (options.moveSlideQty * childrenMaxHeight); // animate to the new 'left' $parent.animate({'top': '+='+parentTop+'px'}, options.speed, options.easing, function(){ isWorking = false; // if its time to loop, reset the $parent if(slideLoop){ $parent.css('top', '-'+getSlidePosition(currentSlide, 'top')+'px'); } // perform the callback function options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide)); }); }else if(options.mode == 'fade'){ setChildrenFade(); } // make the current slide active if(options.moveSlideQty > 1){ makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty)); }else{ makeSlideActive(currentSlide); } // display the caption showCaptions(); } // end if(!isWorking) } } // end function /** * Go to first slide */ this.goToFirstSlide = function(stopAuto){ // check if stopAuto argument is supplied if(typeof(stopAuto) == 'undefined'){ var stopAuto = true; } base.goToSlide(firstSlide, stopAuto); } /** * Go to last slide */ this.goToLastSlide = function(){ // check if stopAuto argument is supplied if(typeof(stopAuto) == 'undefined'){ var stopAuto = true; } base.goToSlide(lastSlide, stopAuto); } /** * Get the current slide */ this.getCurrentSlide = function(){ return currentSlide; } /** * Get the total slide count */ this.getSlideCount = function(){ return $children.length; } /** * Suspend the slideshow */ this.suspendShow = function(changeText){ clearInterval(interval); // check if changeText argument is supplied if(typeof(changeText) == 'undefined'){ var changeText = true; } if(changeText && options.autoControls){ $autoControls.html($startContent).removeClass('stop').addClass('start'); } } /** * Restart the suspended slideshow */ this.restartShow = function(changeText){ // check if changeText argument is supplied if(typeof(changeText) == 'undefined'){ var changeText = true; } if(autoPlaying){ setAutoInterval(); } if(changeText && options.autoControls){ $autoControls.html($stopContent).removeClass('start').addClass('stop'); } } /** * Stop the slideshow permanently */ this.stopShow = function(changeText){ autoPlaying = false; this.suspendShow(changeText); } /** * Start the slideshow */ this.startShow = function(changeText){ autoPlaying = true; this.restartShow(changeText); } /** * Stops the ticker */ this.stopTicker = function(changeText){ $parent.stop(); // check if changeText argument is supplied if(typeof(changeText) == 'undefined'){ var changeText = true; } if(changeText && options.ticker){ $autoControls.html($startContent).removeClass('stop').addClass('start'); autoPlaying = false; } } /** * Starts the ticker */ this.startTicker = function(changeText){ if(options.mode == 'horizontal'){ if(options.tickerDirection == 'next'){ // get the 'left' property where the ticker stopped var stoppedLeft = parseInt($parent.css('left')); // calculate the remaining distance the show must travel until the loop var remainingDistance = (origShowWidth + stoppedLeft) + $children.eq(0).width(); }else if(options.tickerDirection == 'prev'){ // get the 'left' property where the ticker stopped var stoppedLeft = -parseInt($parent.css('left')); // calculate the remaining distance the show must travel until the loop var remainingDistance = (stoppedLeft) - $children.eq(0).width(); } // calculate the speed ratio to seamlessly finish the loop var finishingSpeed = (remainingDistance * options.tickerSpeed) / origShowWidth; // call the show moveTheShow(tickerLeft, remainingDistance, finishingSpeed); }else if(options.mode == 'vertical'){ if(options.tickerDirection == 'next'){ // get the 'top' property where the ticker stopped var stoppedTop = parseInt($parent.css('top')); // calculate the remaining distance the show must travel until the loop var remainingDistance = (origShowHeight + stoppedTop) + $children.eq(0).height(); }else if(options.tickerDirection == 'prev'){ // get the 'left' property where the ticker stopped var stoppedTop = -parseInt($parent.css('top')); // calculate the remaining distance the show must travel until the loop var remainingDistance = (stoppedTop) - $children.eq(0).height(); } // calculate the speed ratio to seamlessly finish the loop var finishingSpeed = (remainingDistance * options.tickerSpeed) / origShowHeight; // call the show moveTheShow(tickerTop, remainingDistance, finishingSpeed); // check if changeText argument is supplied if(typeof(changeText) == 'undefined'){ var changeText = true; } if(changeText && options.ticker){ $autoControls.html($stopContent).removeClass('start').addClass('stop'); autoPlaying = true; } } } /** * Initialize a new slideshow */ this.initShow = function(){ // reinitialize all variables // base = this; $parent = $(this); $origElement = $parent.clone(); $children = $parent.children(options.childSelector); $outerWrapper = ''; $firstChild = $parent.children(options.childSelector + ':first'); childrenWidth = $firstChild.width(); childrenMaxWidth = 0; childrenOuterWidth = $firstChild.outerWidth(); childrenMaxHeight = 0; wrapperWidth = getWrapperWidth(); wrapperHeight = getWrapperHeight(); isWorking = false; $pager = ''; currentSlide = 0; origLeft = 0; origTop = 0; interval = ''; $autoControls = ''; $stopHtml = ''; $startContent = ''; $stopContent = ''; autoPlaying = true; loaded = false; origShowWidth = 0; origShowHeight = 0; tickerLeft = 0; tickerTop = 0; firstSlide = 0; lastSlide = $children.length - 1; // get the largest child's height and width $children.each(function(index) { if($(this).outerHeight() > childrenMaxHeight){ childrenMaxHeight = $(this).outerHeight(); } if($(this).outerWidth() > childrenMaxWidth){ childrenMaxWidth = $(this).outerWidth(); } }); // get random slide number if(options.randomStart){ var randomNumber = Math.floor(Math.random() * $children.length); currentSlide = randomNumber; origLeft = childrenOuterWidth * (options.moveSlideQty + randomNumber); origTop = childrenMaxHeight * (options.moveSlideQty + randomNumber); // start show at specific slide }else{ currentSlide = options.startingSlide; origLeft = childrenOuterWidth * (options.moveSlideQty + options.startingSlide); origTop = childrenMaxHeight * (options.moveSlideQty + options.startingSlide); } // set initial css initCss(); // check to show pager if(options.pager && !options.ticker){ if(options.pagerType == 'full'){ showPager('full'); }else if(options.pagerType == 'short'){ showPager('short'); } } // check to show controls if(options.controls && !options.ticker && $children.length > 1){ setControlsVars(); } // check if auto if(options.auto || options.ticker){ // check if auto controls are displayed if(options.autoControls){ setAutoControlsVars(); } // check if show should auto start if(options.autoStart){ // check if autostart should delay autoPlaying = false; // prevent playing during the deplay setTimeout(function(){ base.startShow(true); }, options.autoDelay); }else{ base.stopShow(true); } // check if show should pause on hover if(options.autoHover && !options.ticker){ setAutoHover(); } } // make the starting slide active if(options.moveSlideQty > 1){ makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty)); }else{ makeSlideActive(currentSlide); } // check for finite show and if controls should be hidden checkEndControls(); // show captions if(options.captions){ showCaptions(); } // perform the callback function options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide)); options.onInit(currentSlide, $children.length, $children.eq(currentSlide)); } /** * Destroy the current slideshow */ this.destroyShow = function(){ // stop the auto show clearInterval(interval); // remove any controls / pagers that have been appended $outerWrapper.children('.next, .prev, .bx-pager, .bx-auto').remove(); // unwrap all bx-wrappers $parent.unwrap().unwrap().removeAttr('style'); // remove any styles that were appended $parent.children(options.childSelector).removeAttr('style').not('.bx-child').remove(); // remove any childrent that were appended $children.removeClass('bx-child'); $children.removeClass('clones'); options.onDestroy(); } /** * Reload the current slideshow */ this.reloadShow = function(){ base.destroyShow(); base.initShow(); } // PRIVATE FUNCTIONS /** * Creates all neccessary styling for the slideshow */ function initCss(){ // layout the children setChildrenLayout(options.startingSlide); // CSS for horizontal mode if(options.mode == 'horizontal'){ // wrap the