From fa07815838cdb5eb73a2c2ccb7b666397e6883f9 Mon Sep 17 00:00:00 2001 From: Eugene Golovan Date: Fri, 22 Mar 2013 01:17:56 +0200 Subject: [PATCH 1/2] Fix favicon disappearing in Firefox Fix favicon disappearing in Firefox when setting location.hash See bug #3448485 --- js/ajax.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/ajax.js b/js/ajax.js index e26fe76869..92f9b59f06 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -671,6 +671,16 @@ AJAX.setUrlHash = (function (jQuery, window) { */ var userChange = true; + // Fix favicon disappearing in Firefox when setting location.hash + // See bug #3448485 + function fix_favicon() { + if (jQuery.browser.mozilla) { + // Move the link tags for the favicon to the bottom + // of the head element to force a reload of the favicon + $('head > link[href=favicon\\.ico]').appendTo('head'); + } + } + /** * Sets the hash part of the URL * @@ -688,6 +698,7 @@ AJAX.setUrlHash = (function (jQuery, window) { userChange = false; if (ready) { window.location.hash = "PMAURL-" + index + ":" + hash; + fix_favicon(); } else { savedHash = "PMAURL-" + index + ":" + hash; } @@ -709,6 +720,7 @@ AJAX.setUrlHash = (function (jQuery, window) { if (savedHash != "") { window.location.hash = savedHash; savedHash = ""; + fix_favicon(); } // Indicate that we're done initialising ready = true; From ed11f037d88b79305ff55f1a342680296689fc2a Mon Sep 17 00:00:00 2001 From: PHP Faber Date: Sat, 30 Mar 2013 12:44:02 +0200 Subject: [PATCH 2/2] Renamed function to fit camel case methods naming. --- js/ajax.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/ajax.js b/js/ajax.js index 92f9b59f06..742974f4e0 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -672,8 +672,7 @@ AJAX.setUrlHash = (function (jQuery, window) { var userChange = true; // Fix favicon disappearing in Firefox when setting location.hash - // See bug #3448485 - function fix_favicon() { + function resetFavicon() { if (jQuery.browser.mozilla) { // Move the link tags for the favicon to the bottom // of the head element to force a reload of the favicon @@ -698,7 +697,7 @@ AJAX.setUrlHash = (function (jQuery, window) { userChange = false; if (ready) { window.location.hash = "PMAURL-" + index + ":" + hash; - fix_favicon(); + resetFavicon(); } else { savedHash = "PMAURL-" + index + ":" + hash; } @@ -720,7 +719,7 @@ AJAX.setUrlHash = (function (jQuery, window) { if (savedHash != "") { window.location.hash = savedHash; savedHash = ""; - fix_favicon(); + resetFavicon(); } // Indicate that we're done initialising ready = true;