History: Do not push same url twice

This commit is contained in:
Marius Hein 2015-02-16 14:08:07 +01:00
parent ae68e8aec4
commit 2aca4dc6d5
1 changed files with 9 additions and 5 deletions

View File

@ -92,7 +92,7 @@
// TODO: update navigation
// Did we find any URL? Then push it!
if (url !== '') {
window.history.pushState({icinga: true}, null, this.cleanupUrl(url));
this.push(url);
}
},
@ -101,15 +101,19 @@
if (!this.enabled) {
return;
}
window.history.pushState({icinga: true}, null, this.cleanupUrl(url));
this.push(url);
},
cleanupUrl: function(url) {
push: function (url) {
url = url.replace(/_render=[a-z0-9]+&/, '').replace(/&_render=[a-z0-9]+/, '').replace(/\?_render=[a-z0-9]+$/, '');
url = url.replace(/_reload=[a-z0-9]+&/, '').replace(/&_reload=[a-z0-9]+/, '').replace(/\?_reload=[a-z0-9]+$/, '');
return url;
if (this.lastPushUrl === url) {
return;
}
this.lastPushUrl = url;
window.history.pushState({icinga: true}, null, url);
},
/**
* Event handler for pop events
*