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