
Just disable it for webkit based browsers, because they do not allow to update any part of location without reload. bug#2937481
57 lines
1.6 KiB
JavaScript
57 lines
1.6 KiB
JavaScript
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
|
/**
|
|
* Various helper scripts, using mootools.
|
|
*
|
|
* @version $Id$
|
|
*/
|
|
|
|
var hash_to_set = "";
|
|
var hash_init_done = 0;
|
|
|
|
/**
|
|
* Sets hash part in URL, either calls itself in parent frame or does the
|
|
* work itself. The hash is not set directly if we did not yet process old
|
|
* one.
|
|
*/
|
|
function setURLHash(hash) {
|
|
if (Browser.Engine.webkit) {
|
|
/*
|
|
* Setting hash leads to reload in webkit:
|
|
* http://www.quirksmode.org/bugreports/archives/2005/05/Safari_13_visual_anomaly_with_windowlocationhref.html
|
|
*/
|
|
return;
|
|
}
|
|
if (window.parent != window && window.parent.setURLHash) {
|
|
window.parent.setURLHash(hash);
|
|
} else {
|
|
if (hash_init_done) {
|
|
window.location.hash = "PMAURL:" + hash;
|
|
} else {
|
|
hash_to_set = "PMAURL:" + hash;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Handler for changing url according to the hash part, which is updated
|
|
* on each page to allow bookmarks.
|
|
*/
|
|
window.addEvent('load', function() {
|
|
/* Don't do anything if we're not root Window */
|
|
if (window.parent != window && window.parent.setURLHash) {
|
|
return;
|
|
}
|
|
/* Check if hash contains parameters */
|
|
if (window.location.hash.substring(0, 8) == '#PMAURL:') {
|
|
window.location = 'index.php?' + window.location.hash.substring(8);
|
|
return;
|
|
}
|
|
/* Check if we should set URL */
|
|
if (hash_to_set != "") {
|
|
window.location.hash = hash_to_set;
|
|
hash_to_set = "";
|
|
}
|
|
/* Indicate that we're done (and we are not going to change location */
|
|
hash_init_done = 1;
|
|
})
|