Skip to content

Commit

Permalink
Fix Java Docs for browsers that block popups
Browse files Browse the repository at this point in the history
  • Loading branch information
its-miroma committed May 31, 2024
1 parent a42ee5a commit 6307297
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions scripts/src/lib/Documentation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
getLoaderVersions,
} from "./Api";
function handleSelectChange(event: any, project: any) {
const selectedVersion = event.target.value;
function handleSelectChange(event: any, project: any) {
const selectedVersion = event.target.value;
if (selectedVersion.includes("Select")) return;
if (selectedVersion.includes("Select")) return;
window.open(`https://maven.fabricmc.net/docs/${project.prefix}${selectedVersion}/`, '_blank');
}
url = `https://maven.fabricmc.net/docs/${project.prefix}${selectedVersion}/`;
anchor.click();
}
function filterAndSortVersions(
versions: string[],
Expand Down Expand Up @@ -86,13 +87,14 @@
{:then data}
{#each data as project}
<div class="javadoc-selector">
<select value="Select {project.name} Version" on:change={(event) => handleSelectChange(event, project)}>
<option>Select {project.name} Version</option>
{#each project.versions as version}
<option value={version}>{version}</option>
{/each}
</select>
</div>
<select value="Select {project.name} Version" on:change={(event) => handleSelectChange(event, project)}>
<option>Select {project.name} Version</option>
{#each project.versions as version}
<option value={version}>{version}</option>
{/each}
</select>
<a bind:this={anchor} href={url} target="_blank">
</div>
{/each}
{:catch error}
<p style="color: red">Error: {error.message}</p>
Expand Down

0 comments on commit 6307297

Please sign in to comment.