aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzlg <zlg@zlg.space>2025-08-28 01:34:57 -0700
committerzlg <zlg@zlg.space>2025-08-28 01:34:57 -0700
commit4b0d0aad228fa17040d9f8be42073d0404b0f06b (patch)
treec35c333f36bb606cb6aa0f1e00cc59c9d6cfe914
parentAdd 'labeled_bar' style (diff)
downloadzsst-4b0d0aad228fa17040d9f8be42073d0404b0f06b.tar.gz
zsst-4b0d0aad228fa17040d9f8be42073d0404b0f06b.tar.bz2
zsst-4b0d0aad228fa17040d9f8be42073d0404b0f06b.tar.xz
zsst-4b0d0aad228fa17040d9f8be42073d0404b0f06b.zip
Remove 'p5' style, replace with 'labeled_bar'HEADmaster
The more generic style supports a parameterized label instead of the hard-coded "Are you ready to enter Game Z?" I also took the opportunity to refactor the code so it looks for features/values and not the specific style.
Diffstat (limited to '')
-rw-r--r--make_timer.html5
-rw-r--r--timer.js66
2 files changed, 26 insertions, 45 deletions
diff --git a/make_timer.html b/make_timer.html
index bfa7098..17fda8c 100644
--- a/make_timer.html
+++ b/make_timer.html
@@ -23,7 +23,6 @@
<input type="radio" id="cdstyle" name="cdstyle" value="standard">Standard Countdown</input>
<input type="radio" id="cdstyle" name="cdstyle" value="bar">Progress Bar</input>
<input type="radio" id="cdstyle" name="cdstyle" value="labeled_bar">Labeled Bar</input>
- <input type="radio" id="cdstyle" name="cdstyle" value="p5">Persona 5</input>
</section>
<section>
<label for="duration">Countdown Duration, in seconds</label>
@@ -31,7 +30,7 @@
</section>
<section>
<label for="label_text">Text to Display Above Countdown (used in Labeled Bar)</label>
- <input name="label_text" type="text" id="end_text">
+ <input name="label_text" type="text" id="label_text">
</section>
<section>
<label for="end_text">Text to Display at End of Countdown</label>
@@ -46,7 +45,7 @@
<input name="f_color" type="color" id="f_color">
</section>
<section>
- <label for="b_color">Bar Color</label>
+ <label for="b_color">Bar Color (used in Bar-enabled styles)</label>
<input name="b_color" type="color" id="b_color">
</section>
<section class="bottom">
diff --git a/timer.js b/timer.js
index c40bd4b..7e01036 100644
--- a/timer.js
+++ b/timer.js
@@ -6,63 +6,45 @@ let cd;
const page = document.getElementById("page");
function setupCountdown() {
+ var prompt_text = "";
+ var progress_bar = "";
params = new URLSearchParams(document.location.search);
for ([key, value] of params.entries()) {
console.log(`${key}: ${value}`);
}
switch (params.get("cdstyle")) {
- case "standard":
- page.innerHTML = `
- <div id="countdown">
- <div id="minutes">00</div>
- <div id="separator">:</div>
- <div id="seconds">00</div>
- </div>
- `;
- break;
case "labeled_bar":
- var label_text = params.get("label_text");
- page.innerHTML = `
- <div id="prompt">${label_text}</div>
- <div id="bar"><div id="progress"></div></div>
- <div id="countdown">
- <div id="minutes">00</div>
- <div id="separator">:</div>
- <div id="seconds">00</div>
- </div>
- `;
+ let label_text = params.get("label_text");
+ prompt_text = `<div id="prompt">${label_text}</div>`;
+ progress_bar = `<div id="bar"><div id="progress"></div></div>`;
break;
case "bar":
- page.innerHTML = `
- <div id="bar"><div id="progress"></div></div>
- <div id="countdown">
- <div id="minutes">00</div>
- <div id="separator">:</div>
- <div id="seconds">00</div>
- </div>
- `;
- break;
- case "p5":
- page.innerHTML = `
- <div id="prompt">Are you ready to <span>Enter Game Z</span>?</div>
- <div id="bar"><div id="progress"></div></div>
- <div id="countdown">
- <div id="minutes">00</div>
- <div id="separator">:</div>
- <div id="seconds">00</div>
- </div>
- `;
+ progress_bar = `<div id="bar"><div id="progress"></div></div>`;
break;
}
+ page_template = `
+ ${prompt_text}
+ ${progress_bar}
+ <div id="countdown">
+ <div id="minutes">00</div>
+ <div id="separator">:</div>
+ <div id="seconds">00</div>
+ </div>
+ `;
+ page.innerHTML = page_template;
cd = document.getElementById("countdown");
+ let prompt = document.getElementById("prompt");
cur_seconds = parseInt(params.get("duration"));
if (params.get("f_family") !== "") {
cd.style.fontFamily = params.get("f_family");
+ if (prompt) {
+ document.getElementById("prompt").style.fontFamily = params.get("f_family");
+ }
}
cd.style.color = params.get("f_color");
- if (params.get("cdstyle") == "labeled_bar" || params.get("cdstyle") == "bar" || params.get("cdstyle") == "p5") {
+ if (document.getElementById("progress")) {
document.getElementById("progress").style.backgroundColor = params.get("b_color");
}
@@ -84,12 +66,12 @@ function tick() {
}
cur_seconds--;
draw();
- if (params.get("cdstyle") == "labeled_bar" || params.get("cdstyle") == "bar" || params.get("cdstyle") == "p5") {
- draw_bar();
- }
}
function draw() {
+ if (document.getElementById("progress")) {
+ draw_bar();
+ }
document.getElementById("minutes").textContent = zero_pad(Math.floor(cur_seconds / 60));
document.getElementById("seconds").textContent = zero_pad((cur_seconds % 60));
}
-09-03 02:55:21 -0700'>2018-09-03Branch off from master with pytest, tox, clickzlg16-778/+779 This commit is huge, but contains everything needed for a "proper" build system built on pytest + tox and a CLI built with click. For now, this branch will contain all new vgstash development activity until it reaches feature parity with master. The CLI is installed to pip's PATH. Only the 'init', 'add', and 'list' commands work, with only two filters. This is pre-alpha software, and is therefore not stable yet. 2018-03-18Flesh out filter types and ownership statuszlg3-82/+144 It's time for a refactor to a module; the functionality and interface are clashing. 2018-03-18README.mdown: break line correctlyzlg1-1/+1 2018-03-18add 'playlog' list filterzlg2-2/+9 This filter is used to get an idea of which games you're currently playing through, so you can prioritize games to play when you're bored and detect it when you've beaten a game but haven't marked it as such. 2018-03-13Update helpers a bitzlg1-2/+9 At present, user modification is needed to make these seamless. vgup() may need to be axed in favor of telling the user to make an alias. 2018-03-13Make VGSTASH_DB_LOCATION point to a filezlg2-21/+20 It used to point to a directory, which would then look for .vgstash.db. This behavior was kind of backwards and I don't remember why I did it that way. This change gives users more control over where they put their DB. Be sure to update your environment variable if you have it set! 2016-11-18Remove settings from helpers.shZe Libertine Gamer1-5/+0 Sourcing them in .bash_profile screws up login if they're set. 2016-11-15Correct phrasing in README.Ze Libertine Gamer1-4/+4 2016-11-13DerpZe Libertine Gamer1-0/+1 2016-11-03Improve error handling in shell scriptsZe Libertine Gamer4-3/+23 2016-10-24Correct run_again, add recursionZe Libertine Gamer1-0/+4 Loops and functions -- oh my, what a useful combination. :) 2016-10-21Add quotes to correct behavior for arglistZe Libertine Gamer1-1/+1 2016-10-14updater.sh: add recursion, error handlingZe Libertine Gamer1-43/+101 2016-10-14Correct pipe-handling behaviorZe Libertine Gamer1-1/+9 2016-10-12Clarify a method to move between platformsZe Libertine Gamer1-2/+5 Also correct a typo.