1 //--- list of versions ---
6 "v6.1.0-rc0": "6.1.0-rc0",
25 //--- list of versions ---
29 "CMSIS-Core (Cortex-M)": "Core",
30 "CMSIS-Core (Cortex-A)": "Core_A",
31 "CMSIS-Driver": "Driver",
32 "CMSIS-RTOS2": "RTOS2"
35 var script = document.currentScript
36 if (script && script.src) {
37 var scriptUrl = new URL(script.src);
38 var docUrl = new URL(document.URL);
39 var baseUrl = new URL(scriptUrl)
40 baseUrl.pathname = baseUrl.pathname.split('/').slice(0,-1).join("/")
42 function urlForVersion(url, version) {
44 pathname = url.pathname.replace(baseUrl.pathname, "");
45 parts = pathname.split("/");
47 url.pathname = baseUrl.pathname + parts.join("/");
51 function writeVersionDropdown(id) {
52 component = components[id]
53 currentVersion = document.currentScript.parentNode.innerText;
54 document.currentScript.parentNode.classList.add("dropdown");
55 document.currentScript.parentNode.innerText = "";
56 document.write(' <span onclick="myFunction()" class="dropbtn">'+currentVersion+'</span>');
57 document.write(' <div id="myDropdown" class="dropdown-content">');
58 for(var version in versions[component]) {
59 var label = versions[component][version];
60 if (label != version) {
61 label += " ("+version+")"
63 label = "Version " + label
64 document.write(' <a href="'+urlForVersion(docUrl, version)+'">'+label+'</a>');
66 document.write(' </div>');
69 function writeVersionDropdown(id) {}
72 /* When the user clicks on the button,
73 toggle between hiding and showing the dropdown content */
74 function myFunction() {
75 document.getElementById("myDropdown").classList.toggle("show");
78 // Close the dropdown menu if the user clicks outside of it
79 window.onclick = function(event) {
80 if (!event.target.matches('.dropbtn')) {
81 var dropdowns = document.getElementsByClassName("dropdown-content");
83 for (i = 0; i < dropdowns.length; i++) {
84 var openDropdown = dropdowns[i];
85 if (openDropdown.classList.contains('show')) {
86 openDropdown.classList.remove('show');