]> git.joonet.de Git - adminer.git/commitdiff
Customizable favicon
authorJakub Vrana <jakub@vrana.cz>
Sun, 3 Apr 2011 15:17:26 +0000 (08:17 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sun, 3 Apr 2011 15:17:26 +0000 (08:17 -0700)
adminer/include/design.inc.php
adminer/static/functions.js
compile.php

index 6c48f9ba22c322de9580d8259a7e618669f34b63..2fd6b649b0c0962e6595bcf1604c4509f0c48909 100644 (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">
index b8e2a159d9b21e3996a628e0ae0d4efb1740e3c0..687d66643f280f26fca3b5865c65a5aa421d5b77 100644 (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 {
index d643245aff23de967fafeca35c35690801639d0b..337bedd926dfd97353f2043489ea74d6c9f36790 100644 (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);