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

Commit 9d8c80f

Browse files
committed
Improve history tracking
- makes sure home and settings state changes aren't added to history - fixes history ends on Discover bug - doesn't increment history on idex, or if same page is navigated to twice - makes disabled states visible when advanced graphics are turned off
1 parent 9091152 commit 9d8c80f

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

css/obBase.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5867,7 +5867,31 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
58675867

58685868
#ov1.notFancy .notFancyDarkBackground,
58695869
#ov1.notFancy #obContainer .notFancyDarkBackground {
5870-
background: #262626;
5870+
background: #262626 !important;
5871+
}
5872+
5873+
#ov1.notFancy .disabled,
5874+
#ov1.notFancy #userPage .disabled,
5875+
#ov1.notFancy #obContainer .disabled,
5876+
#ov1.notFancy #overlay .disabled,
5877+
#ov1.notFancy #sideBar .disabled,
5878+
#ov1.notFancy #pageNav .disabled,
5879+
#ov1.notFancy #modalHolder .disabled,
5880+
#ov1.notFancy #messageModal .disabled,
5881+
#ov1.notFancy #statusBar .disabled {
5882+
opacity: 0.2 !important;
5883+
}
5884+
5885+
#ov1.notFancy .disabled2,
5886+
#ov1.notFancy #userPage .disabled2,
5887+
#ov1.notFancy #obContainer .disabled2,
5888+
#ov1.notFancy #overlay .disabled2,
5889+
#ov1.notFancy #sideBar .disabled2,
5890+
#ov1.notFancy #pageNav .disabled2,
5891+
#ov1.notFancy #modalHolder .disabled2,
5892+
#ov1.notFancy #messageModal .disabled2,
5893+
#ov1.notFancy #statusBar .disabled2 {
5894+
opacity: 0.7 !important;
58715895
}
58725896

58735897
/* add a shadow and a glow, so modal close buttons are still barely visible if the user picks a bad color */

js/router.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ module.exports = Backbone.Router.extend({
4848
this.navigate(translatedRoute, { trigger: true });
4949
});
5050
});
51-
5251
history.size = -1;
5352
history.position = -1;
5453
history.action = 'default';
@@ -108,17 +107,19 @@ module.exports = Backbone.Router.extend({
108107
return deferred.promise();
109108
},
110109

111-
execute: function(callback, args) {
110+
execute: function(callback, args, name) {
112111
if (history.action == 'default') {
113-
history.position += 1;
114-
history.size = history.position;
112+
history.position += 1;
113+
history.size = history.position;
115114
} else if (history.action == 'back') {
116-
history.position -= 1;
117-
} else if (history.action == 'forward') {
115+
history.position -= 1;
116+
} else if(history.action == 'forward' && this.previousName != name && name != "index") {
117+
//don't increment if the same state is navigated to twice
118+
//don't increment on index since that isn't a real state
118119
history.position += 1;
119120
}
120121
history.action = 'default';
121-
122+
122123
if (history.position == history.size)
123124
$('.js-navFwd').addClass('disabled');
124125
else

js/views/homeVw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ module.exports = baseVw.extend({
290290
this.searchItemsText = searchItemsText;
291291

292292
//add action to history
293-
Backbone.history.navigate("#home/" + state + "/" + searchItemsText.replace(/ /g, ""));
293+
Backbone.history.navigate("#home/" + state + "/" + searchItemsText.replace(/ /g, ""), { replace: true });
294294
} else {
295295
//add action to history
296-
Backbone.history.navigate("#home/" + state);
296+
Backbone.history.navigate("#home/" + state, { replace: true });
297297
}
298298

299299
this.state = state;

js/views/settingsVw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ module.exports = Backbone.View.extend({
528528

529529
addTabToHistory: function(state){
530530
//add action to history
531-
Backbone.history.navigate("#settings/" + state);
531+
Backbone.history.navigate("#settings/" + state, { replace: true });
532532
this.options.state = state;
533533
},
534534

0 commit comments

Comments
 (0)