diff --git a/build/tasks/options/spider.js b/build/tasks/options/spider.js index a8bb3e6eff9..f9362e0c475 100644 --- a/build/tasks/options/spider.js +++ b/build/tasks/options/spider.js @@ -4,7 +4,8 @@ module.exports = { url: "http://localhost:" + "<%= phpPort %>", ignore: "api\\.jquerymobile\\.com/accordion|notapage|intel|" + - "api\\.jquerymobile\\.com/[0-9]\\.[0-9]|packt|twitter\\.com/jquery" + "api\\.jquerymobile\\.com/[0-9]\\.[0-9]|packt|twitter\\.com/jquery|" + + "demos/backbone\-requirejs/backbone\-require\.html" } }, "dist": { @@ -12,7 +13,8 @@ module.exports = { url: "http://localhost:" + "<%= phpPort %>" + "/dist/", ignore: "api\\.jquerymobile\\.com/accordion|notapage|intel|" + - "api\\.jquerymobile\\.com/[0-9]\\.[0-9]|packt|twitter\\.com/jquery" + "api\\.jquerymobile\\.com/[0-9]\\.[0-9]|packt|twitter\\.com/jquery|" + + "demos/backbone\-requirejs/backbone\-require\.html" } } }; diff --git a/demos/backbone-requirejs/js/main.js b/demos/backbone-requirejs/js/main.js index 6ab54ba012a..95a57e768ae 100644 --- a/demos/backbone-requirejs/js/main.js +++ b/demos/backbone-requirejs/js/main.js @@ -48,8 +48,10 @@ require([ ) require( [ "jquerymobile" ], function () { + $( "body" ).one( "pagecontainerchange", function() { - // Instantiates a new Backbone.js Mobile Router - this.router = new Mobile(); + // Instantiates a new Backbone.js Mobile Router + this.router = new Mobile(); + } ); }); }); diff --git a/demos/backbone-requirejs/js/routers/mobileRouter.js b/demos/backbone-requirejs/js/routers/mobileRouter.js index b45d37e46e9..968dee46a26 100644 --- a/demos/backbone-requirejs/js/routers/mobileRouter.js +++ b/demos/backbone-requirejs/js/routers/mobileRouter.js @@ -12,11 +12,12 @@ define([ // Extends Backbone.Router var CategoryRouter = Backbone.Router.extend( { + backToHome: false, // The Router constructor initialize: function() { - this.pagecontainer = $( ".ui-pagecontainer" ).pagecontainer( "instance" ); + this.pagecontainerHandle = $( ".ui-pagecontainer" ); // Instantiates a new Animal Category View this.animalsView = new CategoryView( { el: "#animals", collection: new CategoriesCollection( [] , { type: "animals" } ) } ); @@ -27,9 +28,9 @@ define([ // Instantiates a new Vehicles Category View this.vehiclesView = new CategoryView( { el: "#vehicles", collection: new CategoriesCollection( [] , { type: "vehicles" } ) } ); + // Tells Backbone to start watching for hashchange events Backbone.history.start(); - }, // Backbone.js Routes @@ -47,11 +48,10 @@ define([ home: function() { // Programatically changes to the categories page - this.pagecontainer.change( "#categories", { + this.pagecontainerHandle.pagecontainer( "change", "#categories", { reverse: false, - changeHash: false + changeUrl: false }); - }, // Category method that passes in the type that is appended to the url hash @@ -59,9 +59,10 @@ define([ // Stores the current Category View inside of the currentView variable var currentView = this[ type + "View" ]; + var that = this; // If there are no collections in the current Category View - if(!currentView.collection.length) { + if( !currentView.collection.length ) { // Show's the jQuery Mobile loading icon $.mobile.loading( "show" ); @@ -70,9 +71,9 @@ define([ currentView.collection.fetch().done( function() { // Programatically changes to the current categories page - this.pagecontainer.change( "#" + type, { + that.pagecontainerHandle.pagecontainer( "change", "#" + type, { reverse: false, - changeHash: false + changeUrl: false }); } ); @@ -82,9 +83,9 @@ define([ else { // Programatically changes to the current categories page - this.pagecontainer.change( "#" + type, { + this.pagecontainerHandle.pagecontainer( "change", "#" + type, { reverse: false, - changeHash: false + changeUrl: false }); }