prettier
This commit is contained in:
4
dist/optifine-download-links.zomo.js
vendored
4
dist/optifine-download-links.zomo.js
vendored
@@ -1,12 +1,14 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name OptiFine Download Links
|
// @name OptiFine Download Links
|
||||||
// @namespace zomo
|
// @namespace zomo.dev
|
||||||
// @match https://optifine.net/*
|
// @match https://optifine.net/*
|
||||||
// @grant none
|
// @grant none
|
||||||
// @version 1.0
|
// @version 1.0
|
||||||
// @author zomo
|
// @author zomo
|
||||||
// @description automatically grab optifine links through the ads
|
// @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==
|
// ==/UserScript==
|
||||||
const onhover = false; // when to load link, false will load immediately
|
const onhover = false; // when to load link, false will load immediately
|
||||||
async function getDownload(href) {
|
async function getDownload(href) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ async function getDownload(href: string): Promise<string | null> {
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachFetchDownloadLink(a: HTMLLinkElement, depth = 0) {
|
function attachFetchDownloadLink(a: HTMLLinkElement, depth = 0) {
|
||||||
function run() {
|
function run() {
|
||||||
a.innerText = 'Loading'
|
a.innerText = 'Loading'
|
||||||
@@ -42,6 +43,7 @@ function attachFetchDownloadLink(a: HTMLLinkElement, depth = 0) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth > 5) return
|
if (depth > 5) return
|
||||||
|
|
||||||
if (onhover) {
|
if (onhover) {
|
||||||
@@ -50,6 +52,7 @@ function attachFetchDownloadLink(a: HTMLLinkElement, depth = 0) {
|
|||||||
run()
|
run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addEventListener('load', () => {
|
addEventListener('load', () => {
|
||||||
document.querySelectorAll<HTMLLinkElement>('a').forEach(a => {
|
document.querySelectorAll<HTMLLinkElement>('a').forEach(a => {
|
||||||
let href = new URL(a.href)
|
let href = new URL(a.href)
|
||||||
|
|||||||
Reference in New Issue
Block a user