mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
!function(a){var b,c=null,d=null,e=location.hash,f="#",g=0,h=[],i=[],j=0;a.fn.jQTouch=function(b){var c={fullScreen:!0,slideInSelector:"ul li a",backSelector:".back",flipSelector:".flip",slideUpSelector:".slideup",statusBar:"default",icon:null,iconIsGlossy:!1,fixedViewport:!0},d=a.extend({},c,b),e=a("head");if(d.backSelector&&a(d.backSelector).live("click",function(){return history.back(),!1}),d.icon){var f=d.iconIsGlossy?"":"-precomposed";e.append('<link rel="apple-touch-icon'+f+'" href="'+d.icon+'" />')}d.fixedViewport&&e.append('<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>'),d.fullScreen&&(e.append('<meta name="apple-mobile-web-app-capable" content="yes" />'),d.statusBar&&e.append('<meta name="apple-mobile-web-app-status-bar-style" content="'+d.statusBar+'" />'));var g=[];d.slideInSelector&&g.push(d.slideInSelector),d.flipSelector&&g.push(d.flipSelector),d.slideUpSelector&&g.push(d.slideUpSelector),g.length>0&&(a(g.join(", ")).live("click",function(){var b=a(this),c=b.attr("hash"),e="slideInOut";if(a(this).is(d.flipSelector)&&(e="flip"),a(this).is(d.slideUpSelector)&&(e="slideUp"),c&&"#"!=c)b.attr("selected","true"),a.fn.jQTouch.showPage(a(c),e),setTimeout(a.fn.unselect,350,a(this));else if("#"!=b.attr("href")){b.attr("selected","progress");try{a.fn.jQTouch.showPageByHref(a(this).attr("href"),null,null,null,e,function(){setTimeout(a.fn.unselect,350,b)})}catch(f){console.log(f)}}return!1}),a(function(){var b=a.fn.jQTouch.getSelectedPage();b&&a.fn.jQTouch.showPage(b),a.fn.jQTouch.startCheck()}))},a.fn.ianimate=function(a,b,c){if(0===b)this.css(a),window.setTimeout(c,0);else{var d=[];for(var e in a)d.push(e);this.css({webkitTransitionProperty:d.join(", "),webkitTransitionDuration:b+"ms",webkitTransitionTimingFunction:"ease-in-out"}),window.setTimeout(function(a,b){a.css(b)},0,this,a),window.setTimeout(c,b)}return this},a.fn.jQTouch.checkOrientAndLocation=function(){if(window.innerWidth!=g){g=window.innerWidth,currentHeight=window.innerHeight;var b=g<currentHeight?"profile":"landscape";document.body.setAttribute("orient",b),setTimeout(scrollTo,100,0,1)}location.hash!=e&&a.fn.jQTouch.showPageById(location.hash)},a.fn.jQTouch.getSelectedPage=function(){return a("body > *[selected!=false]").slice(0,1)},a.fn.jQTouch.showPage=function(b,e,f){if(b){d&&(d.attr("selected",null),d=null);var g=c;c=b,g?a.fn.jQTouch.animatePages(g,b,e,f):a.fn.jQTouch.updatePage(b,g,e)}},a.fn.jQTouch.showPageById=function(b){var c=a(b);if(c){var d,f=h.indexOf(e),g=h.indexOf(b),j=-1!=g;j&&(d=i[f].transition,h.splice(g,h.length),i.splice(g,i.length)),a.fn.jQTouch.showPage(c,d,j)}},a.fn.jQTouch.insertPages=function(b,c){var d;b.each(function(){a(this).attr("id")||a(this).attr("id",++j),a(this).appendTo(a("body")),("true"==a(this).attr("selected")||!d&&!a(this).hasClass("btn"))&&(d=a(this))}),d&&a.fn.jQTouch.showPage(d,c)},a.fn.jQTouch.showPageByHref=function(b,c,d,e,f,g){a.ajax({url:b,data:c,type:d||"GET",success:function(b){a('a[selected="progress"]').attr("selected","true"),e?a(e).replaceWith(b):a.fn.jQTouch.insertPages(a(b)),g&&g(!0)},error:function(){g&&g(!1)}})},a.fn.jQTouch.submitForm=function(){return a.fn.jQTouch.showPageByHref(a(this).attr("action")||"POST",a(this).serialize(),a(this).attr("method")),!1},a.fn.showForm=function(){return this.each(function(){a(this).submit(a.fn.jQTouch.submitForm)})},a.fn.jQTouch.animatePages=function(c,d,e,f){clearInterval(b),"flip"==e?(d.flip({backwards:f}),c.flip({backwards:f})):"slideUp"==e?f?(d.attr("selected",!0),c.slideUpDown({backwards:f})):d.slideUpDown({backwards:f}):(d.slideInOut({backwards:f}),c.slideInOut({backwards:f})),setTimeout(function(){c.attr("selected","false"),a.fn.jQTouch.updatePage(d,c,e),a.fn.jQTouch.startCheck()},500)},a.fn.jQTouch.startCheck=function(){b=setInterval(a.fn.jQTouch.checkOrientAndLocation,350)},a.fn.jQTouch.updatePage=function(a,b,c){a&&(a.attr("id")||a.attr("id",++j),location.replace(f+a.attr("id")),e=location.hash,h.push(e),i.push({page:a,transition:c}),"form"!=a.attr("localName")||a.attr("target")||a.showForm())},a.fn.unselect=function(a){a.attr("selected",!1)},a.preloadImages=function(a){for(var b=a.length-1;b>=0;b--)(new Image).src=a[b]},a.fn.flip=function(b){this.each(function(){var c={direction:"toggle",backwards:!1},d=a.extend({},c,b),e="toggle"==d.direction&&"true"==a(this).attr("selected")||"out"==d.direction?1:-1;-1==e&&a(this).attr("selected","true"),a(this).parent().css({webkitPerspective:"2000"}),a(this).css({"-webkit-backface-visibility":"hidden","-webkit-transform":"rotateY("+(1==e?"0":(d.backwards?"":"-")+"180")+"deg)"}).ianimate({"-webkit-transform":"rotateY("+(1==e?(d.backwards?"-":"")+"180":"0")+"deg)"},350)})},a.fn.slideInOut=function(b){var c={direction:"toggle",backwards:!1},d=a.extend({},c,b);this.each(function(){var b="toggle"==d.direction&&"true"==a(this).attr("selected")||"out"==d.direction?1:-1;-1==b?a(this).attr("selected","true").css({"-webkit-transform":"translateX("+(d.backwards?-1:1)*g+"px)"}).ianimate({"-webkit-transform":"translateX(0px)"},350).find("h1, .button").css("opacity",0).ianimate({opacity:1},100):a(this).ianimate({"-webkit-transform":"translateX("+(d.backwards?1:-1)*b*g+"px)"},350).find("h1, .button").ianimate({opacity:0},100)})},a.fn.slideUpDown=function(b){var c={direction:"toggle",backwards:!1},d=a.extend({},c,b);this.each(function(){var b="toggle"==d.direction&&"true"==a(this).attr("selected")||"out"==d.direction?1:-1;-1==b?a(this).attr("selected","true").css({"-webkit-transform":"translateY("+(d.backwards?-1:1)*currentHeight+"px)"}).ianimate({"-webkit-transform":"translateY(0px)"},350).find("h1, .button").css("opacity",0).ianimate({opacity:1},100):a(this).ianimate({"-webkit-transform":"translateY("+currentHeight+"px)"},350).find("h1, .button").ianimate({opacity:0},100)})}}(jQuery);
|
|
//# sourceMappingURL=../../../maps/libs/jquery/jqtouch.js.map
|