Skip to content

Commit

Permalink
Update Lazy Loading Background Color (#102)
Browse files Browse the repository at this point in the history
* Update Lazy Loading Background Color

* Cleanup
  • Loading branch information
smashedr authored Sep 14, 2024
1 parent 0f19ec0 commit 23ed010
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
5 changes: 0 additions & 5 deletions src/css/lazy.css

This file was deleted.

1 change: 0 additions & 1 deletion src/html/lazy.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" type="text/css" href="../css/lazy.css">
</head>
<body>

Expand Down
8 changes: 4 additions & 4 deletions src/html/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
</div>

<div class="flex-fill text-center">
<a class="link-body-emphasis text-decoration-none fs-4" title="Home Page" href="homepage_url">Link Extractor</a>
<span class="small">
<a class="link-body-emphasis text-decoration-none" title="Release Notes" href="version_url">
<a class="link-body-emphasis text-decoration-none fs-4" title="Home Page" href="homepage_url">
<img src="../images/logo32.png" alt="Logo" class="mb-1" style="height: 1.1em;">
Link Extractor</a>
<a class="link-body-emphasis text-decoration-none small" title="Release Notes" href="version_url">
v<span class="version"></span></a>
</span>
</div>

<div class="">
Expand Down
12 changes: 12 additions & 0 deletions src/js/lazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ link.rel = 'icon'
link.href = `${url.origin}/favicon.ico`
document.head.appendChild(link)

let theme = localStorage.getItem('theme')
if (!theme || theme === 'auto') {
theme = window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light'
}
if (theme === 'dark') {
document.body.style.backgroundColor = '#1c1b21'
} else {
document.body.style.backgroundColor = '#fff'
}

window.addEventListener('focus', () => {
console.log('url:', url)
window.location = url.href
Expand Down

0 comments on commit 23ed010

Please sign in to comment.