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