From 4f2c1fb07de8d1a542be9e199c71c4ab3885bf2c Mon Sep 17 00:00:00 2001 From: Reimar Date: Tue, 5 Aug 2025 18:04:45 +0200 Subject: [PATCH] Cleanup and various fixes --- bookmark/index.html | 13 +++++++++++-- bookmark/script.js | 9 +++++++++ bookmark/style.css | 24 ++++++++++++++++++++++++ index.html | 8 ++++++-- popup/index.html | 5 +---- popup/script.js | 34 +++++++++++++++------------------- script.js | 8 ++------ style.css | 10 +++++----- 8 files changed, 73 insertions(+), 38 deletions(-) diff --git a/bookmark/index.html b/bookmark/index.html index a7c4b14..792fd06 100644 --- a/bookmark/index.html +++ b/bookmark/index.html @@ -4,13 +4,22 @@ + + + - Press CTRL + D / CMD + D or click the Star Icon to add this to your bookmarks. -

+

+ Press + Ctrl + D + + D + or click the Star Icon in your browser + to add this to your bookmarks. +

+

Next time you open the bookmark, the will automatically be opened.

Back   Open Popup Now diff --git a/bookmark/script.js b/bookmark/script.js index e4ca9ea..7f0053e 100644 --- a/bookmark/script.js +++ b/bookmark/script.js @@ -4,6 +4,15 @@ var popupLink = location.protocol + "//" + location.host + "/popup" + location.s history.replaceState(null, "", link); document.title = parseQueryParams().name + " - Popup Timer"; +if (navigator.platform.match(/Mac/i)) { + document.getElementById("win").style.display = "none"; + document.getElementById("mac").style.display = "inline"; +} + +[].slice.call(document.getElementsByClassName("type")).forEach(function(elem) { + elem.innerText = parseQueryParams().name.toLowerCase(); +}); + document.getElementById("open-popup").onclick = function() { window.open( diff --git a/bookmark/style.css b/bookmark/style.css index a7751ed..9adf647 100644 --- a/bookmark/style.css +++ b/bookmark/style.css @@ -3,6 +3,10 @@ body { font-family: helvetica, arial, sans-serif; font-size: 18px; text-align: center; + color: #424242; +} +b { + color: black; } a, a:visited { color: #43A047; @@ -11,4 +15,24 @@ a, a:visited { a:hover { text-decoration: none; } +kbd { + background-color: #EEE; + border-radius: 3px; + border: 1px solid #B4B4B4; + box-shadow: 0 1px 1px rgb(0 0 0 / 0.2); + color: #333; + display: inline-block; + font-weight: 700; + line-height: 1; + padding: 3px 6px; + white-space: nowrap; +} +.fa-star { + background-color: #EEE; + padding: 3px; + border-radius: 3px; +} +#mac { + display: none; +} diff --git a/index.html b/index.html index 9b69026..5a5d7f0 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ + Popup Timer @@ -30,7 +31,7 @@
   h -    m +    m    s

@@ -53,7 +54,10 @@


- Create Bookmark + + + Bookmark this + diff --git a/popup/index.html b/popup/index.html index 893e5ed..f61b253 100644 --- a/popup/index.html +++ b/popup/index.html @@ -11,9 +11,7 @@ - - - +
00h 00m 00s @@ -26,7 +24,6 @@
- diff --git a/popup/script.js b/popup/script.js index df55c25..5e19d7e 100644 --- a/popup/script.js +++ b/popup/script.js @@ -21,25 +21,21 @@ if (params.beep === "true") { } catch(e) {} } -// Autostart -if (params.autostart === "true") { +// Initialize clock and start +switch (params.type) { - switch (params.type) { + case "timer": + initTimer(); + if (params.autostart === "true") startTimer(1000); + break; - case "timer": - initTimer(); - startTimer(1000); - break; - - case "stopwatch": - initStopwatch(); - startStopwatch(1000); - break; - - default: - location.href = "/"; - } + case "stopwatch": + initStopwatch(); + if (params.autostart === "true") startStopwatch(1000); + break; + default: + location.href = "/"; } // Reset timer/stopwatch @@ -81,8 +77,6 @@ document.getElementById("restart").onclick = function() { // Pause / Resume playBtn.onclick = function() { - if (!timeout) return; - // Pause if (playBtn.classList.contains("fa-pause")) { @@ -94,7 +88,7 @@ playBtn.onclick = function() { playBtn.classList.remove("fa-pause"); playBtn.classList.add("fa-play"); - // Resume + // Resume } else { var startOffset = lastPaused % 1000; @@ -152,6 +146,8 @@ function initTimer() { function startTimer(startOffset) { + if (hours === 0 && minutes == 0 && seconds === 0) return; + playBtn.classList.remove("fa-play"); playBtn.classList.add("fa-pause"); diff --git a/script.js b/script.js index 707a388..3915d18 100644 --- a/script.js +++ b/script.js @@ -5,12 +5,6 @@ }); }*/ -// Only show bookmark button if supported -// Check if AddFavorite() exists, addPanel() exists or replaceState() exists which is used in /bookmark/script.js -if ((window.external && typeof window.external.AddFavorite === "function") || (window.sidebar && typeof window.sidebar.addPanel === "function") || (history && typeof history.replaceState === "function")) { - document.getElementById("bookmark").style.display = "inline-block"; -} - // Open new window when clicking create document.getElementById("create").onclick = function(event) { @@ -109,6 +103,8 @@ function showBookmarkAdded() { linkElem.innerText = createLink("link"); linkElem.style.display = "inline-block"; + document.getElementById("bookmark-type").innerText = elem.id; + } }); diff --git a/style.css b/style.css index cde6c68..ec00d0c 100644 --- a/style.css +++ b/style.css @@ -69,7 +69,7 @@ input:invalid { box-shadow: none; } input[type=checkbox] { - filter: hue-rotate(290deg); + accent-color: #43A047; } #time-input-container { display: flex; @@ -103,17 +103,17 @@ input[type=checkbox] { #bookmark { font-size: 15px; margin-top: 10px; - display: none; color: inherit; + display: inline-block; text-decoration: inherit; cursor: default; border: none; outline: none; -} -#bookmark:not(.disabled):hover { - text-decoration: underline; cursor: pointer; } +#bookmark:not(.disabled):hover #bookmark-label { + text-decoration: underline; +} #link { display: none; background-color: #E0E0E0;