fuzzyworld

hawk / commit

Added a red-and-black image to use as favicon for local development.

c188f134af3e1e1e8e57127f49358cee2bbafbdf · Pavel Safronov · 2023-10-16 15:15:45 -0700 · parents 0b9bb35f98e9

Added a red-and-black image to use as favicon for local development.
 public/images/favicon-local.png | Bin 0 -> 1670 bytes
 public/js/main.js               |   5 +++++
 2 files changed, 5 insertions(+)

diff --git a/public/images/favicon-local.png b/public/images/favicon-local.png
new file mode 100644
index 0000000..5d6e0b8
Binary files /dev/null and b/public/images/favicon-local.png differ
diff --git a/public/js/main.js b/public/js/main.js
index 29e2e8f..5853114 100644
--- a/public/js/main.js
+++ b/public/js/main.js
@@ -1,3 +1,8 @@
+const isLocal = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
+if (isLocal) {
+    document.querySelector("link[rel='icon']").href = "images/favicon-local.png";
+}
+
 const updateInfoDiv = document.getElementById("updated-info");
 const updateInfoTemplate = document.querySelector("#updatedInfoTemplate");
 if (updateInfoTemplate) {