Skip to content

Commit abb5749

Browse files
provide direct links
provide direct links instead of click handler
1 parent c77c42b commit abb5749

File tree

1 file changed

+49
-46
lines changed

1 file changed

+49
-46
lines changed

index.html

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -953,52 +953,45 @@
953953
className += " font-medium";
954954
}
955955

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-
972956
// If there are multiple versions, create an expandable dropdown
973957
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">
978967
<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">
979968
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
980969
</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+
`;
985979

986980
// Versions container
987981
const versionsContainer = document.createElement("div");
988982
versionsContainer.className = "platform-versions ml-6 hidden";
989983

990-
// Add all versions
984+
// Add all versions with anchor tags
991985
packages.forEach((pkg) => {
992986
const versionItem = document.createElement("div");
993987
versionItem.className =
994988
"py-1 text-sm text-macos-secondary hover:text-macos-text flex items-center cursor-pointer";
995989
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+
`;
1002995
versionsContainer.appendChild(versionItem);
1003996
});
1004997

@@ -1014,16 +1007,28 @@
10141007
container.appendChild(platformItem);
10151008
container.appendChild(versionsContainer);
10161009
} 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+
`;
10211026
container.appendChild(platformItem);
10221027
}
10231028
});
10241029
}
10251030

1026-
// Add universal links
1031+
// Add universal links using anchor tags
10271032
if (universalLinks.length > 0) {
10281033
addSectionHeader("Resources");
10291034

@@ -1032,16 +1037,14 @@
10321037
linkItem.className =
10331038
"px-3 py-2 text-sm text-macos-text hover:bg-macos-result-hover cursor-pointer flex items-center";
10341039
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+
`;
10451048
container.appendChild(linkItem);
10461049
});
10471050
}

0 commit comments

Comments
 (0)