forked from rust-lang/docs.rs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
146 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
{%- extends "base.html" -%} | ||
{%- import "releases/header.html" as release_macros -%} | ||
|
||
{%- block title -%}Build Queue - Docs.rs{%- endblock title -%} | ||
|
||
{%- block header -%} | ||
{{ release_macros::header(title="Build Queue", description=description, tab="queue") }} | ||
{%- endblock header -%} | ||
|
||
{%- block body -%} | ||
<div class="container"> | ||
<div class="recent-releases-container"> | ||
|
||
<div class="release"> | ||
{% set queue_length = queue | length -%} | ||
{%- if queue_length == 0 -%} | ||
<strong>There is nothing in queue</strong> | ||
{%- else -%} | ||
<strong>Queue</strong> | ||
{%- endif %} | ||
</div> | ||
|
||
<ol class="queue-list"> | ||
{% for crate in queue -%} | ||
<li> | ||
<a href="https://crates.io/crates/{{ crate.name }}"> | ||
{{ crate.name }} {{ crate.version }} | ||
</a> | ||
|
||
{% if crate.priority != 0 -%} | ||
(priority: {{ crate.priority }}) | ||
{%- endif %} | ||
</li> | ||
{%- endfor %} | ||
</ol> | ||
</div> | ||
</div> | ||
{%- endblock body -%} | ||
|
||
{%- block javascript -%} | ||
<script type="text/javascript" charset="utf-8"> | ||
function getKey(ev) { | ||
if ("key" in ev && typeof ev.key != "undefined") { | ||
return ev.key; | ||
} | ||
return String.fromCharCode(ev.charCode || ev.keyCode); | ||
} | ||
|
||
document.getElementById("i-am-feeling-lucky-button").onclick = function () { | ||
var form = document.getElementsByClassName("landing-search-form"); | ||
var input = document.createElement('input'); | ||
input.type = 'hidden'; | ||
input.name = 'i-am-feeling-lucky'; | ||
input.value = 1; | ||
document.getElementsByClassName("landing-search-form")[0].appendChild(input); | ||
return true; | ||
}; | ||
|
||
function handleShortcut(ev) { | ||
if (ev.ctrlKey || ev.altKey || ev.metaKey || document.activeElement.tagName === "INPUT") { | ||
return; | ||
} | ||
switch (getKey(ev)) { | ||
case "s": | ||
case "S": | ||
ev.preventDefault(); | ||
document.getElementById("search").focus(); | ||
break; | ||
} | ||
} | ||
|
||
document.onkeypress = handleShortcut; | ||
document.onkeydown = handleShortcut; | ||
|
||
var active = null; | ||
|
||
function handleKey(ev) { | ||
if (ev.ctrlKey || ev.altKey || ev.metaKey || document.activeElement.tagName === "INPUT") { | ||
return; | ||
} | ||
if (ev.which === 40) { // Down arrow | ||
ev.preventDefault(); | ||
if (active === null) { | ||
active = document.getElementsByClassName("recent-releases-container")[0].getElementsByTagName("li")[0]; | ||
} else if (active.nextElementSibling) { | ||
active.classList.remove("selected"); | ||
active = active.nextElementSibling; | ||
} | ||
active.classList.add("selected"); | ||
} else if (ev.which === 38) { // Up arrow | ||
ev.preventDefault(); | ||
if (active === null) { | ||
active = document.getElementsByClassName("recent-releases-container")[0].getElementsByTagName("li")[0]; | ||
} else if (active.previousElementSibling) { | ||
active.classList.remove("selected"); | ||
active = active.previousElementSibling; | ||
} | ||
active.classList.add("selected"); | ||
active.focus(); | ||
} else if (ev.which === 13) { // Return | ||
if (active !== null) { | ||
document.location.href = active.getElementsByTagName("a")[0].href; | ||
} | ||
} else { | ||
switch (getKey(ev)) { | ||
case "s": | ||
case "S": | ||
ev.preventDefault(); | ||
document.getElementsByClassName("search-input-nav")[0].focus(); | ||
break; | ||
} | ||
} | ||
} | ||
document.onkeypress = handleKey; | ||
document.onkeydown = handleKey; | ||
var crates = | ||
Array.prototype.slice.call(document.getElementsByClassName("recent-releases-container")[0].getElementsByTagName("li")); | ||
for (var i = 0; i < crates.length; ++i) { | ||
crates[i].addEventListener("mouseover", function (event) { | ||
this.classList.remove("selected"); active = null; | ||
}); crates[i].addEventListener("mouseout", function (event) { | ||
this.classList.remove("selected"); active = null; | ||
}); | ||
} | ||
</script> | ||
{%- endblock javascript -%} |