Fix version drop down creation.

Retrieval of scriptUrl was not working on Firefox.
gh-pages
Jonatan Antoni 3 years ago
parent 9be1e2c65e
commit 9145738f60

@ -9,10 +9,11 @@ const versions = {
} }
//--- list of versions --- //--- list of versions ---
var scripts = document.getElementsByTagName("script"), var script = document.currentScript
scriptUrl = new URL(scripts[scripts.length-1].src); if (script && script.src) {
docUrl = new URL(document.URL); var scriptUrl = new URL(script.src);
baseUrl = new URL(scriptUrl) var docUrl = new URL(document.URL);
var baseUrl = new URL(scriptUrl)
baseUrl.pathname = baseUrl.pathname.split('/').slice(0,-1).join("/") baseUrl.pathname = baseUrl.pathname.split('/').slice(0,-1).join("/")
function urlForVersion(url, version) { function urlForVersion(url, version) {
@ -40,6 +41,9 @@ function writeVersionDropdown() {
} }
document.write(' </div>'); document.write(' </div>');
}; };
} else {
function writeVersionDropdown() {}
}
/* When the user clicks on the button, /* When the user clicks on the button,
toggle between hiding and showing the dropdown content */ toggle between hiding and showing the dropdown content */

Loading…
Cancel
Save