Skip to content
This repository
Browse code

Update js/jquery.mobile.router.min.js

  • Loading branch information...
commit 2144ba91ca53cfb9289626295b1674f0914c50ab 1 parent 4933ef3
Brian Antonelli brianantonelli authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  js/jquery.mobile.router.min.js
2  js/jquery.mobile.router.min.js
@@ -7,4 +7,4 @@
7 7 * http://github.com/azicchetti/jquerymobile-router/blob/master/MIT-LICENSE.txt
8 8 * http://github.com/azicchetti/jquerymobile-router/blob/master/GPL-LICENSE.txt
9 9 */
10   -(function(a){a(document).bind("mobileinit",function(){var d=a.extend({fixFirstPageDataUrl:false,firstPageDataUrl:"index.html",ajaxApp:false},a.mobile.jqmRouter||{});var c=true;function b(g){if(c){console.log(g)}}var e=null,f=null;a(document).bind("pagebeforechange",function(j,i){if(typeof i.toPage==="string"){var g=a.mobile.path.parseUrl(i.toPage);e=f;f=g;if(g.hash.indexOf("?")!==-1){var h=g.hash.replace(/\?.*$/,"");i.options.dataUrl=g.href;if(a.mobile.activePage&&h.replace(/^#/,"")==a.mobile.activePage.jqmData("url")){i.options.allowSamePageTransition=true;a.mobile.changePage(a(h),i.options)}else{a.mobile.changePage(a(h),i.options)}j.preventDefault()}}});if(d.fixFirstPageDataUrl){a(document).ready(function(){var h=a(":jqmData(role='page')").first();var i=h.jqmData("url"),g=window.location.pathname+d.firstPageDataUrl+window.location.search+window.location.hash;if(!window.location.pathname.match("/$")){return}if(i!=g){h.attr("data-url",g).jqmData("url",g)}})}a.mobile.Router=function(k,h,j){this.routes={pagebeforecreate:null,pagecreate:null,pagebeforeshow:null,pageshow:null,pagebeforehide:null,pagehide:null,pageinit:null,pageremove:null};this.evtLookup={bc:"pagebeforecreate",c:"pagecreate",bs:"pagebeforeshow",s:"pageshow",bh:"pagebeforehide",h:"pagehide",i:"pageinit",rm:"pageremove"};this.routesRex={};this.conf=a.extend({},d,j||{});this.defaultHandlerEvents={};if(this.conf.defaultHandlerEvents){var g=this.conf.defaultHandlerEvents.split(",");for(var l=0;l<g.length;l++){this.defaultHandlerEvents[this.evtLookup[g[l]]]=g[l]}}this.add(k,h)};a.extend(a.mobile.Router.prototype,{add:function(j,i){if(!j){return}var g=this,h=[];if(j instanceof Array){a.each(j,a.proxy(function(m,l){this.add(l,i)},this))}else{a.each(j,function(o,m){if(typeof(m)=="string"||typeof(m)=="function"){if(g.routes.pagebeforeshow===null){g.routes.pagebeforeshow={}}g.routes.pagebeforeshow[o]=m;if(!g.routesRex.hasOwnProperty(o)){g.routesRex[o]=new RegExp(o)}}else{var l,n=m.events.split(","),k;for(l=0;l<n.length;l++){k=g.evtLookup[n[l]];if(g.routes.hasOwnProperty(k)){if(g.routes[k]===null){g.routes[k]={}}g.routes[k][o]=m.handler;if(!g.routesRex.hasOwnProperty(o)){g.routesRex[o]=new RegExp(o)}}else{b("can't set unsupported route "+n[l])}}}});a.each(g.routes,function(k,l){if(l!==null){h.push(k)}});if(!this.userHandlers){this.userHandlers={}}a.extend(this.userHandlers,i||{});this._detachEvents();if(h.length>0){this._liveData={events:h.join(" "),handler:function(l,k){g._processRoutes(l,k,this)}};a(":jqmData(role='page'),:jqmData(role='dialog')").live(this._liveData.events,this._liveData.handler)}}},_processRoutes:function(l,p,m){var n=this,o,h,k,g=0;if(l.type in {pagebeforehide:true,pagehide:true,pageremove:true}){o=e}else{o=f}do{if(!o){if(m){k=a(m);o=k.jqmData("url");if(o){if(k.attr("id")==o){o="#"+o}o=a.mobile.path.parseUrl(o)}}}else{if(m&&!a(m).jqmData("url")){return}}if(!o){return}h=(!this.conf.ajaxApp?o.hash:o.pathname+o.search+o.hash);if(h.length==0){o=""}g++}while(h.length==0&&g<=1);var j=false;a.each(this.routes[l.type],function(q,s){var r,u;if((r=h.match(n.routesRex[q]))){if(typeof(s)=="function"){u=s}else{if(typeof(n.userHandlers[s])=="function"){u=n.userHandlers[s]}}if(u){try{u(l.type,r,p,m,l);j=true}catch(t){b(t)}}}});if(!j&&this.conf.defaultHandler&&this.defaultHandlerEvents[l.type]){if(typeof(this.conf.defaultHandler)=="function"){try{this.conf.defaultHandler(l.type,p,m,l)}catch(i){b(i)}}}},_detachEvents:function(){if(this._liveData){a(":jqmData(role='page'),:jqmData(role='dialog')").die(this._liveData.events,this._liveData.handler)}},destroy:function(){this._detachEvents();this.routes=this.routesRex=null},getParams:function(g){if(!g){return null}var j={},h;var i=g.slice(g.indexOf("?")+1).split("&");a.each(i,function(m,l){h=l.split("=");if(j[h[0]]){if(!(j[h[0]] instanceof Array)){j[h[0]]=[j[h[0]]]}j[h[0]].push(h[1])}else{j[h[0]]=h[1]}});if(a.isEmptyObject(j)){return null}return j}})})})(jQuery);
  10 +(function(a){a(document).bind("mobileinit",function(){var d=a.extend({fixFirstPageDataUrl:false,firstPageDataUrl:"index.html",ajaxApp:false},a.mobile.jqmRouter||{});var c=true;function b(g){if(c){console.log(g)}}var e=null,f=null;a(document).bind("pagebeforechange",function(j,i){if(typeof i.toPage==="string"){var g=a.mobile.path.parseUrl(i.toPage);e=f;f=g;if(g.hash.indexOf("?")!==-1){var h=g.hash.replace(/\?.*$/,"");i.options.dataUrl=g.href;if(a.mobile.activePage&&h.replace(/^#/,"")==a.mobile.activePage.jqmData("url")){i.options.allowSamePageTransition=true;a.mobile.changePage(a(h),i.options)}else{a.mobile.changePage(a(h),i.options)}j.preventDefault()}}});if(d.fixFirstPageDataUrl){a(document).ready(function(){if(!window.location.pathname.match("/$")){return}var h=a(":jqmData(role='page')").first();var i=h.jqmData("url"),g=window.location.pathname+d.firstPageDataUrl+window.location.search+window.location.hash;if(i!=g){h.attr("data-url",g).jqmData("url",g)}})}a.mobile.Router=function(k,h,j){this.routes={pagebeforecreate:null,pagecreate:null,pagebeforeshow:null,pageshow:null,pagebeforehide:null,pagehide:null,pageinit:null,pageremove:null};this.evtLookup={bc:"pagebeforecreate",c:"pagecreate",bs:"pagebeforeshow",s:"pageshow",bh:"pagebeforehide",h:"pagehide",i:"pageinit",rm:"pageremove"};this.routesRex={};this.conf=a.extend({},d,j||{});this.defaultHandlerEvents={};if(this.conf.defaultHandlerEvents){var g=this.conf.defaultHandlerEvents.split(",");for(var l=0;l<g.length;l++){this.defaultHandlerEvents[this.evtLookup[g[l]]]=g[l]}}this.add(k,h)};a.extend(a.mobile.Router.prototype,{add:function(j,i){if(!j){return}var g=this,h=[];if(j instanceof Array){a.each(j,a.proxy(function(m,l){this.add(l,i)},this))}else{a.each(j,function(o,m){if(typeof(m)=="string"||typeof(m)=="function"){if(g.routes.pagebeforeshow===null){g.routes.pagebeforeshow={}}g.routes.pagebeforeshow[o]=m;if(!g.routesRex.hasOwnProperty(o)){g.routesRex[o]=new RegExp(o)}}else{var l,n=m.events.split(","),k;for(l=0;l<n.length;l++){k=g.evtLookup[n[l]];if(g.routes.hasOwnProperty(k)){if(g.routes[k]===null){g.routes[k]={}}g.routes[k][o]=m.handler;if(!g.routesRex.hasOwnProperty(o)){g.routesRex[o]=new RegExp(o)}}else{b("can't set unsupported route "+n[l])}}}});a.each(g.routes,function(k,l){if(l!==null){h.push(k)}});if(!this.userHandlers){this.userHandlers={}}a.extend(this.userHandlers,i||{});this._detachEvents();if(h.length>0){this._liveData={events:h.join(" "),handler:function(l,k){g._processRoutes(l,k,this)}};a(":jqmData(role='page'),:jqmData(role='dialog')").live(this._liveData.events,this._liveData.handler)}}},_processRoutes:function(l,p,m){var n=this,o,h,k,g=0;if(l.type in {pagebeforehide:true,pagehide:true,pageremove:true}){o=e}else{o=f}do{if(!o){if(m){k=a(m);o=k.jqmData("url");if(o){if(k.attr("id")==o){o="#"+o}o=a.mobile.path.parseUrl(o)}}}else{if(m&&!a(m).jqmData("url")){return}}if(!o){return}h=(!this.conf.ajaxApp?o.hash:o.pathname+o.search+o.hash);if(h.length==0){o=""}g++}while(h.length==0&&g<=1);var j=false;a.each(this.routes[l.type],function(q,s){var r,u;if((r=h.match(n.routesRex[q]))){if(typeof(s)=="function"){u=s}else{if(typeof(n.userHandlers[s])=="function"){u=n.userHandlers[s]}}if(u){try{u(l.type,r,p,m,l);j=true}catch(t){b(t)}}}});if(!j&&this.conf.defaultHandler&&this.defaultHandlerEvents[l.type]){if(typeof(this.conf.defaultHandler)=="function"){try{this.conf.defaultHandler(l.type,p,m,l)}catch(i){b(i)}}}},_detachEvents:function(){if(this._liveData){a(":jqmData(role='page'),:jqmData(role='dialog')").die(this._liveData.events,this._liveData.handler)}},destroy:function(){this._detachEvents();this.routes=this.routesRex=null},getParams:function(g){if(!g){return null}var j={},h;var i=g.slice(g.indexOf("?")+1).split("&");a.each(i,function(m,l){h=l.split("=");if(j[h[0]]){if(!(j[h[0]] instanceof Array)){j[h[0]]=[j[h[0]]]}j[h[0]].push(h[1])}else{j[h[0]]=h[1]}});if(a.isEmptyObject(j)){return null}return j}})})})(jQuery);

0 comments on commit 2144ba9

Please sign in to comment.
Something went wrong with that request. Please try again.