/* * angular-mobile-nav by Andy Joslin * http://github.com/ajoslin/angular-mobile-nav * @license MIT License http://goo.gl/Z8Nlo */angular.module("mobile-navigate",[]),angular.module("mobile-navigate").factory("$change",["$q","$rootScope",function(e,t){var n={modal:["modal",""],none:["",""]},r={prefix:"mb-"},i="in",s="out",o="reverse",u="done",a="webkitAnimationEnd";return function(f,l,c,h,p){function g(e){return e.reduce(function(e,t){return e+(t?" "+p.prefix+t:"")},"")}function E(){t.$apply(function(){d.resolve()})}p=angular.extend(p||{},r);var d=e.defer(),v,m,y=n[c]?n[c]:[c,c];f.css("z-index","-100"),f[0].offsetWidth+=0;var b=g([h?s:i,v=y[h?1:0],h&&o||""]);f.addClass(b);var w;l&&(w=g([h?i:s,m=y[h?0:1],h&&o||""]),l.addClass(w)),f.css("z-index",""),f[0].offsetWidth+=0;var S;return v&&v.length?(S=f).bind(a,E):l&&m&&m.length?(S=l).bind(a,E):d.resolve(),d.promise.then(function(){S&&S.unbind(a,E),f.removeClass(b),l&&l.removeClass(w)}),d.promise.cancel=function(){d.resolve()},d.promise}}]),angular.module("mobile-navigate").service("$navigate",["$rootScope","$location","$route",function(e,t,n){function s(e,t,n){var r=e,i=t||"slide",s=n,o;this.transition=function(){var e;return o?(e=o,o=null):e=i,e},this.path=function(){return r},this.reverse=function(){return s},this.transitionOnce=function(e){o=e}}function o(t,n,i){e.$broadcast("$pageTransitionStart",t,n,i),r.current=r.next}function u(e,n,u){r.current&&i.push(r.current),r.next=new s(t.path()),r.next.transitionOnce("none"),o(r.next),r.onRouteSuccess=null}var r=this,i=[];r.onRouteSuccess=null,e.$on("$routeChangeSuccess",function(e,t,n){t.$route&&!t.$route.redirectTo&&(r.onRouteSuccess||u)(e,t,n)}),r.go=function(n,u,a){typeof u=="boolean"&&(a=u,u=null),t.path(n),r.onRouteSuccess=function(e,t,f){r.current&&i.push(r.current),r.next=new s(n,u||t.$route.transition,a),o(r.next,r.current,!1)}},r.eraseHistory=function(){i.length=0},r.back=function(){if(i.length>0){var e=i[i.length-1];return t.path(e.path()),r.onRouteSuccess=function(){i.pop(),r.next=e,o(r.next,r.current,!0)},!0}return!1},(window.cordova||window.phonegap)&&window.device&&device.platform&&device.platform.toLowerCase()=="android"&&document.addEventListener("deviceready",function(){document.addEventListener("backbutton",function(){var e=r.back();e||navigator.app.exitApp()})})}]),angular.module("mobile-navigate").directive("mobileView",["$rootScope","$compile","$controller","$route","$change",function(e,t,n,r,i){function s(s,o,u){function a(e){var i=r.current,a=i&&i.locals;e.element=angular.element(document.createElement("div")),e.element.html(a.$template),e.element.addClass("mb-page"),e.scope=s.$new(),i.controller&&(a.$scope=e.scope,e.controller=n(i.controller,a),e.element.contents().data("$ngControllerController",e.controller)),t(e.element.contents())(e.scope),o.append(e.element),e.scope.$emit("$viewContentLoaded"),e.scope.$eval(u.onLoad)}var f;s.$on("$pageTransitionStart",function(n,s,o,u){function l(){a(s);var t=u?o.transition():s.transition();if(s.reverse()||r.current&&r.current.$route.reverse)u=!u;var n=i(s.element,o?o.element:null,t,u);return n.then(function(){o&&(e.$broadcast("$pageTransitionSuccess",s,o),o.scope.$destroy(),o.element.remove(),o=undefined)}),n}f&&f.cancel(),f=l(s,o,u)})}return{restrict:"EA",link:s}}]);