|
@@ -67,7 +67,10 @@ var findEventHandlers = function (eventType, jqSelector) {
|
|
|
|
|
|
window.top.addEventListener('popstate', function (event) {
|
|
|
window.setTimeout(function () {
|
|
|
- if (!event) return;
|
|
|
+ if (!event || !event.state) {
|
|
|
+ console.error('No state!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
var state = event.state;
|
|
|
if (state === '') state = '/';
|
|
|
if (state[0] !== '/') state = '/' + state;
|
|
@@ -76,8 +79,8 @@ window.top.addEventListener('popstate', function (event) {
|
|
|
});
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
- if(window.location.href === window.top.location.href) {
|
|
|
- window.location.href = '/mc' + window.location.pathname;
|
|
|
+ if(window.location.pathname === window.top.location.pathname) {
|
|
|
+ window.top.location.href = '/mc' + window.location.pathname;
|
|
|
return;
|
|
|
}
|
|
|
// window.top.ensureRHS();
|
|
@@ -111,8 +114,7 @@ $(document).ready(function () {
|
|
|
if (target.indexOf('/mc') === 0) {
|
|
|
target = target.split('/mc')[1];
|
|
|
}
|
|
|
- // window.top.history.pushState(target, null, '/mc' + target);
|
|
|
- fastLoad(target, true, false);
|
|
|
+ fastLoad(target, true, false, true);
|
|
|
|
|
|
});
|
|
|
function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
|
|
@@ -225,7 +227,7 @@ function onFastLoaded(_data, _href, _history) {
|
|
|
}
|
|
|
hideMask();
|
|
|
}
|
|
|
-function fastLoad(_href, _history = true, _useCache = true) {
|
|
|
+function fastLoad(_href, _history = true, _useCache = true, _replaceState = false) {
|
|
|
|
|
|
showMask();
|
|
|
|
|
@@ -239,7 +241,12 @@ function fastLoad(_href, _history = true, _useCache = true) {
|
|
|
}
|
|
|
}
|
|
|
if(target[0] === '/') target = target.substr(1);
|
|
|
- window.top.history.pushState(target, null, '/mc/' + target);
|
|
|
+ if(_replaceState) {
|
|
|
+ window.top.history.replaceState(target, null, '/mc/' + target);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ window.top.history.pushState(target, null, '/mc/' + target);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (_useCache && !!fastCache[_href]) {
|