Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit ea812f0

Browse files
committed
Don't store custom history data in history object
1 parent e4ed1c8 commit ea812f0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

js/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,12 @@ heartbeat.on('message', function(e) {
500500

501501
var originalHistoryBack = history.back;
502502
history.back = function() {
503-
window.historyAction = 'back';
503+
historyAction = 'back';
504504
originalHistoryBack();
505505
}
506506

507507
var originalHistoryForward = history.forward;
508508
history.forward = function() {
509-
window.historyAction = 'forward';
509+
historyAction = 'forward';
510510
originalHistoryForward();
511511
}

js/router.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ module.exports = Backbone.Router.extend({
4848
this.navigate(translatedRoute, { trigger: true });
4949
});
5050
});
51-
history.size = -1;
52-
history.position = -1;
51+
window.historySize = -1;
52+
window.historyPosition = -1;
5353
window.historyAction = 'default';
5454
},
5555

@@ -109,23 +109,23 @@ module.exports = Backbone.Router.extend({
109109

110110
execute: function(callback, args, name) {
111111
if (historyAction == 'default') {
112-
history.position += 1;
113-
history.size = history.position;
112+
historyPosition += 1;
113+
historySize = historyPosition;
114114
} else if (historyAction == 'back') {
115-
history.position -= 1;
115+
historyPosition -= 1;
116116
} 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
119-
history.position += 1;
119+
historyPosition += 1;
120120
}
121-
window.historyAction = 'default';
121+
historyAction = 'default';
122122

123-
if (history.position == history.size)
123+
if (historyPosition == historySize)
124124
$('.js-navFwd').addClass('disabled');
125125
else
126126
$('.js-navFwd').removeClass('disabled');
127127

128-
if (history.position == 1)
128+
if (historyPosition == 1)
129129
$('.js-navBack').addClass('disabled');
130130
else
131131
$('.js-navBack').removeClass('disabled');

0 commit comments

Comments
 (0)