Skip to content

Commit da87867

Browse files
authored
Merge pull request #1314 from notriddle/clean-js
Cleanup unneeded JS
2 parents 9f78dc7 + d7d7236 commit da87867

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

static/menu.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@
2929
}
3030
function closeMenu() {
3131
if (this === backdrop) {
32-
var rustdoc = document.querySelector(".rustdoc");
33-
if (rustdoc) {
34-
rustdoc.focus();
35-
} else {
36-
document.documentElement.focus();
37-
}
32+
document.documentElement.focus();
3833
} else if (currentMenu.querySelector(".pure-menu-link:focus")) {
3934
currentMenu.firstElementChild.focus();
4035
}

templates/core/home.html

+1-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1 class="brand">{{ "cubes" | fas(fw=true) }} Docs.rs</h1>
1414

1515
<div class="buttons">
1616
<button type="submit" class="pure-button pure-button-normal">Search</button>
17-
<button type="submit" class="pure-button pure-button-normal" id="i-am-feeling-lucky-button">
17+
<button type="submit" class="pure-button pure-button-normal" name="i-am-feeling-lucky" value="1">
1818
I'm Feeling Lucky
1919
</button>
2020
</div>
@@ -81,16 +81,6 @@ <h1 class="brand">{{ "cubes" | fas(fw=true) }} Docs.rs</h1>
8181
return String.fromCharCode(ev.charCode || ev.keyCode);
8282
}
8383

84-
document.getElementById("i-am-feeling-lucky-button").onclick = function () {
85-
var form = document.getElementsByClassName("landing-search-form");
86-
var input = document.createElement('input');
87-
input.type = 'hidden';
88-
input.name = 'i-am-feeling-lucky';
89-
input.value = 1;
90-
document.getElementsByClassName("landing-search-form")[0].appendChild(input);
91-
return true;
92-
};
93-
9484
function handleShortcut(ev) {
9585
if (ev.ctrlKey || ev.altKey || ev.metaKey || document.activeElement.tagName === "INPUT") {
9686
return;

0 commit comments

Comments
 (0)