Merge pull request #1240 from sinyo-matu/master
add favicon error indicator
This commit is contained in:
commit
6b9c4fa234
4 changed files with 8 additions and 1 deletions
BIN
d2cli/static/favicon-err.ico
Normal file
BIN
d2cli/static/favicon-err.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
d2cli/static/favicon.ico
Normal file
BIN
d2cli/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -28,7 +28,7 @@ function init(reconnectDelay) {
|
|||
// we can't just set `d2SVG.innerHTML = msg.svg` need to parse this as xml not html
|
||||
const parsedXML = new DOMParser().parseFromString(msg.svg, "text/xml");
|
||||
d2SVG.replaceChildren(parsedXML.documentElement);
|
||||
|
||||
changeFavicon("./static/favicon.ico");
|
||||
const svgEl = d2SVG.querySelector("#d2-svg");
|
||||
// just use inner SVG in watch mode
|
||||
svgEl.parentElement.replaceWith(svgEl);
|
||||
|
|
@ -56,6 +56,7 @@ function init(reconnectDelay) {
|
|||
if (msg.err) {
|
||||
d2ErrDiv.innerText = msg.err;
|
||||
d2ErrDiv.style.display = "block";
|
||||
changeFavicon("./static/favicon-err.ico");
|
||||
d2ErrDiv.scrollIntoView();
|
||||
}
|
||||
};
|
||||
|
|
@ -73,3 +74,8 @@ function init(reconnectDelay) {
|
|||
}, reconnectDelay);
|
||||
};
|
||||
}
|
||||
|
||||
const changeFavicon = function (iconURL) {
|
||||
const faviconLink = document.getElementById("favicon");
|
||||
faviconLink.href = iconURL;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -429,6 +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 id="favicon" 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