diff --git a/dist/spa-apis.js b/dist/spa-apis.js index 7613283..cb92cad 100644 --- a/dist/spa-apis.js +++ b/dist/spa-apis.js @@ -1,5 +1,5 @@ /*! - * SPA v2.0.4 + * SPA v2.0.5 * A webapp framework for routing control and view transitions * Copyright 2016 zhaoda * Licensed under MIT @@ -110,7 +110,7 @@ } // 设置版本号,先留空,打包时会自动添加 - $.spa.version = '2.0.4' + $.spa.version = '2.0.5' /* * 插入样式 @@ -1859,7 +1859,7 @@ pagescache[key] = $view } - viewscache.unshift(type + ':' + key) + viewscache.unshift(type + ':' + encodeURIComponent(key)) // 再清理 if(viewcachecount !== 0 && viewscache.length > viewcachecount) { @@ -1872,7 +1872,7 @@ $.each(cleanup, function(index, value) { cleanupsplit = value.split(':', 2) cleanuptype = cleanupsplit[0] - cleanupkey = cleanupsplit[1] + cleanupkey = decodeURIComponent(cleanupsplit[1]) cleanupcache = cleanuptype == 'page' ? pagescache : panelscache $('img', cleanupcache[cleanupkey]).remove() @@ -1903,7 +1903,7 @@ key = viewsdata[viewId].hash } - name = type + ':' + key + name = type + ':' + encodeURIComponent(key) index = viewscache.indexOf(name) if(index !== -1) { diff --git a/dist/spa-apis.min.js b/dist/spa-apis.min.js index a15beee..5b8d969 100644 --- a/dist/spa-apis.min.js +++ b/dist/spa-apis.min.js @@ -1,8 +1,8 @@ /*! - * SPA v2.0.4 + * SPA v2.0.5 * A webapp framework for routing control and view transitions * Copyright 2016 zhaoda * Licensed under MIT */ -!function(a){"use strict";function t(a){return a=a||T.href,a.replace(/^[^#]*#?\/?(.*)\/?$/,"$1")}function e(a){return"[object RegExp]"==Object.prototype.toString.call(a)}function n(a){return a=a.replace(M,"\\$&").replace(q,"(?:$1)?").replace(W,function(a,t){return t?a:"([^/]+)"}).replace(_,"(.*?)"),"^"+a+"$"}function i(t,e){var n=t.exec(e).slice(1),i=[];return a.each(n,function(a,t){t&&i.push(decodeURIComponent(t))}),i}function s(a,t){S[a.data("id")],S[t.data("id")];a.css({zIndex:$}),t.css({zIndex:z})}function o(t,e,n,i){var s=a(".spa-page-body",t),o=(a(".spa-page-body",e),{});!B&&(n="defaultInOut"),J[n]||(n="defaultInOut"),k&&(k=!1,n="defaultInOut"),o.opacity=1,!K(n)&&B&&(o[B]="translate(0, 0) scale(1, 1)"),s.css(o),G[n].apply(t,[t,e,i])}function r(a){a.stopPropagation(),a.preventDefault()}if(!a.os){var p={},l=navigator.userAgent,c=(navigator.platform,l.match(/(Android);?[\s\/]+([\d.]+)?/)),u=l.match(/(iPad).*OS\s([\d_]+)/),d=l.match(/(iPod)(.*OS\s([\d_]+))?/),g=!u&&l.match(/(iPhone\sOS)\s([\d_]+)/);c&&(p.android=!0,p.version=c[2]),g&&!d&&(p.ios=p.iphone=!0,p.version=g[2].replace(/_/g,".")),u&&(p.ios=p.ipad=!0,p.version=u[2].replace(/_/g,".")),d&&(p.ios=p.ipod=!0,p.version=d[3]?d[3].replace(/_/g,"."):null),a.os=p}var f,h,m,v,b,y=a(window),w=a(document),T=window.location,x=window.history,I=!1,P=!1,k=!0,D={},O={},C=[],A=2e3,$=2001,z=2002,F=0,L={},R={},E=[],S={},H="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); -webkit-backface-visibility: hidden; -webkit-transform-style: preserve-3d;} .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); -webkit-backface-visibility: hidden; -webkit-transform-style: preserve-3d;} .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; }",U='
',j=".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 S[a.data("id")]},a.spa.getCurPage=function(){return b},a.spa.version="2.0.4",w.on("spa:addstyle",function(t,e){a("head").append('")}),function(){var t,e,n,i,s=function(){n=Math.max(y.height(),window.innerHeight),i=Math.max(y.width(),window.innerWidth),m.css({height:2*n}),window.scrollTo(0,0),f.data("innerHeight",window.innerHeight),n=Math.max(y.height(),window.innerHeight),m.height()!=n&&(f.css({width:i,height:n}),m.css({width:i,height:n}))};y.on("spa:adjustfullscreen"+(a.os.ios?" orientationchange":""),function(a){void 0!==t&&(cancelAnimationFrame(t),t=void 0),t=requestAnimationFrame(s)}),a.os.android&&y.on("orientationchange",function(a){clearTimeout(e),e=setTimeout(s,500)}),y.on("resize",function(a){clearTimeout(e),e=setTimeout(s,200)})}(),w.on("spa:scroll",function(t,e){var n=a(t.target),i=e&&e.direction||"";n.addClass("spa-scroll"+(i?" spa-scroll-"+i:""))}),w.on("spa:removescroll",function(t,e){var n=a(t.target);n.removeClass("spa-scroll spa-scroll-x spa-scroll-y")}),a.os.ios&&w.on("touchstart",".spa-scroll, .spa-scroll-x, .spa-scroll-y",function(t){var e=a(t.currentTarget),n=e.prop("scrollTop"),i=e.prop("scrollLeft"),s=e.height(),o=e.width(),r=e.prop("scrollHeight"),p=e.prop("scrollWidth");(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-x"))&&(i<=0&&e.prop("scrollLeft",1),i+o>=p&&e.prop("scrollLeft",p-o-1)),(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-y"))&&(n<=0&&e.prop("scrollTop",1),n+s>=r&&e.prop("scrollTop",n-1))}),y.on("popstate",function(a){if(I){if(v&&"block"===v.css("display"))return!1;if(b&&b.hasClass("spa-panel")){var e=b.data("id"),n=S[e],i=n.prevPage;return i.trigger("spa:openpage"),!1}var s=t();if(!C.length||C[C.length-1]!==s){C.push(s);var o=L[s],r=a.state||{};if(h&&(r=h,h=void 0),o){var p=o.data("id"),l=S[p];l.oldpushData=l.pushData,l.pushData=r,o.trigger("spa:openpage")}else w.trigger("spa:createpage",{hash:s,pushData:r})}}});var q=/\((.*?)\)/g,W=/(\(\?)?:\w+/g,_=/\*\w+/g,M=/[\-{}\[\]+?.,\\\^$|#\s]/g,Z={route:"",animate:"",classname:"",view:function(){return{title:"",body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:route",function(t,i){var s=Array.prototype.slice.call(arguments,1);if(s.length>1)return a.each(s,function(a,t){w.trigger("spa:route",t)}),!1;var o=i.route||"";e(o)||(o=n(o)),i.animate&&!a.isFunction(i.animate)&&K(i.animate)&&(i.animate=""),D[o]=a.extend({},Z,i)});var B,Q,V,G={},J={};!function(){var a,t={"-webkit-transition":["-webkit-transform","webkitTransitionEnd"],"-moz-transition":["-moz-transform","transitionend"],"-ms-transition":["-ms-transform","msTransitionEnd"],"-o-transition":["-o-transform","oTransitionEnd"],transition:["transform","transitionend"]},e=document.createElement("div");for(a in t)if(void 0!==e.style[a]){Q=a,B=t[a][0],V=t[a][1];break}}(),a.fn.emulateTransition=function(t,e){var n=a(this);return requestAnimationFrame(function(){n.get(0).offsetWidth,t[Q]="0.4s",n.css(t).emulateTransitionEndBySpa(function(){t={},t[Q]="",n.css(t),e&&e()})}),n},a.fn.transition||(a.fn.transition=a.fn.emulateTransition),a.fn.emulateTransitionEndBySpa=function(t,e){var n,i=!1,s=a(this);e=e||500,s.one(V,function(){i=!0,clearTimeout(n),t.call(s)});var o=function(){i||s.trigger(V)};return n=setTimeout(o,e),s},G.defaultInOut=function(a,t,e){s(t,a),e()},w.on("spa:addTransitPageAnimates",function(t,e){var n=[];a.each(e,function(a,t){n.push(a)}),a.each(n,function(a,t){a%2===0?J[t]=n[a+1]:J[t]=n[a-1]}),a.extend(G,e)}),w.trigger("spa:addTransitPageAnimates",{fadeIn:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{opacity:0}),r={opacity:1};o.opacity=0,i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},fadeOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={opacity:0};i.emulateTransition(o,function(){s(e,t),n()})},slideInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(100%, 0)",r[B]="translate(0%, 0)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(100%, 0)",i.emulateTransition(o,function(){s(e,t),n()})},slideInRight:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(-100%, 0)",r[B]="translate(0%, 0)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(-100%, 0)",i.emulateTransition(o,function(){s(e,t),n()})},slideInUp:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(0, 100%)",r[B]="translate(0, 0%)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(0, 100%)",i.emulateTransition(o,function(){s(e,t),n()})},slideInDown:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(0, -100%)",r[B]="translate(0, 0%)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(0, -100%)",i.emulateTransition(o,function(){s(e,t),n()})},pushInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushInRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushInUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushInDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},zoomIn:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="scale(0, 0)",r[B]="scale(1, 1)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},zoomOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="scale(0, 0)",i.emulateTransition(o,function(){s(e,t),n()})},overlayInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().width()),r={left:"auto",width:o},p={};p[B]="translate(0px, 0)",i.css(r),o=2*o-i.prop("clientWidth"),r={width:o},r[B]="translate("+o+"px, 0)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.width(),r={},p={width:"auto",left:0};r[B]="translate("+o+"px, 0)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},overlayInRight:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().width()),r={right:"auto",width:o},p={};p[B]="translate(0px, 0)",i.css(r),o=2*o-i.prop("clientWidth"),r={width:o},r[B]="translate("+(0-o)+"px, 0)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.width(),r={},p={width:"auto",right:0};r[B]="translate("+(0-o)+"px, 0)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},overlayInUp:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().height()),r={top:"auto",height:o},p={};p[B]="translate(0, 0px)",i.css(r),o=2*o-i.prop("clientHeight"),r={height:o},r[B]="translate(0, "+o+"px)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.height(),r={},p={height:"auto",top:0};r[B]="translate(0, "+o+"px)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},overlayInDown:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().height()),r={bottom:"auto",height:o},p={};p[B]="translate(0, 0px)",i.css(r),o=2*o-i.prop("clientHeight"),r={height:o},r[B]="translate(0, "+(0-o)+"px)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.height(),r={},p={height:"auto",bottom:0};r[B]="translate(0, "+(0-o)+"px)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},revealInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p={left:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+(0-r)+"px, 0)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.width(),{});r[B]="translate(0px, 0)",s(e,t),i.emulateTransition(r,function(){o.css({width:"auto",left:0}),n()})},revealInRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p={right:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+r+"px, 0)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.width(),{});r[B]="translate(0px, 0)",s(e,t),i.emulateTransition(r,function(){o.css({width:"auto",right:0}),n()})},revealInUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p={top:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+(0-r)+"px)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.height(),{});r[B]="translate(0, 0px)",s(e,t),i.emulateTransition(r,function(){o.css({height:"auto",top:0}),n()})},revealInDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p={bottom:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+r+"px)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.height(),{});r[B]="translate(0, 0px)",s(e,t),i.emulateTransition(r,function(){o.css({height:"auto",bottom:0}),n()})},pushPartInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p=0,l={left:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",u[B]="translate("+(0-r)+"px, 0)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.width(),p=0,l={},c={},u={width:"auto",left:0};l[B]="translate(0px, 0)",c[B]="translate("+r+"px, 0)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})},pushPartInRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p=0,l={right:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+(0-r)+"px, 0)",u[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.width(),p=0,l={},c={},u={width:"auto",right:0};l[B]="translate(0px, 0)",c[B]="translate("+(0-r)+"px, 0)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})},pushPartInUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p=0,l={top:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+r+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+(0-r)+"px)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.height(),p=0,l={},c={},u={height:"auto",top:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+r+"px)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})},pushPartInDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p=0,l={bottom:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+(0-r)+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+r+"px)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.height(),p=0,l={},c={},u={height:"auto",bottom:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+(0-r)+"px)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})}});var K=function(){var a=/^(overlay|reveal|pushPart).*$/;return function(t){return a.test(t)}}(),N=function(){var a=0;return function(){return a++}}();w.on("spa:createpage",function(t,n){w.trigger("spa:openloader");var s,o,r,p=n.hash,l=n.pushData;if(a.each(D,function(a,t){return o=new RegExp(a),o.test(p)?(s=a,r=t,!1):void(o=!1)}),e(o)){var c,u,d=(r.classname?" spa-page-"+r.classname:"")+(r.nocache?" no-cache":""),g=a('
'),f=N();g.data("id",f),c={id:f,hash:p,pushData:l,requestData:i(o,p),route:s,el:g},S[f]=c,!r.nocache&&w.trigger("spa:viewcache",{view:g}),u=r.view.call(g,c),a.isPlainObject(u)&&w.trigger("spa:initpage",[g,u])}}),w.on("spa:initpage",function(t,e,n){var i=e.data("id"),s=S[i],o=D[s.route];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(o[t]=n[t])}),s.viewData=n,w.trigger("spa:closeloader"),a(".spa-page-body",e).html(n.body),f.append(e),e.trigger("spa:openpage")}),w.on("spa:openpage",".spa-page",function(e,n){var i=a(e.currentTarget),s=i.data("id"),r=S[s],p=D[r.route],l=r.hash,c=r.pushData,u=(r.oldpushData,r.requestData,r.viewData),d=c.title||u.title,g=!1,h=c.animate||p.animate;b||(f.append('
'),b=a(".spa-page-empty"));var m=b.data("id"),v=S[m]||{};if(!c.animate&&v.prevPage&&v.prevPage.data("id")===s){var T=v.prevAnimate;T&&!a.isFunction(T)&&(h=J[T]),g=!0}var x,I;if(b.hasClass("spa-panel")){var k=O[b.data("id")];x=k.beforeclose,I=k.afterclose}else if(v.route){var C=D[v.route];x=C.beforeclose,I=C.afterclose,w.trigger("spa:navigate",{hash:l,title:d,pushData:c,replace:!0})}var z=function(){i.data("spa:init")||(i.data("spa:init",!0),p.init.call(i,r),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch")),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",b).removeClass("spa-scroll-touch"),I&&I.call(b,v),b.hasClass("no-cache")&&b.remove(),b.hasClass("spa-panel")?(b.css({zIndex:A}),r.prevPage&&r.prevPage.css({zIndex:$})):g||(r.prevPage=b),p.afteropen.call(i,r),b=i,r.hash!==t()?(P=!1,y.trigger("popstate")):(a.isFunction(n)&&n.call(i),P=!1)};x&&x.call(b,v),p.beforeopen.call(i,r),!g&&(r.prevAnimate=h),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch"),g||v.prevPage&&v.prevPage.css({zIndex:A}),a.isFunction(h)?h(i,b,z):o(i,b,h,z),w.trigger("spa:viewcachesort",{view:i})});var X={id:"",animate:"",classname:"",view:function(){return{body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:panel",function(t,e){var n=Array.prototype.slice.call(arguments,1);return n.length>1?(a.each(n,function(a,t){w.trigger("spa:panel",t)}),!1):void(e.id&&!O[e.id]&&(O[e.id]=a.extend({},X,e)))}),w.on("spa:createpanel",function(t,e,n){var i=O[e];if(i){w.trigger("spa:openloader");var s,o,r=i.classname?" spa-panel-"+i.classname:"",p=a('
');p.data("id",e),s={id:e,pushData:n,el:p},S[e]=s,w.trigger("spa:viewcache",{view:p}),o=i.view.call(p,s),a.isPlainObject(o)&&w.trigger("spa:initpanel",[p,o])}}),w.on("spa:initpanel",function(t,e,n){var i=e.data("id"),s=S[i],o=s.pushData,r=O[i];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(r[t]=n[t])}),s.viewData=n,a(".spa-page-body",e).html(n.body),f.append(e),w.trigger("spa:closeloader"),e.trigger("spa:openpanel",[i,o])}),w.on("spa:openpanel",function(t,e,n){if(v&&"block"===v.css("display"))return!1;var i=R[e];if(n||(n={}),i){if(P)return!1;P=!0;var s=O[e],r=n.animate||s.animate;if(b.hasClass("spa-panel")){var p=S[b.data("id")].prevPage;return p.trigger("spa:openpage",[function(){w.trigger("spa:openpanel",[e,n])}]),!1}var l=S[e];l.oldpushData=l.pushData,l.pushData=n,s.beforeopen.call(i,l);var c=function(){i.data("spa:init")||(i.data("spa:init",!0),s.init.call(i,l),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&setTimeout(function(){a(".spa-scroll",i).addClass("spa-scroll-touch")},17)),i.data("closing",!1),l.prevPage=b,s.afteropen.call(i,l),b=i,P=!1};l.prevAnimate=r,a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch");var u=b.data("id"),d=S[u]||{};d.prevPage&&d.prevPage.css({zIndex:A}),a.isFunction(r)?r(i,b,c):o(i,b,r,c),w.trigger("spa:viewcachesort",{view:i})}else w.trigger("spa:createpanel",[e,n])}),w.on("spa:closepanel",function(t,e){var n=a(t.target),i=n.data("id"),s=S[i];if(e&&e.id&&(n=a(".spa-panel-"+e.id)),!n.data("closing")&&(n.data("closing",!0),b.hasClass("spa-panel")&&b.data("id")===i)){var o=s.prevPage;o.trigger("spa:openpage")}}),w.on("click touchstart",".spa-panel",function(t){var e=a(t.currentTarget),n=a(t.target);(n.hasClass("spa-page-bg")||n.hasClass("spa-panel"))&&(t.stopPropagation(),t.preventDefault(),e.trigger("spa:closepanel"))}),w.on("spa:viewcachecount",function(a,t){t.count=1===t.count?2:t.count,F=t.count}),w.on("spa:viewcache",function(t,e){var n,i,s=e.view,o=s.data("id");if(s.hasClass("spa-panel")?(n="panel",i=o,R[i]=s):(n="page",i=S[o].hash,L[i]=s),E.unshift(n+":"+i),0!==F&&E.length>F){var r,p,l,c,u=E.splice(F);a.each(u,function(t,e){r=e.split(":",2),p=r[0],l=r[1],c="page"==p?L:R,a("img",c[l]).remove(),c[l].html("").remove(),delete c[l]})}}),w.on("spa:viewcachesort",function(a,t){var e,n,i,s,o=t.view,r=o.data("id");o.hasClass("spa-panel")?(e="panel",n=r):(e="page",n=S[r].hash),i=e+":"+n,s=E.indexOf(i),s!==-1&&(E.splice(s,1),E.unshift(i))}),w.on("spa:navigate",function(t,e){var n=e.hash||"",i=e.title||"",s=e.pushData||{},o=e.replace||!1,r=e.url||"";if(i&&(document.title=i),n=r+"#"+n,o)x.replaceState(s,i,n);else{if(!b.hasClass("spa-panel")&&C.length&&"#"+C[C.length-1]===n)return;if(P)return!1;P=!0,x.pushState(s,i,n),!a.isEmptyObject(s)&&(h=s),y.trigger("popstate")}}),w.on("spa:loader",function(a,t){t.body&&(U=t.body),t.style&&(j=t.style)});var Y;w.on("spa:openloader",function(a){Y=setTimeout(function(){Y=void 0,v.show()},300)}),w.on("spa:closeloader",function(a){Y?(clearTimeout(Y),Y=void 0):v.hide()}),w.on("spa:boot",function(t,e){f=a("body"),w.trigger("spa:addstyle",H+j),f.append('
'+U+"
"),m=a(".spa-fullscreen"),w.trigger("spa:adjustfullscreen"),v=a(".spa-loader"),v.on("click select mousedown mousemove mouseup touchstart touchmove touchend",r),I=!0,y.trigger("popstate"),e&&e.callback&&e.callback()})}(window.Zepto||window.jQuery||window.$),function(){"use strict";for(var a=0,t=["ms","moz","webkit","o"],e=0;e'+e+"")}),function(){var t,e,n,i,o=function(){n=Math.max(y.height(),window.innerHeight),i=Math.max(y.width(),window.innerWidth),m.css({height:2*n}),window.scrollTo(0,0),f.data("innerHeight",window.innerHeight),n=Math.max(y.height(),window.innerHeight),m.height()!=n&&(f.css({width:i,height:n}),m.css({width:i,height:n}))};y.on("spa:adjustfullscreen"+(a.os.ios?" orientationchange":""),function(a){void 0!==t&&(cancelAnimationFrame(t),t=void 0),t=requestAnimationFrame(o)}),a.os.android&&y.on("orientationchange",function(a){clearTimeout(e),e=setTimeout(o,500)}),y.on("resize",function(a){clearTimeout(e),e=setTimeout(o,200)})}(),w.on("spa:scroll",function(t,e){var n=a(t.target),i=e&&e.direction||"";n.addClass("spa-scroll"+(i?" spa-scroll-"+i:""))}),w.on("spa:removescroll",function(t,e){var n=a(t.target);n.removeClass("spa-scroll spa-scroll-x spa-scroll-y")}),a.os.ios&&w.on("touchstart",".spa-scroll, .spa-scroll-x, .spa-scroll-y",function(t){var e=a(t.currentTarget),n=e.prop("scrollTop"),i=e.prop("scrollLeft"),o=e.height(),s=e.width(),r=e.prop("scrollHeight"),p=e.prop("scrollWidth");(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-x"))&&(i<=0&&e.prop("scrollLeft",1),i+s>=p&&e.prop("scrollLeft",p-s-1)),(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-y"))&&(n<=0&&e.prop("scrollTop",1),n+o>=r&&e.prop("scrollTop",n-1))}),y.on("popstate",function(a){if(I){if(v&&"block"===v.css("display"))return!1;if(b&&b.hasClass("spa-panel")){var e=b.data("id"),n=U[e],i=n.prevPage;return i.trigger("spa:openpage"),!1}var o=t();if(!C.length||C[C.length-1]!==o){C.push(o);var s=F[o],r=a.state||{};if(h&&(r=h,h=void 0),s){var p=s.data("id"),l=U[p];l.oldpushData=l.pushData,l.pushData=r,s.trigger("spa:openpage")}else w.trigger("spa:createpage",{hash:o,pushData:r})}}});var q=/\((.*?)\)/g,W=/(\(\?)?:\w+/g,_=/\*\w+/g,M=/[\-{}\[\]+?.,\\\^$|#\s]/g,Z={route:"",animate:"",classname:"",view:function(){return{title:"",body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:route",function(t,i){var o=Array.prototype.slice.call(arguments,1);if(o.length>1)return a.each(o,function(a,t){w.trigger("spa:route",t)}),!1;var s=i.route||"";e(s)||(s=n(s)),i.animate&&!a.isFunction(i.animate)&&K(i.animate)&&(i.animate=""),D[s]=a.extend({},Z,i)});var B,Q,V,G={},J={};!function(){var a,t={"-webkit-transition":["-webkit-transform","webkitTransitionEnd"],"-moz-transition":["-moz-transform","transitionend"],"-ms-transition":["-ms-transform","msTransitionEnd"],"-o-transition":["-o-transform","oTransitionEnd"],transition:["transform","transitionend"]},e=document.createElement("div");for(a in t)if(void 0!==e.style[a]){Q=a,B=t[a][0],V=t[a][1];break}}(),a.fn.emulateTransition=function(t,e){var n=a(this);return requestAnimationFrame(function(){n.get(0).offsetWidth,t[Q]="0.4s",n.css(t).emulateTransitionEndBySpa(function(){t={},t[Q]="",n.css(t),e&&e()})}),n},a.fn.transition||(a.fn.transition=a.fn.emulateTransition),a.fn.emulateTransitionEndBySpa=function(t,e){var n,i=!1,o=a(this);e=e||500,o.one(V,function(){i=!0,clearTimeout(n),t.call(o)});var s=function(){i||o.trigger(V)};return n=setTimeout(s,e),o},G.defaultInOut=function(a,t,e){o(t,a),e()},w.on("spa:addTransitPageAnimates",function(t,e){var n=[];a.each(e,function(a,t){n.push(a)}),a.each(n,function(a,t){a%2===0?J[t]=n[a+1]:J[t]=n[a-1]}),a.extend(G,e)}),w.trigger("spa:addTransitPageAnimates",{fadeIn:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{opacity:0}),r={opacity:1};s.opacity=0,i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},fadeOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={opacity:0};i.emulateTransition(s,function(){o(e,t),n()})},slideInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(100%, 0)",r[B]="translate(0%, 0)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(100%, 0)",i.emulateTransition(s,function(){o(e,t),n()})},slideInRight:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(-100%, 0)",r[B]="translate(0%, 0)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(-100%, 0)",i.emulateTransition(s,function(){o(e,t),n()})},slideInUp:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(0, 100%)",r[B]="translate(0, 0%)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(0, 100%)",i.emulateTransition(s,function(){o(e,t),n()})},slideInDown:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(0, -100%)",r[B]="translate(0, 0%)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(0, -100%)",i.emulateTransition(s,function(){o(e,t),n()})},pushInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushInRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushInUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushInDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},zoomIn:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="scale(0, 0)",r[B]="scale(1, 1)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},zoomOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="scale(0, 0)",i.emulateTransition(s,function(){o(e,t),n()})},overlayInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().width()),r={left:"auto",width:s},p={};p[B]="translate(0px, 0)",i.css(r),s=2*s-i.prop("clientWidth"),r={width:s},r[B]="translate("+s+"px, 0)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.width(),r={},p={width:"auto",left:0};r[B]="translate("+s+"px, 0)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},overlayInRight:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().width()),r={right:"auto",width:s},p={};p[B]="translate(0px, 0)",i.css(r),s=2*s-i.prop("clientWidth"),r={width:s},r[B]="translate("+(0-s)+"px, 0)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.width(),r={},p={width:"auto",right:0};r[B]="translate("+(0-s)+"px, 0)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},overlayInUp:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().height()),r={top:"auto",height:s},p={};p[B]="translate(0, 0px)",i.css(r),s=2*s-i.prop("clientHeight"),r={height:s},r[B]="translate(0, "+s+"px)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.height(),r={},p={height:"auto",top:0};r[B]="translate(0, "+s+"px)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},overlayInDown:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().height()),r={bottom:"auto",height:s},p={};p[B]="translate(0, 0px)",i.css(r),s=2*s-i.prop("clientHeight"),r={height:s},r[B]="translate(0, "+(0-s)+"px)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.height(),r={},p={height:"auto",bottom:0};r[B]="translate(0, "+(0-s)+"px)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},revealInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p={left:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+(0-r)+"px, 0)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.width(),{});r[B]="translate(0px, 0)",o(e,t),i.emulateTransition(r,function(){s.css({width:"auto",left:0}),n()})},revealInRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p={right:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+r+"px, 0)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.width(),{});r[B]="translate(0px, 0)",o(e,t),i.emulateTransition(r,function(){s.css({width:"auto",right:0}),n()})},revealInUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p={top:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+(0-r)+"px)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.height(),{});r[B]="translate(0, 0px)",o(e,t),i.emulateTransition(r,function(){s.css({height:"auto",top:0}),n()})},revealInDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p={bottom:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+r+"px)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.height(),{});r[B]="translate(0, 0px)",o(e,t),i.emulateTransition(r,function(){s.css({height:"auto",bottom:0}),n()})},pushPartInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p=0,l={left:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",u[B]="translate("+(0-r)+"px, 0)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.width(),p=0,l={},c={},u={width:"auto",left:0};l[B]="translate(0px, 0)",c[B]="translate("+r+"px, 0)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})},pushPartInRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p=0,l={right:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+(0-r)+"px, 0)",u[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.width(),p=0,l={},c={},u={width:"auto",right:0};l[B]="translate(0px, 0)",c[B]="translate("+(0-r)+"px, 0)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})},pushPartInUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p=0,l={top:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+r+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+(0-r)+"px)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.height(),p=0,l={},c={},u={height:"auto",top:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+r+"px)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})},pushPartInDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p=0,l={bottom:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+(0-r)+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+r+"px)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.height(),p=0,l={},c={},u={height:"auto",bottom:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+(0-r)+"px)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})}});var K=function(){var a=/^(overlay|reveal|pushPart).*$/;return function(t){return a.test(t)}}(),N=function(){var a=0;return function(){return a++}}();w.on("spa:createpage",function(t,n){w.trigger("spa:openloader");var o,s,r,p=n.hash,l=n.pushData;if(a.each(D,function(a,t){return s=new RegExp(a),s.test(p)?(o=a,r=t,!1):void(s=!1)}),e(s)){var c,u,d=(r.classname?" spa-page-"+r.classname:"")+(r.nocache?" no-cache":""),g=a('
'),f=N();g.data("id",f),c={id:f,hash:p,pushData:l,requestData:i(s,p),route:o,el:g},U[f]=c,!r.nocache&&w.trigger("spa:viewcache",{view:g}),u=r.view.call(g,c),a.isPlainObject(u)&&w.trigger("spa:initpage",[g,u])}}),w.on("spa:initpage",function(t,e,n){var i=e.data("id"),o=U[i],s=D[o.route];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(s[t]=n[t])}),o.viewData=n,w.trigger("spa:closeloader"),a(".spa-page-body",e).html(n.body),f.append(e),e.trigger("spa:openpage")}),w.on("spa:openpage",".spa-page",function(e,n){var i=a(e.currentTarget),o=i.data("id"),r=U[o],p=D[r.route],l=r.hash,c=r.pushData,u=(r.oldpushData,r.requestData,r.viewData),d=c.title||u.title,g=!1,h=c.animate||p.animate;b||(f.append('
'),b=a(".spa-page-empty"));var m=b.data("id"),v=U[m]||{};if(!c.animate&&v.prevPage&&v.prevPage.data("id")===o){var T=v.prevAnimate;T&&!a.isFunction(T)&&(h=J[T]),g=!0}var x,I;if(b.hasClass("spa-panel")){var k=O[b.data("id")];x=k.beforeclose,I=k.afterclose}else if(v.route){var C=D[v.route];x=C.beforeclose,I=C.afterclose,w.trigger("spa:navigate",{hash:l,title:d,pushData:c,replace:!0})}var z=function(){i.data("spa:init")||(i.data("spa:init",!0),p.init.call(i,r),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch")),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",b).removeClass("spa-scroll-touch"),I&&I.call(b,v),b.hasClass("no-cache")&&b.remove(),b.hasClass("spa-panel")?(b.css({zIndex:A}),r.prevPage&&r.prevPage.css({zIndex:$})):g||(r.prevPage=b),p.afteropen.call(i,r),b=i,r.hash!==t()?(P=!1,y.trigger("popstate")):(a.isFunction(n)&&n.call(i),P=!1)};x&&x.call(b,v),p.beforeopen.call(i,r),!g&&(r.prevAnimate=h),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch"),g||v.prevPage&&v.prevPage.css({zIndex:A}),a.isFunction(h)?h(i,b,z):s(i,b,h,z),w.trigger("spa:viewcachesort",{view:i})});var X={id:"",animate:"",classname:"",view:function(){return{body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:panel",function(t,e){var n=Array.prototype.slice.call(arguments,1);return n.length>1?(a.each(n,function(a,t){w.trigger("spa:panel",t)}),!1):void(e.id&&!O[e.id]&&(O[e.id]=a.extend({},X,e)))}),w.on("spa:createpanel",function(t,e,n){var i=O[e];if(i){w.trigger("spa:openloader");var o,s,r=i.classname?" spa-panel-"+i.classname:"",p=a('
');p.data("id",e),o={id:e,pushData:n,el:p},U[e]=o,w.trigger("spa:viewcache",{view:p}),s=i.view.call(p,o),a.isPlainObject(s)&&w.trigger("spa:initpanel",[p,s])}}),w.on("spa:initpanel",function(t,e,n){var i=e.data("id"),o=U[i],s=o.pushData,r=O[i];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(r[t]=n[t])}),o.viewData=n,a(".spa-page-body",e).html(n.body),f.append(e),w.trigger("spa:closeloader"),e.trigger("spa:openpanel",[i,s])}),w.on("spa:openpanel",function(t,e,n){if(v&&"block"===v.css("display"))return!1;var i=L[e];if(n||(n={}),i){if(P)return!1;P=!0;var o=O[e],r=n.animate||o.animate;if(b.hasClass("spa-panel")){var p=U[b.data("id")].prevPage;return p.trigger("spa:openpage",[function(){w.trigger("spa:openpanel",[e,n])}]),!1}var l=U[e];l.oldpushData=l.pushData,l.pushData=n,o.beforeopen.call(i,l);var c=function(){i.data("spa:init")||(i.data("spa:init",!0),o.init.call(i,l),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&setTimeout(function(){a(".spa-scroll",i).addClass("spa-scroll-touch")},17)),i.data("closing",!1),l.prevPage=b,o.afteropen.call(i,l),b=i,P=!1};l.prevAnimate=r,a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch");var u=b.data("id"),d=U[u]||{};d.prevPage&&d.prevPage.css({zIndex:A}),a.isFunction(r)?r(i,b,c):s(i,b,r,c),w.trigger("spa:viewcachesort",{view:i})}else w.trigger("spa:createpanel",[e,n])}),w.on("spa:closepanel",function(t,e){var n=a(t.target),i=n.data("id"),o=U[i];if(e&&e.id&&(n=a(".spa-panel-"+e.id)),!n.data("closing")&&(n.data("closing",!0),b.hasClass("spa-panel")&&b.data("id")===i)){var s=o.prevPage;s.trigger("spa:openpage")}}),w.on("click touchstart",".spa-panel",function(t){var e=a(t.currentTarget),n=a(t.target);(n.hasClass("spa-page-bg")||n.hasClass("spa-panel"))&&(t.stopPropagation(),t.preventDefault(),e.trigger("spa:closepanel"))}),w.on("spa:viewcachecount",function(a,t){t.count=1===t.count?2:t.count,R=t.count}),w.on("spa:viewcache",function(t,e){var n,i,o=e.view,s=o.data("id");if(o.hasClass("spa-panel")?(n="panel",i=s,L[i]=o):(n="page",i=U[s].hash,F[i]=o),E.unshift(n+":"+encodeURIComponent(i)),0!==R&&E.length>R){var r,p,l,c,u=E.splice(R);a.each(u,function(t,e){r=e.split(":",2),p=r[0],l=decodeURIComponent(r[1]),c="page"==p?F:L,a("img",c[l]).remove(),c[l].html("").remove(),delete c[l]})}}),w.on("spa:viewcachesort",function(a,t){var e,n,i,o,s=t.view,r=s.data("id");s.hasClass("spa-panel")?(e="panel",n=r):(e="page",n=U[r].hash),i=e+":"+encodeURIComponent(n),o=E.indexOf(i),o!==-1&&(E.splice(o,1),E.unshift(i))}),w.on("spa:navigate",function(t,e){var n=e.hash||"",i=e.title||"",o=e.pushData||{},s=e.replace||!1,r=e.url||"";if(i&&(document.title=i),n=r+"#"+n,s)x.replaceState(o,i,n);else{if(!b.hasClass("spa-panel")&&C.length&&"#"+C[C.length-1]===n)return;if(P)return!1;P=!0,x.pushState(o,i,n),!a.isEmptyObject(o)&&(h=o),y.trigger("popstate")}}),w.on("spa:loader",function(a,t){t.body&&(H=t.body),t.style&&(j=t.style)});var Y;w.on("spa:openloader",function(a){Y=setTimeout(function(){Y=void 0,v.show()},300)}),w.on("spa:closeloader",function(a){Y?(clearTimeout(Y),Y=void 0):v.hide()}),w.on("spa:boot",function(t,e){f=a("body"),w.trigger("spa:addstyle",S+j),f.append('
'+H+"
"),m=a(".spa-fullscreen"),w.trigger("spa:adjustfullscreen"),v=a(".spa-loader"),v.on("click select mousedown mousemove mouseup touchstart touchmove touchend",r),I=!0,y.trigger("popstate"),e&&e.callback&&e.callback()})}(window.Zepto||window.jQuery||window.$),function(){"use strict";for(var a=0,t=["ms","moz","webkit","o"],e=0;e * Licensed under MIT @@ -110,7 +110,7 @@ } // 设置版本号,先留空,打包时会自动添加 - $.spa.version = '2.0.4' + $.spa.version = '2.0.5' /* * 插入样式 @@ -1859,7 +1859,7 @@ pagescache[key] = $view } - viewscache.unshift(type + ':' + key) + viewscache.unshift(type + ':' + encodeURIComponent(key)) // 再清理 if(viewcachecount !== 0 && viewscache.length > viewcachecount) { @@ -1872,7 +1872,7 @@ $.each(cleanup, function(index, value) { cleanupsplit = value.split(':', 2) cleanuptype = cleanupsplit[0] - cleanupkey = cleanupsplit[1] + cleanupkey = decodeURIComponent(cleanupsplit[1]) cleanupcache = cleanuptype == 'page' ? pagescache : panelscache $('img', cleanupcache[cleanupkey]).remove() @@ -1903,7 +1903,7 @@ key = viewsdata[viewId].hash } - name = type + ':' + key + name = type + ':' + encodeURIComponent(key) index = viewscache.indexOf(name) if(index !== -1) { diff --git a/dist/spa.min.js b/dist/spa.min.js index ba71efe..914fabe 100644 --- a/dist/spa.min.js +++ b/dist/spa.min.js @@ -1,8 +1,8 @@ /*! - * SPA v2.0.4 + * SPA v2.0.5 * A webapp framework for routing control and view transitions * Copyright 2016 zhaoda * Licensed under MIT */ -!function(a){"use strict";function t(a){return a=a||T.href,a.replace(/^[^#]*#?\/?(.*)\/?$/,"$1")}function e(a){return"[object RegExp]"==Object.prototype.toString.call(a)}function n(a){return a=a.replace(M,"\\$&").replace(S,"(?:$1)?").replace($,function(a,t){return t?a:"([^/]+)"}).replace(_,"(.*?)"),"^"+a+"$"}function i(t,e){var n=t.exec(e).slice(1),i=[];return a.each(n,function(a,t){t&&i.push(decodeURIComponent(t))}),i}function s(a,t){U[a.data("id")],U[t.data("id")];a.css({zIndex:z}),t.css({zIndex:F})}function o(t,e,n,i){var s=a(".spa-page-body",t),o=(a(".spa-page-body",e),{});!B&&(n="defaultInOut"),J[n]||(n="defaultInOut"),D&&(D=!1,n="defaultInOut"),o.opacity=1,!K(n)&&B&&(o[B]="translate(0, 0) scale(1, 1)"),s.css(o),G[n].apply(t,[t,e,i])}function r(a){a.stopPropagation(),a.preventDefault()}if(!a.os){var p={},l=navigator.userAgent,c=(navigator.platform,l.match(/(Android);?[\s\/]+([\d.]+)?/)),u=l.match(/(iPad).*OS\s([\d_]+)/),d=l.match(/(iPod)(.*OS\s([\d_]+))?/),g=!u&&l.match(/(iPhone\sOS)\s([\d_]+)/);c&&(p.android=!0,p.version=c[2]),g&&!d&&(p.ios=p.iphone=!0,p.version=g[2].replace(/_/g,".")),u&&(p.ios=p.ipad=!0,p.version=u[2].replace(/_/g,".")),d&&(p.ios=p.ipod=!0,p.version=d[3]?d[3].replace(/_/g,"."):null),a.os=p}var h,f,m,v,b,y=a(window),w=a(document),T=window.location,x=window.history,I=!1,k=!1,D=!0,O={},P={},C=[],A=2e3,z=2001,F=2002,R=0,L={},E={},H=[],U={},q="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); -webkit-backface-visibility: hidden; -webkit-transform-style: preserve-3d;} .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); -webkit-backface-visibility: hidden; -webkit-transform-style: preserve-3d;} .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; }",W='
',j=".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 U[a.data("id")]},a.spa.getCurPage=function(){return b},a.spa.version="2.0.4",w.on("spa:addstyle",function(t,e){a("head").append('")}),function(){var t,e,n,i,s=function(){n=Math.max(y.height(),window.innerHeight),i=Math.max(y.width(),window.innerWidth),m.css({height:2*n}),window.scrollTo(0,0),h.data("innerHeight",window.innerHeight),n=Math.max(y.height(),window.innerHeight),m.height()!=n&&(h.css({width:i,height:n}),m.css({width:i,height:n}))};y.on("spa:adjustfullscreen"+(a.os.ios?" orientationchange":""),function(a){void 0!==t&&(cancelAnimationFrame(t),t=void 0),t=requestAnimationFrame(s)}),a.os.android&&y.on("orientationchange",function(a){clearTimeout(e),e=setTimeout(s,500)}),y.on("resize",function(a){clearTimeout(e),e=setTimeout(s,200)})}(),w.on("spa:scroll",function(t,e){var n=a(t.target),i=e&&e.direction||"";n.addClass("spa-scroll"+(i?" spa-scroll-"+i:""))}),w.on("spa:removescroll",function(t,e){var n=a(t.target);n.removeClass("spa-scroll spa-scroll-x spa-scroll-y")}),a.os.ios&&w.on("touchstart",".spa-scroll, .spa-scroll-x, .spa-scroll-y",function(t){var e=a(t.currentTarget),n=e.prop("scrollTop"),i=e.prop("scrollLeft"),s=e.height(),o=e.width(),r=e.prop("scrollHeight"),p=e.prop("scrollWidth");(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-x"))&&(i<=0&&e.prop("scrollLeft",1),i+o>=p&&e.prop("scrollLeft",p-o-1)),(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-y"))&&(n<=0&&e.prop("scrollTop",1),n+s>=r&&e.prop("scrollTop",n-1))}),y.on("popstate",function(a){if(I){if(v&&"block"===v.css("display"))return!1;if(b&&b.hasClass("spa-panel")){var e=b.data("id"),n=U[e],i=n.prevPage;return i.trigger("spa:openpage"),!1}var s=t();if(!C.length||C[C.length-1]!==s){C.push(s);var o=L[s],r=a.state||{};if(f&&(r=f,f=void 0),o){var p=o.data("id"),l=U[p];l.oldpushData=l.pushData,l.pushData=r,o.trigger("spa:openpage")}else w.trigger("spa:createpage",{hash:s,pushData:r})}}});var S=/\((.*?)\)/g,$=/(\(\?)?:\w+/g,_=/\*\w+/g,M=/[\-{}\[\]+?.,\\\^$|#\s]/g,Z={route:"",animate:"",classname:"",view:function(){return{title:"",body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:route",function(t,i){var s=Array.prototype.slice.call(arguments,1);if(s.length>1)return a.each(s,function(a,t){w.trigger("spa:route",t)}),!1;var o=i.route||"";e(o)||(o=n(o)),i.animate&&!a.isFunction(i.animate)&&K(i.animate)&&(i.animate=""),O[o]=a.extend({},Z,i)});var B,Q,V,G={},J={};!function(){var a,t={"-webkit-transition":["-webkit-transform","webkitTransitionEnd"],"-moz-transition":["-moz-transform","transitionend"],"-ms-transition":["-ms-transform","msTransitionEnd"],"-o-transition":["-o-transform","oTransitionEnd"],transition:["transform","transitionend"]},e=document.createElement("div");for(a in t)if(void 0!==e.style[a]){Q=a,B=t[a][0],V=t[a][1];break}}(),a.fn.emulateTransition=function(t,e){var n=a(this);return requestAnimationFrame(function(){n.get(0).offsetWidth,t[Q]="0.4s",n.css(t).emulateTransitionEndBySpa(function(){t={},t[Q]="",n.css(t),e&&e()})}),n},a.fn.transition||(a.fn.transition=a.fn.emulateTransition),a.fn.emulateTransitionEndBySpa=function(t,e){var n,i=!1,s=a(this);e=e||500,s.one(V,function(){i=!0,clearTimeout(n),t.call(s)});var o=function(){i||s.trigger(V)};return n=setTimeout(o,e),s},G.defaultInOut=function(a,t,e){s(t,a),e()},w.on("spa:addTransitPageAnimates",function(t,e){var n=[];a.each(e,function(a,t){n.push(a)}),a.each(n,function(a,t){a%2===0?J[t]=n[a+1]:J[t]=n[a-1]}),a.extend(G,e)}),w.trigger("spa:addTransitPageAnimates",{fadeIn:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{opacity:0}),r={opacity:1};o.opacity=0,i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},fadeOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={opacity:0};i.emulateTransition(o,function(){s(e,t),n()})},slideInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(100%, 0)",r[B]="translate(0%, 0)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(100%, 0)",i.emulateTransition(o,function(){s(e,t),n()})},slideInRight:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(-100%, 0)",r[B]="translate(0%, 0)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(-100%, 0)",i.emulateTransition(o,function(){s(e,t),n()})},slideInUp:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(0, 100%)",r[B]="translate(0, 0%)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(0, 100%)",i.emulateTransition(o,function(){s(e,t),n()})},slideInDown:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="translate(0, -100%)",r[B]="translate(0, 0%)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},slideOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="translate(0, -100%)",i.emulateTransition(o,function(){s(e,t),n()})},pushInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushInRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushInUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushInDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},pushOutUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),s(e,t),i.emulateTransition(l,function(){2==++r&&n()}),o.emulateTransition(c,function(){2==++r&&n()})},zoomIn:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),{}),r={};o[B]="scale(0, 0)",r[B]="scale(1, 1)",i.css(o),s(e,t),i.emulateTransition(r,function(){n()})},zoomOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o={};o[B]="scale(0, 0)",i.emulateTransition(o,function(){s(e,t),n()})},overlayInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().width()),r={left:"auto",width:o},p={};p[B]="translate(0px, 0)",i.css(r),o=2*o-i.prop("clientWidth"),r={width:o},r[B]="translate("+o+"px, 0)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.width(),r={},p={width:"auto",left:0};r[B]="translate("+o+"px, 0)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},overlayInRight:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().width()),r={right:"auto",width:o},p={};p[B]="translate(0px, 0)",i.css(r),o=2*o-i.prop("clientWidth"),r={width:o},r[B]="translate("+(0-o)+"px, 0)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.width(),r={},p={width:"auto",right:0};r[B]="translate("+(0-o)+"px, 0)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},overlayInUp:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().height()),r={top:"auto",height:o},p={};p[B]="translate(0, 0px)",i.css(r),o=2*o-i.prop("clientHeight"),r={height:o},r[B]="translate(0, "+o+"px)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.height(),r={},p={height:"auto",top:0};r[B]="translate(0, "+o+"px)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},overlayInDown:function(t,e,n){var i=a(".spa-page-body",t),o=(a(".spa-page-body",e),i.children().height()),r={bottom:"auto",height:o},p={};p[B]="translate(0, 0px)",i.css(r),o=2*o-i.prop("clientHeight"),r={height:o},r[B]="translate(0, "+(0-o)+"px)",i.css(r),s(e,t),i.emulateTransition(p,function(){n()})},overlayOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),o=i.height(),r={},p={height:"auto",bottom:0};r[B]="translate(0, "+(0-o)+"px)",i.emulateTransition(r,function(){s(e,t),i.css(p),n()})},revealInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p={left:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+(0-r)+"px, 0)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.width(),{});r[B]="translate(0px, 0)",s(e,t),i.emulateTransition(r,function(){o.css({width:"auto",left:0}),n()})},revealInRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p={right:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+r+"px, 0)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.width(),{});r[B]="translate(0px, 0)",s(e,t),i.emulateTransition(r,function(){o.css({width:"auto",right:0}),n()})},revealInUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p={top:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+(0-r)+"px)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.height(),{});r[B]="translate(0, 0px)",s(e,t),i.emulateTransition(r,function(){o.css({height:"auto",top:0}),n()})},revealInDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p={bottom:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+r+"px)",s(t,e),o.emulateTransition(l,function(){s(e,t),n()})},revealOutUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=(o.height(),{});r[B]="translate(0, 0px)",s(e,t),i.emulateTransition(r,function(){o.css({height:"auto",bottom:0}),n()})},pushPartInLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p=0,l={left:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",u[B]="translate("+(0-r)+"px, 0)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.width(),p=0,l={},c={},u={width:"auto",left:0};l[B]="translate(0px, 0)",c[B]="translate("+r+"px, 0)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})},pushPartInRight:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().width(),p=0,l={right:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+(0-r)+"px, 0)",u[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutLeft:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.width(),p=0,l={},c={},u={width:"auto",right:0};l[B]="translate(0px, 0)",c[B]="translate("+(0-r)+"px, 0)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})},pushPartInUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p=0,l={top:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+r+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+(0-r)+"px)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.height(),p=0,l={},c={},u={height:"auto",top:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+r+"px)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})},pushPartInDown:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=i.children().height(),p=0,l={bottom:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+(0-r)+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+r+"px)",i.css(l),s(e,t),i.emulateTransition(c,function(){2==++p&&n()}),o.emulateTransition(u,function(){2==++p&&n()})},pushPartOutUp:function(t,e,n){var i=a(".spa-page-body",t),o=a(".spa-page-body",e),r=o.height(),p=0,l={},c={},u={height:"auto",bottom:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+(0-r)+"px)",s(e,t),i.emulateTransition(l,function(){2==++p&&n()}),o.emulateTransition(c,function(){o.css(u),2==++p&&n()})}});var K=function(){var a=/^(overlay|reveal|pushPart).*$/;return function(t){return a.test(t)}}(),N=function(){var a=0;return function(){return a++}}();w.on("spa:createpage",function(t,n){w.trigger("spa:openloader");var s,o,r,p=n.hash,l=n.pushData;if(a.each(O,function(a,t){return o=new RegExp(a),o.test(p)?(s=a,r=t,!1):void(o=!1)}),e(o)){var c,u,d=(r.classname?" spa-page-"+r.classname:"")+(r.nocache?" no-cache":""),g=a('
'),h=N();g.data("id",h),c={id:h,hash:p,pushData:l,requestData:i(o,p),route:s,el:g},U[h]=c,!r.nocache&&w.trigger("spa:viewcache",{view:g}),u=r.view.call(g,c),a.isPlainObject(u)&&w.trigger("spa:initpage",[g,u])}}),w.on("spa:initpage",function(t,e,n){var i=e.data("id"),s=U[i],o=O[s.route];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(o[t]=n[t])}),s.viewData=n,w.trigger("spa:closeloader"),a(".spa-page-body",e).html(n.body),h.append(e),e.trigger("spa:openpage")}),w.on("spa:openpage",".spa-page",function(e,n){var i=a(e.currentTarget),s=i.data("id"),r=U[s],p=O[r.route],l=r.hash,c=r.pushData,u=(r.oldpushData,r.requestData,r.viewData),d=c.title||u.title,g=!1,f=c.animate||p.animate;b||(h.append('
'),b=a(".spa-page-empty"));var m=b.data("id"),v=U[m]||{};if(!c.animate&&v.prevPage&&v.prevPage.data("id")===s){var T=v.prevAnimate;T&&!a.isFunction(T)&&(f=J[T]),g=!0}var x,I;if(b.hasClass("spa-panel")){var D=P[b.data("id")];x=D.beforeclose,I=D.afterclose}else if(v.route){var C=O[v.route];x=C.beforeclose,I=C.afterclose,w.trigger("spa:navigate",{hash:l,title:d,pushData:c,replace:!0})}var F=function(){i.data("spa:init")||(i.data("spa:init",!0),p.init.call(i,r),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch")),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",b).removeClass("spa-scroll-touch"),I&&I.call(b,v),b.hasClass("no-cache")&&b.remove(),b.hasClass("spa-panel")?(b.css({zIndex:A}),r.prevPage&&r.prevPage.css({zIndex:z})):g||(r.prevPage=b),p.afteropen.call(i,r),b=i,r.hash!==t()?(k=!1,y.trigger("popstate")):(a.isFunction(n)&&n.call(i),k=!1)};x&&x.call(b,v),p.beforeopen.call(i,r),!g&&(r.prevAnimate=f),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch"),g||v.prevPage&&v.prevPage.css({zIndex:A}),a.isFunction(f)?f(i,b,F):o(i,b,f,F),w.trigger("spa:viewcachesort",{view:i})});var X={id:"",animate:"",classname:"",view:function(){return{body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:panel",function(t,e){var n=Array.prototype.slice.call(arguments,1);return n.length>1?(a.each(n,function(a,t){w.trigger("spa:panel",t)}),!1):void(e.id&&!P[e.id]&&(P[e.id]=a.extend({},X,e)))}),w.on("spa:createpanel",function(t,e,n){var i=P[e];if(i){w.trigger("spa:openloader");var s,o,r=i.classname?" spa-panel-"+i.classname:"",p=a('
');p.data("id",e),s={id:e,pushData:n,el:p},U[e]=s,w.trigger("spa:viewcache",{view:p}),o=i.view.call(p,s),a.isPlainObject(o)&&w.trigger("spa:initpanel",[p,o])}}),w.on("spa:initpanel",function(t,e,n){var i=e.data("id"),s=U[i],o=s.pushData,r=P[i];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(r[t]=n[t])}),s.viewData=n,a(".spa-page-body",e).html(n.body),h.append(e),w.trigger("spa:closeloader"),e.trigger("spa:openpanel",[i,o])}),w.on("spa:openpanel",function(t,e,n){if(v&&"block"===v.css("display"))return!1;var i=E[e];if(n||(n={}),i){if(k)return!1;k=!0;var s=P[e],r=n.animate||s.animate;if(b.hasClass("spa-panel")){var p=U[b.data("id")].prevPage;return p.trigger("spa:openpage",[function(){w.trigger("spa:openpanel",[e,n])}]),!1}var l=U[e];l.oldpushData=l.pushData,l.pushData=n,s.beforeopen.call(i,l);var c=function(){i.data("spa:init")||(i.data("spa:init",!0),s.init.call(i,l),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&setTimeout(function(){a(".spa-scroll",i).addClass("spa-scroll-touch")},17)),i.data("closing",!1),l.prevPage=b,s.afteropen.call(i,l),b=i,k=!1};l.prevAnimate=r,a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch");var u=b.data("id"),d=U[u]||{};d.prevPage&&d.prevPage.css({zIndex:A}),a.isFunction(r)?r(i,b,c):o(i,b,r,c),w.trigger("spa:viewcachesort",{view:i})}else w.trigger("spa:createpanel",[e,n])}),w.on("spa:closepanel",function(t,e){var n=a(t.target),i=n.data("id"),s=U[i];if(e&&e.id&&(n=a(".spa-panel-"+e.id)),!n.data("closing")&&(n.data("closing",!0),b.hasClass("spa-panel")&&b.data("id")===i)){var o=s.prevPage;o.trigger("spa:openpage")}}),w.on("click touchstart",".spa-panel",function(t){var e=a(t.currentTarget),n=a(t.target);(n.hasClass("spa-page-bg")||n.hasClass("spa-panel"))&&(t.stopPropagation(),t.preventDefault(),e.trigger("spa:closepanel"))}),w.on("spa:viewcachecount",function(a,t){t.count=1===t.count?2:t.count,R=t.count}),w.on("spa:viewcache",function(t,e){var n,i,s=e.view,o=s.data("id");if(s.hasClass("spa-panel")?(n="panel",i=o,E[i]=s):(n="page",i=U[o].hash,L[i]=s),H.unshift(n+":"+i),0!==R&&H.length>R){var r,p,l,c,u=H.splice(R);a.each(u,function(t,e){r=e.split(":",2),p=r[0],l=r[1],c="page"==p?L:E,a("img",c[l]).remove(),c[l].html("").remove(),delete c[l]})}}),w.on("spa:viewcachesort",function(a,t){var e,n,i,s,o=t.view,r=o.data("id");o.hasClass("spa-panel")?(e="panel",n=r):(e="page",n=U[r].hash),i=e+":"+n,s=H.indexOf(i),s!==-1&&(H.splice(s,1),H.unshift(i))}),w.on("spa:navigate",function(t,e){var n=e.hash||"",i=e.title||"",s=e.pushData||{},o=e.replace||!1,r=e.url||"";if(i&&(document.title=i),n=r+"#"+n,o)x.replaceState(s,i,n);else{if(!b.hasClass("spa-panel")&&C.length&&"#"+C[C.length-1]===n)return;if(k)return!1;k=!0,x.pushState(s,i,n),!a.isEmptyObject(s)&&(f=s),y.trigger("popstate")}}),w.on("spa:loader",function(a,t){t.body&&(W=t.body),t.style&&(j=t.style)});var Y;w.on("spa:openloader",function(a){Y=setTimeout(function(){Y=void 0,v.show()},300)}),w.on("spa:closeloader",function(a){Y?(clearTimeout(Y),Y=void 0):v.hide()}),w.on("spa:boot",function(t,e){h=a("body"),w.trigger("spa:addstyle",q+j),h.append('
'+W+"
"),m=a(".spa-fullscreen"),w.trigger("spa:adjustfullscreen"),v=a(".spa-loader"),v.on("click select mousedown mousemove mouseup touchstart touchmove touchend",r),I=!0,y.trigger("popstate"),e&&e.callback&&e.callback()})}(window.Zepto||window.jQuery||window.$),function(){"use strict";for(var a=0,t=["ms","moz","webkit","o"],e=0;e'+e+"")}),function(){var t,e,n,i,o=function(){n=Math.max(y.height(),window.innerHeight),i=Math.max(y.width(),window.innerWidth),m.css({height:2*n}),window.scrollTo(0,0),h.data("innerHeight",window.innerHeight),n=Math.max(y.height(),window.innerHeight),m.height()!=n&&(h.css({width:i,height:n}),m.css({width:i,height:n}))};y.on("spa:adjustfullscreen"+(a.os.ios?" orientationchange":""),function(a){void 0!==t&&(cancelAnimationFrame(t),t=void 0),t=requestAnimationFrame(o)}),a.os.android&&y.on("orientationchange",function(a){clearTimeout(e),e=setTimeout(o,500)}),y.on("resize",function(a){clearTimeout(e),e=setTimeout(o,200)})}(),w.on("spa:scroll",function(t,e){var n=a(t.target),i=e&&e.direction||"";n.addClass("spa-scroll"+(i?" spa-scroll-"+i:""))}),w.on("spa:removescroll",function(t,e){var n=a(t.target);n.removeClass("spa-scroll spa-scroll-x spa-scroll-y")}),a.os.ios&&w.on("touchstart",".spa-scroll, .spa-scroll-x, .spa-scroll-y",function(t){var e=a(t.currentTarget),n=e.prop("scrollTop"),i=e.prop("scrollLeft"),o=e.height(),s=e.width(),r=e.prop("scrollHeight"),p=e.prop("scrollWidth");(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-x"))&&(i<=0&&e.prop("scrollLeft",1),i+s>=p&&e.prop("scrollLeft",p-s-1)),(e.hasClass("spa-scroll")||e.hasClass("spa-scroll-y"))&&(n<=0&&e.prop("scrollTop",1),n+o>=r&&e.prop("scrollTop",n-1))}),y.on("popstate",function(a){if(I){if(v&&"block"===v.css("display"))return!1;if(b&&b.hasClass("spa-panel")){var e=b.data("id"),n=H[e],i=n.prevPage;return i.trigger("spa:openpage"),!1}var o=t();if(!C.length||C[C.length-1]!==o){C.push(o);var s=U[o],r=a.state||{};if(f&&(r=f,f=void 0),s){var p=s.data("id"),l=H[p];l.oldpushData=l.pushData,l.pushData=r,s.trigger("spa:openpage")}else w.trigger("spa:createpage",{hash:o,pushData:r})}}});var S=/\((.*?)\)/g,$=/(\(\?)?:\w+/g,_=/\*\w+/g,M=/[\-{}\[\]+?.,\\\^$|#\s]/g,Z={route:"",animate:"",classname:"",view:function(){return{title:"",body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:route",function(t,i){var o=Array.prototype.slice.call(arguments,1);if(o.length>1)return a.each(o,function(a,t){w.trigger("spa:route",t)}),!1;var s=i.route||"";e(s)||(s=n(s)),i.animate&&!a.isFunction(i.animate)&&K(i.animate)&&(i.animate=""),O[s]=a.extend({},Z,i)});var B,Q,V,G={},J={};!function(){var a,t={"-webkit-transition":["-webkit-transform","webkitTransitionEnd"],"-moz-transition":["-moz-transform","transitionend"],"-ms-transition":["-ms-transform","msTransitionEnd"],"-o-transition":["-o-transform","oTransitionEnd"],transition:["transform","transitionend"]},e=document.createElement("div");for(a in t)if(void 0!==e.style[a]){Q=a,B=t[a][0],V=t[a][1];break}}(),a.fn.emulateTransition=function(t,e){var n=a(this);return requestAnimationFrame(function(){n.get(0).offsetWidth,t[Q]="0.4s",n.css(t).emulateTransitionEndBySpa(function(){t={},t[Q]="",n.css(t),e&&e()})}),n},a.fn.transition||(a.fn.transition=a.fn.emulateTransition),a.fn.emulateTransitionEndBySpa=function(t,e){var n,i=!1,o=a(this);e=e||500,o.one(V,function(){i=!0,clearTimeout(n),t.call(o)});var s=function(){i||o.trigger(V)};return n=setTimeout(s,e),o},G.defaultInOut=function(a,t,e){o(t,a),e()},w.on("spa:addTransitPageAnimates",function(t,e){var n=[];a.each(e,function(a,t){n.push(a)}),a.each(n,function(a,t){a%2===0?J[t]=n[a+1]:J[t]=n[a-1]}),a.extend(G,e)}),w.trigger("spa:addTransitPageAnimates",{fadeIn:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{opacity:0}),r={opacity:1};s.opacity=0,i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},fadeOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={opacity:0};i.emulateTransition(s,function(){o(e,t),n()})},slideInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(100%, 0)",r[B]="translate(0%, 0)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(100%, 0)",i.emulateTransition(s,function(){o(e,t),n()})},slideInRight:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(-100%, 0)",r[B]="translate(0%, 0)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(-100%, 0)",i.emulateTransition(s,function(){o(e,t),n()})},slideInUp:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(0, 100%)",r[B]="translate(0, 0%)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(0, 100%)",i.emulateTransition(s,function(){o(e,t),n()})},slideInDown:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="translate(0, -100%)",r[B]="translate(0, 0%)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},slideOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="translate(0, -100%)",i.emulateTransition(s,function(){o(e,t),n()})},pushInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushInRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(-100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(100%, 0)",l[B]="translate(0%, 0)",c[B]="translate(-100%, 0)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushInUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushInDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, -100%)",l[B]="translate(0%, 0)",c[B]="translate(0, 100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},pushOutUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=0,p={},l={},c={};p[B]="translate(0, 100%)",l[B]="translate(0%, 0)",c[B]="translate(0, -100%)",i.css(p),o(e,t),i.emulateTransition(l,function(){2==++r&&n()}),s.emulateTransition(c,function(){2==++r&&n()})},zoomIn:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),{}),r={};s[B]="scale(0, 0)",r[B]="scale(1, 1)",i.css(s),o(e,t),i.emulateTransition(r,function(){n()})},zoomOut:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s={};s[B]="scale(0, 0)",i.emulateTransition(s,function(){o(e,t),n()})},overlayInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().width()),r={left:"auto",width:s},p={};p[B]="translate(0px, 0)",i.css(r),s=2*s-i.prop("clientWidth"),r={width:s},r[B]="translate("+s+"px, 0)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutRight:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.width(),r={},p={width:"auto",left:0};r[B]="translate("+s+"px, 0)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},overlayInRight:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().width()),r={right:"auto",width:s},p={};p[B]="translate(0px, 0)",i.css(r),s=2*s-i.prop("clientWidth"),r={width:s},r[B]="translate("+(0-s)+"px, 0)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutLeft:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.width(),r={},p={width:"auto",right:0};r[B]="translate("+(0-s)+"px, 0)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},overlayInUp:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().height()),r={top:"auto",height:s},p={};p[B]="translate(0, 0px)",i.css(r),s=2*s-i.prop("clientHeight"),r={height:s},r[B]="translate(0, "+s+"px)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutDown:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.height(),r={},p={height:"auto",top:0};r[B]="translate(0, "+s+"px)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},overlayInDown:function(t,e,n){var i=a(".spa-page-body",t),s=(a(".spa-page-body",e),i.children().height()),r={bottom:"auto",height:s},p={};p[B]="translate(0, 0px)",i.css(r),s=2*s-i.prop("clientHeight"),r={height:s},r[B]="translate(0, "+(0-s)+"px)",i.css(r),o(e,t),i.emulateTransition(p,function(){n()})},overlayOutUp:function(t,e,n){var i=(a(".spa-page-body",t),a(".spa-page-body",e)),s=i.height(),r={},p={height:"auto",bottom:0};r[B]="translate(0, "+(0-s)+"px)",i.emulateTransition(r,function(){o(e,t),i.css(p),n()})},revealInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p={left:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+(0-r)+"px, 0)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.width(),{});r[B]="translate(0px, 0)",o(e,t),i.emulateTransition(r,function(){s.css({width:"auto",left:0}),n()})},revealInRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p={right:"auto",width:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.width()-i.prop("clientWidth"),i.css({width:r}),l[B]="translate("+r+"px, 0)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.width(),{});r[B]="translate(0px, 0)",o(e,t),i.emulateTransition(r,function(){s.css({width:"auto",right:0}),n()})},revealInUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p={top:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+(0-r)+"px)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.height(),{});r[B]="translate(0, 0px)",o(e,t),i.emulateTransition(r,function(){s.css({height:"auto",top:0}),n()})},revealInDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p={bottom:"auto",height:r},l={};p[B]="translate(0, 0)",i.css(p),r=2*i.height()-i.prop("clientHeight"),i.css({height:r}),l[B]="translate(0, "+r+"px)",o(t,e),s.emulateTransition(l,function(){o(e,t),n()})},revealOutUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=(s.height(),{});r[B]="translate(0, 0px)",o(e,t),i.emulateTransition(r,function(){s.css({height:"auto",bottom:0}),n()})},pushPartInLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p=0,l={left:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",u[B]="translate("+(0-r)+"px, 0)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.width(),p=0,l={},c={},u={width:"auto",left:0};l[B]="translate(0px, 0)",c[B]="translate("+r+"px, 0)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})},pushPartInRight:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().width(),p=0,l={right:"auto",width:r},c={},u={};i.css(l),r=2*i.width()-i.prop("clientWidth"),l={width:r},l[B]="translate("+(0-r)+"px, 0)",u[B]="translate("+r+"px, 0)",c[B]="translate(0px, 0)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutLeft:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.width(),p=0,l={},c={},u={width:"auto",right:0};l[B]="translate(0px, 0)",c[B]="translate("+(0-r)+"px, 0)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})},pushPartInUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p=0,l={top:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+r+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+(0-r)+"px)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.height(),p=0,l={},c={},u={height:"auto",top:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+r+"px)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})},pushPartInDown:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=i.children().height(),p=0,l={bottom:"auto",height:r},c={},u={};i.css(l),r=2*i.height()-i.prop("clientHeight"),l={height:r},l[B]="translate(0, "+(0-r)+"px)",c[B]="translate(0, 0px)",u[B]="translate(0, "+r+"px)",i.css(l),o(e,t),i.emulateTransition(c,function(){2==++p&&n()}),s.emulateTransition(u,function(){2==++p&&n()})},pushPartOutUp:function(t,e,n){var i=a(".spa-page-body",t),s=a(".spa-page-body",e),r=s.height(),p=0,l={},c={},u={height:"auto",bottom:0};l[B]="translate(0, 0px)",c[B]="translate(0, "+(0-r)+"px)",o(e,t),i.emulateTransition(l,function(){2==++p&&n()}),s.emulateTransition(c,function(){s.css(u),2==++p&&n()})}});var K=function(){var a=/^(overlay|reveal|pushPart).*$/;return function(t){return a.test(t)}}(),N=function(){var a=0;return function(){return a++}}();w.on("spa:createpage",function(t,n){w.trigger("spa:openloader");var o,s,r,p=n.hash,l=n.pushData;if(a.each(O,function(a,t){return s=new RegExp(a),s.test(p)?(o=a,r=t,!1):void(s=!1)}),e(s)){var c,u,d=(r.classname?" spa-page-"+r.classname:"")+(r.nocache?" no-cache":""),g=a('
'),h=N();g.data("id",h),c={id:h,hash:p,pushData:l,requestData:i(s,p),route:o,el:g},H[h]=c,!r.nocache&&w.trigger("spa:viewcache",{view:g}),u=r.view.call(g,c),a.isPlainObject(u)&&w.trigger("spa:initpage",[g,u])}}),w.on("spa:initpage",function(t,e,n){var i=e.data("id"),o=H[i],s=O[o.route];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(s[t]=n[t])}),o.viewData=n,w.trigger("spa:closeloader"),a(".spa-page-body",e).html(n.body),h.append(e),e.trigger("spa:openpage")}),w.on("spa:openpage",".spa-page",function(e,n){var i=a(e.currentTarget),o=i.data("id"),r=H[o],p=O[r.route],l=r.hash,c=r.pushData,u=(r.oldpushData,r.requestData,r.viewData),d=c.title||u.title,g=!1,f=c.animate||p.animate;b||(h.append('
'),b=a(".spa-page-empty"));var m=b.data("id"),v=H[m]||{};if(!c.animate&&v.prevPage&&v.prevPage.data("id")===o){var T=v.prevAnimate;T&&!a.isFunction(T)&&(f=J[T]),g=!0}var x,I;if(b.hasClass("spa-panel")){var D=P[b.data("id")];x=D.beforeclose,I=D.afterclose}else if(v.route){var C=O[v.route];x=C.beforeclose,I=C.afterclose,w.trigger("spa:navigate",{hash:l,title:d,pushData:c,replace:!0})}var F=function(){i.data("spa:init")||(i.data("spa:init",!0),p.init.call(i,r),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch")),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",b).removeClass("spa-scroll-touch"),I&&I.call(b,v),b.hasClass("no-cache")&&b.remove(),b.hasClass("spa-panel")?(b.css({zIndex:A}),r.prevPage&&r.prevPage.css({zIndex:z})):g||(r.prevPage=b),p.afteropen.call(i,r),b=i,r.hash!==t()?(k=!1,y.trigger("popstate")):(a.isFunction(n)&&n.call(i),k=!1)};x&&x.call(b,v),p.beforeopen.call(i,r),!g&&(r.prevAnimate=f),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch"),g||v.prevPage&&v.prevPage.css({zIndex:A}),a.isFunction(f)?f(i,b,F):s(i,b,f,F),w.trigger("spa:viewcachesort",{view:i})});var X={id:"",animate:"",classname:"",view:function(){return{body:""}},init:function(){},beforeopen:function(){},afteropen:function(){},beforeclose:function(){},afterclose:function(){}};w.on("spa:panel",function(t,e){var n=Array.prototype.slice.call(arguments,1);return n.length>1?(a.each(n,function(a,t){w.trigger("spa:panel",t)}),!1):void(e.id&&!P[e.id]&&(P[e.id]=a.extend({},X,e)))}),w.on("spa:createpanel",function(t,e,n){var i=P[e];if(i){w.trigger("spa:openloader");var o,s,r=i.classname?" spa-panel-"+i.classname:"",p=a('
');p.data("id",e),o={id:e,pushData:n,el:p},H[e]=o,w.trigger("spa:viewcache",{view:p}),s=i.view.call(p,o),a.isPlainObject(s)&&w.trigger("spa:initpanel",[p,s])}}),w.on("spa:initpanel",function(t,e,n){var i=e.data("id"),o=H[i],s=o.pushData,r=P[i];a.each(["init","beforeopen","afteropen","beforeclose","afterclose"],function(a,t){n[t]&&(r[t]=n[t])}),o.viewData=n,a(".spa-page-body",e).html(n.body),h.append(e),w.trigger("spa:closeloader"),e.trigger("spa:openpanel",[i,s])}),w.on("spa:openpanel",function(t,e,n){if(v&&"block"===v.css("display"))return!1;var i=L[e];if(n||(n={}),i){if(k)return!1;k=!0;var o=P[e],r=n.animate||o.animate;if(b.hasClass("spa-panel")){var p=H[b.data("id")].prevPage;return p.trigger("spa:openpage",[function(){w.trigger("spa:openpanel",[e,n])}]),!1}var l=H[e];l.oldpushData=l.pushData,l.pushData=n,o.beforeopen.call(i,l);var c=function(){i.data("spa:init")||(i.data("spa:init",!0),o.init.call(i,l),a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&setTimeout(function(){a(".spa-scroll",i).addClass("spa-scroll-touch")},17)),i.data("closing",!1),l.prevPage=b,o.afteropen.call(i,l),b=i,k=!1};l.prevAnimate=r,a.os.ios&&parseInt(a.os.version.slice(0,1))>5&&a(".spa-scroll",i).addClass("spa-scroll-touch");var u=b.data("id"),d=H[u]||{};d.prevPage&&d.prevPage.css({zIndex:A}),a.isFunction(r)?r(i,b,c):s(i,b,r,c),w.trigger("spa:viewcachesort",{view:i})}else w.trigger("spa:createpanel",[e,n])}),w.on("spa:closepanel",function(t,e){var n=a(t.target),i=n.data("id"),o=H[i];if(e&&e.id&&(n=a(".spa-panel-"+e.id)),!n.data("closing")&&(n.data("closing",!0),b.hasClass("spa-panel")&&b.data("id")===i)){var s=o.prevPage;s.trigger("spa:openpage")}}),w.on("click touchstart",".spa-panel",function(t){var e=a(t.currentTarget),n=a(t.target);(n.hasClass("spa-page-bg")||n.hasClass("spa-panel"))&&(t.stopPropagation(),t.preventDefault(),e.trigger("spa:closepanel"))}),w.on("spa:viewcachecount",function(a,t){t.count=1===t.count?2:t.count,R=t.count}),w.on("spa:viewcache",function(t,e){var n,i,o=e.view,s=o.data("id");if(o.hasClass("spa-panel")?(n="panel",i=s,L[i]=o):(n="page",i=H[s].hash,U[i]=o),E.unshift(n+":"+encodeURIComponent(i)),0!==R&&E.length>R){var r,p,l,c,u=E.splice(R);a.each(u,function(t,e){r=e.split(":",2),p=r[0],l=decodeURIComponent(r[1]),c="page"==p?U:L,a("img",c[l]).remove(),c[l].html("").remove(),delete c[l]})}}),w.on("spa:viewcachesort",function(a,t){var e,n,i,o,s=t.view,r=s.data("id");s.hasClass("spa-panel")?(e="panel",n=r):(e="page",n=H[r].hash),i=e+":"+encodeURIComponent(n),o=E.indexOf(i),o!==-1&&(E.splice(o,1),E.unshift(i))}),w.on("spa:navigate",function(t,e){var n=e.hash||"",i=e.title||"",o=e.pushData||{},s=e.replace||!1,r=e.url||"";if(i&&(document.title=i),n=r+"#"+n,s)x.replaceState(o,i,n);else{if(!b.hasClass("spa-panel")&&C.length&&"#"+C[C.length-1]===n)return;if(k)return!1;k=!0,x.pushState(o,i,n),!a.isEmptyObject(o)&&(f=o),y.trigger("popstate")}}),w.on("spa:loader",function(a,t){t.body&&(W=t.body),t.style&&(j=t.style)});var Y;w.on("spa:openloader",function(a){Y=setTimeout(function(){Y=void 0,v.show()},300)}),w.on("spa:closeloader",function(a){Y?(clearTimeout(Y),Y=void 0):v.hide()}),w.on("spa:boot",function(t,e){h=a("body"),w.trigger("spa:addstyle",q+j),h.append('
'+W+"
"),m=a(".spa-fullscreen"),w.trigger("spa:adjustfullscreen"),v=a(".spa-loader"),v.on("click select mousedown mousemove mouseup touchstart touchmove touchend",r),I=!0,y.trigger("popstate"),e&&e.callback&&e.callback()})}(window.Zepto||window.jQuery||window.$),function(){"use strict";for(var a=0,t=["ms","moz","webkit","o"],e=0;e viewcachecount) { @@ -1865,7 +1865,7 @@ $.each(cleanup, function(index, value) { cleanupsplit = value.split(':', 2) cleanuptype = cleanupsplit[0] - cleanupkey = cleanupsplit[1] + cleanupkey = decodeURIComponent(cleanupsplit[1]) cleanupcache = cleanuptype == 'page' ? pagescache : panelscache $('img', cleanupcache[cleanupkey]).remove() @@ -1896,7 +1896,7 @@ key = viewsdata[viewId].hash } - name = type + ':' + key + name = type + ':' + encodeURIComponent(key) index = viewscache.indexOf(name) if(index !== -1) {