compass-jquery-plugin 0.3.2.1 → 0.3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +13 -6
- data/VERSION.yml +1 -1
- data/lib/handle_attributes.rb +23 -23
- data/lib/handle_js_files.rb +1 -1
- data/lib/jquery/compass_plugin.rb +5 -5
- data/lib/jquery/dynatree.rb +5 -5
- data/lib/jquery/jqtouch.rb +3 -3
- data/lib/jquery/jquery_auto_complete.rb +44 -44
- data/lib/jquery/jquery_selector_assertions.rb +78 -78
- data/lib/jquery/jstree.rb +4 -4
- data/lib/jquery/ribbon.rb +5 -5
- data/templates/jqtouch/jquery.jqtouch.min.js +2 -2
- data/templates/jquery/config/initializers/jquery.rb +2 -0
- data/templates/jquery/jquery.dotimeout.js +285 -0
- data/templates/jquery/jquery.dotimeout.min.js +2 -0
- data/templates/jquery/jquery.dst.js +154 -0
- data/templates/jquery/jquery.dst.min.js +4 -0
- data/templates/jquery/jquery.form.js +48 -36
- data/templates/jquery/jquery.form.min.js +15 -14
- data/templates/jquery/manifest.rb +4 -0
- data/templates/mobile/jquery/mobile/_base.scss +35 -20
- data/templates/mobile/jquery/mobile/default/icons-18-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-18-white.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-36-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-36-white.png +0 -0
- data/templates/mobile/jquery/mobile/default.scss +8 -2
- data/templates/mobile/jquery/mobile/valencia/icons-18-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-18-white.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-36-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-36-white.png +0 -0
- data/templates/mobile/jquery.mobile.js +29 -26
- data/templates/mobile/jquery.mobile.min.js +6 -6
- metadata +8 -4
@@ -1,5 +1,5 @@
|
|
1
1
|
(function(a){a.jQTouch=function(u){var C,r=a("head"),K="",H=[],G=0,l={},i="",t="portrait",S=true,R=0,e=0,h=[],v={},j=351,M=a.jQTouch.prototype.extensions,Q=[],q="",D={addGlossToIcon:true,backSelector:".back, .cancel, .goback",cacheGetRequests:true,debug:false,fallback2dAnimation:"fade",fixedViewport:true,formSelector:"form",fullScreen:true,fullScreenClass:"fullscreen",hoverDelay:50,icon:null,icon4:null,moveThreshold:10,preloadImages:false,pressDelay:1000,startupScreen:null,statusBar:"default",submitSelector:".submit",touchSelector:"a, .touch",useAnimations:true,useFastTouch:true,animations:[{selector:".cube",name:"cubeleft",is3d:true},{selector:".cubeleft",name:"cubeleft",is3d:true},{selector:".cuberight",name:"cuberight",is3d:true},{selector:".dissolve",name:"fade",is3d:false},{selector:".fade",name:"fade",is3d:false},{selector:".flip",name:"flipleft",is3d:true},{selector:".flipleft",name:"flipleft",is3d:true},{selector:".flipright",name:"flipright",is3d:true},{selector:".pop",name:"pop",is3d:true},{selector:".slide",name:"slideleft",is3d:false},{selector:".slidedown",name:"slidedown",is3d:false},{selector:".slideleft",name:"slideleft",is3d:false},{selector:".slideright",name:"slideright",is3d:false},{selector:".slideup",name:"slideup",is3d:false},{selector:".swap",name:"swapleft",is3d:true},{selector:"#jqt > * > ul li a",name:"slideleft",is3d:false}]};function w(T){now=(new Date).getTime();delta=now-R;R=now;if(l.debug){if(T){console.log(delta+": "+T)}else{console.log(delta+": Called "+arguments.callee.caller.name)}}}function b(T){w();if(typeof(T.selector)==="string"&&typeof(T.name)==="string"){Q.push(T)}}function k(V,U,T){w();H.unshift({page:V,animation:U,hash:"#"+V.attr("id"),id:V.attr("id")})}function n(U){w();if(!S){w("ClickHandler handler aborted because tap is not ready");U.preventDefault();return false}var T=a(U.target);if(!T.is(h.join(", "))){var T=a(U.target).closest(h.join(", "))}if(T&&T.attr("href")&&!T.isExternalLink()){w("Need to prevent default click behavior");U.preventDefault()}else{w("No need to prevent default click behavior")}if(a.support.touch){w("Not converting click to a tap event because touch handler is on the job")}else{w("Converting click event to a tap event");a(U.target).trigger("tap",U)}}function c(Y,V,X,U){w();if(V.length===0){a.fn.unselect();w("Target element is missing.");return false}if(V.hasClass("current")){a.fn.unselect();w("You are already on the page you are trying to navigate to.");return false}a(":focus").blur();Y.trigger("pageAnimationStart",{direction:"out"});V.trigger("pageAnimationStart",{direction:"in"});if(a.support.animationEvents&&X&&l.useAnimations){S=false;if(!a.support.transform3d&&X.is3d){X.name=l.fallback2dAnimation}var T;if(U){if(X.name.indexOf("left")>0){T=X.name.replace(/left/,"right")}else{if(X.name.indexOf("right")>0){T=X.name.replace(/right/,"left")}else{if(X.name.indexOf("up")>0){T=X.name.replace(/up/,"down")}else{if(X.name.indexOf("down")>0){T=X.name.replace(/down/,"up")}else{T=X.name}}}}}else{T=X.name}Y.bind("webkitAnimationEnd",W);V.addClass(T+" in current");Y.addClass(T+" out")}else{V.addClass("current");W()}function W(Z){w();if(a.support.animationEvents&&X&&l.useAnimations){Y.unbind("webkitAnimationEnd",W);Y.removeClass(T+" out current");V.removeClass(T+" in")}else{Y.removeClass(T+" out current")}i=V;if(U){H.shift()}else{k(i,X)}Y.unselect();e=(new Date()).getTime();m(i.attr("id"));S=true;V.trigger("pageAnimationEnd",{direction:"in",animation:X});Y.trigger("pageAnimationEnd",{direction:"out",animation:X})}return true}function P(){w();return t}function g(){w();if(H.length<1){w("History is empty.")}if(H.length===1){w("You are on the first panel.")}var U=H[0],T=H[1];if(c(U.page,T.page,U.animation,true)){return v}else{w("Could not go back.");return false}}function L(X,Y,V){w();if(V){console.warn("The reverse parameter was sent to goTo() function, which is bad.")}var Z=H[0].page;if(typeof Y==="string"){for(var W=0,T=Q.length;W<T;W++){if(Q[W].name===Y){Y=Q[W];break}}}if(typeof(X)==="string"){var U=a(X);if(U.length<1){d(X,{animation:Y});return}else{X=U}}if(c(Z,X,Y,V)){return v}else{w("Could not animate pages.");return false}}function O(T){w();if(H[1]===undefined){w("There is no previous page in history")}else{if(location.hash===H[1].hash){g()}else{w(location.hash+" !== "+H[1].hash)}}}function N(T){w();l=a.extend({},D,T);if(l.preloadImages){for(var U=l.preloadImages.length-1;U>=0;U--){(new Image()).src=l.preloadImages[U]}}if(l.icon||l.icon4){var V,W;if(l.icon4&&window.devicePixelRatio&&window.devicePixelRatio===2){W=l.icon4}else{if(l.icon){W=l.icon}else{W=false}}if(W){V=(l.addGlossToIcon)?"":"-precomposed";q+='<link rel="apple-touch-icon'+V+'" href="'+W+'" />'}}if(l.startupScreen){q+='<link rel="apple-touch-startup-image" href="'+l.startupScreen+'" />'}if(l.fixedViewport){q+='<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>'}if(l.fullScreen){q+='<meta name="apple-mobile-web-app-capable" content="yes" />';if(l.statusBar){q+='<meta name="apple-mobile-web-app-status-bar-style" content="'+l.statusBar+'" />'}}if(q){r.prepend(q)}}function A(T,U){w();var V=null;a(T).each(function(X,Y){var W=a(this);if(!W.attr("id")){W.attr("id","page-"+(++G))}a("#"+W.attr("id")).remove();C.trigger("pageInserted",{page:W.appendTo(C)});if(W.hasClass("current")||!V){V=W}});if(V!==null){L(V,U);return V}else{return false}}function z(T){var U=(new Date()).getTime()-e;if(U<j){return false}}function f(){w();t=Math.abs(window.orientation)==90?"landscape":"portrait";C.removeClass("portrait landscape").addClass(t).trigger("turn",{orientation:t})}function m(T){w();T=T.replace(/^#/,""),window.onhashchange=null;location.hash="#"+T;window.onhashchange=O}function d(T,U){w();var W={data:null,method:"GET",animation:null,callback:null,$referrer:null};var V=a.extend({},W,U);if(T!="#"){a.ajax({url:T,data:V.data,type:V.method,success:function(X,Z){var Y=A(X,V.animation);if(Y){if(V.method=="GET"&&l.cacheGetRequests===true&&V.$referrer){V.$referrer.attr("href","#"+Y.attr("id"))}if(V.callback){V.callback(true)}}},error:function(X){if(V.$referrer){V.$referrer.unselect()}if(V.callback){V.callback(false)}}})}else{if(V.$referrer){V.$referrer.unselect()}}}function p(U,V){w();a(":focus").blur();U.preventDefault();var T=(typeof(U)==="string")?a(U).eq(0):(U.target?a(U.target):a(U));w(T.attr("action"));if(T.length&&T.is(l.formSelector)&&T.attr("action")){d(T.attr("action"),{data:T.serialize(),method:T.attr("method")||"POST",animation:Q[0]||null,callback:V});return false}return false}function J(V){w();var U=V.closest("form");if(U.length===0){w("No parent form found")}else{w("About to submit parent form");var T=a.Event("submit");T.preventDefault();U.trigger(T);return false}return true}function o(){w();return(typeof WebKitAnimationEvent!="undefined")}function E(){w();return(typeof WebKitCSSMatrix!="undefined")}function I(){w();if(!l.useFastTouch){return false}if(typeof TouchEvent!="undefined"){if(window.navigator.userAgent.indexOf("Mobile")>-1){return true}else{return false}}else{return false}}function B(){w();var V,U,W,X,T;V=document.getElementsByTagName("head")[0];U=document.body;W=document.createElement("style");W.textContent="@media (transform-3d),(-o-transform-3d),(-moz-transform-3d),(-ms-transform-3d),(-webkit-transform-3d),(modernizr){#jqtTestFor3dSupport{height:3px}}";X=document.createElement("div");X.id="jqtTestFor3dSupport";V.appendChild(W);U.appendChild(X);T=X.offsetHeight===3;W.parentNode.removeChild(W);X.parentNode.removeChild(X);return T}function F(Z){w();if(!S){w("Tap is not ready");return false}var V=a(Z.target);if(!V.is(h.join(", "))){var V=a(Z.target).closest(h.join(", "))}if(!V.length||!V.attr("href")){w("Could not find a link related to tapped element");return false}var Y=V.attr("target"),X=V.attr("hash"),W=null;if(V.isExternalLink()){V.unselect();return true}else{if(V.is(l.backSelector)){g(X)}else{if(V.is(l.submitSelector)){J(V)}else{if(Y==="_webapp"){window.location=V.attr("href");return false}else{if(V.attr("href")==="#"){V.unselect();return true}else{for(var U=0,T=Q.length;U<T;U++){if(V.is(Q[U].selector)){W=Q[U];break}}if(!W){console.warn("Animation could not be found. Using slideleft.");W="slideleft"}if(X&&X!=="#"){V.addClass("active");L(a(X).data("referrer",V),W,a(this).hasClass("reverse"));return false}else{V.addClass("loading active");d(V.attr("href"),{animation:W,callback:function(){V.removeClass("loading");setTimeout(a.fn.unselect,250,V)},$referrer:V});return false}}}}}}}function s(ae){w();if(!S){w("TouchStart handler aborted because tap is not ready");ae.preventDefault();return false}var ah=a(ae.target);if(!ah.length){w("Could not find target of touchstart event.");return}var U=(new Date).getTime(),T=null,V=null,aa,ac,ab,Z=0,X=0,ad=0;if(event.changedTouches&&event.changedTouches.length){aa=event.changedTouches[0];ac=aa.pageX;ab=aa.pageY}ah.bind("touchmove",Y).bind("touchend",af).bind("touchcancel",W);T=setTimeout(function(){ah.makeActive()},l.hoverDelay);V=setTimeout(function(){ah.unbind("touchmove",Y).unbind("touchend",af).unbind("touchcancel",W);ah.unselect();clearTimeout(T);ah.trigger("press")},l.pressDelay);function W(ai){w();clearTimeout(T);ah.unselect();ah.unbind("touchmove",Y).unbind("touchend",af).unbind("touchcancel",W)}function af(ai){w();ah.unbind("touchend",af).unbind("touchcancel",W);clearTimeout(T);clearTimeout(V);if(Math.abs(Z)<l.moveThreshold&&Math.abs(X)<l.moveThreshold&&ad<l.pressDelay){ah.trigger("tap",ai)}else{ah.unselect()}}function Y(al){ag();var ak=Math.abs(Z);var ai=Math.abs(X);var aj;if(ak>ai&&(ak>35)&&ad<1000){if(Z<0){aj="left"}else{aj="right"}ah.unbind("touchmove",Y).unbind("touchend",af).unbind("touchcancel",W);ah.trigger("swipe",{direction:aj,deltaX:Z,deltaY:X})}ah.unselect();clearTimeout(T);if(ak>l.moveThreshold||ai>l.moveThreshold){clearTimeout(V)}}function ag(){var ai=event.changedTouches[0]||null;Z=ai.pageX-ac;X=ai.pageY-ab;ad=(new Date).getTime()-U}}N(u);a(document).ready(function(){a.support.animationEvents=o();a.support.cssMatrix=E();a.support.touch=I();a.support.transform3d=B();if(!a.support.touch){console.warn("This device does not support touch interaction, or it has been deactivated by the developer. Some features might be unavailable.")}if(!a.support.transform3d){console.warn("This device does not support 3d animation. 2d animations will be used instead.")}a.fn.isExternalLink=function(){var X=a(this);return(X.attr("target")=="_blank"||X.attr("rel")=="external"||X.is('a[href^="http://maps.google.com"], a[href^="mailto:"], a[href^="tel:"], a[href^="javascript:"], a[href*="youtube.com/v"], a[href*="youtube.com/watch"]'))};a.fn.makeActive=function(){return a(this).addClass("active")};a.fn.press=function(X){if(a.isFunction(X)){return a(this).live("press",X)}else{return a(this).trigger("press")}};a.fn.swipe=function(X){if(a.isFunction(X)){return a(this).live("swipe",X)}else{return a(this).trigger("swipe")}};a.fn.tap=function(X){if(a.isFunction(X)){return a(this).live("tap",X)}else{return a(this).trigger("tap")}};a.fn.unselect=function(X){if(X){X.removeClass("active")}else{a(".active").removeClass("active")}};for(var U=0,T=M.length;U<T;U++){var V=M[U];if(a.isFunction(V)){a.extend(v,V(v))}}if(l.cubeSelector){console.warn("NOTE: cubeSelector has been deprecated. Please use cubeleftSelector instead.");l.cubeleftSelector=l.cubeSelector}if(l.flipSelector){console.warn("NOTE: flipSelector has been deprecated. Please use flipleftSelector instead.");l.flipleftSelector=l.flipSelector}if(l.slideSelector){console.warn("NOTE: slideSelector has been deprecated. Please use slideleftSelector instead.");l.slideleftSelector=l.slideSelector}for(var U=0,T=D.animations.length;U<T;U++){var W=D.animations[U];if(l[W.name+"Selector"]!==undefined){W.selector=l[W.name+"Selector"]}b(W)}h.push("input");h.push(l.touchSelector);h.push(l.backSelector);h.push(l.submitSelector);a(h.join(", ")).css("-webkit-touch-callout","none");C=a("#jqt");if(C.length===0){console.warn('Could not find an element with the id "jqt", so the body id has been set to "jqt". If you are having any problems, wrapping your panels in a div with the id "jqt" might help.');C=a("body").attr("id","jqt")}if(a.support.transform3d){C.addClass("supports3d")}if(l.fullScreenClass&&window.navigator.standalone==true){C.addClass(l.fullScreenClass+" "+l.statusBar)}C.bind("touchstart",s).bind("click",n).bind("mousedown",z).bind("orientationchange",f).bind("submit",p).bind("tap",F).trigger("orientationchange");if(location.hash.length){location.replace(location.href.split("#")[0])}if(a("#jqt > .current").length==0){i=a("#jqt > *:first")}else{i=a("#jqt > .current:first");a("#jqt > .current").removeClass("current")}a(i).addClass("current");K=a(i).attr("id");if(history.replaceState!==undefined){history.replaceState(null,null,"#"+K)}else{m(K)}k(i);scrollTo(0,0)});v={animations:Q,hist:H,settings:l,support:a.support,getOrientation:P,goBack:g,goTo:L,addAnimation:b,submitForm:p};return v};a.jQTouch.prototype.extensions=[];a.jQTouch.addExtension=function(b){a.jQTouch.prototype.extensions.push(b)}})(jQuery);(function(a){a.fn.transition=function(c,b){return this.each(function(){var e=a(this);var h={speed:"300ms",callback:null,ease:"ease-in-out"};var g=a.extend({},h,b);if(g.speed===0){e.css(c);window.setTimeout(g.callback,0)}else{if(a.browser.safari){var f=[];for(var d in c){f.push(d)}e.css({webkitTransitionProperty:f.join(", "),webkitTransitionDuration:g.speed,webkitTransitionTimingFunction:g.ease});if(g.callback){e.one("webkitTransitionEnd",g.callback)}setTimeout(function(i){i.css(c)},0,e)}else{e.animate(c,g.speed,g.callback)}}})}})(jQuery);var SpinningWheel={cellHeight:44,friction:0.003,slotData:[],handleEvent:function(a){if(a.type=="touchstart"){this.lockScreen(a);if(a.currentTarget.id=="sw-cancel"||a.currentTarget.id=="sw-done"){this.tapDown(a)}else{if(a.currentTarget.id=="sw-frame"){this.scrollStart(a)}}}else{if(a.type=="touchmove"){this.lockScreen(a);if(a.currentTarget.id=="sw-cancel"||a.currentTarget.id=="sw-done"){this.tapCancel(a)}else{if(a.currentTarget.id=="sw-frame"){this.scrollMove(a)}}}else{if(a.type=="touchend"){if(a.currentTarget.id=="sw-cancel"||a.currentTarget.id=="sw-done"){this.tapUp(a)}else{if(a.currentTarget.id=="sw-frame"){this.scrollEnd(a)}}}else{if(a.type=="webkitTransitionEnd"){if(a.target.id=="sw-wrapper"){}else{this.backWithinBoundaries(a)}}else{if(a.type=="orientationchange"){this.onOrientationChange(a)}else{if(a.type=="scroll"){this.onScroll(a)}}}}}}},onOrientationChange:function(a){window.scrollTo(0,0);this.swWrapper.style.top=window.innerHeight+window.pageYOffset+"px";this.calculateSlotsWidth()},onScroll:function(a){this.swWrapper.style.top=window.innerHeight+window.pageYOffset+"px"},lockScreen:function(a){a.preventDefault();a.stopPropagation()},reset:function(){this.slotEl=[];this.activeSlot=null;this.swWrapper=undefined;this.swSlotWrapper=undefined;this.swSlots=undefined;this.swFrame=undefined},calculateSlotsWidth:function(){var b=this.swSlots.getElementsByTagName("div");for(var a=0;a<b.length;a+=1){this.slotEl[a].slotWidth=b[a].offsetWidth}},create:function(){var d,a,b,c,e;this.reset();e=document.createElement("div");e.id="sw-wrapper";e.style.top=window.innerHeight+window.pageYOffset+"px";e.style.webkitTransitionProperty="-webkit-transform";e.innerHTML='<div id="sw-slots-wrapper"><div id="sw-slots"></div></div><div id="sw-frame"></div>';document.body.appendChild(e);this.swWrapper=e;this.swSlotWrapper=document.getElementById("sw-slots-wrapper");this.swSlots=document.getElementById("sw-slots");this.swFrame=document.getElementById("sw-frame");for(a=0;a<this.slotData.length;a+=1){c=document.createElement("ul");b="";for(d in this.slotData[a].values){b+="<li>"+this.slotData[a].values[d]+"</li>"}c.innerHTML=b;e=document.createElement("div");e.className=this.slotData[a].style;e.appendChild(c);this.swSlots.appendChild(e);c.slotPosition=a;c.slotYPosition=0;c.slotWidth=0;c.slotMaxScroll=this.swSlotWrapper.clientHeight-c.clientHeight-86;c.style.webkitTransitionTimingFunction="cubic-bezier(0, 0, 0.2, 1)";this.slotEl.push(c);if(this.slotData[a].defaultValue){this.scrollToValue(a,this.slotData[a].defaultValue)}}this.calculateSlotsWidth();document.addEventListener("touchmove",this,false);window.addEventListener("orientationchange",this,true);window.addEventListener("scroll",this,true);document.getElementById("sw-done").addEventListener("touchstart",this,false);this.swFrame.addEventListener("touchstart",this,false)},open:function(){this.create();this.swWrapper.style.webkitTransitionTimingFunction="ease-out";this.swWrapper.style.webkitTransitionDuration="400ms";this.swWrapper.style.webkitTransform="translate3d(0, -210px, 0)"},destroy:function(){this.swWrapper.removeEventListener("webkitTransitionEnd",this,false);this.swFrame.removeEventListener("touchstart",this,false);document.getElementById("sw-done").removeEventListener("touchstart",this,false);document.removeEventListener("touchmove",this,false);window.removeEventListener("orientationchange",this,true);window.removeEventListener("scroll",this,true);this.slotData=[];this.cancelAction=function(){return false};this.cancelDone=function(){return true};this.reset();document.body.removeChild(document.getElementById("sw-wrapper"))},close:function(){this.swWrapper.style.webkitTransitionTimingFunction="ease-in";this.swWrapper.style.webkitTransitionDuration="400ms";this.swWrapper.style.webkitTransform="translate3d(0, 0, 0)";this.swWrapper.addEventListener("webkitTransitionEnd",this,false)},addSlot:function(b,d,a){if(!d){d=""}d=d.split(" ");for(var c=0;c<d.length;c+=1){d[c]="sw-"+d[c]}d=d.join(" ");var e={values:b,style:d,defaultValue:a};this.slotData.push(e)},getSelectedValues:function(){var c,f,d,a,e=[],b=[];for(d in this.slotEl){this.slotEl[d].removeEventListener("webkitTransitionEnd",this,false);this.slotEl[d].style.webkitTransitionDuration="0";if(this.slotEl[d].slotYPosition>0){this.setPosition(d,0)}else{if(this.slotEl[d].slotYPosition<this.slotEl[d].slotMaxScroll){this.setPosition(d,this.slotEl[d].slotMaxScroll)}}c=-Math.round(this.slotEl[d].slotYPosition/this.cellHeight);f=0;for(a in this.slotData[d].values){if(f==c){e.push(a);b.push(this.slotData[d].values[a]);break}f+=1}}return{keys:e,values:b}},setPosition:function(b,a){this.slotEl[b].slotYPosition=a;this.slotEl[b].style.webkitTransform="translate3d(0, "+a+"px, 0)"},scrollStart:function(c){var d=c.targetTouches[0].clientX-this.swSlots.offsetLeft;var f=0;for(var a=0;a<this.slotEl.length;a+=1){f+=this.slotEl[a].slotWidth;if(d<f){this.activeSlot=a;break}}if(this.slotData[this.activeSlot].style.match("readonly")){this.swFrame.removeEventListener("touchmove",this,false);this.swFrame.removeEventListener("touchend",this,false);return false}this.slotEl[this.activeSlot].removeEventListener("webkitTransitionEnd",this,false);this.slotEl[this.activeSlot].style.webkitTransitionDuration="0";var b=window.getComputedStyle(this.slotEl[this.activeSlot]).webkitTransform;b=new WebKitCSSMatrix(b).m42;if(b!=this.slotEl[this.activeSlot].slotYPosition){this.setPosition(this.activeSlot,b)}this.startY=c.targetTouches[0].clientY;this.scrollStartY=this.slotEl[this.activeSlot].slotYPosition;this.scrollStartTime=c.timeStamp;this.swFrame.addEventListener("touchmove",this,false);this.swFrame.addEventListener("touchend",this,false);return true},scrollMove:function(b){var a=b.targetTouches[0].clientY-this.startY;if(this.slotEl[this.activeSlot].slotYPosition>0||this.slotEl[this.activeSlot].slotYPosition<this.slotEl[this.activeSlot].slotMaxScroll){a/=2}this.setPosition(this.activeSlot,this.slotEl[this.activeSlot].slotYPosition+a);this.startY=b.targetTouches[0].clientY;if(b.timeStamp-this.scrollStartTime>80){this.scrollStartY=this.slotEl[this.activeSlot].slotYPosition;this.scrollStartTime=b.timeStamp}},scrollEnd:function(f){this.swFrame.removeEventListener("touchmove",this,false);this.swFrame.removeEventListener("touchend",this,false);if(this.slotEl[this.activeSlot].slotYPosition>0||this.slotEl[this.activeSlot].slotYPosition<this.slotEl[this.activeSlot].slotMaxScroll){this.scrollTo(this.activeSlot,this.slotEl[this.activeSlot].slotYPosition>0?0:this.slotEl[this.activeSlot].slotMaxScroll);return false}var b=this.slotEl[this.activeSlot].slotYPosition-this.scrollStartY;if(b<this.cellHeight/1.5&&b>-this.cellHeight/1.5){if(this.slotEl[this.activeSlot].slotYPosition%this.cellHeight){this.scrollTo(this.activeSlot,Math.round(this.slotEl[this.activeSlot].slotYPosition/this.cellHeight)*this.cellHeight,"100ms")}return false}var g=f.timeStamp-this.scrollStartTime;var a=(2*b/g)/this.friction;var d=(this.friction/2)*(a*a);if(a<0){a=-a;d=-d}var c=this.slotEl[this.activeSlot].slotYPosition+d;if(c>0){c/=2;a/=3;if(c>this.swSlotWrapper.clientHeight/4){c=this.swSlotWrapper.clientHeight/4}}else{if(c<this.slotEl[this.activeSlot].slotMaxScroll){c=(c-this.slotEl[this.activeSlot].slotMaxScroll)/2+this.slotEl[this.activeSlot].slotMaxScroll;a/=3;if(c<this.slotEl[this.activeSlot].slotMaxScroll-this.swSlotWrapper.clientHeight/4){c=this.slotEl[this.activeSlot].slotMaxScroll-this.swSlotWrapper.clientHeight/4}}else{c=Math.round(c/this.cellHeight)*this.cellHeight}}this.scrollTo(this.activeSlot,Math.round(c),Math.round(a)+"ms");return true},scrollTo:function(c,a,b){this.slotEl[c].style.webkitTransitionDuration=b?b:"100ms";this.setPosition(c,a?a:0);if(this.slotEl[c].slotYPosition>0||this.slotEl[c].slotYPosition<this.slotEl[c].slotMaxScroll){this.slotEl[c].addEventListener("webkitTransitionEnd",this,false)}},scrollToValue:function(e,d){var c,b,a;this.slotEl[e].removeEventListener("webkitTransitionEnd",this,false);this.slotEl[e].style.webkitTransitionDuration="0";b=0;for(a in this.slotData[e].values){if(a==d){c=b*this.cellHeight;this.setPosition(e,c);break}b-=1}},backWithinBoundaries:function(a){a.target.removeEventListener("webkitTransitionEnd",this,false);this.scrollTo(a.target.slotPosition,a.target.slotYPosition>0?0:a.target.slotMaxScroll,"150ms");return false},tapDown:function(a){a.currentTarget.addEventListener("touchmove",this,false);a.currentTarget.addEventListener("touchend",this,false);a.currentTarget.className="sw-pressed"},tapCancel:function(a){a.currentTarget.removeEventListener("touchmove",this,false);a.currentTarget.removeEventListener("touchend",this,false);a.currentTarget.className=""},tapUp:function(a){this.tapCancel(a);if(a.currentTarget.id=="sw-cancel"){this.cancelAction()}else{this.doneAction()}},setCancelAction:function(a){this.cancelAction=a},setDoneAction:function(a){this.doneAction=a},cancelAction:function(){return false},cancelDone:function(){return true}};(function(){var o=this;var j=Array();var p=Array();function f(u,v){for(var t in v){u[t]=v[t]}}function h(v,t,u){v.style.width=t.toString()+"px";v.style.height=u.toString()+"px"}function s(u,t,v){u.style.left=Math.round(t).toString()+"px";u.style.top=Math.round(v).toString()+"px"}TrayController=function(){return this};TrayController.prototype.init=function(t){this.currentX=0;this.elem=t};TrayController.prototype.touchstart=function(t){this.startX=t.touches[0].pageX-this.currentX;this.touchMoved=false;window.addEventListener("touchmove",this,true);window.addEventListener("touchend",this,true);this.elem.style.webkitTransitionDuration="0s"};TrayController.prototype.touchmove=function(t){this.touchMoved=true;this.lastX=this.currentX;this.lastMoveTime=new Date();this.currentX=event.touches[0].pageX-this.startX;this.delegate.update(this.currentX)};TrayController.prototype.touchend=function(u){window.removeEventListener("touchmove",this,true);window.removeEventListener("touchend",this,true);this.elem.style.webkitTransitionDuration="0.4s";if(this.touchMoved){var v=this.currentX-this.lastX;var t=(new Date())-this.lastMoveTime+1;this.currentX=this.currentX+v*200/t;this.delegate.updateTouchEnd(this)}else{this.delegate.clicked(this.currentX)}};TrayController.prototype.handleEvent=function(t){this[t.type](t);t.preventDefault()};const e=150;const n=e/2;const d=70;const a=n/2;const g=e;const b=e/3;const k="rotateY("+(-d)+"deg)";const c="rotateY("+d+"deg)";const i="translateZ("+g+"px)";FlowDelegate=function(){this.cells=new Array();this.transforms=new Array()};FlowDelegate.prototype.init=function(t){this.elem=t};FlowDelegate.prototype.updateTouchEnd=function(t){this.lastFocus=undefined;var u=this.getFocusedCell(t.currentX);t.currentX=-u*n;this.update(t.currentX)};FlowDelegate.prototype.clicked=function(u){var v=-Math.round(u/n);var t=this.cells[v];galleryCell=v};FlowDelegate.prototype.getFocusedCell=function(t){var u=-Math.round(t/n);return Math.min(Math.max(u,0),this.cells.length-1)};FlowDelegate.prototype.transformForCell=function(u,w,z){var t=(w*n);var v=t+z;if((v<a)&&(v>=-a)){return i+" translateX("+t+"px)"}else{if(v>0){return"translateX("+(t+b)+"px) "+k}else{return"translateX("+(t-b)+"px) "+c}}};FlowDelegate.prototype.setTransformForCell=function(t,v,u){if(this.transforms[v]!=u){t.style.webkitTransform=u;this.transforms[v]=u}};FlowDelegate.prototype.update=function(u){this.elem.style.webkitTransform="translateX("+(u)+"px)";for(var v in this.cells){var t=this.cells[v];this.setTransformForCell(t,v,this.transformForCell(t,v,u));v+=1}};var l=new TrayController();var q=new FlowDelegate();o.zflow=function(v,u){var z=document.querySelector(u);l.init(z);q.init(z);l.delegate=q;var t={top:Math.round(-e*0.65)+"px",left:Math.round(-e/2)+"px",width:e+"px",height:Math.round(e*1.5)+"px",opacity:0,};var w=0;function A(){var B=document.createElement("div");var F=document.createElement("img");var D=document.createElement("canvas");var E=document.createElement("a");var C=document.createElement("caption");B.className="cell";B.appendChild(E);E.appendChild(F);B.appendChild(D);B.appendChild(C);F.src=v[w];j[w]=v[w];E.href="show_image?fName="+v[w];E.className="slide-right";o.afnc=function(){var G=F.width;var J=F.height;var H=Math.min(e/J,e/G);G*=H;J*=H;h(F,G,J);f(B.style,t);s(F,(e-G)/2,e-J);s(D,(e-G)/2,e);s(C,(e-G)/2,e+10);m(F,G,J,D);var I=v[w].match(/(.*)[\/\\]([^\/\\]+)\.\w+$/)[2];I=I.replace(/_/g," ");I=I.replace(/(^|\s)([a-z])/g,function(K,M,L){return M+L.toUpperCase()});p[w]=I;r(C,G,w);q.setTransformForCell(B,q.cells.length,q.transformForCell(B,q.cells.length,l.currentX));q.cells.push(B);z.appendChild(B);B.style.opacity=1;if(w<(v.length-1)){w++;A()}else{window.setTimeout(function(){window.scrollTo(0,0)},100);galleryInit=1}};F.addEventListener("load",afnc,true)}A();z.addEventListener("touchstart",l,false)};o.zflowCleanup=function(t){var u=document.querySelector(t);if(u){if(u.childNodes.length>0){q.transforms.length=0;q.cells.length=0;while(u.hasChildNodes()){var v=u.childNodes[0].childNodes[0].childNodes[0];v.removeEventListener("load",afnc,true);u.removeChild(u.childNodes[0])}var w=document.getElementById("gallery");if(w){w.parentNode.removeChild(w);galleryInit=0;galleryCell=0}}}};o.zflowGetImageSource=function(t,u){var v=document.querySelector(t);var w="";if(v){if(v.childNodes.length>0){while(v.hasChildNodes()){w=v.childNodes[0].childNodes[0].childNodes[u].src}}}return w};function r(u,t,v){u.width=t;u.innerHTML=p[v]}function m(z,u,A,v){v.width=u;v.height=A/2;var t=v.getContext("2d");t.save();t.translate(0,A-1);t.scale(1,-1);t.drawImage(z,0,0,u,A);t.restore();t.globalCompositeOperation="destination-out";var w=t.createLinearGradient(0,0,0,A/2);w.addColorStop(1,"rgba(255, 255, 255, 1.0)");w.addColorStop(0,"rgba(255, 255, 255, 0.5)");t.fillStyle=w;t.fillRect(0,0,u,A/2)}})();var now=new Date();var url_month="month";var url_event="events.htm";function getCalendar(e,c,b){url_month=e;url_event=c;var f=b.getDate();var a=b.getMonth()+1;var g=b.getFullYear();$.get(url_month,{month:a,year:g},function(d){$("#ical").empty();$(d).appendTo("#ical");setBindings();setToday();setSelectedAndLoadEvents(b)})}function getEvents(b){var c=b.getDate();var a=b.getMonth()+1;var e=b.getFullYear();$.get(url_event,{day:c,month:a,year:e},function(d){$("#ical .events").empty();$(d).appendTo("#ical .events")})}function getNoEvents(){var a="<li class='no-event'>No Events</li>";$("#ical .events").empty();$(a).appendTo("#ical .events")}function setBindings(){$("#ical td").bind("click",function(){var b=$(this).attr("class");var a=getClickedDate($(this));RemoveSelectedCell();setToday();if(b.indexOf("date_has_event")!=-1||b.indexOf("today_date_has_event")!=-1){$(this).attr("class","selected_date_has_event");getEvents(a)}if(b==""||b.indexOf("today")!=-1){$(this).attr("class","selected");getNoEvents()}if(b.indexOf("prevmonth")!=-1||b.indexOf("nextmonth")!=-1){getCalendar(url,a)}});$("#ical .bottom-bar .bottom-bar-today").bind("click",function(){getCalendar(url_month,url_event,now)});$("#ical .goto-prevmonth").bind("click",function(){loadPrevNextMonth(-1)});$("#ical .goto-nextmonth").bind("click",function(){loadPrevNextMonth(1)})}function RemoveSelectedCell(){$("#ical .selected_date_has_event").removeClass("selected_date_has_event");$("#ical .selected").removeClass("selected")}function getClickedDate(b){var c=$(b).find("input").val();var a=getDateFromHiddenField(c);return a}function loadPrevNextMonth(c){var b=$("#ical .selected").text();if(b==""){b=$("#ical .selected_date_has_event").text()}var a=parseInt($("#ical > #month").val());var e=$("#ical > #year").val();var d=new Date(e,a-1,b);if(c==1){d.nextMonth()}else{d.prevMonth()}getCalendar(url_month,url_event,d)}function setToday(){$("#ical :hidden").each(function(c){var a=getDateFromHiddenField($(this).val());if(!isNaN(a)){var h=now;var j=now.getDate();var i=a.getDate();var g=now.getMonth();var f=a.getMonth();var e=now.getFullYear();var d=a.getFullYear();if(now.getDate()==a.getDate()&&now.getMonth()==a.getMonth()&&now.getFullYear()==a.getFullYear()){var b=$(this).closest("td");if($(b).attr("class")=="date_has_event"){$(b).attr("class","today_date_has_event")}else{$(b).attr("class","today")}}}})}function getDateFromHiddenField(c){var b=c.split("-");return new Date(b[0],b[1]-1,b[2])}function setSelectedAndLoadEvents(a){RemoveSelectedCell();$("#ical td").each(function(c){var d=$(this).attr("class");var b=getClickedDate($(this));if((d!="prevmonth"&&d!="nextmonth")&&a.getDate()==b.getDate()&&a.getMonth()==b.getMonth()&&a.getFullYear()==b.getFullYear()){if(d=="date_has_event"){$(this).attr("class","selected_date_has_event");getEvents(a)}else{$(this).attr("class","selected");getNoEvents()}}});setToday()}function trim(b,a){return ltrim(rtrim(b,a),a)}function ltrim(b,a){a=a||"\\s";return b.replace(new RegExp("^["+a+"]+","g"),"")}function rtrim(b,a){a=a||"\\s";return b.replace(new RegExp("["+a+"]+$","g"),"")}function dateAddExtention(c,a){var b=new String();c=c.toLowerCase();if(isNaN(a)){throw"The second parameter must be a number. \n You passed: "+a;return false}a=new Number(a);switch(c.toLowerCase()){case"yyyy":this.setFullYear(this.getFullYear()+a);break;case"q":this.setMonth(this.getMonth()+(a*3));break;case"m":this.setMonth(this.getMonth()+a);break;case"y":case"d":case"w":this.setDate(this.getDate()+a);break;case"ww":this.setDate(this.getDate()+(a*7));break;case"h":this.setHours(this.getHours()+a);break;case"n":this.setMinutes(this.getMinutes()+a);break;case"s":this.setSeconds(this.getSeconds()+a);break;case"ms":this.setMilliseconds(this.getMilliseconds()+a);break;default:throw"The first parameter must be a string from this list: \nyyyy, q, m, y, d, w, ww, h, n, s, or ms. You passed: "+c;return false}return this}Date.prototype.dateAdd=dateAddExtention;function prevMonth(){var a=this.getMonth();this.setMonth(a-1);if(this.getMonth()!=a-1&&(this.getMonth()!=11||(a==11&&this.getDate()==1))){this.setDate(0)}}function nextMonth(){var a=this.getMonth();this.setMonth(a+1);if(this.getMonth()!=a+1&&this.getMonth()!=0){this.setDate(0)}}Date.prototype.nextMonth=nextMonth;Date.prototype.prevMonth=prevMonth;(function(c){c.fn.drag=function(f,e,d){if(e){this.bind("dragstart",f)}if(d){this.bind("dragend",d)}return !f?this.trigger("mousedown",{which:1}):this.bind("drag",e?e:f)};var b=c.event.special.drag={distance:0,setup:function(d){d=c.extend({distance:b.distance},d||{});c.event.add(this,"mousedown",b.handler,d)},teardown:function(){c.event.remove(this,"mousedown",b.handler);if(this==b.dragging){b.dragging=b.proxy=null}a(this,true)},handler:function(e){var d;if(e.data.elem){e.dragTarget=e.data.elem;e.dragProxy=b.proxy||e.dragTarget;e.cursorOffsetX=e.data.x-e.data.left;e.cursorOffsetY=e.data.y-e.data.top;e.offsetX=e.pageX-e.cursorOffsetX;e.offsetY=e.pageY-e.cursorOffsetY}switch(e.type){case !b.dragging&&e.which==1&&"mousedown":c.extend(e.data,c(this).offset(),{x:e.pageX,y:e.pageY,elem:this,dist2:Math.pow(e.data.distance,2)});c.event.add(document.body,"mousemove mouseup",b.handler,e.data);a(this,false);return false;case !b.dragging&&"mousemove":if(Math.pow(e.pageX-e.data.x,2)+Math.pow(e.pageY-e.data.y,2)<e.data.dist2){break}b.dragging=e.dragTarget;e.type="dragstart";d=c.event.handle.call(b.dragging,e);b.proxy=c(d)[0]||b.dragging;if(d!==false){break}a(b.dragging,true);b.dragging=b.proxy=null;case"mousemove":if(b.dragging){e.type="drag";d=c.event.handle.call(b.dragging,e);if(c.event.special.drop){c.event.special.drop.allowed=(d!==false);c.event.special.drop.handler(e)}if(d!==false){break}e.type="mouseup"}case"mouseup":c.event.remove(document.body,"mousemove mouseup",b.handler);if(b.dragging){if(c.event.special.drop){c.event.special.drop.handler(e)}e.type="dragend";c.event.handle.call(b.dragging,e);a(b.dragging,true);b.dragging=b.proxy=null;e.data={}}break}}};function a(e,d){if(!e){return}e.unselectable=d?"off":"on";e.onselectstart=function(){return d};if(e.style){e.style.MozUserSelect=d?"":"none"}}})(jQuery);(function(b){b.fn.drop=function(e,d,c){if(d){this.bind("dropstart",e)}if(c){this.bind("dropend",c)}return !e?this.trigger("drop"):this.bind("drop",d?d:e)};b.dropManage=function(c){b.extend(a,{filter:"*",data:[],tolerance:null},c||{});return a.$elements.filter(a.filter).each(function(d){a.data[d]=a.locate(this)})};var a=b.event.special.drop={delay:100,mode:"intersect",$elements:b([]),data:[],setup:function(){a.$elements=a.$elements.add(this);a.data[a.data.length]=a.locate(this)},teardown:function(){var c=this;a.$elements=a.$elements.not(this);a.data=b.grep(a.data,function(d){return(d.elem!==c)})},handler:function(d){var c=null,e;d.dropTarget=a.dropping||undefined;if(a.data.length&&d.dragTarget){switch(d.type){case"drag":a.event=d;if(!a.timer){a.timer=setTimeout(a.tolerate,20)}break;case"mouseup":a.timer=clearTimeout(a.timer);if(!a.dropping){break}if(a.allowed){d.type="drop";e=b.event.handle.call(a.dropping,d)}c=false;case a.dropping&&"dropstart":d.type="dropend";c=c===null&&a.allowed?true:false;case a.dropping&&"dropend":b.event.handle.call(a.dropping,d);a.dropping=null;if(e===false){d.dropTarget=undefined}if(!c){break}d.type="dropstart";case a.allowed&&"dropstart":d.dropTarget=this;a.dropping=b.event.handle.call(this,d)!==false?this:null;break}}},tolerate:function(){var d=0,c,e,f=[a.event.pageX,a.event.pageY],g=a.locate(a.event.dragProxy);a.tolerance=a.tolerance||a.modes[a.mode];do{if(c=a.data[d]){if(a.tolerance){e=a.tolerance.call(a,a.event,g,c)}else{if(a.contains(c,f)){e=c}}}}while(++d<a.data.length&&!e);a.event.type=(e=e||a.best)?"dropstart":"dropend";if(a.event.type=="dropend"||e.elem!=a.dropping){a.handler.call(e?e.elem:a.dropping,a.event)}if(a.last&&f[0]==a.last.pageX&&f[1]==a.last.pageY){delete a.timer}else{a.timer=setTimeout(a.tolerate,a.delay)}a.last=a.event;a.best=null},locate:function(f){var d=b(f),g=d.offset(),e=d.outerHeight(),c=d.outerWidth();return{elem:f,L:g.left,R:g.left+c,T:g.top,B:g.top+e,W:c,H:e}},contains:function(c,d){return((d[0]||d.L)>=c.L&&(d[0]||d.R)<=c.R&&(d[1]||d.T)>=c.T&&(d[1]||d.B)<=c.B)},modes:{intersect:function(d,c,e){return this.contains(e,[d.pageX,d.pageY])?e:this.modes.overlap.apply(this,arguments)},overlap:function(d,c,e){e.overlap=Math.max(0,Math.min(e.B,c.B)-Math.max(e.T,c.T))*Math.max(0,Math.min(e.R,c.R)-Math.max(e.L,c.L));if(e.overlap>((this.best||{}).overlap||0)){this.best=e}return null},fit:function(d,c,e){return this.contains(e,c)?e:null},middle:function(d,c,e){return this.contains(e,[c.L+c.W/2,c.T+c.H/2])?e:null}}}})(jQuery);var _target=null,_dragx=null,_dragy=null,_rotate=null,_resort=null;var _dragging=false,_sizing=false,_animate=false;var _rotating=0,_width=0,_height=0,_left=0,_top=0,_xspeed=0,_yspeed=0;var _zindex=1000;jQuery.fn.touch=function(a){a=jQuery.extend({animate:true,sticky:false,dragx:true,dragy:true,rotate:false,resort:true,scale:false},a);var b=[];b=$.extend({},$.fn.touch.defaults,a);this.each(function(){this.opts=b;this.ontouchstart=touchstart;this.ontouchend=touchend;this.ontouchmove=touchmove;this.ongesturestart=gesturestart;this.ongesturechange=gesturechange;this.ongestureend=gestureend})};function touchstart(a){_target=this.id;_dragx=this.opts.dragx;_dragy=this.opts.dragy;_resort=this.opts.resort;_animate=this.opts.animate;_xspeed=0;_yspeed=0;$(a.changedTouches).each(function(){var c=($("#"+_target).css("left")=="auto")?this.pageX:parseInt($("#"+_target).css("left"));var b=($("#"+_target).css("top")=="auto")?this.pageY:parseInt($("#"+_target).css("top"));if(!_dragging&&!_sizing){_left=(a.pageX-c);_top=(a.pageY-b);_dragging=[_left,_top];if(_resort){_zindex=($("#"+_target).css("z-index")==_zindex)?_zindex:_zindex+1;$("#"+_target).css({zIndex:_zindex})}}})}function touchmove(c){if(_dragging&&!_sizing&&_animate){var a=(isNaN(parseInt($("#"+_target).css("left"))))?0:parseInt($("#"+_target).css("left"));var b=(isNaN(parseInt($("#"+_target).css("top"))))?0:parseInt($("#"+_target).css("top"))}$(c.changedTouches).each(function(){c.preventDefault();_left=(this.pageX-(parseInt($("#"+_target).css("width"))/2));_top=(this.pageY-(parseInt($("#"+_target).css("height"))/2));if(_dragging&&!_sizing){if(_animate){_xspeed=Math.round((_xspeed+Math.round(_left-a))/1.5);_yspeed=Math.round((_yspeed+Math.round(_top-b))/1.5)}if(_dragx||_dragy){$("#"+_target).css({position:"absolute"})}if(_dragx){$("#"+_target).css({left:_left+"px"})}if(_dragy){$("#"+_target).css({top:_top+"px"})}$("#"+_target).css({backgroundColor:"#4B880B"});$("#"+_target+" b").text("WEEEEEEEE!!!!")}})}function touchend(a){$(a.changedTouches).each(function(){if(!a.targetTouches.length){_dragging=false;if(_animate){_left=($("#"+_target).css("left")=="auto")?this.pageX:parseInt($("#"+_target).css("left"));_top=($("#"+_target).css("top")=="auto")?this.pageY:parseInt($("#"+_target).css("top"));var c=(_dragx)?(_left+_xspeed)+"px":_left+"px";var b=(_dragy)?(_top+_yspeed)+"px":_top+"px";if(_dragx||_dragy){$("#"+_target).animate({left:c,top:b},"fast")}}}});$("#"+_target+" b").text("I am sad :(");$("#"+_target).css({backgroundColor:"#0B4188"});setTimeout(changeBack,5000,_target)}function gesturestart(a){_sizing=[$("#"+this.id).css("width"),$("#"+this.id).css("height")]}function gesturechange(a){if(_sizing){_width=(this.opts.scale)?Math.min(parseInt(_sizing[0])*a.scale,300):_sizing[0];_height=(this.opts.scale)?Math.min(parseInt(_sizing[1])*a.scale,300):_sizing[1];_rotate=(this.opts.rotate)?"rotate("+((_rotating+a.rotation)%360)+"deg)":"0deg";$("#"+this.id).css({width:_width+"px",height:_height+"px",webkitTransform:_rotate});$("#"+this.id+" b").text("TRANSFORM!");$("#"+this.id).css({backgroundColor:"#4B880B"})}}function gestureend(a){_sizing=false;_rotating=(_rotating+a.rotation)%360}function changeBack(a){$("#"+a+" b").text("Touch Me :)");$("#"+a).css({backgroundColor:"#999"})}(function(b){var a=this,c=a.jQExtensionsCSS||{};b(a).load(function(){a.scrollTo(0,0);var g=a.innerWidth<a.innerHeight?"profile":"landscape",f=c.toolbarHeight||b("#jqt .toolbar").outerHeight()||45,e={profile:null,landscape:null},d=b.extend({defaults:".horizontal-scroll, .horizontal-scroll .scroll-container, .horizontal-slide, .horizontal-slide .slide-container { width: {width}px; height: 100%; overflow: hidden; padding: 0; } .vertical-scroll > div, .vertical-slide > div { margin: 0 auto; padding-bottom:{paddingBottom}px; } #jqt.fullscreen .vertical-scroll.use-bottom-toolbar > div, #jqt.fullscreen .vertical-slide.use-bottom-toolbar > div { padding-bottom:0px; } .vertical-scroll, .vertical-slide { position: relative; z-index: 1; overflow: hidden; height: {height}px; } .vertical-scroll.use-bottom-toolbar, .vertical-slide.use-bottom-toolbar { height: {bottomToolbarHeight}px !important; }\n",profile:".profile .horizontal-scroll, .profile .horizontal-scroll .scroll-container, .profile .horizontal-slide, .profile .horizontal-slide .slide-container { width: {width}px; } .profile .vertical-scroll, .profile .vertical-slide { position: relative; z-index: 1; overflow: hidden; height: {height}px; } .profile .vertical-scroll.use-bottom-toolbar, .profile .vertical-slide.use-bottom-toolbar { height: {bottomToolbarHeight}px !important; }",landscape:".landscape .horizontal-scroll, .landscape .horizontal-scroll .scroll-container, .landscape .horizontal-slide, .landscape .horizontal-slide .slide-container { width: {width}px; height: 100%; overflow: hidden; padding: 0; } .landscape .vertical-scroll, .landscape .vertical-slide { position: relative; z-index: 1; overflow: hidden; height: {height}px; } .landscape .vertical-scroll.use-bottom-toolbar, .landscape .vertical-slide.use-bottom-toolbar { height: {bottomToolbarHeight}px !important; }"},c.css||{});e[g]=b.extend({paddingBottom:5,width:a.innerWidth,height:a.innerHeight-f,bottomToolbarHeight:a.innerHeight-(f*2)},c[g]||{});e.defaults=b.extend({},e[g],c.defaults||{});b(document.createElement("style")).attr("type","text/css").html(d.defaults.replace(/\{(\w+)\}/g,function(i,h){return h in e.defaults?e.defaults[h]:i})+d[g].replace(/\{(\w+)\}/g,function(i,h){return h in e[g]?e[g][h]:i})).appendTo("head");b(a).one("orientationchange",function(){var h=a.innerWidth<a.innerHeight?"profile":"landscape";e[h]=b.extend({paddingBottom:5,width:a.innerWidth,height:a.innerHeight-f,bottomToolbarHeight:a.innerHeight-(f*2)},c[h]||{});b(document.createElement("style")).attr("type","text/css").html(d[h].replace(/\{(\w+)\}/g,function(j,i){return i in e[h]?e[h][i]:j})).appendTo("head")})})})(jQuery);(function($){$.Chain={version:"0.2",tag:["{","}"],services:{},service:function(name,proto){this.services[name]=proto;$.fn[name]=function(options){if(!this.length){return this}var instance=this.data("chain-"+name);var args=Array.prototype.slice.call(arguments,1);if(!instance){if(options=="destroy"){return this}instance=$.extend({element:this},$.Chain.services[name]);this.data("chain-"+name,instance);if(instance.init){instance.init()}}var result;if(typeof options=="string"&&instance["$"+options]){result=instance["$"+options].apply(instance,args)}else{if(instance.handler){result=instance.handler.apply(instance,[options].concat(args))}else{result=this}}if(options=="destroy"){this.removeData("chain-"+name)}return result}},extend:function(name,proto){if(this.services[name]){this.services[name]=$.extend(this.services[name],proto)}},jobject:function(obj){return obj&&obj.init==$.fn.init},jidentic:function(j1,j2){if(!j1||!j2||j1.length!=j2.length){return false}var a1=j1.get();var a2=j2.get();for(var i=0;i<a1.length;i++){if(a1[i]!=a2[i]){return false}}return true},parse:function(){var $this={};$this.closure=['function($data, $el){var $text = [];\n$text.print = function(text){this.push((typeof text == "number") ? text : ((typeof text != "undefined") ? text : ""));};\nwith($data){\n','}\nreturn $text.join("");}'];$this.textPrint=function(text){return'$text.print("'+text.split("\\").join("\\\\").split("'").join("\\'").split('"').join('\\"')+'");'};$this.scriptPrint=function(text){return"$text.print("+text+");"};$this.parser=function(text){var tag=$.Chain.tag;var opener,closer,closer2=null,result=[];while(text){opener=text.indexOf(tag[0]);closer=opener+text.substring(opener).indexOf(tag[1]);if(opener!=-1){if(text[opener-1]=="\\"){closer2=opener+tag[0].length+text.substring(opener+tag[0].length).indexOf(tag[0]);if(closer2!=opener+tag[0].length-1&&text[closer2-1]=="\\"){closer2=closer2-1}else{if(closer2==opener+tag[0].length-1){closer2=text.length}}result.push($this.textPrint(text.substring(0,opener-1)));result.push($this.textPrint(text.substring(opener,closer2)))}else{closer2=null;if(closer==opener-1){closer=text.length}result.push($this.textPrint(text.substring(0,opener)));result.push($this.scriptPrint(text.substring(opener+tag[0].length,closer)))}text=text.substring((closer2===null)?closer+tag[1].length:closer2)}else{if(text){result.push($this.textPrint(text));text=""}}}return result.join("\n")};return function($text){var $fn=function(){};try{eval("$fn = "+$this.closure[0]+$this.parser($text)+$this.closure[1])}catch(e){throw"Parsing Error"}return $fn}}()}})(jQuery);(function(a){a.Chain.service("update",{handler:function(b){if(typeof b=="function"){return this.bind(b)}else{return this.trigger(b)}},bind:function(b){return this.element.bind("update",b)},trigger:function(b){this.element.items("update");this.element.item("update");this.element.triggerHandler("preupdate",this.element.item());if(b=="hard"){this.element.items(true).each(function(){a(this).update()})}this.element.triggerHandler("update",this.element.item());return this.element}})})(jQuery);(function(a){a.Chain.service("chain",{init:function(){this.anchor=this.element;this.template=this.anchor.html();this.tplNumber=0;this.builder=this.createBuilder();this.plugins={};this.isActive=false;this.destroyers=[];this.element.addClass("chain-element")},handler:function(b){this.element.items("backup");this.element.item("backup");if(typeof b=="object"){this.handleUpdater(b)}else{if(typeof b=="function"){this.handleBuilder(b)}}this.anchor.empty();this.isActive=true;this.element.update();return this.element},handleUpdater:function(h){var b=h.builder;delete h.builder;if(h.anchor){this.setAnchor(h.anchor)}delete h.anchor;var e=h.override;delete h.override;for(var d in h){if(typeof h[d]=="string"){h[d]=a.Chain.parse(h[d])}else{if(typeof h[d]=="object"){for(var c in h[d]){if(typeof h[d][c]=="string"){h[d][c]=a.Chain.parse(h[d][c])}}}}}var f=function(o,p){var n,q;var k=a(this);for(var m in h){if(m=="self"){n=k}else{n=a(m,k)}if(typeof h[m]=="function"){q=h[m].apply(k,[p,n]);if(typeof q=="string"){n.not(":input").html(q).end().filter(":input").val(q)}}else{if(typeof h[m]=="object"){for(var l in h[m]){if(typeof h[m][l]=="function"){q=h[m][l].apply(k,[p,n]);if(typeof q=="string"){if(l=="content"){n.html(q)}else{if(l=="text"){n.text(q)}else{if(l=="value"){n.val(q)}else{if(l=="class"||l=="className"){n.addClass(q)}else{n.attr(l,q)}}}}}}}}}}};var g=this.defaultBuilder;this.builder=function(i){if(b){b.apply(this,[i])}if(!e){g.apply(this)}this.update(f);return false}},handleBuilder:function(b){this.builder=this.createBuilder(b)},defaultBuilder:function(c,b){var d=c?(c.apply(this,[b])!==false):true;if(d){this.bind("update",function(g,h){var e=a(this);for(var f in h){if(typeof h[f]!="object"&&typeof h[f]!="function"){e.find("> ."+f+", *:not(.chain-element) ."+f).each(function(){var i=a(this);if(i.filter(":input").length){i.val(h[f])}else{if(i.filter("img").length){i.attr("src",h[f])}else{i.html(h[f])}}})}}})}},createBuilder:function(b){var c=this.defaultBuilder;return function(d){c.apply(this,[b,d]);return false}},setAnchor:function(b){this.anchor.html(this.template);this.anchor=b==this.element?b:this.element.find(b).eq(0);this.template=this.anchor.html();this.anchor.empty()},$anchor:function(b){if(b){this.element.items("backup");this.element.item("backup");this.setAnchor(b);this.element.update();return this.element}else{return this.anchor}},$template:function(b){if(!arguments.length){return a("<div>").html(this.template).children().eq(this.tplNumber)}if(b=="raw"){return this.template}if(typeof b=="number"){this.tplNumber=b}else{var c=a("<div>").html(this.template).children();var d=c.filter(b).eq(0);if(d.length){this.tplNumber=c.index(d)}else{return this.element}}this.element.items("backup");this.element.item("backup");this.element.update();return this.element},$builder:function(b){if(b){return this.handler(b)}else{return this.builder}},$active:function(){return this.isActive},$plugin:function(b,c){if(c===null){delete this.plugins[b]}else{if(typeof c=="function"){this.plugins[b]=c}else{if(b&&!c){return this.plugins[b]}else{return this.plugins}}}if(typeof c=="function"){this.element.items(true).each(function(){var d=a(this);c.call(d,d.item("root"))})}this.element.update();return this.element},$clone:function(){var c=this.element.attr("id");this.element.attr("id","");var b=this.element.clone().empty().html(this.template);this.element.attr("id",c);return b},$destroy:function(b){this.element.removeClass("chain-element");if(!b){this.element.items("backup");this.element.item("backup");this.element.find(".chain-element").each(function(){a(this).chain("destroy",true)})}this.element.triggerHandler("destroy");this.isActive=false;this.anchor.html(this.template);return this.element}})})(jQuery);(function(a){a.Chain.service("item",{init:function(){this.isActive=false;this.isBuilt=false;this.root=this.element;this.data=false;this.datafn=this.dataHandler},handler:function(b){if(typeof b=="object"){return this.handleObject(b)}else{if(typeof b=="function"){return this.handleFunction(b)}else{return this.handleDefault()}}},handleObject:function(b){this.setData(b);this.isActive=true;this.update();return this.element},handleFunction:function(b){this.datafn=b;return this.element},handleDefault:function(){if(this.isActive){return this.getData()}else{return false}},getData:function(){this.data=this.datafn.call(this.element,this.data);return this.data},setData:function(d){var c;if(a.Chain.jobject(d)&&d.item()){c=a.extend({},d.item())}else{if(a.Chain.jobject(d)){c={}}else{c=d}}this.data=this.datafn.call(this.element,this.data||c,c);if(this.linkElement&&this.linkElement[0]!=d[0]){var b=this.linkFunction();if(a.Chain.jobject(b)&&b.length&&b.item()){b.item(this.data)}}},dataHandler:function(b,c){if(arguments.length==2){return a.extend(b,c)}else{return b}},update:function(){return this.element.update()},build:function(){var b=this.element.chain("template","raw").replace(/jQuery\d+\=\"null\"/gi,"");this.element.chain("anchor").html(b);if(!a.Chain.jidentic(this.root,this.element)){var c=this.root.chain("plugin");for(var d in c){c[d].apply(this.element,[this.root])}}this.element.chain("builder").apply(this.element,[this.root]);this.isBuilt=true},$update:function(){if(this.element.chain("active")&&this.isActive&&!this.isBuilt&&this.getData()){this.build()}return this.element},$replace:function(b){this.data={};this.setData(b);this.isActive=true;this.update();return this.element},$remove:function(b){this.element.chain("destroy");this.element.remove();this.element.item("link",null);this.element.item("destroy");if(!a.Chain.jidentic(this.root,this.element)&&!b){this.root.update()}},$active:function(){return this.isActive},$root:function(b){if(arguments.length){this.root=b;this.update();return this.element}else{return this.root}},$backup:function(){this.isBuilt=false;return this.element},$link:function(c,d){if(this.linkElement){this.linkElement.unbind("update",this.linkUpdater);this.linkElement=null}c=a(c);if(c.length){var b=this;this.isActive=true;this.linkElement=c;this.linkFunction=function(){if(typeof d=="function"){try{return d.call(b.element,b.linkElement)}catch(f){return a().eq(-1)}}else{if(typeof d=="string"){return b.linkElement.items("collection",d)}else{return a().eq(-1)}}};this.linkUpdater=function(){var e=b.linkFunction();if(e&&e.length){b.element.item(e)}};this.linkElement.bind("update",this.linkUpdater);this.linkUpdater()}return this.element},$destroy:function(){return this.element}})})(jQuery);(function(a){a.Chain.service("items",{collections:{all:function(){return this.element.chain("anchor").children(".chain-item")},visible:function(){return this.element.chain("anchor").children(".chain-item:visible")},hidden:function(){return this.element.chain("anchor").children(".chain-item:hidden")},self:function(){return this.element}},init:function(){this.isActive=false;this.pushBuffer=[];this.shiftBuffer=[];this.collections=a.extend({},this.collections)},handler:function(b){if(b instanceof Array){return this.handleArray(b)}else{if(!this.isActive){return a().eq(-1)}else{if(a.Chain.jobject(b)){return this.handleElement(b)}else{if(typeof b=="object"){return this.handleObject(b)}else{if(typeof b=="number"){return this.handleNumber(b)}else{if(b===true){return this.handleTrue()}else{return this.handleDefault()}}}}}}},handleObject:function(b){return this.collection("all").filter(function(){return a(this).item()==b})},handleElement:function(b){if(!a.Chain.jidentic(b,b.item("root"))&&a.Chain.jidentic(this.element,b.item("root"))){return b}else{return a().eq(-1)}},handleArray:function(b){return this.$merge(b)},handleNumber:function(b){if(b==-1){return this.collection("visible").filter(":last")}else{return this.collection("visible").eq(b)}},handleTrue:function(){return this.collection("all")},handleDefault:function(){return this.collection("visible")},update:function(){this.element.update()},empty:function(){var b=this.collection("all");setTimeout(function(){b.each(function(){a(this).item("remove",true)})},1);this.element.chain("anchor").empty()},collection:function(b,c){if(arguments.length>1){if(typeof c=="function"){this.collections[b]=c}return this.element}else{if(this.collections[b]){return this.collections[b].apply(this)}else{return a().eq(-1)}}},$update:function(){if(!this.element.chain("active")||!this.isActive){return this.element}var c=this;var b=this.element.chain("builder");var f=this.element.chain("template");var d;var e=function(){var g=f.clone()[d?"appendTo":"prependTo"](c.element.chain("anchor")).addClass("chain-item").item("root",c.element);if(c.linkElement&&a.Chain.jobject(this)&&this.item()){g.item("link",this,"self")}else{g.item(this)}g.chain(b)};d=false;a.each(this.shiftBuffer,e);d=true;a.each(this.pushBuffer,e);this.shiftBuffer=[];this.pushBuffer=[];return this.element},$add:function(){if(this.linkElement){return this.element}var d;var c=Array.prototype.slice.call(arguments);if(typeof c[0]=="string"){d=c.shift()}var b=(d=="shift")?"shiftBuffer":"pushBuffer";this.isActive=true;this[b]=this[b].concat(c);this.update();return this.element},$merge:function(d,c){if(this.linkElement){return this.element}if(typeof d!="string"){c=d}var b=(d=="shift")?"shiftBuffer":"pushBuffer";this.isActive=true;if(a.Chain.jobject(c)){this[b]=this[b].concat(c.map(function(){return a(this)}).get())}else{if(c instanceof Array){this[b]=this[b].concat(c)}}this.update();return this.element},$replace:function(d,c){if(this.linkElement&&arguments.callee.caller!=this.linkUpdater){return this.element}if(typeof d!="string"){c=d}var b=(d=="shift")?"shiftBuffer":"pushBuffer";this.isActive=true;this.empty();if(a.Chain.jobject(c)){this[b]=c.map(function(){return a(this)}).get()}else{if(c instanceof Array){this[b]=c}}this.update();return this.element},$remove:function(){if(this.linkElement){return this.element}for(var b=0;b<arguments.length;b++){this.handler(arguments[b]).item("remove",true)}this.update();return this.element},$reorder:function(c,b){if(b){this.handler(c).before(this.handler(b))}else{this.handler(c).appendTo(this.element.chain("anchor"))}this.update();return this.element},$empty:function(){if(this.linkElement){return this.element}this.empty();this.shiftBuffer=[];this.pushBuffer=[];this.update();return this.element},$data:function(b){return this.handler(b).map(function(){return a(this).item()}).get()},$link:function(c,d){if(this.linkElement){this.linkElement.unbind("update",this.linkUpdater);this.linkElement=null}c=a(c);if(c.length){var b=this;this.linkElement=c;this.linkFunction=function(){if(typeof d=="function"){try{return d.call(b.element,b.linkElement)}catch(f){return a().eq(-1)}}else{if(typeof d=="string"){return b.linkElement.items("collection",d)}else{return a().eq(-1)}}};this.linkUpdater=function(){b.$replace(b.linkFunction())};this.linkElement.bind("update",this.linkUpdater);this.linkUpdater()}return this.element},$index:function(b){return this.collection("all").index(this.handler(b))},$collection:function(){return this.collection.apply(this,Array.prototype.slice.call(arguments))},$active:function(){return this.isActive},$backup:function(){if(!this.element.chain("active")||!this.isActive){return this.element}var b=[];this.collection("all").each(function(){var c=a(this).item();if(c){b.push(c)}});this.pushBuffer=b.concat(this.pushBuffer);this.empty();return this.element},$destroy:function(){this.empty();return this.element}});a.Chain.extend("items",{doFilter:function(){var c=this.searchProperties;var d=this.searchText;if(d){if(typeof d=="string"){d=d.toLowerCase()}var b=this.element.items(true).filter(function(){var f=a(this).item();if(c){for(var e=0;e<c.length;e++){if(typeof f[c[e]]=="string"&&!!(typeof d=="string"?f[c[e]].toLowerCase():f[c[e]]).match(d)){return true}}}else{for(var g in f){if(typeof f[g]=="string"&&!!(typeof d=="string"?f[g].toLowerCase():f[g]).match(d)){return true}}}});this.element.items(true).not(b).hide();b.show()}else{this.element.items(true).show();this.element.unbind("preupdate",this.searchBinding);this.searchBinding=null}},$filter:function(d,c){if(!arguments.length){return this.update()}this.searchText=d;if(typeof c=="string"){this.searchProperties=[c]}else{if(c instanceof Array){this.searchProperties=c}else{this.searchProperties=null}}if(!this.searchBinding){var b=this;this.searchBinding=function(f,e){b.doFilter()};this.element.bind("preupdate",this.searchBinding)}return this.update()}});a.Chain.extend("items",{doSort:function(){var b=this.sortName;var d=this.sortOpt;var g={number:function(i,h){return parseFloat((a(i).item()[b]+"").match(/\d+/gi)[0])-parseFloat((a(h).item()[b]+"").match(/\d+/gi)[0])},"default":function(i,h){return a(i).item()[b]>a(h).item()[b]?1:-1}};if(b){var e=d.fn||g[d.type]||g["default"];var f=this.element.items(true).get().sort(e);f=d.desc?f.reverse():f;for(var c=0;c<f.length;c++){this.element.chain("anchor").append(f[c])}d.desc=d.toggle?!d.desc:d.desc}else{this.element.unbind("preupdate",this.sortBinding);this.sortBinding=null}},$sort:function(c,d){if(!c&&c!==null&&c!==false){return this.update()}if(this.sortName!=c){this.sortOpt=a.extend({desc:false,type:"default",toggle:false},d)}else{a.extend(this.sortOpt,d)}this.sortName=c;if(!this.sortBinding){var b=this;this.sortBinding=function(f,e){b.doSort()};this.element.bind("preupdate",this.sortBinding)}return this.update()}})})(jQuery);(function(a){if(a.jQTouch){a.jQTouch.addExtension(function b(e){var d=".toolbar h1";a(function(){a("#jqt").bind("pageAnimationStart",function(i,g){if(g.direction==="in"){var f=a(d,a(i.target));var h=a(i.target).data("referrer");if(f.length&&h&&f.html()===""){f.html(h.text())}}})});function c(f){d=f}return{setTitleSelector:c}})}})(jQuery);(function(a){if(a.jQTouch){a.jQTouch.addExtension(function b(f){var m,i;var d=false;function n(p,o,r,q){i=p;if(window.openDatabase){m=openDatabase(p,o,r,q);if(!m){debugTxt=("Failed to open the database on disk. This is probably because the version was bad or there is not enough space left in this domain's quota");if(d){c(debugTxt)}}}else{debugTxt=("Couldn't open the database. Please try with a WebKit nightly with this feature enabled");if(d){c(debugTxt)}}}function e(o){for(x=0;x<o.createTables.length;x++){p(o.createTables[x])}function p(r){debugTxt="create table "+r.table;var q="CREATE TABLE "+r.table+" (";nodeSize=r.property.length-1;for(y=0;y<=nodeSize;y++){q+=r.property[y].name+" "+r.property[y].type;if(y!=nodeSize){q+=", "}}q+=")";k(q,debugTxt)}}function j(p,o,q){stringQuery="DELETE FROM "+p+" WHERE "+o+" = "+q;debugTxt="delete row"+o+" "+q;k(stringQuery,debugTxt)}function g(p,o){stringQuery="SELECT * FROM "+p;debugTxt="selecting everything in table "+p;k(stringQuery,debugTxt,o)}function h(o){stringQuery="DROP TABLE "+o;debugTxt="delete table "+o;k(stringQuery,debugTxt)}function l(o){for(x=0;x<o.addRow.length;x++){p(o.addRow[x])}function p(q){debugTxt="create row "+q.table;stringQuery="INSERT INTO "+q.table+" (";nodeSize=q.property.length-1;for(y=0;y<=nodeSize;y++){stringQuery+=q.property[y].name;if(y!=nodeSize){stringQuery+=", "}}stringQuery+=") VALUES (";for(y=0;y<=nodeSize;y++){stringQuery+='"'+q.property[y].value+'"';if(y!=nodeSize){stringQuery+=", "}}stringQuery+=")";k(stringQuery,debugTxt)}}function k(o,p,q){p+="<br> SQL: "+o;callback=q;m.transaction(function(r){r.executeSql(o,[],function(t,s){if(callback){callback(s)}if(d){p+="<br><span style='color:green'>success</span> ";c(p)}},function(s,t){p+="<br><span style='color:red'>"+t.message+"</span> ";if(d){c(p)}})})}function c(o){if(!a("#debugMode")[0]){a("body").append("<div style='position:abolute;top:0 !important;left:0 !important;width:100% !important;min-height:100px !important; height:300px; overflow:scroll;z-index:1000; display:block; opacity:0.8; background:#000;-webkit-backface-visibility:visible ' id='debugMode'></div>")}a("#debugMode").append("<div class='debugerror'>"+o+"</div>")}return{dbOpen:n,dbDeleteRow:j,dbDropTable:h,dbInsertRows:l,dbSelectAll:g,dbExecuteQuery:k,dbCreateTables:e}})}})(jQuery);(function(a){if(a.jQTouch){a.jQTouch.addExtension(function b(d){function c(g){if(g==null){g=0}var f=e(g);a("body > *").css("min-height",f+"px !important");a("body.fullscreen > *").css("min-height",f+"px !important");a("body.fullscreen.black-translucent > *").css("min-height",f+"px !important");a("body.landscape > *").css("min-height",f+"px !important")}function e(g){var f=0;if(typeof(window.innerWidth)=="number"){f=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){f=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){f=document.body.clientHeight}}}if(f<g){f=g}return f}return{resetHeight:c}})}})(jQuery);(function(b){if(b.jQTouch){b.jQTouch.addExtension(function a(c){b.fn.makeFloaty=function(d){var f={align:"top",spacing:20,time:".3s"};var e=b.extend({},f,d);e.align=(e.align=="top")?"top":"bottom";return this.each(function(){var g=b(this);g.css({"-webkit-transition":"top "+e.time+" ease-in-out",display:"block","min-height":"0 !important"}).data("settings",e);b(document).bind("scroll",function(){if(g.data("floatyVisible")===true){g.scrollFloaty()}});g.scrollFloaty()})};b.fn.scrollFloaty=function(){return this.each(function(){var d=b(this);var f=d.data("settings");var e=b("html").attr("clientHeight");var g=window.pageYOffset+((f.align=="top")?f.spacing:e-f.spacing-d.get(0).offsetHeight);d.css("top",g).data("floatyVisible",true)})};b.fn.hideFloaty=function(){return this.each(function(){var d=b(this);var e=d.get(0).offsetHeight;d.css("top",-e-10).data("floatyVisible",false)})};b.fn.toggleFloaty=function(){return this.each(function(){var d=b(this);if(d.data("floatyVisible")===true){d.hideFloaty()}else{d.scrollFloaty()}})}})}})(jQuery);(function(c){if(c.jQTouch){function b(f){var i,e,h,i,g=0;h={element:c("#gesture_test"),onGestureStart:null,onGestureChange:null,onGestureEnd:null,};h=c.extend({},h,f);h.element.bind("gesturestart",function(j){j.originalEvent.preventDefault();if(h.onGestureStart){h.onGestureStart(a(j,i),d(j,g),j,h.element)}}).bind("gesturechange",function(j){if(h.onGestureChange){h.onGestureChange(a(j,i),d(j,g),j,h.element)}}).bind("gestureend",function(j){i=j.originalEvent.scale;g=(j.originalEvent.rotation+g)%360;if(h.onGestureEnd){h.onGestureEnd(a(j,i),d(j,g),j,h.element)}})}function d(f,e){return f.originalEvent.rotation+e}function a(f,e){return f.originalEvent.scale+e}c.fn.bindGestures=function(e){e.element=this;b(e)}}})(jQuery);(function(f){var g,j=this,o=j.document,l=this.WebKitCSSMatrix,k={selector:".horizontal-scroll > table",attributesToOptions:e,attributes:{defaultDuration:"slidespeed",preventDefault:"preventdefault",defaultTransform:"defaulttransform",bounce:function(u){return u.attr("bounce")==="false"?false:k.bounce},scrollBar:function(u){return u.hasClass("with-scrollbar")}},ignoreTags:"SELECT,TEXTAREA,BUTTON,INPUT",eventProperty:"pageX",numberOfTouches:1,defaultDuration:500,defaultTransform:"translate3d({0}px,0,0)",defaultOffset:0,bounceSpeed:500,preventDefault:true,maxScrollTime:1000,friction:3,bounceTimingFunction:"cubic-bezier(0,0,.25,1)",bounce:true,scrollBar:true,scrollBarElement:null,scrollBarOptions:{},events:{touchstart:a,touchmove:s,touchend:d,touchcancel:d,webkitTransitionEnd:i,},setPosition:c,reset:t,momentum:m},q=function(){return j.innerWidth+"px"},n=function(u){return(j.innerHeight-u.toolbar)+"px"},h={variables:{toolbar:45},defaults:{".horizontal-scroll":{width:q,height:"100%",overflow:"hidden",padding:"0px",position:"relative",height:n},".horizontal-scroll > table":{height:"100%"},".horizontal-scroll .scrollbar.horizontal":{"-webkit-transition-timing-function":"cubic-bezier(0,0,0.25,1)","-webkit-transform":"translate3d(0,0,0)","-webkit-transition-property":"-webkit-transform,opacity","-webkit-transition-duration":"0,300ms","-webkit-border-radius":"4px","pointer-events":"none",opacity:0,"-webkit-border-image":"-webkit-gradient(radial, 50% 50%, 2, 50% 50%, 8, from(rgba(0,0,0,.5)), to(rgba(0,0,0,.5))) 3 2",position:"absolute","z-index":10,width:"1px",height:"5px",bottom:"1px",left:"1px"}},portrait:{".portrait .horizontal-scroll":{width:q}},landscape:{".landscape .horizontal-scroll":{width:q}}};if(f.jQTouch){f.jQTouch.addExtension(function(v){function u(A,z){var w=z.page.find(k.selector);w.scrollHorizontally(k.attributesToOptions(w,k.attributes))}f(o.body).bind("pageInserted",u);f(function(){f(k.selector).each(function(){f(this).scrollHorizontally(k.attributesToOptions(f(this),k.attributes))})});return{}})}function e(w,u){var v={};f.each(u,function(z,A){if(f.isFunction(A)){v[z]=A(w)}else{if(w.attr(A)!=g){v[z]=w.attr(A)}}});return v}f.fn.scrollHorizontally=function(u){u=f.extend(true,{},k,u||{});return this.each(function(){p(this,u)})};f.fn.scrollHorizontally.defaults=function(u){if(u!==g){k=f.extend(true,k,u)}return f.extend({},k)};f.fn.scrollHorizontally.defaultCSS=function(u){if(u!==g){h=f.extend(true,h,u)}return f.extend({},h)};function p(z,w){var u=f(z).data("jqt-horizontal-scroll-options",w).css("webkitTransform",r(w.defaultTransform,w.defaultOffset)),v=new l(u.css("webkitTransform"));f.each(w.events,function(A,B){z.addEventListener(A,B,false)});w.currentPosition=v.m41;w.parentWidth=u.parent().width();if(w.scrollBar&&w.scrollBar===true&&!w.scrollBarElement){w.scrollBarElement=f.isFunction(w.scrollBar)?w.scrollBar(u.parent(),"horizontal",w.scrollBarOptions||{}):b(u.parent(),"horizontal",w.scrollBarOptions||{})}}function a(C){var D=f(this),w=D.data("jqt-horizontal-scroll-options"),v,B=D.outerWidth(),A=D.parent().width(),z=-(B-A),u=A/6;w.parentWidth=A;if(!!w.ignoreTags&&f(C.target).is(w.ignoreTags)||C.targetTouches.length!==w.numberOfTouches){return null}v=new l(D.css("webkitTransform"));D.data("jqt-horizontal-scroll-current-event",{startLocation:C.touches[0][w.eventProperty],startPosition:v.m41,currentPosition:v.m41,startTime:C.timeStamp,moved:false,lastMoveTime:C.timeStamp,parentWidth:A,endPoint:z,minScroll:!w.bounce?0:u,maxScroll:!w.bounce?z:z-u,timingFunction:w.bounceTimingFunction});if(w.scrollBarElement){w.scrollBarElement.init(A,B)}w.setPosition(D,w,v.m41,"0");if(w.preventDefault){C.preventDefault();return false}else{return true}}function s(z){var B=f(this),w=B.data("jqt-horizontal-scroll-options"),A=B.data("jqt-horizontal-scroll-current-event"),v=A.lastMoveTime,C=A.startLocation-z.touches[0][w.eventProperty],u=A.startPosition-C;A.currentPosition=u;A.moved=true;A.lastMoveTime=z.timeStamp;if((A.lastMoveTime-v)>w.maxScrollTime){A.startTime=A.lastMoveTime}if(w.scrollBarElement&&!w.scrollBarElement.visible){w.scrollBarElement.show()}w.setPosition(B,w,A.currentPosition,0);if(w.preventDefault){z.preventDefault();return false}else{return true}}function d(v){var A=f(this),u=A.data("jqt-horizontal-scroll-options"),w=A.data("jqt-horizontal-scroll-current-event"),z,B;if(!w.moved){if(u.scrollBarElement){u.scrollBarElement.hide()}z=v.target;if(z.nodeType==3){z=z.parentNode}B=o.createEvent("MouseEvents");B.initEvent("click",true,true);z.dispatchEvent(B);if(u.preventDefault){v.preventDefault();v.stopPropagation();return false}}u.momentum(A,u,w,v);u.setPosition(A,u,w.currentPosition,w.duration);if(u.preventDefault){v.preventDefault();v.stopPropagation();return false}else{return true}}function i(z){var w=f(this),u=w.data("jqt-horizontal-scroll-options"),v=w.data("jqt-horizontal-scroll-current-event");if(v){if(v.currentPosition>0){v.currentPosition=0;u.setPosition(w,u,0,u.bounceSpeed)}else{if(v.currentPosition<v.endPoint){v.currentPosition=v.endPoint;u.setPosition(w,u,v.endPoint,u.bounceSpeed)}else{if(u.scrollBarElement){u.scrollBarElement.hide()}}}}else{if(u.scrollBarElement){u.scrollBarElement.hide()}}}function m(C,F,D,v){var z=Math.min(F.maxScrollTime,D.lastMoveTime-D.startTime),u=D.startPosition-D.currentPosition,A=Math.abs(u)/z,B=z*A*F.friction,w=Math.round(u*A),E=Math.round(D.currentPosition-w);if(D.currentPosition>0){E=0}else{if(D.currentPosition<D.endPoint){E=D.endPoint}else{if(E>D.minScroll){B=B*Math.abs(D.minScroll/E);E=D.minScroll}else{if(E<D.maxScroll){B=B*Math.abs(D.maxScroll/E);E=D.maxScroll}}}}D.momentum=E/D.currentPosition;D.currentPosition=E;D.duration=B}function t(v,u){return u.setPosition(v,u,0,u.defaultDuration)}function c(w,v,u,B,A){if(v.scrollBarElement){var z=(w.parent().width()-w.outerWidth());if(u>0){z+=Number(u)}v.scrollBarElement.scrollTo(v.scrollBarElement.maxScroll/z*u,r("{0}ms",B!==g?B:v.defaultDuration))}if(B!==g){w.css("webkitTransitionDuration",r("{0}ms",B))}if(A!==g){w.css("webkitTransitionTimingFunction",A)}v.currentPosition=u||0;return w.css("webkitTransform",r("translate3d({0}px, 0, 0)",v.currentPosition))}function r(v){var u=arguments;return v.replace(/\{(\d+)\}/g,function(z,w){return u[Number(w)+1]+""})}function b(v,w,u){if(!(this instanceof b)){return new b(v,w,u)}this.direction=w;this.bar=f(o.createElement("div")).addClass("scrollbar "+w).appendTo(v)[0]}b.prototype={direction:"horizontal",size:0,maxSize:0,maxScroll:0,visible:false,init:function(u,v){var w=this.direction=="horizontal"?this.bar.offsetWidth-this.bar.clientWidth:this.bar.offsetHeight-this.bar.clientHeight;this.maxSize=u-8;this.size=Math.round(this.maxSize*this.maxSize/v)+w;this.maxScroll=this.maxSize-this.size;this.bar.style[this.direction=="horizontal"?"width":"height"]=(this.size-w)+"px"},setPosition:function(u){u=this.direction=="horizontal"?"translate3d("+Math.round(u)+"px,0,0)":"translate3d(0,"+Math.round(u)+"px,0)";this.bar.style.webkitTransform=u},scrollTo:function(v,u){this.bar.style.webkitTransitionDuration=(u||"400ms")+",300ms";this.setPosition(v)},show:function(){this.visible=true;this.bar.style.opacity="1"},hide:function(){this.visible=false;this.bar.style.opacity="0"},remove:function(){this.bar.parentNode.removeChild(this.bar);return null}};f(function(){j.scrollTo(0,0);var u="",z=h,w=j.innerHeight>j.innerWidth?"portrait":"landscape",A=function(B,C){u+=B+":"+(f.isFunction(C)?C(z.variables):C)+";"},v=function(B,C){u+=B+"{";f.each(C,A);u+="}"};f.each(z.defaults,v);f.each(z[w],v);f(o.createElement("style")).attr({type:"text/css",media:"screen"}).html(u).appendTo("head");f(j).one("orientationchange",function(){setTimeout(function(){j.scrollTo(0,0);u="";f.each(z[j.innerHeight>j.innerWidth?"portrait":"landscape"],v);f(o.createElement("style")).attr({type:"text/css",media:"screen"}).html(u).appendTo("head")},30)})})})(jQuery);(function(b){if(b.jQTouch){b.jQTouch.addExtension(function a(){var i,f,h;function d(){return navigator.geolocation}function g(j){if(d()){h=j;navigator.geolocation.getCurrentPosition(c);return true}else{console.log("Device not capable of geo-location.");j(false);return false}}function c(j){i=j.coords.latitude;f=j.coords.longitude;if(h){h(e())}}function e(){if(i&&f){return{latitude:i,longitude:f}}else{console.log("No location available. Try calling updateLocation() first.");return false}}return{updateLocation:g,getLocation:e}})}})(jQuery);(function(b){if(b.jQTouch){b.jQTouch.addExtension(function a(){var c=[];c[0]="uncached";c[1]="idle";c[2]="checking";c[3]="downloading";c[4]="updateready";c[5]="obsolete";var d=window.applicationCache;window.addEventListener("cached",f,false);window.addEventListener("checking",f,false);window.addEventListener("downloading",f,false);window.addEventListener("error",f,false);window.addEventListener("noupdate",f,false);window.addEventListener("obsolete",f,false);window.addEventListener("progress",f,false);window.addEventListener("updateready",f,false);function f(m){var j,i,k,l;j=(h())?"yes":"no";i=c[d.status];k=m.type;l="online: "+j;l+=", event: "+k;l+=", status: "+i;if(k=="error"&&navigator.onLine){l+=" There was an unknown error, check your Cache Manifest."}console.log(l)}function h(){return navigator.onLine}if(!b("html").attr("manifest")){console.log("No Cache Manifest listed on the <html> tag.")}d.addEventListener("updateready",function(i){if(c[d.status]!="idle"){d.swapCache();console.log("Swapped/updated the Cache Manifest.")}},false);function e(){d.update()}function g(){setInterval(function(){d.update()},10000)}return{isOnline:h,checkForUpdates:e,autoCheckForUpdates:g}})}})(jQuery);
|
2
|
-
|
2
|
+
/*!*
|
3
3
|
* Provides event handling for iPhone like photo gallery (without thumbnail portion)
|
4
4
|
*
|
5
5
|
* @author Sam Shull <http://www.google.com/profiles/brickysam26>
|
@@ -40,7 +40,7 @@
|
|
40
40
|
* jqt-photo-toggle-toolbars - toggle the visibility of the toolbars
|
41
41
|
*/
|
42
42
|
(function(P){if(!"WebKitCSSMatrix" in this){return null}var q,z=[],s="Touch" in this,H=s?{start:"touchstart",move:"touchmove",end:"touchend"}:{start:"mousedown",move:"mousemove",end:"mouseup"},f,ae=false,X=this,k=X.document,C=X.Math,ad=C.min,l=C.floor,T=C.sqrt,L=C.pow,O=C.abs,E=O(X.orientation)==90?"landscape":"portrait",R={data:[],galleryName:"{0} of {1}",defaultIndex:0,transitionProperty:"-webkit-transform",timingFunction:"cubic-bezier(0,0,.25,1)",transform:"translate3d({0}px,0,0)",imageTransform:"scale({0}) translate3d({1}px, {2}px, 0)",maxSlidesBefore:2,maxSlidesAfter:2,slideDelay:5000,scrollSpeed:500,scaleSpeed:500,useDynamicStyleSheet:true,repeatSlideShow:false,appendTo:"#jqt",dataAttribute:"data-index",tagNames:"A,INPUT,SELECT,TEXTAREA",backLink:'<a class="back">Back</a>',blankImage:'<img class="jqt-photo-img"/>',slideTemplate:'<td class="jqt-photo-image-slide"> <div class="jqt-photo-not-loaded"> <img class="jqt-photo-img"/> <div class="jqt-photo-caption"></div> </div> </td>',parsedClassTemplate:"#jqt .jqt-photo .jqt-photo-image-slide > .{0}{max-width:auto;max-height:auto;}",galleryTemplate:'<div class="jqt-photo"> <div class="toolbar toolbar-top"></div> <table class="jqt-photo-table"> <tr class="jqt-photo-slide-list"></tr> </table> <div class="toolbar toolbar-bottom"> <div class="jqt-photo-prev"></div> <div class="jqt-photo-pause"></div> <div class="jqt-photo-play"></div> <div class="jqt-photo-next"></div> </div> </div>',pageAnimationEnd:i,pageAnimationStart:d,slideTo:h,play:K,pause:c,next:g,prev:N,goTo:Z,showToolbars:u,hideToolbars:Y,toggleToolbars:J,touchStart:U,dragStart:n,drag:j,dragEnd:aa,scaleStart:r,scale:Q,scaleEnd:p,loader:D,createSlide:S,rearrange:W,presizedClass:"jqt-photo-presized",parsedClass:"jqt-photo-parsed",currentClass:"jqt-photo-current",playingClass:"jqt-photo-playing",notLoadedClass:"jqt-photo-not-loaded",toolbarAnimationInClass:"jqt-photo-toolbar-animation-in",toolbarAnimationOutClass:"jqt-photo-toolbar-animation-out",toolbarHideClass:"jqt-photo-toolbar-hidden",tableSelector:".jqt-photo-table",captionSelector:".jqt-photo-caption",slideSelector:".jqt-photo-image-slide",imageSelector:"img.jqt-photo-img",titleSelector:".toolbar-top h1",listSelector:".jqt-photo-slide-list",playSelector:".jqt-photo-play",pauseSelector:".jqt-photo-pause",nextSelector:".jqt-photo-next",prevSelector:".jqt-photo-prev",gallerySelector:".jqt-photo"},V=function(af){return(X.innerHeight-af.caption)+"px"},e=function(){return X.innerHeight+"px"},a=function(){return X.innerWidth+"px"},A=function(af){return(X.innerHeight-af.toolbar)+"px"},w={variables:{caption:90,toolbar:45},defaults:{"#jqt .jqt-photo .toolbar-bottom":{top:A},"#jqt .jqt-photo .jqt-photo-image-slide > div":{width:a,height:e,"line-height":e},"#jqt .jqt-photo .jqt-photo-image-slide .jqt-photo-caption":{top:V,}},portrait:{"#jqt.portrait .jqt-photo":{height:e,width:a,},"#jqt.portrait .jqt-photo .toolbar-bottom":{top:A},"#jqt.portrait .jqt-photo .jqt-photo-image-slide > div":{width:a,height:e,"line-height":e,},"#jqt .jqt-photo .jqt-photo-image-slide .jqt-photo-caption":{top:V,}},landscape:{"#jqt.landscape .jqt-photo":{height:e,width:a,},"#jqt.landscape .jqt-photo .toolbar-bottom":{top:A,},"#jqt.landscape .jqt-photo .jqt-photo-table":{height:e,},"#jqt.landscape .jqt-photo .jqt-photo-image-slide > div":{height:e,width:a,"line-height":e,},"#jqt.landscape .jqt-photo .jqt-photo-image-slide .jqt-photo-caption":{top:V,}}};if(P.jQTouch){P.jQTouch.addExtension(function(af){return{generateGallery:t,goToSlide:function(ag,aj,am,ai){var al=P(ag),ah=al.data("jqt-photo-options"),ak=al.find(ah.slideSelector);if(ak.index("."+ah.currentClass)!=aj){ak.removeClass(ah.currentClass).eq(aj).addClass(ah.currentClass)}if(!al.hasClass("current")){af.goTo(al,am||"slide",ai)}al.triggerHandler("jqt-photo-show-toolbars");return al}}})}function t(am,af,ah){ah=P.extend({},R,ah);ah.data=af;if(!ae){ae=true;var ai=k.styleSheets[k.styleSheets.length-1];ai.insertRule(M(ah.parsedClassTemplate,ah.parsedClass),ai.cssRules.length)}ah.gallery=P(ah.galleryTemplate).appendTo(ah.appendTo);var al=ah.list=ah.gallery.find(ah.listSelector),ag=ah.defaultIndex-ah.maxSlidesBefore,aj=ah.defaultIndex+ah.maxSlidesAfter,ak=ah.gallery.attr("id",am).find(".toolbar-top").append(P("<h1></h1>").html(M(ah.galleryName,ah.defaultIndex+1,af.length)));if(ah.backLink){ak.append(ah.backLink)}P.each(af,function(an,ao){al.append(ah.createSlide(ao,an,ah,an>=ag&&an<=aj))});return B(ah.gallery[0],ah)}P.fn.jqtPhoto=function(af){af=P.extend({},R,af||{});return this.each(function(){B(this,af)})};P.jqtPhoto={generateGallery:t,defaults:function(af){if(af){R=P.extend(R,af)}return P.extend({},R)},defaultCSS:function(af){if(af!==q){w=P.extend(true,w,af)}return P.extend({},w)}};function B(ai,ah){var ag=P(ai),aj=v(ag,ah).find(ah.slideSelector),af=aj.find(ah.imageSelector);ah.list=ag.find(ah.listSelector);ah.table=o(ag.data("jqt-photo-options",ah),ah);ah.blankImage=I(ag,P(ah.blankImage).load(ah.loader),ah);if(!aj.filter("."+ah.currentClass).length){if(!aj.filter(M("[{0}={1}]",ah.dataAttribute,ah.defaultIndex)).addClass(ah.currentClass).length){aj.eq(0).addClass(ah.currentClass)}}ag.find(ah.tableSelector).css({webkitTransitionProperty:ah.transitionProperty,webkitTransitionTimingFunction:ah.timingFunction,webkitTransitionDuration:ah.defaultDuration+"s",webkitTransform:M(ah.transform,-aj.filter("."+ah.currentClass).attr("offsetLeft")||0)});I(ag,af,ah);z=z.concat(P.makeArray(ag));return ag}function o(aj,ah){var ai=aj.find(ah.tableSelector),ag=X.getComputedStyle(ai[0]).webkitTransform,af=new WebKitCSSMatrix(ag);return ai.data("jqt-photo-position",{x:Number(af.m41||0),gallery:aj})}function v(ag,af){return ag.each(function(){this.addEventListener(H.start,af.touchStart,false)}).bind("jqt-photo-slideto",af.slideTo).bind("jqt-photo-goto",af.goTo).bind("jqt-photo-play",af.play).bind("jqt-photo-pause",af.pause).bind("jqt-photo-prev",af.prev).bind("jqt-photo-next",af.next).bind("jqt-photo-hide-toolbars",af.hideToolbars).bind("jqt-photo-show-toolbars",af.showToolbars).bind("jqt-photo-toggle-toolbars",af.toggleToolbars).bind("pageAnimationEnd",af.pageAnimationEnd).bind("pageAnimationStart",af.pageAnimationStart)}function I(ah,af,ag){return af.each(function(){var aj=P(this).addClass(ag.parsedClass),ai=new WebKitCSSMatrix(X.getComputedStyle(this).webkitTransform),al=Number(ai.m11),ak=aj.data("jqt-photo-info")||{},am={scale:al,top:Number(ai.m42),left:Number(ai.m41),width:aj.width()*al,height:aj.height()*al,parent:aj.parent()};ak.galleryOptions=ag;ak.gallery=ak.gallery||ah;ak[E]={current:am,original:P.extend({},am)};aj.data("jqt-photo-info",ak)})}function U(ah){var aj=P(ah.target.nodeType==3?ah.target.parentNode:ah.target),ai=P(this),af=ai.data("jqt-photo-options"),ag=s?ah.targetTouches:{length:!ah.ctrlKey?1:2};if(aj.is(af.tagNames)){return null}if(aj.is(af.playSelector)){if(!ai.hasClass(af.playingClass)&&af.play){return af.play.call(this,ah)}return true}else{if(aj.is(af.pauseSelector)){if(ai.hasClass(af.playingClass)&&af.pause){return af.pause.call(this,ah)}return true}else{if(aj.is(af.nextSelector)&&af.next){return af.next.call(this,ah)}else{if(aj.is(af.prevSelector)&&af.prev){return af.prev.call(this,ah)}else{if(ag.length==2&&aj.closest(af.imageSelector).length&&af.scaleStart){if(ai.hasClass(af.playingClass)&&af.pause){af.pause.call(this)}return af.scaleStart.call(this,ah)}else{if(ag.length==1&&af.dragStart){if(ai.hasClass(af.playingClass)&&af.pause){af.pause.call(this,ah)}return af.dragStart.call(this,ah)}}}}}}return true}function n(af){af.preventDefault();X.scrollTo(0,0);var am=P(this),ao=am.data("jqt-photo-options"),an=am.find(ao.tableSelector).css("webkitTransitionDuration","0s"),ai=an.data("jqt-photo-position"),al=P(af.target).closest(ao.imageSelector),ah=al.data("jqt-photo-info")||false,ag=!!ah&&ah[E]||false,ak=!!ag&&ag.current||{},aj=s?af.targetTouches[0]:af;this.addEventListener(H.move,ao.drag,false);this.addEventListener(H.end,ao.dragEnd,false);am.data("jqt-photo-event",{table:an,position:{current:ai.x,original:ai.x},target:al.css("webkitTransitionDuration","0s"),options:ao,slides:an.find(ao.slideSelector),moved:false,x:aj.pageX,y:aj.pageY,left:ak.left||0,top:ak.top||0,timeStamp:+new Date});return true}function j(ap){ap.preventDefault();var ag=P(this),ao=ag.data("jqt-photo-event"),at=ao.table,ay=ao.position,ax=ao.target,av=ax.data("jqt-photo-info"),az=!!av&&av[E]||false,am=az.current||false,af=s?ap.targetTouches[0]:ap,au=ao.x-af.pageX,ar=ao.y-af.pageY,aj,aq,ai,ah,an,ak,aw,al=am.scale;ao.moved=true;if(az){ag.triggerHandler("jqt-photo-hide-toolbars",[ao.options]);if(au){ai=ax.width()*al;aj=am.parent.width();an=ao.left;if(ai>aj){an-=au/al;au=0;aw=((ai-aj)/al)/2;if(an>aw){au=aw-an;an=aw}else{if(an<-aw){au=-(an+aw);an=-aw}}}am.left=l(an)}if(ar){ah=ax.height()*al;aq=am.parent.height(),ak=ao.top;if(ah>aq){ak-=ar/al}am.top=l(ak)}ax.css({webkitTransitionDuration:"0s",webkitTransform:M(ao.options.imageTransform,al,am.left,am.top)})}ay.current=ay.original-au;at.css({webkitTransitionDuration:"0s",webkitTransform:M(ao.options.transform,ay.current)});return true}function aa(aq){var af=P(this),ap=af.data("jqt-photo-event"),at=ap.table,aj=at.data("jqt-photo-position"),ax=ap.position,aw=ap.target,au=aw.data("jqt-photo-info"),ay=!!au&&au[E]||false,am=ay.current||false,ao=ap.slides,ar,ah,ag,ak,av,an,ai,al=am.scale;this.removeEventListener(H.move,ap.options.drag,false);this.removeEventListener(H.end,ap.options.dragEnd,false);if(!ap.moved){af.trigger("jqt-photo-toggle-toolbars");return ab(aq.target)}aq.preventDefault();if(ay){ag=aw.height()*al;ar=am.parent.height(),ak=am.top;if(ag>ar){av=((ag-ar)/al)/2;if(ak>av){ak=av}else{if(ak<-av){ak=-av}}}am.top=l(ak);aw.css({webkitTransitionDuration:ap.options.scaleSpeed+"ms",webkitTransform:M(ap.options.imageTransform,al,am.left,am.top)})}av=(+new Date()-ap.timeStamp);if(ax.current>0){aj.x=0}else{if(ax.current<(ao.eq(ao.length-1).width()-at.outerWidth())){aj.x=(ao.eq(ao.length-1).width()-at.outerWidth())}else{an=aj.x<ax.current?-1:1;ah=ao.filter("."+ap.options.currentClass);ak=O(ah.attr("offsetLeft")+ax.current);ai=ah.width()/3;if(ak>ai){af.triggerHandler("jqt-photo-slideto",[ao.index(ah[0])+an,(av>1000?1000:av),ap.options,ao]);return true}}}at.css({webkitTransitionDuration:(av>1000?1000:av)+"ms",webkitTransform:M(ap.options.transform,aj.x)});return true}function r(ah){ah.preventDefault();X.scrollTo(0,0);var aj=P(this),af=aj.data("jqt-photo-options"),ag=s?ah.targetTouches:[{pageX:f.x-ah.pageX,pageY:f.y-ah.pageY},ah];this.addEventListener(H.move,af.scale,false);this.addEventListener(H.end,af.scaleEnd,false);try{this.removeEventListener(H.move,af.drag,false);this.removeEventListener(H.end,af.dragEnd,false)}catch(ai){}aj.data("jqt-photo-event",{target:P(ah.target).closest(af.imageSelector).css("webkitTransitionDuration","0s"),options:af,distance:T(L((ag[1].pageX-ag[0].pageX),2)+L((ag[1].pageY-ag[0].pageY),2))}).find(".image-list").css("webkitTransitionDuration","0s");return true}function Q(ag){if(ag.targetTouches.length!=2){return true}ag.preventDefault();var aq=P(this),aj=aq.data("jqt-photo-event"),ao=aj.target,ai=ao.data("jqt-photo-info"),al=!!ai&&ai[E]||false,ap=ag.targetTouches,af=T(L((ap[1].pageX-ap[0].pageX),2)+L((ap[1].pageY-ap[0].pageY),2)),ak=af-aj.distance,am=(ak/aj.distance)/2,an=al.current,ah;if(!an){I(aq,ao,aj.options);ai=ao.data("jqt-photo-info");al=!!ai&&ai[E]||false;an=al.current}aq.triggerHandler("jqt-photo-hide-toolbars",[aj.options]);ah=M(aj.options.imageTransform,(an.scale=(an.scale+(an.scale*am))),an.left,an.top);aj.distance=af;ao.css({webkitTransitionDuration:"0s",webkitTransform:ah});return true}function p(ag){ag.preventDefault();var ak=P(this),af=ak.data("jqt-photo-event"),aj=af.target.data("jqt-photo-info"),ah=!!aj&&aj[E]||false,ai=ah.current;this.removeEventListener(H.move,af.options.scale,false);this.removeEventListener(H.end,af.options.scaleEnd,false);if(!ai){I(ak,af.target,af.options);aj=af.target.data("jqt-photo-info");ah=!!aj&&aj[E]||false;ai=ah.current}if(ai.scale<ah.original.scale){ai.scale=ah.original.scale;ai.left=ah.original.left;ai.top=ah.original.top}af.target.css({webkitTransitionDuration:af.options.scaleSpeed+"ms",webkitTransform:M(af.options.imageTransform,ai.scale,ai.left,ai.top)});return true}function ab(af){var ag=af.ownerDocument.createEvent("MouseEvents");ag.initEvent("click",true,true);af.dispatchEvent(ag);return true}function K(ai,ag){ai.preventDefault&&ai.preventDefault();var aj=P(this),af=aj.data("jqt-photo-options"),ah=aj.find(af.slideSelector),ak=ag===q||ag<0?Number(ah.filter("."+af.currentClass).attr(af.dataAttribute)):O(ag);G(aj.addClass(af.playingClass),aj.find(af.pauseSelector)[0]);if(ak!=ag){aj.triggerHandler("jqt-photo-goto",[ak,0,af,ah])}aj.data("jqt-photo-slide-timer",setInterval(function(){b(aj,ah,af)},af.slideDelay));return true}function b(aj,ah,ag){var af=Number(aj.find(ag.slideSelector).filter("."+ag.currentClass).attr(ag.dataAttribute))+1,ai="jqt-photo-slideto";if(af===ag.data.length){if(!ag.repeatSlideShow){aj.triggerHandler("jqt-photo-pause");return null}af=0;ai="jqt-photo-goto"}aj.triggerHandler(ai,[af,ag.scrollSpeed,ag,ah]);aj.triggerHandler("jqt-photo-hide-toolbars",[ag]);return null}function c(ag){ag.preventDefault&&ag.preventDefault();var ah=P(this),ai=ah.data("jqt-photo-slide-timer"),af=ah.data("jqt-photo-options");G(ah,ah.find(af.playSelector)[0]);clearInterval(ai);ah.removeClass(af.playingClass).data("jqt-photo-slide-timer",null).triggerHandler("jqt-photoshow-toolbars");return true}function h(af,aj,ah,ap,ag){af.preventDefault&&af.preventDefault();var al=P(this),ao,ak,am,an,ai;ap=ap||al.data("jqt-photo-options");ag=ag||al.find(ap.slideSelector);ao=ap.table;aj=Number(aj||0);ah=ah===q||ah<0?ap.scrollSpeed:(Number(ah)||0);if(aj>=ap.data.length){al.triggerHandler("jqt-photo-goto",[0,ah,ap,ag]);return true}if(aj<0){aj=ap.data.length+aj}an=ag.filter("."+ap.currentClass);ak=ag.removeClass(ap.currentClass).filter(M("[{0}={1}]",ap.dataAttribute,aj));ai=ak.find(ap.imageSelector);if(ai.attr("src")!=ap.data[aj].src){ai.parent().addClass(ap.notLoadedClass);ai.attr("src",ap.data[aj].src)}position=-ak.addClass(ap.currentClass).attr("offsetLeft");if(position>0){position=0}else{if(position<-(ao.width()-ak.width())){position=-(ao.width()-ak.width())}}al.trigger("jqt-photo-slide-change",[aj,ah,position]);ao.data("jqt-photo-position").x=position;ao.one("webkitTransitionEnd",function(){ap.rearrange(ak,an,ap)}).css({webkitTransitionDuration:ah+"ms",webkitTransform:M(ap.transform,position)});am=al.find(ap.titleSelector);am.html(M(ap.galleryName||am.html(),Number(aj)+1,ap.data.length));return true}function Z(af,aj,ah,ap,ag){af.preventDefault&&af.preventDefault();var al=P(this),ao,ak,am,an,ai;ap=ap||al.data("jqt-photo-options");ag=ag||al.find(ap.slideSelector);ao=ap.table;aj=Number(aj||0);ah=ah===q||ah<0?ap.scrollSpeed:(Number(ah)||0);if(aj>=ap.data.length){aj=0}if(aj<0){aj=ap.data.length+aj}an=ag.filter("."+ap.currentClass);ak=ag.removeClass(ap.currentClass).filter(M("[{0}={1}]",ap.dataAttribute,aj));ai=ak.find(ap.imageSelector);if(ai.attr("src")!=ap.data[aj].src){ai.parent().addClass(ap.notLoadedClass);ai.attr("src",ap.data[aj].src)}position=-ak.addClass(ap.currentClass).attr("offsetLeft");if(position>0){position=0}else{if(position<-(ao.width()-ak.width())){position=-(ao.width()-ak.width())}}ao.data("jqt-photo-position").x=position;ao.css({webkitTransitionDuration:"0s",webkitTransform:M(ap.transform,position)});am=al.find(ap.titleSelector);am.html(M(ap.galleryName||am.html(),Number(aj)+1,ap.data.length));ap.rearrange(ak,an,ap);return true}function W(ai,ah,af){var ag=ai.next();N=ai.prev();ag.length&&ag.find(af.imageSelector).attr("src",af.data[ag.attr(af.dataAttribute)].src);N.length&&N.find(af.imageSelector).attr("src",af.data[N.attr(af.dataAttribute)].src);ai.prevAll().slice(af.maxSlidesBefore).find(af.imageSelector).filter("[src]").each(function(){var ak=af.blankImage.clone(true),aj=P(this);aj.parent().addClass(af.notLoadedClass);aj.replaceWith(ak);I(aj,ak,af)});ai.nextAll().slice(af.maxSlidesAfter).find(af.imageSelector).filter("[src]").each(function(){var ak=af.blankImage.clone(true),aj=P(this);aj.parent().addClass(af.notLoadedClass);aj.replaceWith(ak);I(aj,ak,af)});if(ah[0]!==ai[0]){m(ah.find(af.imageSelector))}return true}function N(ai){ai.preventDefault&&ai.preventDefault();var aj=P(this),ag=aj.data("jqt-photo-options"),ah=aj.find(ag.slideSelector),af=Number(ah.filter("."+ag.currentClass).attr(ag.dataAttribute));G(aj,ai.target);aj.triggerHandler("jqt-photo-goto",[af-1,0,ag,ah]);return true}function g(ai){ai.preventDefault&&ai.preventDefault();var aj=P(this),ag=aj.data("jqt-photo-options"),ah=aj.find(ag.slideSelector),af=Number(ah.filter("."+ag.currentClass).attr(ag.dataAttribute));G(aj,ai.target);aj.triggerHandler("jqt-photo-goto",[af+1,0,ag,ah]);return true}function J(ah,ag){if(ah&&ah.target&&ah.target.tagName==="A"){return null}var af=P(this);ag=ag||af.data("jqt-photo-options");if(af.hasClass(ag.toolbarHideClass)){af.triggerHandler("jqt-photo-show-toolbars",[ag])}else{af.triggerHandler("jqt-photo-hide-toolbars",[ag])}return null}function Y(ah,ag){var af=P(this);ag=ag||af.data("jqt-photo-options");if(!af.hasClass(ag.toolbarHideClass)){af.one("webkitTransitionEnd",function(){af.addClass(ag.toolbarHideClass).removeClass(ag.toolbarAnimationOutClass)}).addClass(ag.toolbarAnimationOutClass)}return null}function u(ah,ag){var af=P(this);ag=ag||af.data("jqt-photo-options");if(af.hasClass(ag.toolbarHideClass)){af.one("webkitTransitionEnd",function(){af.removeClass(ag.toolbarAnimationInClass)}).addClass(ag.toolbarAnimationInClass).removeClass(ag.toolbarHideClass)}return null}function d(ai,ak){if(ak&&ak.direction=="in"){var aj=P(this),ag=aj.data("jqt-photo-options"),ah=aj.find(ag.slideSelector),af=Number(ah.filter("."+ag.currentClass).attr(ag.dataAttribute)),al=af>-1?af:(ag.defaultIndex>-1?ag.defaultIndex:0);if(ah.index("."+ag.currentClass)!=al){aj.triggerHandler("jqt-photo-goto",[al,0,ag,ah]);aj.triggerHandler("jqt-photo-show-toolbars")}}return null}function i(ai,ak){var aj=P(this),ag=aj.data("jqt-photo-options"),ah=aj.find(ag.slideSelector),af,al;if(ak&&ak.direction=="out"){aj.triggerHandler("jqt-photo-goto",[ag.defaultIndex,0,ag,ah]);aj.triggerHandler("jqt-photo-show-toolbars")}else{af=Number(ah.filter("."+ag.currentClass).attr(ag.dataAttribute));al=af>-1?af:(ag.defaultIndex>-1?ag.defaultIndex:0);aj.triggerHandler("jqt-photo-goto",[al,0,ag,ah])}return null}function S(ak,aj,ai,ag){var af=P(ak.template||ai.slideTemplate).attr(ai.dataAttribute,aj),ah=af.find(ai.imageSelector);I(ai.gallery,ah.load(ai.loader),ai);if(ag){ah.attr("src",ak.src)}if(ak.caption){af.find(ai.captionSelector).html(ak.caption)}return af}function m(af){return af.each(function(ah){var ag=P(this),ai=ag.data("jqt-photo-info"),aj=ai[E];if(aj&&aj.current.scale!=1&&aj.current.scale!=aj.original.scale){ag.css({webkitTransitionDuration:"0s",webkitTransform:M(ai.galleryOptions.imageTransform,aj.current.scale=aj.original.scale,aj.current.left=aj.original.left,aj.current.top=aj.original.top)});aj.current.width=aj.original.width;aj.current.height=aj.original.height}return null})}function G(af,ag){P(ag).addClass("hover");af.one("touchend",function(){P(ag).removeClass("hover")});return null}function M(ag){var af=arguments;return ag.replace(/\{(\d+)\}/g,function(ai,ah){return af[Number(ah)+1]+""})}function ac(){E=O(X.orientation)==90?"landscape":"portrait";P("#jqt").removeClass("portrait landscape").addClass(E);setTimeout(function(){var ag=[],af=function(){var ak=P(this),ai=ak.data("jqt-photo-options"),aj=ak.find(ai.slideSelector),ah=aj.find(ai.imageSelector);F(ak,aj,ai);if(ak.hasClass(ai.playingClass)){ag.push(this);ak.triggerHandler("jqt-photo-pause")}m(ah.filter("[src]"))};P(z).filter(":visible").each(af).end().filter(":not(:visible)").each(af);P(ag).triggerHandler("jqt-photo-play")},10);f={x:X.innerWidth/2,y:X.innerHeight/2};return null}function F(ah,ag,af){table=ah.find(af.tableSelector),position=-ag.filter("."+af.currentClass).attr("offsetLeft");table.data("jqt-photo-position").x=position;table.css({webkitTransitionDuration:"0s",webkitTransform:M(af.transform,position)});return null}function D(){var am=X.innerWidth,af=X.innerHeight,al=P(this),ao=al.width(),ak=al.height(),an,ah,ai=ad(ad(ao,am)/ao,ad(ak,af)/ak),ag=ao*ai,ap=ak*ai,aj=al.data("jqt-photo-info"),aq=aj.galleryOptions;al.parent().removeClass(aq.notLoadedClass);if(!al.is(":visible")){aj.gallery.one("pageAnimationEnd",function(){I(aj.gallery,al,aj.galleryOptions)})}else{if(ag>am||ap>af){ah=-l(((ag-am)/ai)/2);an=-l(((ap-af)/ai)/2);al.css({webkitTransitionDuration:"0s",webkitTransform:M(aq.imageTransform,ai,ah,an)}).addClass(aq.presizedClass);aj=aj[E];aj.current.scale=aj.original.scale=ai;aj.current.left=aj.original.left=ah;aj.current.top=aj.original.top=an;aj.current.width=aj.original.width=ag*ai;aj.current.height=aj.original.height=ap*ai}}return null}P(function(){X.scrollTo(0,0);f={x:X.innerWidth/2,y:X.innerHeight/2};if(R.useDynamicStyleSheet){var af="",ai=w,ah=X.innerHeight>X.innerWidth?"portrait":"landscape",aj=function(ak,al){af+=ak+":"+(P.isFunction(al)?al(ai.variables):al)+";"},ag=function(ak,al){af+=ak+"{";P.each(al,aj);af+="}"};P.each(ai.defaults,ag);P.each(ai[ah],ag);P(k.createElement("style")).attr({type:"text/css",media:"screen"}).html(af).appendTo("head");P(X).one("orientationchange",function(){X.scrollTo(0,0);E=O(X.orientation)==90?"landscape":"portrait";P("#jqt").removeClass("portrait landscape").addClass(E);af="";P.each(ai[E],ag);P(k.createElement("style")).attr({type:"text/css",media:"screen"}).html(af).appendTo("head")})}P(X).bind("orientationchange",ac)})})(jQuery);(function(b){b.fn.scalable=function(c){return this.each(function(){new a(this,c)})};if(b.jQTouch){b.jQTouch.addExtension(function(d){function c(g,f){f.page.find(".scalable").scalable()}b(document.body).bind("pageInserted",c);b(function(){b("body > *").each(function(){c({},{page:b(this)})})});return{}});function a(d,c){var e=this;this.numberOfTouches=2;this.element=d;this.scale(1);this.refresh();this.scaleLessThanOne=false;d.style.webkitTransitionTimingFunction="cubic-bezier(0, 0, 0.2, 1)";d.addEventListener("touchstart",this,false);d.addEventListener("touchmove",this,false);d.addEventListener("touchend",this,false);window.addEventListener("unload",function(){d.removeEventListener("touchstart",e,false);d.removeEventListener("touchmove",e,false);d.removeEventListener("touchend",e,false);this.removeEventListener("unload",arguments.callee,false)},false);if(c){b.extend(this,c)}}a.prototype={handleEvent:function(c){switch(c.type){case"touchstart":return this.onTouchStart(c);break;case"touchmove":return this.onTouchMove(c);break;case"touchend":return this.onTouchEnd(c);break}},scale:function(c){if(c!==undefined){this._scale=c;this.element.style.webkitTransform="scale("+c+")";return}return this._scale},refresh:function(){this.element.style.webkitTransitionDuration="0"},onTouchStart:function(c){if(c.targetTouches.length!=this.numberOfTouches){return}this.refresh();this.moved=false;this.startDistance=Math.sqrt(Math.pow((c.targetTouches[1].clientX-c.targetTouches[0].clientX),2)+Math.pow((c.targetTouches[1].clientX-c.targetTouches[0].clientX),2));return false},onTouchMove:function(f){if(f.targetTouches.length!=this.numberOfTouches){return}f.preventDefault();this.moved=true;this.refresh();var c=Math.sqrt(Math.pow((f.targetTouches[1].clientX-f.targetTouches[0].clientX),2)+Math.pow((f.targetTouches[1].clientY-f.targetTouches[0].clientY),2)),g=c-this.startDistance,d=(g/this.startDistance)/2;this.scale(this.scale()+(this.scale()*d));this.startDistance=c;return false},onTouchEnd:function(d){var c,f;if(!this.moved){c=d.target;if(c.nodeType==3){c=c.parentNode}f=document.createEvent("MouseEvents");f.initEvent("click",true,true);c.dispatchEvent(f);return}d.preventDefault();d.stopPropagation();if(!this.scaleLessThanOne&&this.scale()<1){this.element.style.webkitTransitionDuration="200ms";this.scale(1)}return false},scaleTo:function(c,d){this.element.style.webkitTransitionDuration=d?d:"300ms";this.scale(c?c:0)}}}})(jQuery);
|
43
|
-
|
43
|
+
/*!*
|
44
44
|
*
|
45
45
|
* Add support for scrolling vertically and horizontally using jQTouch in Webkit Mobile
|
46
46
|
* Plus support for slides
|
@@ -25,6 +25,8 @@ ActionView::Helpers::AssetTagHelper.register_javascript_expansion :haml_js => ['
|
|
25
25
|
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :contextMenu => ['compiled/jquery/ui/contextMenu.css']
|
26
26
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :contextMenu => ['jquery.contextMenu.min']
|
27
27
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :cookie => ['jquery.cookie.min']
|
28
|
+
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :doTimeout => ['jquery.dotimeout.min']
|
29
|
+
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :dst => ['jquery.dst.min']
|
28
30
|
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :farbtastic => ['compiled/jquery/ui/farbtastic.css']
|
29
31
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :farbtastic => ['jquery.farbtastic.min']
|
30
32
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :form => ['jquery.form.min']
|
@@ -0,0 +1,285 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
|
3
|
+
* http://benalman.com/projects/jquery-dotimeout-plugin/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
6
|
+
* Dual licensed under the MIT and GPL licenses.
|
7
|
+
* http://benalman.com/about/license/
|
8
|
+
*/
|
9
|
+
|
10
|
+
// Script: jQuery doTimeout: Like setTimeout, but better!
|
11
|
+
//
|
12
|
+
// *Version: 1.0, Last updated: 3/3/2010*
|
13
|
+
//
|
14
|
+
// Project Home - http://benalman.com/projects/jquery-dotimeout-plugin/
|
15
|
+
// GitHub - http://github.com/cowboy/jquery-dotimeout/
|
16
|
+
// Source - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.js
|
17
|
+
// (Minified) - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.min.js (1.0kb)
|
18
|
+
//
|
19
|
+
// About: License
|
20
|
+
//
|
21
|
+
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
22
|
+
// Dual licensed under the MIT and GPL licenses.
|
23
|
+
// http://benalman.com/about/license/
|
24
|
+
//
|
25
|
+
// About: Examples
|
26
|
+
//
|
27
|
+
// These working examples, complete with fully commented code, illustrate a few
|
28
|
+
// ways in which this plugin can be used.
|
29
|
+
//
|
30
|
+
// Debouncing - http://benalman.com/code/projects/jquery-dotimeout/examples/debouncing/
|
31
|
+
// Delays, Polling - http://benalman.com/code/projects/jquery-dotimeout/examples/delay-poll/
|
32
|
+
// Hover Intent - http://benalman.com/code/projects/jquery-dotimeout/examples/hoverintent/
|
33
|
+
//
|
34
|
+
// About: Support and Testing
|
35
|
+
//
|
36
|
+
// Information about what version or versions of jQuery this plugin has been
|
37
|
+
// tested with, what browsers it has been tested in, and where the unit tests
|
38
|
+
// reside (so you can test it yourself).
|
39
|
+
//
|
40
|
+
// jQuery Versions - 1.3.2, 1.4.2
|
41
|
+
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
|
42
|
+
// Unit Tests - http://benalman.com/code/projects/jquery-dotimeout/unit/
|
43
|
+
//
|
44
|
+
// About: Release History
|
45
|
+
//
|
46
|
+
// 1.0 - (3/3/2010) Callback can now be a string, in which case it will call
|
47
|
+
// the appropriate $.method or $.fn.method, depending on where .doTimeout
|
48
|
+
// was called. Callback must now return `true` (not just a truthy value)
|
49
|
+
// to poll.
|
50
|
+
// 0.4 - (7/15/2009) Made the "id" argument optional, some other minor tweaks
|
51
|
+
// 0.3 - (6/25/2009) Initial release
|
52
|
+
|
53
|
+
(function($){
|
54
|
+
'$:nomunge'; // Used by YUI compressor.
|
55
|
+
|
56
|
+
var cache = {},
|
57
|
+
|
58
|
+
// Reused internal string.
|
59
|
+
doTimeout = 'doTimeout',
|
60
|
+
|
61
|
+
// A convenient shortcut.
|
62
|
+
aps = Array.prototype.slice;
|
63
|
+
|
64
|
+
// Method: jQuery.doTimeout
|
65
|
+
//
|
66
|
+
// Initialize, cancel, or force execution of a callback after a delay.
|
67
|
+
//
|
68
|
+
// If delay and callback are specified, a doTimeout is initialized. The
|
69
|
+
// callback will execute, asynchronously, after the delay. If an id is
|
70
|
+
// specified, this doTimeout will override and cancel any existing doTimeout
|
71
|
+
// with the same id. Any additional arguments will be passed into callback
|
72
|
+
// when it is executed.
|
73
|
+
//
|
74
|
+
// If the callback returns true, the doTimeout loop will execute again, after
|
75
|
+
// the delay, creating a polling loop until the callback returns a non-true
|
76
|
+
// value.
|
77
|
+
//
|
78
|
+
// Note that if an id is not passed as the first argument, this doTimeout will
|
79
|
+
// NOT be able to be manually canceled or forced. (for debouncing, be sure to
|
80
|
+
// specify an id).
|
81
|
+
//
|
82
|
+
// If id is specified, but delay and callback are not, the doTimeout will be
|
83
|
+
// canceled without executing the callback. If force_mode is specified, the
|
84
|
+
// callback will be executed, synchronously, but will only be allowed to
|
85
|
+
// continue a polling loop if force_mode is true (provided the callback
|
86
|
+
// returns true, of course). If force_mode is false, no polling loop will
|
87
|
+
// continue, even if the callback returns true.
|
88
|
+
//
|
89
|
+
// Usage:
|
90
|
+
//
|
91
|
+
// > jQuery.doTimeout( [ id, ] delay, callback [, arg ... ] );
|
92
|
+
// > jQuery.doTimeout( id [, force_mode ] );
|
93
|
+
//
|
94
|
+
// Arguments:
|
95
|
+
//
|
96
|
+
// id - (String) An optional unique identifier for this doTimeout. If id is
|
97
|
+
// not specified, the doTimeout will NOT be able to be manually canceled or
|
98
|
+
// forced.
|
99
|
+
// delay - (Number) A zero-or-greater delay in milliseconds after which
|
100
|
+
// callback will be executed.
|
101
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
102
|
+
// callback - (String) A jQuery method to be executed after delay
|
103
|
+
// milliseconds. This method will only poll if it explicitly returns
|
104
|
+
// true.
|
105
|
+
// force_mode - (Boolean) If true, execute that id's doTimeout callback
|
106
|
+
// immediately and synchronously, continuing any callback return-true
|
107
|
+
// polling loop. If false, execute the callback immediately and
|
108
|
+
// synchronously but do NOT continue a callback return-true polling loop.
|
109
|
+
// If omitted, cancel that id's doTimeout.
|
110
|
+
//
|
111
|
+
// Returns:
|
112
|
+
//
|
113
|
+
// If force_mode is true, false or undefined and there is a
|
114
|
+
// yet-to-be-executed callback to cancel, true is returned, but if no
|
115
|
+
// callback remains to be executed, undefined is returned.
|
116
|
+
|
117
|
+
$[doTimeout] = function() {
|
118
|
+
return p_doTimeout.apply( window, [ 0 ].concat( aps.call( arguments ) ) );
|
119
|
+
};
|
120
|
+
|
121
|
+
// Method: jQuery.fn.doTimeout
|
122
|
+
//
|
123
|
+
// Initialize, cancel, or force execution of a callback after a delay.
|
124
|
+
// Operates like <jQuery.doTimeout>, but the passed callback executes in the
|
125
|
+
// context of the jQuery collection of elements, and the id is stored as data
|
126
|
+
// on the first element in that collection.
|
127
|
+
//
|
128
|
+
// If delay and callback are specified, a doTimeout is initialized. The
|
129
|
+
// callback will execute, asynchronously, after the delay. If an id is
|
130
|
+
// specified, this doTimeout will override and cancel any existing doTimeout
|
131
|
+
// with the same id. Any additional arguments will be passed into callback
|
132
|
+
// when it is executed.
|
133
|
+
//
|
134
|
+
// If the callback returns true, the doTimeout loop will execute again, after
|
135
|
+
// the delay, creating a polling loop until the callback returns a non-true
|
136
|
+
// value.
|
137
|
+
//
|
138
|
+
// Note that if an id is not passed as the first argument, this doTimeout will
|
139
|
+
// NOT be able to be manually canceled or forced (for debouncing, be sure to
|
140
|
+
// specify an id).
|
141
|
+
//
|
142
|
+
// If id is specified, but delay and callback are not, the doTimeout will be
|
143
|
+
// canceled without executing the callback. If force_mode is specified, the
|
144
|
+
// callback will be executed, synchronously, but will only be allowed to
|
145
|
+
// continue a polling loop if force_mode is true (provided the callback
|
146
|
+
// returns true, of course). If force_mode is false, no polling loop will
|
147
|
+
// continue, even if the callback returns true.
|
148
|
+
//
|
149
|
+
// Usage:
|
150
|
+
//
|
151
|
+
// > jQuery('selector').doTimeout( [ id, ] delay, callback [, arg ... ] );
|
152
|
+
// > jQuery('selector').doTimeout( id [, force_mode ] );
|
153
|
+
//
|
154
|
+
// Arguments:
|
155
|
+
//
|
156
|
+
// id - (String) An optional unique identifier for this doTimeout, stored as
|
157
|
+
// jQuery data on the element. If id is not specified, the doTimeout will
|
158
|
+
// NOT be able to be manually canceled or forced.
|
159
|
+
// delay - (Number) A zero-or-greater delay in milliseconds after which
|
160
|
+
// callback will be executed.
|
161
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
162
|
+
// callback - (String) A jQuery.fn method to be executed after delay
|
163
|
+
// milliseconds. This method will only poll if it explicitly returns
|
164
|
+
// true (most jQuery.fn methods return a jQuery object, and not `true`,
|
165
|
+
// which allows them to be chained and prevents polling).
|
166
|
+
// force_mode - (Boolean) If true, execute that id's doTimeout callback
|
167
|
+
// immediately and synchronously, continuing any callback return-true
|
168
|
+
// polling loop. If false, execute the callback immediately and
|
169
|
+
// synchronously but do NOT continue a callback return-true polling loop.
|
170
|
+
// If omitted, cancel that id's doTimeout.
|
171
|
+
//
|
172
|
+
// Returns:
|
173
|
+
//
|
174
|
+
// When creating a <jQuery.fn.doTimeout>, the initial jQuery collection of
|
175
|
+
// elements is returned. Otherwise, if force_mode is true, false or undefined
|
176
|
+
// and there is a yet-to-be-executed callback to cancel, true is returned,
|
177
|
+
// but if no callback remains to be executed, undefined is returned.
|
178
|
+
|
179
|
+
$.fn[doTimeout] = function() {
|
180
|
+
var args = aps.call( arguments ),
|
181
|
+
result = p_doTimeout.apply( this, [ doTimeout + args[0] ].concat( args ) );
|
182
|
+
|
183
|
+
return typeof args[0] === 'number' || typeof args[1] === 'number'
|
184
|
+
? this
|
185
|
+
: result;
|
186
|
+
};
|
187
|
+
|
188
|
+
function p_doTimeout( jquery_data_key ) {
|
189
|
+
var that = this,
|
190
|
+
elem,
|
191
|
+
data = {},
|
192
|
+
|
193
|
+
// Allows the plugin to call a string callback method.
|
194
|
+
method_base = jquery_data_key ? $.fn : $,
|
195
|
+
|
196
|
+
// Any additional arguments will be passed to the callback.
|
197
|
+
args = arguments,
|
198
|
+
slice_args = 4,
|
199
|
+
|
200
|
+
id = args[1],
|
201
|
+
delay = args[2],
|
202
|
+
callback = args[3];
|
203
|
+
|
204
|
+
if ( typeof id !== 'string' ) {
|
205
|
+
slice_args--;
|
206
|
+
|
207
|
+
id = jquery_data_key = 0;
|
208
|
+
delay = args[1];
|
209
|
+
callback = args[2];
|
210
|
+
}
|
211
|
+
|
212
|
+
// If id is passed, store a data reference either as .data on the first
|
213
|
+
// element in a jQuery collection, or in the internal cache.
|
214
|
+
if ( jquery_data_key ) { // Note: key is 'doTimeout' + id
|
215
|
+
|
216
|
+
// Get id-object from the first element's data, otherwise initialize it to {}.
|
217
|
+
elem = that.eq(0);
|
218
|
+
elem.data( jquery_data_key, data = elem.data( jquery_data_key ) || {} );
|
219
|
+
|
220
|
+
} else if ( id ) {
|
221
|
+
// Get id-object from the cache, otherwise initialize it to {}.
|
222
|
+
data = cache[ id ] || ( cache[ id ] = {} );
|
223
|
+
}
|
224
|
+
|
225
|
+
// Clear any existing timeout for this id.
|
226
|
+
data.id && clearTimeout( data.id );
|
227
|
+
delete data.id;
|
228
|
+
|
229
|
+
// Clean up when necessary.
|
230
|
+
function cleanup() {
|
231
|
+
if ( jquery_data_key ) {
|
232
|
+
elem.removeData( jquery_data_key );
|
233
|
+
} else if ( id ) {
|
234
|
+
delete cache[ id ];
|
235
|
+
}
|
236
|
+
};
|
237
|
+
|
238
|
+
// Yes, there actually is a setTimeout call in here!
|
239
|
+
function actually_setTimeout() {
|
240
|
+
data.id = setTimeout( function(){ data.fn(); }, delay );
|
241
|
+
};
|
242
|
+
|
243
|
+
if ( callback ) {
|
244
|
+
// A callback (and delay) were specified. Store the callback reference for
|
245
|
+
// possible later use, and then setTimeout.
|
246
|
+
data.fn = function( no_polling_loop ) {
|
247
|
+
|
248
|
+
// If the callback value is a string, it is assumed to be the name of a
|
249
|
+
// method on $ or $.fn depending on where doTimeout was executed.
|
250
|
+
if ( typeof callback === 'string' ) {
|
251
|
+
callback = method_base[ callback ];
|
252
|
+
}
|
253
|
+
|
254
|
+
callback.apply( that, aps.call( args, slice_args ) ) === true && !no_polling_loop
|
255
|
+
|
256
|
+
// Since the callback returned true, and we're not specifically
|
257
|
+
// canceling a polling loop, do it again!
|
258
|
+
? actually_setTimeout()
|
259
|
+
|
260
|
+
// Otherwise, clean up and quit.
|
261
|
+
: cleanup();
|
262
|
+
};
|
263
|
+
|
264
|
+
// Set that timeout!
|
265
|
+
actually_setTimeout();
|
266
|
+
|
267
|
+
} else if ( data.fn ) {
|
268
|
+
// No callback passed. If force_mode (delay) is true, execute the data.fn
|
269
|
+
// callback immediately, continuing any callback return-true polling loop.
|
270
|
+
// If force_mode is false, execute the data.fn callback immediately but do
|
271
|
+
// NOT continue a callback return-true polling loop. If force_mode is
|
272
|
+
// undefined, simply clean up. Since data.fn was still defined, whatever
|
273
|
+
// was supposed to happen hadn't yet, so return true.
|
274
|
+
delay === undefined ? cleanup() : data.fn( delay === false );
|
275
|
+
return true;
|
276
|
+
|
277
|
+
} else {
|
278
|
+
// Since no callback was passed, and data.fn isn't defined, it looks like
|
279
|
+
// whatever was supposed to happen already did. Clean up and quit!
|
280
|
+
cleanup();
|
281
|
+
}
|
282
|
+
|
283
|
+
};
|
284
|
+
|
285
|
+
})(jQuery);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
(function(g){function l(a){function f(){if(a)h.removeData(a);else c&&delete j[c]}function m(){b.id=setTimeout(function(){b.fn()},i)}var n=this,h,b={},p=a?g.fn:g,d=arguments,o=4,c=d[1],i=d[2],e=d[3];if(typeof c!=="string"){o--;c=a=0;i=d[1];e=d[2]}if(a){h=n.eq(0);h.data(a,b=h.data(a)||{})}else if(c)b=j[c]||(j[c]={});b.id&&clearTimeout(b.id);delete b.id;if(e){b.fn=function(q){if(typeof e==="string")e=p[e];e.apply(n,k.call(d,o))===true&&!q?m():f()};m()}else if(b.fn){i===undefined?f():b.fn(i===false);
|
2
|
+
return true}else f()}var j={},k=Array.prototype.slice;g.doTimeout=function(){return l.apply(window,[0].concat(k.call(arguments)))};g.fn.doTimeout=function(){var a=k.call(arguments),f=l.apply(this,["doTimeout"+a[0]].concat(a));return typeof a[0]==="number"||typeof a[1]==="number"?this:f}})(jQuery);
|