Created
February 18, 2012 12:35
-
-
Save datiecher/1859103 to your computer and use it in GitHub Desktop.
Revisions
-
datiecher created this gist
Feb 18, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ (function($){ window.app = { init: function() { app.router = new app.Router(); Backbone.history.loadUrl = function(fragmentOverride) { var fragment = this.fragment = this.getFragment(fragmentOverride).replace(/^.+\.php\/?/, ''); console.log('Navigated URL: '+fragment); var matched = _.any(this.handlers, function(handler) { if (handler.route.test(fragment)) { handler.callback(fragment); return true; } }); return matched; }; Backbone.history.start({ pushState: true }); } }; app.Router = Backbone.Router.extend({ routes: { '' : 'index' }, index: function() { console.log('index fired') } }); $(function(){ app.init(); }); })(jQuery, undefined); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ (function($){ window.app = { init: function() { app.router = new app.Router(); Backbone.history.start({ pushState: true }); } }; app.Router = Backbone.Router.extend({ routes: { '' : 'index' }, index: function() { console.log('index fired') } }); $(function(){ app.init(); }); })(jQuery, undefined);