Change favicon during AJAX
This commit is contained in:
parent
e52ac37c3e
commit
db40abccc8
|
@ -22,7 +22,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
<meta http-equiv="Content-Script-Type" content="text/javascript">
|
<meta http-equiv="Content-Script-Type" content="text/javascript">
|
||||||
<meta name="robots" content="noindex">
|
<meta name="robots" content="noindex">
|
||||||
<title><?php echo $title_page; ?></title>
|
<title><?php echo $title_page; ?></title>
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
|
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico" id="favicon">
|
||||||
<link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
|
<link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
|
||||||
<?php if (file_exists("adminer.css")) { ?>
|
<?php if (file_exists("adminer.css")) { ?>
|
||||||
<link rel="stylesheet" type="text/css" href="adminer.css">
|
<link rel="stylesheet" type="text/css" href="adminer.css">
|
||||||
|
|
|
@ -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;
|
var ajaxState = 0;
|
||||||
|
|
||||||
/** Safely load content to #content
|
/** Safely load content to #content
|
||||||
|
@ -280,9 +292,11 @@ var ajaxState = 0;
|
||||||
*/
|
*/
|
||||||
function ajaxSend(url, data, popState) {
|
function ajaxSend(url, data, popState) {
|
||||||
var currentState = ++ajaxState;
|
var currentState = ++ajaxState;
|
||||||
|
var favicon = replaceFavicon('../adminer/static/loader.gif');
|
||||||
setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
|
setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
|
||||||
return ajax(url, function (text) {
|
return ajax(url, function (text) {
|
||||||
if (currentState == ajaxState) {
|
if (currentState == ajaxState) {
|
||||||
|
replaceFavicon(favicon);
|
||||||
if (text === undefined) {
|
if (text === undefined) {
|
||||||
setHtml('loader', '');
|
setHtml('loader', '');
|
||||||
} else {
|
} else {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
Loading…
Reference in a new issue