Compare commits

...

2 Commits

Author SHA1 Message Date
dc46288e6d Reset progress animation when restarting 2025-08-09 12:43:47 +02:00
82868a6b22 Fix issues with timer names 2025-08-09 12:36:25 +02:00
2 changed files with 5 additions and 6 deletions

View File

@ -2,7 +2,7 @@ var link = location.protocol + "//" + location.host + "/link" + location.search;
var popupLink = location.protocol + "//" + location.host + "/popup" + location.search; var popupLink = location.protocol + "//" + location.host + "/popup" + location.search;
history.replaceState(null, "", link); history.replaceState(null, "", link);
document.title = parseQueryParams().name + " - Popup Timer"; document.title = decodeURIComponent(parseQueryParams().name) + " - Popup Timer";
if (navigator.platform.match(/Mac/i)) { if (navigator.platform.match(/Mac/i)) {
document.getElementById("win").style.display = "none"; document.getElementById("win").style.display = "none";
@ -10,7 +10,7 @@ if (navigator.platform.match(/Mac/i)) {
} }
[].slice.call(document.getElementsByClassName("type")).forEach(function(elem) { [].slice.call(document.getElementsByClassName("type")).forEach(function(elem) {
elem.innerText = parseQueryParams().name.toLowerCase(); elem.innerText = parseQueryParams().type.toLowerCase();
}); });
document.getElementById("open-popup").onclick = function() { document.getElementById("open-popup").onclick = function() {

View File

@ -1,7 +1,7 @@
var params = parseQueryParams(); var params = parseQueryParams();
// Set window title // Set window title
if (params.name) document.title = params.name + " - Popup Timer"; if (params.name) document.title = decodeURIComponent(params.name) + " - Popup Timer";
var hours, minutes, seconds; var hours, minutes, seconds;
var secondsElem = document.getElementById("seconds"); var secondsElem = document.getElementById("seconds");
@ -49,8 +49,8 @@ document.getElementById("restart").onclick = function() {
case "timer": case "timer":
// Reset progress bar // Reset progress bar
// TODO progressBar.style.animationName = "none";
progressBar.animationName = ""; progressBar.offsetHeight; // Trigger reflow
progressBar.animationName = "progress"; progressBar.animationName = "progress";
initTimer(); initTimer();
@ -193,7 +193,6 @@ function timeUp() {
[].slice.call(document.querySelectorAll("main > span")).forEach(function(elem) { [].slice.call(document.querySelectorAll("main > span")).forEach(function(elem) {
elem.classList.toggle("red"); elem.classList.toggle("red");
}); });
//document.querySelector
// Blink title // Blink title
if (document.title.indexOf(timesUpStr) === -1) document.title = timesUpStr + document.title; if (document.title.indexOf(timesUpStr) === -1) document.title = timesUpStr + document.title;