diff --git a/dist/spa.js b/dist/spa.js index 4ababc4..d8b07ef 100644 --- a/dist/spa.js +++ b/dist/spa.js @@ -143,13 +143,21 @@ } } - $win.on('spa:adjustfullscreen orientationchange', function(event) { + $win.on('spa:adjustfullscreen' + ($.os.ios?' orientationchange':''), function(event) { if(requestID !== undefined) { cancelAnimationFrame(requestID) requestID = undefined } requestID = requestAnimationFrame(adjust) }) + // android下orientationchange触发的时候页面很可能还没有渲染好 + // 所以马上取数据或者短延时取数据都有问题。 + // 暂时没有特别好的思路来处理这个问题 + $.os.android && $win.on('orientationchange', function(event) { + clearTimeout(resizeID) + + resizeID = setTimeout(adjust, 500) + }) $win.on('resize', function(event) { clearTimeout(resizeID) diff --git a/dist/spa.min.js b/dist/spa.min.js index e87841f..8195584 100644 --- a/dist/spa.min.js +++ b/dist/spa.min.js @@ -5,4 +5,4 @@ * Licensed under MIT https://raw.github.com/zhaoda/spa/master/LICENSE */ -!function(a){"use strict";function b(a){return a=a||p.href,a.replace(/^[^#]*#?\/?(.*)\/?$/,"$1")}function c(a){return"[object RegExp]"==Object.prototype.toString.call(a)}function d(a){return a=a.replace(M,"\\$&").replace(J,"(?:$1)?").replace(K,function(a,b){return b?a:"([^/]+)"}).replace(L,"(.*?)"),"^"+a+"$"}function e(b,c){var d=b.exec(c).slice(1),e=[];return a.each(d,function(a,b){b&&e.push(decodeURIComponent(b))}),e}function f(a,b){F[a.data("id")],F[b.data("id")];a.css({zIndex:z}),b.css({zIndex:A})}function g(b,c,d,e){var f=a(".spa-page-body",b),g=(a(".spa-page-body",c),{});!O&&(d="defaultInOut"),S[d]||(d="defaultInOut"),u&&(u=!1,d="defaultInOut"),g.opacity=1,!T(d)&&O&&(g[O]="translate(0, 0) scale(1, 1)"),f.css(g),R[d].apply(b,[b,c,e])}function h(){event.stopPropagation(),event.preventDefault()}var i,j,k,l,m,n=a(window),o=a(document),p=window.location,q=window.history,r=navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad)/),s=!1,t=!1,u=!0,v={},w={},x=[],y=2e3,z=2001,A=2002,B=0,C={},D={},E=[],F={},G="body {position: relative; margin: 0; padding: 0; width: 100%; overflow: hidden;} .spa-fullscreen {position: absolute; left: 0; top: 0; margin: 0; padding: 0; width: 100%; visibility: hidden; overflow: hidden; z-index: -1; } .spa-page {position: absolute; left: 0; top: 0; bottom: 0; right: 0; margin: 0; padding: 0; overflow: hidden; z-index: 2000; -webkit-transform: translateZ(0); } .spa-page-bg {position: absolute; left: 0; top: 0; bottom: 0; right: 0; margin: 0; padding: 0; } .spa-page-body {position: absolute; left: 0; top: 0; bottom: 0; right: 0; margin: 0; padding: 0; overflow: hidden; -webkit-transform: translateZ(0); } .spa-scroll {overflow: auto;} .spa-scroll-touch {-webkit-overflow-scrolling: touch; } .spa-scroll-x {overflow-y: hidden;} .spa-scroll-y {overflow-x: hidden;} .spa-cover {display: none; position: absolute; left: 0; right: 0; top: 0; bottom: 0; text-align: center; z-index: 5000; } .spa-loader {display: none; position: absolute; left: 0; right: 0; top: 0; bottom: 0; text-align: center; overflow: hidden; z-index: 5001; }",H='
',I=".spa-loader-animate {position: absolute; top: 50%; left: 50%;} .spa-loader-animate .bg {position: absolute; width: 64px; height: 64px; margin: 0 auto; top: -32px; left: -32px; border-radius: 50%; background: #2C3E50; opacity: 0.5;} .spa-loader-animate .ball {display: block; float: left; padding: 8px; margin-top: -8px; margin-left: -10px; -webkit-border-radius: 50%; -moz-border-radius: 50%; -ms-border-radius: 50%; -o-border-radius: 50%; border-radius: 50%;} .spa-loader-animate span:nth-child(2) {background: #16A085; -webkit-animation: move-left 800ms ease-in-out infinite alternate; -moz-animation: move-left 800ms ease-in-out infinite alternate; -ms-animation: move-left 800ms ease-in-out infinite alternate; -animation: move-left 800ms ease-in-out infinite alternate;} .spa-loader-animate .ball:nth-child(3) {background: #E67E22; -webkit-animation: move-right 800ms ease-in-out infinite alternate; -moz-animation: move-right 800ms ease-in-out infinite alternate; -ms-animation: move-right 800ms ease-in-out infinite alternate; animation: move-right 800ms ease-in-out infinite alternate;} @-webkit-keyframes move-left {to {-webkit-transform: translate(20px, 0); transform: translate(20px, 0); background: #e85932;}} @-webkit-keyframes move-right {to {-webkit-transform: translate(-20px, 0); transform: translate(-20px, 0); background: #44bbcc;}}";a.spa={},a.spa.getViewData=function(a){return F[a.data("id")]},a.spa.getCurPage=function(){return m},o.on("spa:addstyle",function(b,c){a("head").append('")}),function(){var a,b,c,d,e=function(){c=Math.max(n.height(),window.innerHeight),d=Math.max(n.width(),window.innerWidth),k.css({height:2*c}),window.scrollTo(0,0),i.data("innerHeight",window.innerHeight),c=Math.max(n.height(),window.innerHeight),k.height()!=c&&(i.css({width:d,height:c}),k.css({width:d,height:c}))};n.on("spa:adjustfullscreen orientationchange",function(){void 0!==a&&(cancelAnimationFrame(a),a=void 0),a=requestAnimationFrame(e)}),n.on("resize",function(){clearTimeout(b),b=setTimeout(e,200)})}(),o.on("spa:scroll",function(b,c){var d=a(b.target),e=c&&c.direction||"";d.addClass("spa-scroll"+(e?" spa-scroll-"+e:""))}),o.on("spa:removescroll",function(b){var c=a(b.target);c.removeClass("spa-scroll")}),r&&o.on("touchstart",".spa-scroll, .spa-scroll-x, .spa-scroll-y",function(b){var c=a(b.currentTarget),d=c.prop("scrollTop"),e=c.prop("scrollLeft"),f=c.height(),g=c.width(),h=c.prop("scrollHeight"),i=c.prop("scrollWidth");(c.hasClass("spa-scroll")||c.hasClass("spa-scroll-x"))&&(0>=e&&c.prop("scrollLeft",1),e+g>=i&&c.prop("scrollLeft",i-g-1)),(c.hasClass("spa-scroll")||c.hasClass("spa-scroll-y"))&&(0>=d&&c.prop("scrollTop",1),d+f>=h&&c.prop("scrollTop",d-1))}),n.on("scroll",function(){var a=i&&i.data("innerHeight");a&&a!==window.innerHeight&&n.trigger("spa:adjustfullscreen")}),n.on("popstate",function(a){if(s){if(l&&"block"===l.css("display"))return!1;if(m&&m.hasClass("spa-panel")){var c=m.data("id"),d=F[c],e=d.prevPage;return e.trigger("spa:openpage"),!1}var f=b();if(!x.length||x[x.length-1]!==f){x.push(f);var g=C[f],h=a.state||{};if(j&&(h=j,j=void 0),g){var i=g.data("id"),k=F[i];k.oldpushData=k.pushData,k.pushData=h,g.trigger("spa:openpage")}else o.trigger("spa:createpage",{hash:f,pushData:h})}}});var J=/\((.*?)\)/g,K=/(\(\?)?:\w+/g,L=/\*\w+/g,M=/[\-{}\[\]+?.,\\\^$|#\s]/g,N={route:"",animate:"",classname:"",view:function(){return{title:"",body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};o.on("spa:route",function(b,e){var f=Array.prototype.slice.call(arguments,1);if(f.length>1)return a.each(f,function(a,b){o.trigger("spa:route",b)}),!1;var g=e.route||"";c(g)||(g=d(g)),e.animate&&!a.isFunction(e.animate)&&T(e.animate)&&(e.animate=""),v[g]=a.extend({},N,e)});var O,P,Q,R={},S={};!function(){var a,b={"-webkit-transition":["-webkit-transform","webkitTransitionEnd"],"-moz-transition":["-moz-transform","transitionend"],"-ms-transition":["-ms-transform","msTransitionEnd"],"-o-transition":["-o-transform","oTransitionEnd"],transition:["transform","transitionend"]},c=document.createElement("div");for(a in b)if(void 0!==c.style[a])return P=a,O=b[a][0],void(Q=b[a][1])}(),a.fn.transition=function(b,c){var d=a(this);return requestAnimationFrame(function(){d.get(0).offsetWidth,b[P]="0.4s",d.css(b).emulateTransitionEnd(function(){b={},b[P]="",d.css(b),c&&c()})}),d},a.fn.emulateTransitionEnd=function(b,c){var d,e=!1,f=a(this);c=c||500,f.one(Q,function(){e=!0,clearTimeout(d),b.call(f)});var g=function(){e||f.trigger(Q)};return d=setTimeout(g,c),f},R.defaultInOut=function(a,b,c){f(b,a),c()},o.on("spa:addTransitPageAnimates",function(b,c){var d=[];a.each(c,function(a){d.push(a)}),a.each(d,function(a,b){S[b]=a%2===0?d[a+1]:d[a-1]}),a.extend(R,c)}),o.trigger("spa:addTransitPageAnimates",{fadeIn:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{opacity:0}),h={opacity:1};g.opacity=0,e.css(g),f(c,b),e.transition(h,function(){d()})},fadeOut:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={opacity:0};e.transition(g,function(){f(c,b),d()})},slideInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(100%, 0)",h[O]="translate(0%, 0)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutRight:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(100%, 0)",e.transition(g,function(){f(c,b),d()})},slideInRight:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(-100%, 0)",h[O]="translate(0%, 0)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutLeft:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(-100%, 0)",e.transition(g,function(){f(c,b),d()})},slideInUp:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(0, 100%)",h[O]="translate(0, 0%)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutDown:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(0, 100%)",e.transition(g,function(){f(c,b),d()})},slideInDown:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(0, -100%)",h[O]="translate(0, 0%)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutUp:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(0, -100%)",e.transition(g,function(){f(c,b),d()})},pushInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(-100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(-100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushInRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(-100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(-100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushInUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, 100%)",j[O]="translate(0%, 0)",k[O]="translate(0, -100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, -100%)",j[O]="translate(0%, 0)",k[O]="translate(0, 100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushInDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, -100%)",j[O]="translate(0%, 0)",k[O]="translate(0, 100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, 100%)",j[O]="translate(0%, 0)",k[O]="translate(0, -100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},zoomIn:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="scale(0, 0)",h[O]="scale(1, 1)",e.css(g),f(c,b),e.transition(h,function(){d()})},zoomOut:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="scale(0, 0)",e.transition(g,function(){f(c,b),d()})},overlayInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().width()),h={left:"auto",width:g},i={};i[O]="translate(0px, 0)",e.css(h),g=2*g-e.prop("clientWidth"),h={width:g},h[O]="translate("+g+"px, 0)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutRight:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.width(),h={},i={width:"auto",left:0};h[O]="translate("+g+"px, 0)",e.transition(h,function(){f(c,b),e.css(i),d()})},overlayInRight:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().width()),h={right:"auto",width:g},i={};i[O]="translate(0px, 0)",e.css(h),g=2*g-e.prop("clientWidth"),h={width:g},h[O]="translate("+(0-g)+"px, 0)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutLeft:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.width(),h={},i={width:"auto",right:0};h[O]="translate("+(0-g)+"px, 0)",e.transition(h,function(){f(c,b),e.css(i),d()})},overlayInUp:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().height()),h={top:"auto",height:g},i={};i[O]="translate(0, 0px)",e.css(h),g=2*g-e.prop("clientHeight"),h={height:g},h[O]="translate(0, "+g+"px)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutDown:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.height(),h={},i={height:"auto",top:0};h[O]="translate(0, "+g+"px)",e.transition(h,function(){f(c,b),e.css(i),d()})},overlayInDown:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().height()),h={bottom:"auto",height:g},i={};i[O]="translate(0, 0px)",e.css(h),g=2*g-e.prop("clientHeight"),h={height:g},h[O]="translate(0, "+(0-g)+"px)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutUp:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.height(),h={},i={height:"auto",bottom:0};h[O]="translate(0, "+(0-g)+"px)",e.transition(h,function(){f(c,b),e.css(i),d()})},revealInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i={left:"auto",width:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.width()-e.prop("clientWidth"),e.css({width:h}),j[O]="translate("+(0-h)+"px, 0)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.width(),{});h[O]="translate(0px, 0)",f(c,b),e.transition(h,function(){g.css({width:"auto",left:0}),d()})},revealInRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i={right:"auto",width:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.width()-e.prop("clientWidth"),e.css({width:h}),j[O]="translate("+h+"px, 0)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.width(),{});h[O]="translate(0px, 0)",f(c,b),e.transition(h,function(){g.css({width:"auto",right:0}),d()})},revealInUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i={top:"auto",height:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.height()-e.prop("clientHeight"),e.css({height:h}),j[O]="translate(0, "+(0-h)+"px)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.height(),{});h[O]="translate(0, 0px)",f(c,b),e.transition(h,function(){g.css({height:"auto",top:0}),d()})},revealInDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i={bottom:"auto",height:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.height()-e.prop("clientHeight"),e.css({height:h}),j[O]="translate(0, "+h+"px)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.height(),{});h[O]="translate(0, 0px)",f(c,b),e.transition(h,function(){g.css({height:"auto",bottom:0}),d()})},pushPartInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i=0,j={left:"auto",width:h},k={},l={};e.css(j),h=2*e.width()-e.prop("clientWidth"),j={width:h},j[O]="translate("+h+"px, 0)",k[O]="translate(0px, 0)",l[O]="translate("+(0-h)+"px, 0)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.width(),i=0,j={},k={},l={width:"auto",left:0};j[O]="translate(0px, 0)",k[O]="translate("+h+"px, 0)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})},pushPartInRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i=0,j={right:"auto",width:h},k={},l={};e.css(j),h=2*e.width()-e.prop("clientWidth"),j={width:h},j[O]="translate("+(0-h)+"px, 0)",l[O]="translate("+h+"px, 0)",k[O]="translate(0px, 0)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.width(),i=0,j={},k={},l={width:"auto",right:0};j[O]="translate(0px, 0)",k[O]="translate("+(0-h)+"px, 0)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})},pushPartInUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i=0,j={top:"auto",height:h},k={},l={};e.css(j),h=2*e.height()-e.prop("clientHeight"),j={height:h},j[O]="translate(0, "+h+"px)",k[O]="translate(0, 0px)",l[O]="translate(0, "+(0-h)+"px)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.height(),i=0,j={},k={},l={height:"auto",top:0};j[O]="translate(0, 0px)",k[O]="translate(0, "+h+"px)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})},pushPartInDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i=0,j={bottom:"auto",height:h},k={},l={};e.css(j),h=2*e.height()-e.prop("clientHeight"),j={height:h},j[O]="translate(0, "+(0-h)+"px)",k[O]="translate(0, 0px)",l[O]="translate(0, "+h+"px)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.height(),i=0,j={},k={},l={height:"auto",bottom:0};j[O]="translate(0, 0px)",k[O]="translate(0, "+(0-h)+"px)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})}});var T=function(){var a=/^(overlay|reveal|pushPart).*$/;return function(b){return a.test(b)}}(),U=function(){var a=0;return function(){return a++}}();o.on("spa:createpage",function(b,d){o.trigger("spa:openloader");var f,g,h,i=d.hash,j=d.pushData;if(a.each(v,function(a,b){return g=new RegExp(a),g.test(i)?(f=a,h=b,!1):void(g=!1)}),c(g)){var k,l,m=h.classname?" spa-page-"+h.classname:"",n=a('
'),p=U();n.data("id",p),k={id:p,hash:i,pushData:j,requestData:e(g,i),route:f,el:n},F[p]=k,o.trigger("spa:viewcache",{view:n}),l=h.view.call(n,k),a.isPlainObject(l)&&o.trigger("spa:initpage",[n,l])}}),o.on("spa:initpage",function(b,c,d){var e=c.data("id"),f=F[e],g=v[f.route];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,b){d[b]&&(g[b]=d[b])}),f.viewData=d,o.trigger("spa:closeloader"),a(".spa-page-body",c).html(d.body),i.append(c),c.trigger("spa:openpage")}),o.on("spa:openpage",".spa-page",function(c,d){var e=a(c.currentTarget),f=e.data("id"),h=F[f],j=v[h.route],k=h.hash,l=h.pushData,p=(h.oldpushData,h.requestData,h.viewData),q=l.title||p.title,r=!1,s=l.animate||j.animate;m||(i.append('
'),m=a(".spa-page-empty"));var u=m.data("id"),x=F[u]||{};if(!l.animate&&x.prevPage&&x.prevPage.data("id")===f){var z=x.prevAnimate;z&&!a.isFunction(z)&&(s=S[z]),r=!0}var A,B;if(m.hasClass("spa-panel")){var C=w[m.data("id")];A=C.beforeclose,B=C.afterclose}else if(x.route){var D=v[x.route];A=D.beforeclose,B=D.afterclose,o.trigger("spa:navigate",{hash:k,title:q,pushData:l,replace:!0})}var E=function(){e.data("spa:init")||(e.data("spa:init",!0),j.init.call(e,h),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch")),j.afteropen.call(e,h),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",m).removeClass("spa-scroll-touch"),B&&B.call(m,x),(m.hasClass("spa-panel")||!r)&&(h.prevPage=m),m=e,h.hash!==b()?(t=!1,n.trigger("popstate")):(a.isFunction(d)&&d.call(e),t=!1)};A&&A.call(m,x),j.beforeopen.call(e,h),!r&&(h.prevAnimate=s),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch"),r||x.prevPage&&x.prevPage.css({zIndex:y}),a.isFunction(s)?s(e,m,E):g(e,m,s,E),o.trigger("spa:viewcachesort",{view:e})});var V={id:"",animate:"",classname:"",view:function(){return{body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};o.on("spa:panel",function(b,c){var d=Array.prototype.slice.call(arguments,1);return d.length>1?(a.each(d,function(a,b){o.trigger("spa:panel",b)}),!1):void(c.id&&!w[c.id]&&(w[c.id]=a.extend({},V,c)))}),o.on("spa:createpanel",function(b,c,d){var e=w[c];if(e){o.trigger("spa:openloader");var f,g,h=e.classname?" spa-panel-"+e.classname:"",i=a('
');i.data("id",c),f={id:c,pushData:d,el:i},F[c]=f,o.trigger("spa:viewcache",{view:i}),g=e.view.call(i,f),a.isPlainObject(g)&&i.trigger("spa:initpanel",[i,g])}}),o.on("spa:initpanel",function(b,c,d){var e=c.data("id"),f=F[e],g=f.pushData,h=w[e];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,b){d[b]&&(h[b]=d[b])}),f.viewData=d,a(".spa-page-body",c).html(d.body),i.append(c),o.trigger("spa:closeloader"),c.trigger("spa:openpanel",[e,g])}),o.on("spa:openpanel",function(b,c,d){if(l&&"block"===l.css("display"))return!1;var e=D[c];if(d||(d={}),e){if(t)return!1;t=!0;var f=w[c],h=d.animate||f.animate;if(m.hasClass("spa-panel")){var i=F(m.data("id")).prevPage;return i.trigger("spa:openpage",[function(){o.trigger("spa:openpanel",[c,d])}]),!1}var j=F[c];j.oldpushData=j.pushData,j.pushData=d,f.beforeopen.call(e,j);var k=function(){e.data("spa:init")||(e.data("spa:init",!0),f.init.call(e,j),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch")),f.afteropen.call(e,j),j.prevPage=m,m=e,t=!1};j.prevAnimate=h,a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch");var n=m.data("id"),p=F[n]||{};p.prevPage&&p.prevPage.css({zIndex:y}),a.isFunction(h)?h(e,m,k):g(e,m,h,k),o.trigger("spa:viewcachesort",{view:e})}else o.trigger("spa:createpanel",[c,d])}),o.on("spa:closepanel",function(b,c){var d=a(b.target),e=d.data("id"),f=F[e];if(c&&c.id&&(d=a(".spa-panel-"+c.id)),m.hasClass("spa-panel")&&m.data("id")===e){var g=f.prevPage;g.trigger("spa:openpage")}}),o.on("click touchstart",".spa-panel",function(b){var c=a(b.currentTarget),d=a(b.target);(d.hasClass("spa-page-bg")||d.hasClass("spa-panel"))&&(b.stopPropagation(),b.preventDefault(),c.trigger("spa:closepanel"))}),o.on("spa:viewcachecount",function(a,b){B=b.count}),o.on("spa:viewcache",function(b,c){var d,e,f=c.view,g=f.data("id");if(f.hasClass("spa-panel")?(d="panle",e=g,D[e]=f):(d="page",e=F[g].hash,C[e]=f),E.unshift(d+":"+e),0!==B&&E.length>B){var h,i,j,k,l=E.splice(B);a.each(l,function(b,c){h=c.split(":",2),i=h[0],j=h[1],k="page"==i?C:D,a("img",k[j]).remove(),k[j].html("").remove(),delete k[j]})}}),o.on("spa:viewcachesort",function(a,b){var c,d,e,f,g=b.view,h=g.data("id");g.hasClass("spa-panel")?(c="panle",d=h):(c="page",d=F[h].hash),e=c+":"+d,f=E.indexOf(e),-1!==f&&(E.splice(f,1),E.unshift(e))}),o.on("spa:navigate",function(b,c){var d=c.hash||"",e=c.title||"",f=c.pushData||{},g=c.replace||!1,h=c.url||"";if(e&&(document.title=e),d=h+"#"+d,g)q.replaceState(f,e,d);else{if(!m.hasClass("spa-panel")&&x.length&&"#"+x[x.length-1]===d)return;if(t)return!1;t=!0,q.pushState(f,e,d),!a.isEmptyObject(f)&&(j=f),n.trigger("popstate")}}),o.on("spa:loader",function(a,b){b.body&&(H=b.body),b.style&&(I=b.style)});var W;o.on("spa:openloader",function(){W=setTimeout(function(){W=void 0,l.show()},300)}),o.on("spa:closeloader",function(){W?(clearTimeout(W),W=void 0):l.hide()}),o.on("spa:boot",function(b,c){i=a("body"),o.trigger("spa:addstyle",G+I),i.append('
'+H+"
"),k=a(".spa-fullscreen"),o.trigger("spa:adjustfullscreen"),l=a(".spa-loader"),l.on("click select mousedown mousemove mouseup touchstart touchmove touchend",h),s=!0,n.trigger("popstate"),c&&c.callback&&c.callback()})}(window.Zepto||window.jQuery||window.$),function(){"use strict";for(var a=0,b=["ms","moz","webkit","o"],c=0;c'+c+"")}),function(){var b,c,d,e,f=function(){d=Math.max(n.height(),window.innerHeight),e=Math.max(n.width(),window.innerWidth),k.css({height:2*d}),window.scrollTo(0,0),i.data("innerHeight",window.innerHeight),d=Math.max(n.height(),window.innerHeight),k.height()!=d&&(i.css({width:e,height:d}),k.css({width:e,height:d}))};n.on("spa:adjustfullscreen"+(a.os.ios?" orientationchange":""),function(){void 0!==b&&(cancelAnimationFrame(b),b=void 0),b=requestAnimationFrame(f)}),a.os.android&&n.on("orientationchange",function(){clearTimeout(c),c=setTimeout(f,500)}),n.on("resize",function(){clearTimeout(c),c=setTimeout(f,200)})}(),o.on("spa:scroll",function(b,c){var d=a(b.target),e=c&&c.direction||"";d.addClass("spa-scroll"+(e?" spa-scroll-"+e:""))}),o.on("spa:removescroll",function(b){var c=a(b.target);c.removeClass("spa-scroll")}),r&&o.on("touchstart",".spa-scroll, .spa-scroll-x, .spa-scroll-y",function(b){var c=a(b.currentTarget),d=c.prop("scrollTop"),e=c.prop("scrollLeft"),f=c.height(),g=c.width(),h=c.prop("scrollHeight"),i=c.prop("scrollWidth");(c.hasClass("spa-scroll")||c.hasClass("spa-scroll-x"))&&(0>=e&&c.prop("scrollLeft",1),e+g>=i&&c.prop("scrollLeft",i-g-1)),(c.hasClass("spa-scroll")||c.hasClass("spa-scroll-y"))&&(0>=d&&c.prop("scrollTop",1),d+f>=h&&c.prop("scrollTop",d-1))}),n.on("scroll",function(){var a=i&&i.data("innerHeight");a&&a!==window.innerHeight&&n.trigger("spa:adjustfullscreen")}),n.on("popstate",function(a){if(s){if(l&&"block"===l.css("display"))return!1;if(m&&m.hasClass("spa-panel")){var c=m.data("id"),d=F[c],e=d.prevPage;return e.trigger("spa:openpage"),!1}var f=b();if(!x.length||x[x.length-1]!==f){x.push(f);var g=C[f],h=a.state||{};if(j&&(h=j,j=void 0),g){var i=g.data("id"),k=F[i];k.oldpushData=k.pushData,k.pushData=h,g.trigger("spa:openpage")}else o.trigger("spa:createpage",{hash:f,pushData:h})}}});var J=/\((.*?)\)/g,K=/(\(\?)?:\w+/g,L=/\*\w+/g,M=/[\-{}\[\]+?.,\\\^$|#\s]/g,N={route:"",animate:"",classname:"",view:function(){return{title:"",body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};o.on("spa:route",function(b,e){var f=Array.prototype.slice.call(arguments,1);if(f.length>1)return a.each(f,function(a,b){o.trigger("spa:route",b)}),!1;var g=e.route||"";c(g)||(g=d(g)),e.animate&&!a.isFunction(e.animate)&&T(e.animate)&&(e.animate=""),v[g]=a.extend({},N,e)});var O,P,Q,R={},S={};!function(){var a,b={"-webkit-transition":["-webkit-transform","webkitTransitionEnd"],"-moz-transition":["-moz-transform","transitionend"],"-ms-transition":["-ms-transform","msTransitionEnd"],"-o-transition":["-o-transform","oTransitionEnd"],transition:["transform","transitionend"]},c=document.createElement("div");for(a in b)if(void 0!==c.style[a])return P=a,O=b[a][0],void(Q=b[a][1])}(),a.fn.transition=function(b,c){var d=a(this);return requestAnimationFrame(function(){d.get(0).offsetWidth,b[P]="0.4s",d.css(b).emulateTransitionEnd(function(){b={},b[P]="",d.css(b),c&&c()})}),d},a.fn.emulateTransitionEnd=function(b,c){var d,e=!1,f=a(this);c=c||500,f.one(Q,function(){e=!0,clearTimeout(d),b.call(f)});var g=function(){e||f.trigger(Q)};return d=setTimeout(g,c),f},R.defaultInOut=function(a,b,c){f(b,a),c()},o.on("spa:addTransitPageAnimates",function(b,c){var d=[];a.each(c,function(a){d.push(a)}),a.each(d,function(a,b){S[b]=a%2===0?d[a+1]:d[a-1]}),a.extend(R,c)}),o.trigger("spa:addTransitPageAnimates",{fadeIn:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{opacity:0}),h={opacity:1};g.opacity=0,e.css(g),f(c,b),e.transition(h,function(){d()})},fadeOut:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={opacity:0};e.transition(g,function(){f(c,b),d()})},slideInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(100%, 0)",h[O]="translate(0%, 0)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutRight:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(100%, 0)",e.transition(g,function(){f(c,b),d()})},slideInRight:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(-100%, 0)",h[O]="translate(0%, 0)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutLeft:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(-100%, 0)",e.transition(g,function(){f(c,b),d()})},slideInUp:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(0, 100%)",h[O]="translate(0, 0%)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutDown:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(0, 100%)",e.transition(g,function(){f(c,b),d()})},slideInDown:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="translate(0, -100%)",h[O]="translate(0, 0%)",e.css(g),f(c,b),e.transition(h,function(){d()})},slideOutUp:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="translate(0, -100%)",e.transition(g,function(){f(c,b),d()})},pushInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(-100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(-100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushInRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(-100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(100%, 0)",j[O]="translate(0%, 0)",k[O]="translate(-100%, 0)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushInUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, 100%)",j[O]="translate(0%, 0)",k[O]="translate(0, -100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, -100%)",j[O]="translate(0%, 0)",k[O]="translate(0, 100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushInDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, -100%)",j[O]="translate(0%, 0)",k[O]="translate(0, 100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},pushOutUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=0,i={},j={},k={};i[O]="translate(0, 100%)",j[O]="translate(0%, 0)",k[O]="translate(0, -100%)",e.css(i),f(c,b),e.transition(j,function(){2==++h&&d()}),g.transition(k,function(){2==++h&&d()})},zoomIn:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),{}),h={};g[O]="scale(0, 0)",h[O]="scale(1, 1)",e.css(g),f(c,b),e.transition(h,function(){d()})},zoomOut:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g={};g[O]="scale(0, 0)",e.transition(g,function(){f(c,b),d()})},overlayInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().width()),h={left:"auto",width:g},i={};i[O]="translate(0px, 0)",e.css(h),g=2*g-e.prop("clientWidth"),h={width:g},h[O]="translate("+g+"px, 0)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutRight:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.width(),h={},i={width:"auto",left:0};h[O]="translate("+g+"px, 0)",e.transition(h,function(){f(c,b),e.css(i),d()})},overlayInRight:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().width()),h={right:"auto",width:g},i={};i[O]="translate(0px, 0)",e.css(h),g=2*g-e.prop("clientWidth"),h={width:g},h[O]="translate("+(0-g)+"px, 0)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutLeft:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.width(),h={},i={width:"auto",right:0};h[O]="translate("+(0-g)+"px, 0)",e.transition(h,function(){f(c,b),e.css(i),d()})},overlayInUp:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().height()),h={top:"auto",height:g},i={};i[O]="translate(0, 0px)",e.css(h),g=2*g-e.prop("clientHeight"),h={height:g},h[O]="translate(0, "+g+"px)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutDown:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.height(),h={},i={height:"auto",top:0};h[O]="translate(0, "+g+"px)",e.transition(h,function(){f(c,b),e.css(i),d()})},overlayInDown:function(b,c,d){var e=a(".spa-page-body",b),g=(a(".spa-page-body",c),e.children().height()),h={bottom:"auto",height:g},i={};i[O]="translate(0, 0px)",e.css(h),g=2*g-e.prop("clientHeight"),h={height:g},h[O]="translate(0, "+(0-g)+"px)",e.css(h),f(c,b),e.transition(i,function(){d()})},overlayOutUp:function(b,c,d){var e=(a(".spa-page-body",b),a(".spa-page-body",c)),g=e.height(),h={},i={height:"auto",bottom:0};h[O]="translate(0, "+(0-g)+"px)",e.transition(h,function(){f(c,b),e.css(i),d()})},revealInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i={left:"auto",width:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.width()-e.prop("clientWidth"),e.css({width:h}),j[O]="translate("+(0-h)+"px, 0)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.width(),{});h[O]="translate(0px, 0)",f(c,b),e.transition(h,function(){g.css({width:"auto",left:0}),d()})},revealInRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i={right:"auto",width:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.width()-e.prop("clientWidth"),e.css({width:h}),j[O]="translate("+h+"px, 0)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.width(),{});h[O]="translate(0px, 0)",f(c,b),e.transition(h,function(){g.css({width:"auto",right:0}),d()})},revealInUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i={top:"auto",height:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.height()-e.prop("clientHeight"),e.css({height:h}),j[O]="translate(0, "+(0-h)+"px)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.height(),{});h[O]="translate(0, 0px)",f(c,b),e.transition(h,function(){g.css({height:"auto",top:0}),d()})},revealInDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i={bottom:"auto",height:h},j={};i[O]="translate(0, 0)",e.css(i),h=2*e.height()-e.prop("clientHeight"),e.css({height:h}),j[O]="translate(0, "+h+"px)",f(b,c),g.transition(j,function(){f(c,b),d()})},revealOutUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=(g.height(),{});h[O]="translate(0, 0px)",f(c,b),e.transition(h,function(){g.css({height:"auto",bottom:0}),d()})},pushPartInLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i=0,j={left:"auto",width:h},k={},l={};e.css(j),h=2*e.width()-e.prop("clientWidth"),j={width:h},j[O]="translate("+h+"px, 0)",k[O]="translate(0px, 0)",l[O]="translate("+(0-h)+"px, 0)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.width(),i=0,j={},k={},l={width:"auto",left:0};j[O]="translate(0px, 0)",k[O]="translate("+h+"px, 0)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})},pushPartInRight:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().width(),i=0,j={right:"auto",width:h},k={},l={};e.css(j),h=2*e.width()-e.prop("clientWidth"),j={width:h},j[O]="translate("+(0-h)+"px, 0)",l[O]="translate("+h+"px, 0)",k[O]="translate(0px, 0)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutLeft:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.width(),i=0,j={},k={},l={width:"auto",right:0};j[O]="translate(0px, 0)",k[O]="translate("+(0-h)+"px, 0)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})},pushPartInUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i=0,j={top:"auto",height:h},k={},l={};e.css(j),h=2*e.height()-e.prop("clientHeight"),j={height:h},j[O]="translate(0, "+h+"px)",k[O]="translate(0, 0px)",l[O]="translate(0, "+(0-h)+"px)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.height(),i=0,j={},k={},l={height:"auto",top:0};j[O]="translate(0, 0px)",k[O]="translate(0, "+h+"px)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})},pushPartInDown:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=e.children().height(),i=0,j={bottom:"auto",height:h},k={},l={};e.css(j),h=2*e.height()-e.prop("clientHeight"),j={height:h},j[O]="translate(0, "+(0-h)+"px)",k[O]="translate(0, 0px)",l[O]="translate(0, "+h+"px)",e.css(j),f(c,b),e.transition(k,function(){2==++i&&d()}),g.transition(l,function(){2==++i&&d()})},pushPartOutUp:function(b,c,d){var e=a(".spa-page-body",b),g=a(".spa-page-body",c),h=g.height(),i=0,j={},k={},l={height:"auto",bottom:0};j[O]="translate(0, 0px)",k[O]="translate(0, "+(0-h)+"px)",f(c,b),e.transition(j,function(){2==++i&&d()}),g.transition(k,function(){g.css(l),2==++i&&d()})}});var T=function(){var a=/^(overlay|reveal|pushPart).*$/;return function(b){return a.test(b)}}(),U=function(){var a=0;return function(){return a++}}();o.on("spa:createpage",function(b,d){o.trigger("spa:openloader");var f,g,h,i=d.hash,j=d.pushData;if(a.each(v,function(a,b){return g=new RegExp(a),g.test(i)?(f=a,h=b,!1):void(g=!1)}),c(g)){var k,l,m=h.classname?" spa-page-"+h.classname:"",n=a('
'),p=U();n.data("id",p),k={id:p,hash:i,pushData:j,requestData:e(g,i),route:f,el:n},F[p]=k,o.trigger("spa:viewcache",{view:n}),l=h.view.call(n,k),a.isPlainObject(l)&&o.trigger("spa:initpage",[n,l])}}),o.on("spa:initpage",function(b,c,d){var e=c.data("id"),f=F[e],g=v[f.route];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,b){d[b]&&(g[b]=d[b])}),f.viewData=d,o.trigger("spa:closeloader"),a(".spa-page-body",c).html(d.body),i.append(c),c.trigger("spa:openpage")}),o.on("spa:openpage",".spa-page",function(c,d){var e=a(c.currentTarget),f=e.data("id"),h=F[f],j=v[h.route],k=h.hash,l=h.pushData,p=(h.oldpushData,h.requestData,h.viewData),q=l.title||p.title,r=!1,s=l.animate||j.animate;m||(i.append('
'),m=a(".spa-page-empty"));var u=m.data("id"),x=F[u]||{};if(!l.animate&&x.prevPage&&x.prevPage.data("id")===f){var z=x.prevAnimate;z&&!a.isFunction(z)&&(s=S[z]),r=!0}var A,B;if(m.hasClass("spa-panel")){var C=w[m.data("id")];A=C.beforeclose,B=C.afterclose}else if(x.route){var D=v[x.route];A=D.beforeclose,B=D.afterclose,o.trigger("spa:navigate",{hash:k,title:q,pushData:l,replace:!0})}var E=function(){e.data("spa:init")||(e.data("spa:init",!0),j.init.call(e,h),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch")),j.afteropen.call(e,h),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",m).removeClass("spa-scroll-touch"),B&&B.call(m,x),(m.hasClass("spa-panel")||!r)&&(h.prevPage=m),m=e,h.hash!==b()?(t=!1,n.trigger("popstate")):(a.isFunction(d)&&d.call(e),t=!1)};A&&A.call(m,x),j.beforeopen.call(e,h),!r&&(h.prevAnimate=s),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch"),r||x.prevPage&&x.prevPage.css({zIndex:y}),a.isFunction(s)?s(e,m,E):g(e,m,s,E),o.trigger("spa:viewcachesort",{view:e})});var V={id:"",animate:"",classname:"",view:function(){return{body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};o.on("spa:panel",function(b,c){var d=Array.prototype.slice.call(arguments,1);return d.length>1?(a.each(d,function(a,b){o.trigger("spa:panel",b)}),!1):void(c.id&&!w[c.id]&&(w[c.id]=a.extend({},V,c)))}),o.on("spa:createpanel",function(b,c,d){var e=w[c];if(e){o.trigger("spa:openloader");var f,g,h=e.classname?" spa-panel-"+e.classname:"",i=a('
');i.data("id",c),f={id:c,pushData:d,el:i},F[c]=f,o.trigger("spa:viewcache",{view:i}),g=e.view.call(i,f),a.isPlainObject(g)&&i.trigger("spa:initpanel",[i,g])}}),o.on("spa:initpanel",function(b,c,d){var e=c.data("id"),f=F[e],g=f.pushData,h=w[e];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,b){d[b]&&(h[b]=d[b])}),f.viewData=d,a(".spa-page-body",c).html(d.body),i.append(c),o.trigger("spa:closeloader"),c.trigger("spa:openpanel",[e,g])}),o.on("spa:openpanel",function(b,c,d){if(l&&"block"===l.css("display"))return!1;var e=D[c];if(d||(d={}),e){if(t)return!1;t=!0;var f=w[c],h=d.animate||f.animate;if(m.hasClass("spa-panel")){var i=F(m.data("id")).prevPage;return i.trigger("spa:openpage",[function(){o.trigger("spa:openpanel",[c,d])}]),!1}var j=F[c];j.oldpushData=j.pushData,j.pushData=d,f.beforeopen.call(e,j);var k=function(){e.data("spa:init")||(e.data("spa:init",!0),f.init.call(e,j),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch")),f.afteropen.call(e,j),j.prevPage=m,m=e,t=!1};j.prevAnimate=h,a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",e).addClass("spa-scroll-touch");var n=m.data("id"),p=F[n]||{};p.prevPage&&p.prevPage.css({zIndex:y}),a.isFunction(h)?h(e,m,k):g(e,m,h,k),o.trigger("spa:viewcachesort",{view:e})}else o.trigger("spa:createpanel",[c,d])}),o.on("spa:closepanel",function(b,c){var d=a(b.target),e=d.data("id"),f=F[e];if(c&&c.id&&(d=a(".spa-panel-"+c.id)),m.hasClass("spa-panel")&&m.data("id")===e){var g=f.prevPage;g.trigger("spa:openpage")}}),o.on("click touchstart",".spa-panel",function(b){var c=a(b.currentTarget),d=a(b.target);(d.hasClass("spa-page-bg")||d.hasClass("spa-panel"))&&(b.stopPropagation(),b.preventDefault(),c.trigger("spa:closepanel"))}),o.on("spa:viewcachecount",function(a,b){B=b.count}),o.on("spa:viewcache",function(b,c){var d,e,f=c.view,g=f.data("id");if(f.hasClass("spa-panel")?(d="panle",e=g,D[e]=f):(d="page",e=F[g].hash,C[e]=f),E.unshift(d+":"+e),0!==B&&E.length>B){var h,i,j,k,l=E.splice(B);a.each(l,function(b,c){h=c.split(":",2),i=h[0],j=h[1],k="page"==i?C:D,a("img",k[j]).remove(),k[j].html("").remove(),delete k[j]})}}),o.on("spa:viewcachesort",function(a,b){var c,d,e,f,g=b.view,h=g.data("id");g.hasClass("spa-panel")?(c="panle",d=h):(c="page",d=F[h].hash),e=c+":"+d,f=E.indexOf(e),-1!==f&&(E.splice(f,1),E.unshift(e))}),o.on("spa:navigate",function(b,c){var d=c.hash||"",e=c.title||"",f=c.pushData||{},g=c.replace||!1,h=c.url||"";if(e&&(document.title=e),d=h+"#"+d,g)q.replaceState(f,e,d);else{if(!m.hasClass("spa-panel")&&x.length&&"#"+x[x.length-1]===d)return;if(t)return!1;t=!0,q.pushState(f,e,d),!a.isEmptyObject(f)&&(j=f),n.trigger("popstate")}}),o.on("spa:loader",function(a,b){b.body&&(H=b.body),b.style&&(I=b.style)});var W;o.on("spa:openloader",function(){W=setTimeout(function(){W=void 0,l.show()},300)}),o.on("spa:closeloader",function(){W?(clearTimeout(W),W=void 0):l.hide()}),o.on("spa:boot",function(b,c){i=a("body"),o.trigger("spa:addstyle",G+I),i.append('
'+H+"
"),k=a(".spa-fullscreen"),o.trigger("spa:adjustfullscreen"),l=a(".spa-loader"),l.on("click select mousedown mousemove mouseup touchstart touchmove touchend",h),s=!0,n.trigger("popstate"),c&&c.callback&&c.callback()})}(window.Zepto||window.jQuery||window.$),function(){"use strict";for(var a=0,b=["ms","moz","webkit","o"],c=0;c