diff --git a/dist/optifine-download-links.zomo.js b/dist/optifine-download-links.zomo.js index 0e120fd..09075b0 100644 --- a/dist/optifine-download-links.zomo.js +++ b/dist/optifine-download-links.zomo.js @@ -1,12 +1,14 @@ "use strict"; // ==UserScript== // @name OptiFine Download Links -// @namespace zomo +// @namespace zomo.dev // @match https://optifine.net/* // @grant none // @version 1.0 // @author zomo // @description automatically grab optifine links through the ads +// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js +// @updateURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js // ==/UserScript== const onhover = false; // when to load link, false will load immediately async function getDownload(href) { diff --git a/src/optifine-download-links.zomo.ts b/src/optifine-download-links.zomo.ts index 3eafc84..5d78c07 100644 --- a/src/optifine-download-links.zomo.ts +++ b/src/optifine-download-links.zomo.ts @@ -21,6 +21,7 @@ async function getDownload(href: string): Promise { } return null } + function attachFetchDownloadLink(a: HTMLLinkElement, depth = 0) { function run() { a.innerText = 'Loading' @@ -42,6 +43,7 @@ function attachFetchDownloadLink(a: HTMLLinkElement, depth = 0) { }) } } + if (depth > 5) return if (onhover) { @@ -50,6 +52,7 @@ function attachFetchDownloadLink(a: HTMLLinkElement, depth = 0) { run() } } + addEventListener('load', () => { document.querySelectorAll('a').forEach(a => { let href = new URL(a.href)