Avoid double replacing AJAX favicon
This commit is contained in:
parent
d1f6fa9a3a
commit
70066b3f37
|
@ -263,14 +263,11 @@ function ajaxSetHtml(url) {
|
||||||
|
|
||||||
/** Replace favicon
|
/** Replace favicon
|
||||||
* @param string
|
* @param string
|
||||||
* @return string original href
|
|
||||||
*/
|
*/
|
||||||
function replaceFavicon(href) {
|
function replaceFavicon(href) {
|
||||||
var favicon = document.getElementById('favicon');
|
var favicon = document.getElementById('favicon');
|
||||||
var orig = favicon.href;
|
|
||||||
favicon.href = href;
|
favicon.href = href;
|
||||||
favicon.parentNode.appendChild(favicon); // to replace the icon in Firefox
|
favicon.parentNode.appendChild(favicon); // to replace the icon in Firefox
|
||||||
return orig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ajaxState = 0;
|
var ajaxState = 0;
|
||||||
|
@ -283,7 +280,7 @@ 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');
|
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 (xmlhttp) {
|
return ajax(url, function (xmlhttp) {
|
||||||
if (currentState == ajaxState) {
|
if (currentState == ajaxState) {
|
||||||
|
@ -298,7 +295,7 @@ function ajaxSend(url, data, popState) {
|
||||||
}
|
}
|
||||||
return ajaxSend(redirect);
|
return ajaxSend(redirect);
|
||||||
}
|
}
|
||||||
replaceFavicon(favicon);
|
replaceFavicon('../adminer/static/favicon.ico');
|
||||||
if (!xmlhttp.status) {
|
if (!xmlhttp.status) {
|
||||||
setHtml('loader', '');
|
setHtml('loader', '');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -262,6 +262,7 @@ foreach (array("adminer", "editor") as $project) {
|
||||||
$file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
|
$file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
|
||||||
$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files
|
$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files
|
||||||
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&version=' . $VERSION;
|
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&version=' . $VERSION;
|
||||||
|
$file = preg_replace("~'\\.\\./adminer/static/(loader\\.gif|favicon\\.ico)~", "location.pathname+'?file=\\1&version=$VERSION", $file);
|
||||||
$file = preg_replace('~\\.\\./adminer/static/(loader\\.gif)~', "'+location.pathname+'?file=\\1&version=$VERSION", $file);
|
$file = preg_replace('~\\.\\./adminer/static/(loader\\.gif)~', "'+location.pathname+'?file=\\1&version=$VERSION", $file);
|
||||||
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
|
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
|
||||||
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
|
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
|
||||||
|
|
Loading…
Reference in a new issue