84 lines
2.4 KiB
HTML
84 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Rust Docs</title>
|
|
<meta charset="utf-8">
|
|
<!-- Make the device look good on phones -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
|
|
<link rel="icon" href="/favicon.ico" sizes="any">
|
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
background: black;
|
|
}
|
|
|
|
#links {
|
|
overflow-x: scroll;
|
|
white-space: nowrap;
|
|
padding-bottom: 20px;
|
|
}
|
|
|
|
a {
|
|
padding: 20px;
|
|
color: white;
|
|
}
|
|
|
|
#main {
|
|
position:fixed;
|
|
left: 0;
|
|
bottom: 0;right: 0;
|
|
width: 100%;
|
|
height: calc(100% - 2.5rem);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="links">
|
|
<a href="global/std/" id="std-docs" target="main" onclick="focusFrame()">STD</a>
|
|
<a href="local-latest" id="local-docs" target="main" onclick="focusFrame()">Cargo</a>
|
|
</div>
|
|
|
|
<iframe name="main" id="main" src="local-latest"></iframe>
|
|
</body>
|
|
|
|
<script type="text/javascript">
|
|
let links = {
|
|
"std": document.getElementById("std-docs"),
|
|
"local": document.getElementById("local-docs"),
|
|
};
|
|
let frame = document.getElementById("main");
|
|
let lastLoaded = "local";
|
|
|
|
function toggleLastLoaded() {
|
|
if (lastLoaded === "std") {
|
|
lastLoaded = "local";
|
|
} else {
|
|
lastLoaded = "std";
|
|
}
|
|
links[lastLoaded].click();
|
|
}
|
|
|
|
function focusFrame() {
|
|
frame.contentWindow.focus();
|
|
frame.addEventListener("load", function() {
|
|
// if (this.contentWindow.window.searchState) {
|
|
// this.contentWindow.window.searchState.focus();
|
|
// }
|
|
frame.contentWindow.removeEventListener("keydown", cl);
|
|
frame.contentWindow.addEventListener("keydown", cl);
|
|
});
|
|
}
|
|
|
|
function cl(e) {
|
|
if ((e.which == 219 || e.which == 221) && !e.ctrlKey && e.shiftKey) {
|
|
e.preventDefault();
|
|
toggleLastLoaded();
|
|
}
|
|
}
|
|
|
|
focusFrame();
|
|
</script>
|
|
</html>
|