|
|
|
|
@ -9,37 +9,41 @@ const versions = {
|
|
|
|
|
}
|
|
|
|
|
//--- list of versions ---
|
|
|
|
|
|
|
|
|
|
var scripts = document.getElementsByTagName("script"),
|
|
|
|
|
scriptUrl = new URL(scripts[scripts.length-1].src);
|
|
|
|
|
docUrl = new URL(document.URL);
|
|
|
|
|
baseUrl = new URL(scriptUrl)
|
|
|
|
|
baseUrl.pathname = baseUrl.pathname.split('/').slice(0,-1).join("/")
|
|
|
|
|
var script = document.currentScript
|
|
|
|
|
if (script && script.src) {
|
|
|
|
|
var scriptUrl = new URL(script.src);
|
|
|
|
|
var docUrl = new URL(document.URL);
|
|
|
|
|
var baseUrl = new URL(scriptUrl)
|
|
|
|
|
baseUrl.pathname = baseUrl.pathname.split('/').slice(0,-1).join("/")
|
|
|
|
|
|
|
|
|
|
function urlForVersion(url, version) {
|
|
|
|
|
url = new URL(url);
|
|
|
|
|
pathname = url.pathname.replace(baseUrl.pathname, "");
|
|
|
|
|
parts = pathname.split("/");
|
|
|
|
|
parts[1] = version;
|
|
|
|
|
url.pathname = baseUrl.pathname + parts.join("/");
|
|
|
|
|
return url
|
|
|
|
|
}
|
|
|
|
|
function urlForVersion(url, version) {
|
|
|
|
|
url = new URL(url);
|
|
|
|
|
pathname = url.pathname.replace(baseUrl.pathname, "");
|
|
|
|
|
parts = pathname.split("/");
|
|
|
|
|
parts[1] = version;
|
|
|
|
|
url.pathname = baseUrl.pathname + parts.join("/");
|
|
|
|
|
return url
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function writeVersionDropdown() {
|
|
|
|
|
currentVersion = document.currentScript.parentNode.innerText;
|
|
|
|
|
document.currentScript.parentNode.classList.add("dropdown");
|
|
|
|
|
document.currentScript.parentNode.innerText = "";
|
|
|
|
|
document.write(' <span onclick="myFunction()" class="dropbtn">'+currentVersion+'</span>');
|
|
|
|
|
document.write(' <div id="myDropdown" class="dropdown-content">');
|
|
|
|
|
for(var version in versions) {
|
|
|
|
|
var label = versions[version];
|
|
|
|
|
if (label != version) {
|
|
|
|
|
label += "("+version+")"
|
|
|
|
|
}
|
|
|
|
|
label = "Version " + label
|
|
|
|
|
document.write(' <a href="'+urlForVersion(docUrl, version)+'">'+label+'</a>');
|
|
|
|
|
}
|
|
|
|
|
document.write(' </div>');
|
|
|
|
|
};
|
|
|
|
|
function writeVersionDropdown() {
|
|
|
|
|
currentVersion = document.currentScript.parentNode.innerText;
|
|
|
|
|
document.currentScript.parentNode.classList.add("dropdown");
|
|
|
|
|
document.currentScript.parentNode.innerText = "";
|
|
|
|
|
document.write(' <span onclick="myFunction()" class="dropbtn">'+currentVersion+'</span>');
|
|
|
|
|
document.write(' <div id="myDropdown" class="dropdown-content">');
|
|
|
|
|
for(var version in versions) {
|
|
|
|
|
var label = versions[version];
|
|
|
|
|
if (label != version) {
|
|
|
|
|
label += " ("+version+")"
|
|
|
|
|
}
|
|
|
|
|
label = "Version " + label
|
|
|
|
|
document.write(' <a href="'+urlForVersion(docUrl, version)+'">'+label+'</a>');
|
|
|
|
|
}
|
|
|
|
|
document.write(' </div>');
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
function writeVersionDropdown() {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* When the user clicks on the button,
|
|
|
|
|
toggle between hiding and showing the dropdown content */
|
|
|
|
|
|