-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployed b6df99d to 0.8 with MkDocs 1.5.3 and mike 2.0.0
- Loading branch information
Showing
62 changed files
with
170 additions
and
14,591 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
#version-selector { | ||
float: left; | ||
display: flex; | ||
align-items: center; | ||
margin: 0 10px; | ||
padding: 0 10px; | ||
} | ||
|
||
#version-selector > select { | ||
width: auto; | ||
height: auto; | ||
padding: 1px; | ||
} | ||
|
||
/* MkDocs v1.0 */ | ||
.navbar-header > #version-selector { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
/* MkDocs v1.1 */ | ||
.container > #version-selector { | ||
flex-grow: 1; | ||
} | ||
|
||
@media (min-width: 992px) { | ||
.container > #version-selector { | ||
flex-grow: 0; | ||
} | ||
} |
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,80 @@ | ||
window.addEventListener("DOMContentLoaded", function() { | ||
function normalizePath(path) { | ||
var normalized = []; | ||
function expandPath(path) { | ||
// Get the base directory components. | ||
var expanded = window.location.pathname.split("/"); | ||
expanded.pop(); | ||
var isSubdir = false; | ||
|
||
path.split("/").forEach(function(bit, i) { | ||
if (bit === "." || (bit === "" && i !== 0)) { | ||
return; | ||
if (bit === "" && i === 0) { | ||
isSubdir = false; | ||
expanded = [""]; | ||
} else if (bit === "." || bit === "") { | ||
isSubdir = true; | ||
} else if (bit === "..") { | ||
if (normalized.length === 1 && normalized[0] === "") { | ||
if (expanded.length === 1) { | ||
// We must be trying to .. past the root! | ||
throw new Error("invalid path"); | ||
} else if (normalized.length === 0 || | ||
normalized[normalized.length - 1] === "..") { | ||
normalized.push(".."); | ||
} else { | ||
normalized.pop(); | ||
isSubdir = true; | ||
expanded.pop(); | ||
} | ||
} else { | ||
normalized.push(bit); | ||
isSubdir = false; | ||
expanded.push(bit); | ||
} | ||
}); | ||
return normalized.join("/"); | ||
|
||
if (isSubdir) | ||
expanded.push(""); | ||
return expanded.join("/"); | ||
} | ||
|
||
// `base_url` comes from the base.html template for this theme. | ||
var REL_BASE_URL = base_url; | ||
var ABS_BASE_URL = normalizePath(window.location.pathname + "/" + | ||
REL_BASE_URL); | ||
var CURRENT_VERSION = ABS_BASE_URL.split("/").pop(); | ||
var ABS_BASE_URL = expandPath(base_url); | ||
var CURRENT_VERSION = ABS_BASE_URL.match(/\/([^\/]+)\/$/)[1]; | ||
|
||
function makeSelect(options, selected) { | ||
function makeSelect(options) { | ||
var select = document.createElement("select"); | ||
select.classList.add("form-control"); | ||
|
||
options.forEach(function(i) { | ||
var option = new Option(i.text, i.value, undefined, | ||
i.value === selected); | ||
i.selected); | ||
select.add(option); | ||
}); | ||
|
||
return select; | ||
} | ||
|
||
var xhr = new XMLHttpRequest(); | ||
xhr.open("GET", REL_BASE_URL + "/../versions.json"); | ||
xhr.onload = function() { | ||
var versions = JSON.parse(this.responseText); | ||
|
||
fetch(ABS_BASE_URL + "../versions.json").then((response) => { | ||
return response.json(); | ||
}).then((versions) => { | ||
var realVersion = versions.find(function(i) { | ||
return i.version === CURRENT_VERSION || | ||
i.aliases.includes(CURRENT_VERSION); | ||
}).version; | ||
|
||
var select = makeSelect(versions.map(function(i) { | ||
return {text: i.title, value: i.version}; | ||
}), realVersion); | ||
var select = makeSelect(versions.filter(function(i) { | ||
return i.version === realVersion || !i.properties || !i.properties.hidden; | ||
}).map(function(i) { | ||
return {text: i.title, value: i.version, | ||
selected: i.version === realVersion}; | ||
})); | ||
select.addEventListener("change", function(event) { | ||
window.location.href = REL_BASE_URL + "/../" + this.value; | ||
window.location.href = ABS_BASE_URL + "../" + this.value + "/"; | ||
}); | ||
|
||
var container = document.createElement("div"); | ||
container.id = "version-selector"; | ||
container.appendChild(select); | ||
|
||
var title = document.querySelector("div.navbar-header"); | ||
var height = window.getComputedStyle(title).getPropertyValue("height"); | ||
container.style.height = height; | ||
var title = document.querySelector(".navbar-brand"); | ||
if (title.parentNode.classList.contains("navbar-header")) { | ||
var height = window.getComputedStyle(title).getPropertyValue("height"); | ||
container.style.height = height; | ||
} | ||
|
||
title.appendChild(container); | ||
}; | ||
xhr.send(); | ||
title.parentNode.insertBefore(container, title.nextSibling); | ||
}); | ||
}); |
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 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
Binary file not shown.
Oops, something went wrong.