update changeFavicon to only change the href attribute
This commit is contained in:
parent
5dfc80b2f2
commit
be6161d02e
2 changed files with 3 additions and 13 deletions
|
|
@ -76,16 +76,6 @@ function init(reconnectDelay) {
|
|||
}
|
||||
|
||||
const changeFavicon = function (iconURL) {
|
||||
const head = document.getElementsByTagName("head")[0];
|
||||
const newLink = document.createElement("link");
|
||||
newLink.rel = "icon";
|
||||
newLink.href = iconURL;
|
||||
removeExistingFavicons();
|
||||
head.appendChild(newLink);
|
||||
};
|
||||
const removeExistingFavicons = function () {
|
||||
const links = document.getElementsByTagName("link");
|
||||
Array.from(links)
|
||||
.filter((link) => /\bicon\b/i.test(link.getAttribute("rel")))
|
||||
.forEach((link) => link.remove());
|
||||
const faviconLink = document.getElementById("favicon-link");
|
||||
faviconLink.href = iconURL;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ func (w *watcher) handleRoot(hw http.ResponseWriter, r *http.Request) {
|
|||
<title>%s</title>
|
||||
<script src="./static/watch.js"></script>
|
||||
<link rel="stylesheet" href="./static/watch.css">
|
||||
<link rel="icon" href="./static/favicon.ico">
|
||||
<link id="favicon-link" rel="icon" href="./static/favicon.ico">
|
||||
</head>
|
||||
<body data-d2-dev-mode=%t>
|
||||
<div id="d2-err" style="display: none"></div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue