diff --git a/assets/links.js b/assets/links.js index 56e2ccb..236cfff 100644 --- a/assets/links.js +++ b/assets/links.js @@ -28,6 +28,8 @@ function buildRepoLink() { } else { window.location.assign(`/repo/${hoster}/${owner}/${repoName}${qparams}`); } + + return false; } function buildCrateLink() { @@ -36,10 +38,12 @@ function buildCrateLink() { let crate = formRef.elements["crateName"].value; let crateVer = formRef.elements["crateVersion"].value; - if (crateVer.length == 0) { + if (crateVer.length === 0) { // default to latest version window.location.assign(`/crate/${crate}`); } else { window.location.assign(`/crate/${crate}/${crateVer}`); } + + return false; } diff --git a/src/server/views/html/index.rs b/src/server/views/html/index.rs index 626fe57..a1ccae0 100644 --- a/src/server/views/html/index.rs +++ b/src/server/views/html/index.rs @@ -67,7 +67,7 @@ fn link_forms() -> Markup { p class="help" id="baseUrlHelp" { "Path within the repository where the " code { "Cargo.toml" } " file is located." } } - input type="submit" class="button is-primary" value="Check" onclick="buildRepoLink();"; + input type="submit" class="button is-primary" value="Check" onclick="return buildRepoLink();"; } } } @@ -80,7 +80,7 @@ fn link_forms() -> Markup { label class="label" { "Crate Name" } div class="control" { - input class="input" type="text" id="crateName" placeholder="serde-derive" required; + input class="input" type="text" id="crateName" placeholder="serde" required; } } @@ -94,7 +94,7 @@ fn link_forms() -> Markup { p class="help" { "If left blank, defaults to the latest version." } } - input type="submit" class="button is-primary" value="Check" onclick="buildCrateLink();"; + input type="submit" class="button is-primary" value="Check" onclick="return buildCrateLink();"; } } }