Apply history also on page load

This commit is contained in:
Thomas Gelf 2014-03-10 14:48:40 +00:00
parent e291974e55
commit e0be89a1dc

View File

@ -49,6 +49,7 @@
) { ) {
this.enabled = true; this.enabled = true;
this.icinga.logger.debug('History API enabled'); this.icinga.logger.debug('History API enabled');
this.applyLocationBar();
$(window).on('popstate', { self: this }, this.onHistoryChange); $(window).on('popstate', { self: this }, this.onHistoryChange);
} }
@ -98,9 +99,7 @@
var self = event.data.self, var self = event.data.self,
icinga = self.icinga, icinga = self.icinga,
onload, onload;
main,
parts;
icinga.logger.debug('Got a history change'); icinga.logger.debug('Got a history change');
@ -117,6 +116,15 @@
icinga.logger.debug('History state', event.originalEvent.state); icinga.logger.debug('History state', event.originalEvent.state);
} }
self.applyLocationBar();
},
applyLocationBar: function () {
var icinga = this.icinga,
main,
parts;
// TODO: Still hardcoding col1/col2, shall be dynamic soon // TODO: Still hardcoding col1/col2, shall be dynamic soon
main = document.location.pathname + document.location.search; main = document.location.pathname + document.location.search;
if ($('#col1').data('icingaUrl') !== main) { if ($('#col1').data('icingaUrl') !== main) {
@ -145,7 +153,6 @@
// TODO: Replace with dynamic columns // TODO: Replace with dynamic columns
icinga.ui.layout1col(); icinga.ui.layout1col();
} }
}, },
/** /**