1 //--- list of versions ---
4 "latest": "6.0.0-dev76"
19 //--- list of versions ---
23 "CMSIS-Core (Cortex-M)": "Core",
24 "CMSIS-Core (Cortex-A)": "Core_A",
25 "CMSIS-Driver": "Driver",
26 "CMSIS-RTOS2": "RTOS2"
29 var script = document.currentScript
30 if (script && script.src) {
31 var scriptUrl = new URL(script.src);
32 var docUrl = new URL(document.URL);
33 var baseUrl = new URL(scriptUrl)
34 baseUrl.pathname = baseUrl.pathname.split('/').slice(0,-1).join("/")
36 function urlForVersion(url, version) {
38 pathname = url.pathname.replace(baseUrl.pathname, "");
39 parts = pathname.split("/");
41 url.pathname = baseUrl.pathname + parts.join("/");
45 function writeVersionDropdown(id) {
46 component = components[id]
47 currentVersion = document.currentScript.parentNode.innerText;
48 document.currentScript.parentNode.classList.add("dropdown");
49 document.currentScript.parentNode.innerText = "";
50 document.write(' <span onclick="myFunction()" class="dropbtn">'+currentVersion+'</span>');
51 document.write(' <div id="myDropdown" class="dropdown-content">');
52 for(var version in versions[component]) {
53 var label = versions[component][version];
54 if (label != version) {
55 label += " ("+version+")"
57 label = "Version " + label
58 document.write(' <a href="'+urlForVersion(docUrl, version)+'">'+label+'</a>');
60 document.write(' </div>');
63 function writeVersionDropdown(id) {}
66 /* When the user clicks on the button,
67 toggle between hiding and showing the dropdown content */
68 function myFunction() {
69 document.getElementById("myDropdown").classList.toggle("show");
72 // Close the dropdown menu if the user clicks outside of it
73 window.onclick = function(event) {
74 if (!event.target.matches('.dropbtn')) {
75 var dropdowns = document.getElementsByClassName("dropdown-content");
77 for (i = 0; i < dropdowns.length; i++) {
78 var openDropdown = dropdowns[i];
79 if (openDropdown.classList.contains('show')) {
80 openDropdown.classList.remove('show');