Permalink
Browse files

Customizable favicon

  • Loading branch information...
1 parent 8e46171 commit d55ba18b43060d02d7b8bb20653c65c6a4e5eea4 @vrana committed Apr 3, 2011
Showing with 12 additions and 6 deletions.
  1. +4 −2 adminer/include/design.inc.php
  2. +7 −3 adminer/static/functions.js
  3. +1 −1 compile.php
@@ -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">
@@ -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
@@ -262,7 +262,7 @@ function compile_file($match) {
$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);

0 comments on commit d55ba18

Please sign in to comment.