1 //--- list of versions ---
3 "main": "11.0.1-dev17",
6 //--- list of versions ---
8 var script = document.currentScript
9 if (script && script.src) {
10 var scriptUrl = new URL(script.src);
11 var docUrl = new URL(document.URL);
12 var baseUrl = new URL(scriptUrl)
13 baseUrl.pathname = baseUrl.pathname.split('/').slice(0,-1).join("/")
15 function urlForVersion(url, version) {
17 pathname = url.pathname.replace(baseUrl.pathname, "");
18 parts = pathname.split("/");
20 url.pathname = baseUrl.pathname + parts.join("/");
24 function writeVersionDropdown() {
25 currentVersion = document.currentScript.parentNode.innerText;
26 document.currentScript.parentNode.classList.add("dropdown");
27 document.currentScript.parentNode.innerText = "";
28 document.write(' <span onclick="myFunction()" class="dropbtn">'+currentVersion+'</span>');
29 document.write(' <div id="myDropdown" class="dropdown-content">');
30 for(var version in versions) {
31 var label = versions[version];
32 if (label != version) {
33 label += " ("+version+")"
35 label = "Version " + label
36 document.write(' <a href="'+urlForVersion(docUrl, version)+'">'+label+'</a>');
38 document.write(' </div>');
41 function writeVersionDropdown() {}
44 /* When the user clicks on the button,
45 toggle between hiding and showing the dropdown content */
46 function myFunction() {
47 document.getElementById("myDropdown").classList.toggle("show");
50 // Close the dropdown menu if the user clicks outside of it
51 window.onclick = function(event) {
52 if (!event.target.matches('.dropbtn')) {
53 var dropdowns = document.getElementsByClassName("dropdown-content");
55 for (i = 0; i < dropdowns.length; i++) {
56 var openDropdown = dropdowns[i];
57 if (openDropdown.classList.contains('show')) {
58 openDropdown.classList.remove('show');