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