This repository was archived by the owner on May 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed
Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -497,3 +497,15 @@ heartbeat.on('message', function(e) {
497497 }
498498 }
499499} ) ;
500+
501+ var originalHistoryBack = history . back ;
502+ history . back = function ( ) {
503+ window . historyAction = 'back' ;
504+ originalHistoryBack ( ) ;
505+ }
506+
507+ var originalHistoryForward = history . forward ;
508+ history . forward = function ( ) {
509+ window . historyAction = 'forward' ;
510+ originalHistoryForward ( ) ;
511+ }
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ module.exports = Backbone.Router.extend({
5050 } ) ;
5151 history . size = - 1 ;
5252 history . position = - 1 ;
53- history . action = 'default' ;
53+ window . historyAction = 'default' ;
5454 } ,
5555
5656 translateRoute : function ( route ) {
@@ -108,17 +108,17 @@ module.exports = Backbone.Router.extend({
108108 } ,
109109
110110 execute : function ( callback , args , name ) {
111- if ( history . action == 'default' ) {
111+ if ( historyAction == 'default' ) {
112112 history . position += 1 ;
113113 history . size = history . position ;
114- } else if ( history . action == 'back' ) {
114+ } else if ( historyAction == 'back' ) {
115115 history . position -= 1 ;
116- } else if ( history . action == 'forward' && this . previousName != name && name != "index" ) {
116+ } else if ( historyAction == 'forward' && this . previousName != name && name != "index" ) {
117117 //don't increment if the same state is navigated to twice
118118 //don't increment on index since that isn't a real state
119119 history . position += 1 ;
120120 }
121- history . action = 'default' ;
121+ window . historyAction = 'default' ;
122122
123123 if ( history . position == history . size )
124124 $ ( '.js-navFwd' ) . addClass ( 'disabled' ) ;
Original file line number Diff line number Diff line change @@ -501,12 +501,10 @@ module.exports = baseVw.extend({
501501 } ,
502502
503503 navBackClick : function ( ) {
504- history . action = 'back' ;
505504 history . back ( ) ;
506505 } ,
507506
508507 navFwdClick : function ( ) {
509- history . action = 'forward' ;
510508 history . forward ( ) ;
511509 } ,
512510
You can’t perform that action at this time.
0 commit comments