Customizable favicon

This commit is contained in:
Jakub Vrana 2011-04-03 08:17:26 -07:00
parent 8e46171f14
commit d55ba18b43
3 changed files with 12 additions and 6 deletions

View file

@ -22,16 +22,18 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="robots" content="noindex">
<title><?php echo $title_page; ?></title>
<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">
<script type="text/javascript">
var areYouSure = '<?php echo lang('Resend POST data?'); ?>';
</script>
<script type="text/javascript" src="../adminer/static/functions.js"></script>
<script type="text/javascript" src="static/editing.js"></script>
<?php if ($adminer->head() && file_exists("adminer.css")) { ?>
<?php if ($adminer->head()) { ?>
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico" id="favicon">
<?php if (file_exists("adminer.css")) { ?>
<link rel="stylesheet" type="text/css" href="adminer.css">
<?php } ?>
<?php } ?>
<body class="<?php echo lang('ltr'); ?> nojs" onclick="return bodyClick(event, '<?php echo js_escape(DB); ?>', '<?php echo js_escape($_GET["ns"]); ?>');" onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
<script type="text/javascript">

View file

@ -280,13 +280,17 @@ function ajaxSetHtml(url) {
});
}
var originalFavicon = (document.getElementById('favicon') || {}).href;
/** Replace favicon
* @param string
*/
function replaceFavicon(href) {
var favicon = document.getElementById('favicon');
favicon.href = href;
favicon.parentNode.appendChild(favicon); // to replace the icon in Firefox
if (favicon) {
favicon.href = href;
favicon.parentNode.appendChild(favicon); // to replace the icon in Firefox
}
}
var ajaxState = 0;
@ -317,7 +321,7 @@ function ajaxSend(url, data, popState) {
return ajaxSend(redirect, '', popState);
}
onblur = function () { };
replaceFavicon('../adminer/static/favicon.ico');
replaceFavicon(originalFavicon);
if (!xmlhttp.status) {
setHtml('loader', '');
} else {

View file

@ -262,7 +262,7 @@ foreach (array("adminer", "editor") as $project) {
$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
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION;
$file = preg_replace("~'\\.\\./adminer/static/(loader\\.gif|favicon\\.ico)~", "location.pathname+'?file=\\1&amp;version=$VERSION", $file);
$file = preg_replace("~'\\.\\./adminer/static/(loader\\.gif)~", "location.pathname+'?file=\\1&amp;version=$VERSION", $file);
$file = preg_replace('~\\.\\./adminer/static/(loader\\.gif)~', "'+location.pathname+'?file=\\1&amp;version=$VERSION", $file);
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);