Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Java Docs for browsers that block popups #91

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions scripts/src/lib/Documentation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
getLoaderVersions,
} from "./Api";

function handleSelectChange(event: any, project: any) {
const selectedVersion = event.target.value;
let anchor: HTMLAnchorElement;
let url: string;

if (selectedVersion.includes("Select")) return;
function handleSelectChange(event: any, project: any) {
const selectedVersion = event.target.value;

window.open(`https://maven.fabricmc.net/docs/${project.prefix}${selectedVersion}/`, '_blank');
}
if (selectedVersion.includes("Select")) return;

url = `https://maven.fabricmc.net/docs/${project.prefix}${selectedVersion}/`;
anchor.click();
}

function filterAndSortVersions(
versions: string[],
Expand Down Expand Up @@ -86,13 +90,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