diff --git a/website/server/src/site.rs b/website/server/src/site.rs index 9e4b811..84767bd 100644 --- a/website/server/src/site.rs +++ b/website/server/src/site.rs @@ -74,6 +74,11 @@ const CLIENT_KEYS: &[&str] = &[ "copied", "lb_count", "meta_title", + "btn_android", + "and_full_title", + "and_requires", + "and_alpha", + "next_android", ]; pub struct Site { @@ -388,4 +393,18 @@ mod tests { assert_eq!(date("2026-10-19T06:54:58Z", "es"), "19 de octubre de 2026"); assert_eq!(date("bad", "en"), ""); } + + /// Every text the page script asks for is sent to it: a key left out shows as + /// itself ("btn_android") on the page. + #[test] + fn the_script_gets_every_text_it_uses() { + let script = include_str!("../../static/js/site.js"); + let en: HashMap = + serde_json::from_str(include_str!("../../site/i18n/en.json")).expect("en.json"); + let quoted = script.split('"').skip(1).step_by(2); + let missing: Vec<&str> = quoted + .filter(|k| en.contains_key(*k) && !CLIENT_KEYS.contains(k)) + .collect(); + assert!(missing.is_empty(), "not in CLIENT_KEYS: {missing:?}"); + } } diff --git a/website/static/js/site.js b/website/static/js/site.js index b3741f6..a96b392 100644 --- a/website/static/js/site.js +++ b/website/static/js/site.js @@ -230,7 +230,9 @@ var panelId = id.replace(/^(download-(windows|macos|linux|android)).*/, "$1"); var tab = tabs.filter(function (x) { return x.getAttribute("aria-controls") === panelId; })[0]; if (tab) select(tab); - var target = $(id); + // A platform link shows the section from its heading and tabs; a link to one + // file, its row. + var target = id === panelId ? $("download") : $(id); if (target) target.scrollIntoView(); } // The jump is done: drop the anchor, or a reload jumps there again from wherever