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