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