Skip to content

Commit

Permalink
Fixed icon not showing properly sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
kckarnige committed Jan 30, 2024
1 parent 43b31ca commit 97b1af8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
No user information is collected in any capacity, it it shall remain that way.
No user information is collected in any capacity, and it shall remain that way.
2 changes: 1 addition & 1 deletion manifest.crx.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Ecsta",
"short_name": "Ecsta",
"version": "0.3.3",
"version": "0.3.4",

"description": "A simple new tab extension meant to stay out of your way while still making for great eye-candy.",

Expand Down
2 changes: 1 addition & 1 deletion manifest.xpi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Ecsta",
"short_name": "Ecsta",
"version": "0.3.3",
"version": "0.3.4",

"description": "A simple new tab extension meant to stay out of your way while still making for great eye-candy.",

Expand Down
12 changes: 7 additions & 5 deletions src/res/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ const getLastFetchDate = localStorage.getItem("lastFetchDate");
const UNSPLASH_API_KEY = localStorage.getItem("unsplashApiKey");
var currentDate = new Date().toISOString().split("T")[0];

window.onload = () => {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.getElementById("tabIcon").setAttribute("href","res/icons/white-256.png")
} else {
document.getElementById("tabIcon").setAttribute("href","res/icons/black-256.png")
}
}
if (UNSPLASH_API_KEY) {
//Background code
function set(fetched) {
Expand Down Expand Up @@ -65,11 +72,6 @@ if (UNSPLASH_API_KEY) {
document.getElementById("imgCreator").innerText = ("Image by " + localStorage.getItem("unsplashApiCreditName"));
document.getElementById("imgCreator").setAttribute("href", localStorage.getItem("unsplashApiCreditLink"));
}
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.getElementById("tabIcon").setAttribute("href","res/icons/white-256.png")
} else {
document.getElementById("tabIcon").setAttribute("href","res/icons/black-256.png")
}
console.log(
`Hasn't been 3 minutes (Has only been ${(
Date.now() / 60000 -
Expand Down

0 comments on commit 97b1af8

Please sign in to comment.