Translation update done using Pootle.
[phpmyadmin.git] / js / update-location.js
blob18e9851c09bf6ec952512a3905035b85e6962449
1 /* vim: set expandtab sw=4 ts=4 sts=4: */
2 /**
3 * Scripts to update location to allow bookmarking of frameset
4 * and restoring the bookmark once the page is loaded.
6 */
8 var hash_to_set = "";
9 var hash_init_done = 0;
11 /**
12 * Sets hash part in URL, either calls itself in parent frame or does the
13 * work itself. The hash is not set directly if we did not yet process old
14 * one.
16 function setURLHash(hash)
18 if (jQuery.browser.webkit) {
20 * Setting hash leads to reload in webkit:
21 * http://www.quirksmode.org/bugreports/archives/2005/05/Safari_13_visual_anomaly_with_windowlocationhref.html
23 return;
25 if (window.parent != window && window.parent.setURLHash) {
26 window.parent.setURLHash(hash);
27 } else {
28 /* Do not set if we're not updating frameset */
29 var path = window.location.pathname;
30 if (path.substring(path.length - 9, path.length) != "index.php") {
31 return;
33 if (hash_init_done) {
34 window.location.hash = "PMAURL:" + hash;
35 fix_favicon();
36 } else {
37 hash_to_set = "PMAURL:" + hash;
42 // Fix favicon disappearing in Firefox when setting location.hash
43 // See bug #3448485
44 function fix_favicon() {
45 if (jQuery.browser.mozilla) {
46 // Move the link tags for the favicon to the bottom
47 // of the head element to force a reload of the favicon
48 $('head > link[href=\\.\\/favicon\\.ico]').appendTo('head');
52 /**
53 * Handler for changing url according to the hash part, which is updated
54 * on each page to allow bookmarks.
56 $(document).ready(function(){
57 /* Don't do anything if we're not root Window */
58 if (window.parent != window && window.parent.setURLHash) {
59 return;
61 /* Check if hash contains parameters */
62 if (window.location.hash.substring(0, 8) == '#PMAURL:') {
63 window.location = 'index.php?' + window.location.hash.substring(8);
64 return;
66 /* Check if we should set URL */
67 if (hash_to_set != "") {
68 window.location.hash = hash_to_set;
69 hash_to_set = "";
70 fix_favicon();
72 /* Indicate that we're done (and we are not going to change location */
73 hash_init_done = 1;