/** * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!) * Common usage: wipe images (left and right to show the previous or next image) * * MIT License * * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de) * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems) * @version 1.1 (1st September 2010) - support wipe up and wipe down * @version 1.0 (15th July 2010) */ (function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery); ;;(function($){$.extend($.easing,{def:'easeOutQuad',easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;}});var sidrMoving=false,sidrOpened=false;var privateMethods={isUrl:function(str){var pattern=new RegExp('^(https?:\\/\\/)?'+'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+'((\\d{1,3}\\.){3}\\d{1,3}))'+'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+'(\\?[;&a-z\\d%_.~+=-]*)?'+'(\\#[-a-z\\d_]*)?$','i');if(!pattern.test(str)){return false;}else{return true;}},loadContent:function($menu,content){$menu.html(content);},addPrefix:function($element){var elementId=$element.attr('id'),elementClass=$element.attr('class');if(typeof elementId==='string'&&''!==elementId){$element.attr('id',elementId.replace(/([A-Za-z0-9_.\-]+)/g,'sidr-id-$1'));} if(typeof elementClass==='string'&&''!==elementClass&&'sidr-inner'!==elementClass){$element.attr('class',elementClass.replace(/([A-Za-z0-9_.\-]+)/g,'sidr-class-$1'));} $element.removeAttr('style');},execute:function(action,name,callback){if(typeof name==='function'){callback=name;name='sidr';} else if(!name){name='sidr';} var $menu=$('#'+name),$body=$($menu.data('body')),$html=$('html'),menuWidth=$menu.outerWidth(true),speed=$menu.data('speed'),side=$menu.data('side'),bodyAnimation,menuAnimation,scrollTop;if('open'===action||('toogle'===action&&!$menu.is(':visible'))){if($menu.is(':visible')||sidrMoving){return;} if(sidrOpened!==false){methods.close(sidrOpened,function(){methods.open(name);});return;} sidrMoving=true;if(side==='left'){bodyAnimation={left:menuWidth+'px'};menuAnimation={left:'0px'};} else{bodyAnimation={right:menuWidth+'px'};menuAnimation={right:'0px'};} scrollTop=$html.scrollTop();$html.css('overflow-x','hidden').scrollTop(scrollTop);$body.css({width:$body.width(),position:'absolute'}).animate(bodyAnimation,speed,'easeOutCubic');$menu.css('display','block').animate(menuAnimation,speed,'easeOutCubic',function(){sidrMoving=false;sidrOpened=name;if(typeof callback==='function'){callback(name);}});} else{if(!$menu.is(':visible')||sidrMoving){return;} sidrMoving=true;if(side==='left'){bodyAnimation={left:0};menuAnimation={left:'-'+menuWidth+'px'};} else{bodyAnimation={right:0};menuAnimation={right:'-'+menuWidth+'px'};} scrollTop=$html.scrollTop();$html.removeAttr('style').scrollTop(scrollTop);$body.animate(bodyAnimation,speed,'easeOutCubic');$menu.animate(menuAnimation,speed,'easeOutCubic',function(){$menu.removeAttr('style');$body.removeAttr('style');$('html').removeAttr('style');sidrMoving=false;sidrOpened=false;if(typeof callback==='function'){callback(name);}});}}};var methods={open:function(name,callback){privateMethods.execute('open',name,callback);},close:function(name,callback){privateMethods.execute('close',name,callback);},toogle:function(name,callback){privateMethods.execute('toogle',name,callback);}};$.sidr=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else if(typeof method==='function'||typeof method==='string'||!method){return methods.toogle.apply(this,arguments);}else{$.error('Method '+method+' does not exist on jQuery.sidr');}};$.fn.sidr=function(options){var settings=$.extend({name:'sidr',speed:200,side:'left',source:null,renaming:true,body:'body'},options);var name=settings.name,$sideMenu=$('#'+name);if($sideMenu.length===0){$sideMenu=$('
').attr('id',name).appendTo($('body'));} $sideMenu.addClass('sidr').addClass(settings.side).data({speed:settings.speed,side:settings.side,body:settings.body});if(typeof settings.source==='function'){var newContent=settings.source(name);privateMethods.loadContent($sideMenu,newContent);} else if(typeof settings.source==='string'&&privateMethods.isUrl(settings.source)){$.get(settings.source,function(data){privateMethods.loadContent($sideMenu,data);});} else if(typeof settings.source==='string'){var htmlContent='',selectors=settings.source.split(',');$.each(selectors,function(index,element){htmlContent+='!
\');r.3z(\'3e: \'+i+"
");r.3z(\'\'+s+"
")}(16(e){e.9x.2M=16(n){12 r="1.7.0";12 i=e.9x.78;12 s=e(14);12 o=16(e,t){12 n=e.1Y(".");12 r=t.1Y(".");2u(12 i=0;i