1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-13 18:14:07 +02:00

Change favicon during AJAX

This commit is contained in:
Jakub Vrana
2011-03-11 23:21:54 +01:00
parent e52ac37c3e
commit db40abccc8
3 changed files with 15 additions and 1 deletions

View File

@@ -270,6 +270,18 @@ function ajaxSetHtml(url) {
});
}
/** Replace favicon
* @param string
* @return string original href
*/
function replaceFavicon(href) {
var favicon = document.getElementById('favicon');
var orig = favicon.href;
favicon.href = href;
favicon.parentNode.appendChild(favicon); // to replace the icon in Firefox
return orig;
}
var ajaxState = 0;
/** Safely load content to #content
@@ -280,9 +292,11 @@ var ajaxState = 0;
*/
function ajaxSend(url, data, popState) {
var currentState = ++ajaxState;
var favicon = replaceFavicon('../adminer/static/loader.gif');
setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
return ajax(url, function (text) {
if (currentState == ajaxState) {
replaceFavicon(favicon);
if (text === undefined) {
setHtml('loader', '');
} else {