|
953 | 953 | className += " font-medium"; |
954 | 954 | } |
955 | 955 |
|
956 | | - platformItem.innerHTML = ` |
957 | | - <div class="${className}"> |
958 | | - <div class="flex items-center"> |
959 | | - <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
960 | | - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" /> |
961 | | - </svg> |
962 | | - <span class="truncate">${displayName}</span> |
963 | | - </div> |
964 | | - ${ |
965 | | - platform === currentPlatform |
966 | | - ? '<span class="text-xs text-macos-accent">Current Platform</span>' |
967 | | - : "" |
968 | | - } |
969 | | - </div> |
970 | | - `; |
971 | | - |
972 | 956 | // If there are multiple versions, create an expandable dropdown |
973 | 957 | if (packages.length > 1) { |
974 | | - platformItem.classList.add("platform-expandable"); |
975 | | - const chevron = document.createElement("div"); |
976 | | - chevron.className = "platform-chevron text-macos-secondary ml-2"; |
977 | | - chevron.innerHTML = ` |
| 958 | + platformItem.classList.add("platform-expandable", "cursor-pointer"); |
| 959 | + platformItem.innerHTML = ` |
| 960 | + <div class="${className}"> |
| 961 | + <div class="flex items-center"> |
| 962 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 963 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" /> |
| 964 | + </svg> |
| 965 | + <span class="truncate">${displayName}</span> |
| 966 | + <div class="platform-chevron text-macos-secondary ml-2"> |
978 | 967 | <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 transform transition-transform duration-200" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
979 | 968 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /> |
980 | 969 | </svg> |
981 | | - `; |
982 | | - platformItem |
983 | | - .querySelector(".flex.items-center") |
984 | | - .appendChild(chevron); |
| 970 | + </div> |
| 971 | + </div> |
| 972 | + ${ |
| 973 | + platform === currentPlatform |
| 974 | + ? '<span class="text-xs text-macos-accent">Current Platform</span>' |
| 975 | + : "" |
| 976 | + } |
| 977 | + </div> |
| 978 | + `; |
985 | 979 |
|
986 | 980 | // Versions container |
987 | 981 | const versionsContainer = document.createElement("div"); |
988 | 982 | versionsContainer.className = "platform-versions ml-6 hidden"; |
989 | 983 |
|
990 | | - // Add all versions |
| 984 | + // Add all versions with anchor tags |
991 | 985 | packages.forEach((pkg) => { |
992 | 986 | const versionItem = document.createElement("div"); |
993 | 987 | versionItem.className = |
994 | 988 | "py-1 text-sm text-macos-secondary hover:text-macos-text flex items-center cursor-pointer"; |
995 | 989 | versionItem.innerHTML = ` |
996 | | - <span class="truncate">Version ${pkg.version}</span> |
997 | | - `; |
998 | | - versionItem.addEventListener("click", (e) => { |
999 | | - e.stopPropagation(); |
1000 | | - window.open(pkg.url, "_blank"); |
1001 | | - }); |
| 990 | + <a href="${pkg.url}" target="_blank" rel="noopener" |
| 991 | + class="text-sm text-macos-secondary hover:text-macos-text flex items-center"> |
| 992 | + <span class="truncate">Version ${pkg.version}</span> |
| 993 | + </a> |
| 994 | + `; |
1002 | 995 | versionsContainer.appendChild(versionItem); |
1003 | 996 | }); |
1004 | 997 |
|
|
1014 | 1007 | container.appendChild(platformItem); |
1015 | 1008 | container.appendChild(versionsContainer); |
1016 | 1009 | } else if (packages.length === 1) { |
1017 | | - // For single version, just make the platform item clickable |
1018 | | - platformItem.addEventListener("click", () => { |
1019 | | - window.open(packages[0].url, "_blank"); |
1020 | | - }); |
| 1010 | + // For single version, use an anchor tag |
| 1011 | + platformItem.innerHTML = ` |
| 1012 | + <a href="${packages[0].url}" target="_blank" rel="noopener" class="${className}"> |
| 1013 | + <div class="flex items-center"> |
| 1014 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 1015 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" /> |
| 1016 | + </svg> |
| 1017 | + <span class="truncate">${displayName}</span> |
| 1018 | + </div> |
| 1019 | + ${ |
| 1020 | + platform === currentPlatform |
| 1021 | + ? '<span class="text-xs text-macos-accent">Current Platform</span>' |
| 1022 | + : "" |
| 1023 | + } |
| 1024 | + </a> |
| 1025 | + `; |
1021 | 1026 | container.appendChild(platformItem); |
1022 | 1027 | } |
1023 | 1028 | }); |
1024 | 1029 | } |
1025 | 1030 |
|
1026 | | - // Add universal links |
| 1031 | + // Add universal links using anchor tags |
1027 | 1032 | if (universalLinks.length > 0) { |
1028 | 1033 | addSectionHeader("Resources"); |
1029 | 1034 |
|
|
1032 | 1037 | linkItem.className = |
1033 | 1038 | "px-3 py-2 text-sm text-macos-text hover:bg-macos-result-hover cursor-pointer flex items-center"; |
1034 | 1039 | linkItem.innerHTML = ` |
1035 | | - <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
1036 | | - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" /> |
1037 | | - </svg> |
1038 | | - <span class="truncate">${asset.name}</span> |
1039 | | - `; |
1040 | | - |
1041 | | - linkItem.addEventListener("click", () => { |
1042 | | - window.open(asset.url, "_blank"); |
1043 | | - }); |
1044 | | - |
| 1040 | + <a href="${asset.url}" target="_blank" rel="noopener" |
| 1041 | + class="text-sm text-macos-text hover:bg-macos-result-hover flex items-center"> |
| 1042 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 1043 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" /> |
| 1044 | + </svg> |
| 1045 | + <span class="truncate">${asset.name}</span> |
| 1046 | + </a> |
| 1047 | + `; |
1045 | 1048 | container.appendChild(linkItem); |
1046 | 1049 | }); |
1047 | 1050 | } |
|
0 commit comments