updated browser-scripts-builder
This commit is contained in:
91
dist/optifine-download-links.user.js
vendored
91
dist/optifine-download-links.user.js
vendored
@@ -8,55 +8,56 @@
|
||||
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
|
||||
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
|
||||
// ==/UserScript==
|
||||
var onhover = false;
|
||||
var onhover = false
|
||||
async function getDownload(href) {
|
||||
let resp = await fetch(href);
|
||||
let text = await resp.text();
|
||||
let match = text.match(/<a href=['"](downloadx.*?)['"]/i);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
return null;
|
||||
let resp = await fetch(href)
|
||||
let text = await resp.text()
|
||||
let match = text.match(/<a href=['"](downloadx.*?)['"]/i)
|
||||
if (match) {
|
||||
return match[1]
|
||||
}
|
||||
return null
|
||||
}
|
||||
function attachFetchDownloadLink(a, depth = 0) {
|
||||
function run() {
|
||||
a.innerText = "Loading";
|
||||
let url = new URL(a.href);
|
||||
if (url.pathname === "/adloadx") {
|
||||
getDownload(a.href).then((downloadUrl) => {
|
||||
if (downloadUrl) {
|
||||
a.href = downloadUrl;
|
||||
a.innerText = "Download";
|
||||
} else {
|
||||
a.innerText = "Failed";
|
||||
if (onhover)
|
||||
attachFetchDownloadLink(a, ++depth);
|
||||
else
|
||||
setTimeout(() => attachFetchDownloadLink(a, ++depth), 1e3);
|
||||
function run() {
|
||||
a.innerText = 'Loading'
|
||||
let url = new URL(a.href)
|
||||
if (url.pathname === '/adloadx') {
|
||||
getDownload(a.href).then(downloadUrl => {
|
||||
if (downloadUrl) {
|
||||
a.href = downloadUrl
|
||||
a.innerText = 'Download'
|
||||
} else {
|
||||
a.innerText = 'Failed'
|
||||
if (onhover) attachFetchDownloadLink(a, ++depth)
|
||||
else
|
||||
setTimeout(
|
||||
() => attachFetchDownloadLink(a, ++depth),
|
||||
1e3
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (depth > 5)
|
||||
return;
|
||||
if (onhover) {
|
||||
a.addEventListener("mouseover", run, { once: true });
|
||||
} else {
|
||||
run();
|
||||
}
|
||||
if (depth > 5) return
|
||||
if (onhover) {
|
||||
a.addEventListener('mouseover', run, { once: true })
|
||||
} else {
|
||||
run()
|
||||
}
|
||||
}
|
||||
addEventListener("load", () => {
|
||||
document.querySelectorAll("a").forEach((a) => {
|
||||
let href = new URL(a.href);
|
||||
if (href.hostname === "adfoc.us") {
|
||||
let params = href.searchParams;
|
||||
if (params.has("url")) {
|
||||
let url = params.get("url")?.replace("http://", "https://");
|
||||
if (url) {
|
||||
a.href = url;
|
||||
attachFetchDownloadLink(a);
|
||||
addEventListener('load', () => {
|
||||
document.querySelectorAll('a').forEach(a => {
|
||||
let href = new URL(a.href)
|
||||
if (href.hostname === 'adfoc.us') {
|
||||
let params = href.searchParams
|
||||
if (params.has('url')) {
|
||||
let url = params.get('url')?.replace('http://', 'https://')
|
||||
if (url) {
|
||||
a.href = url
|
||||
attachFetchDownloadLink(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
26
dist/twitch-click-mute.user.js
vendored
26
dist/twitch-click-mute.user.js
vendored
@@ -8,14 +8,18 @@
|
||||
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
|
||||
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
|
||||
// ==/UserScript==
|
||||
addEventListener("load", () => {
|
||||
document.body.addEventListener("click", (e) => {
|
||||
let target = e.target;
|
||||
if (target && target.getAttribute("data-a-target") === "player-overlay-click-handler") {
|
||||
let video = document.querySelector("video");
|
||||
if (video) {
|
||||
video.muted = !video.muted;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
addEventListener('load', () => {
|
||||
document.body.addEventListener('click', e => {
|
||||
let target = e.target
|
||||
if (
|
||||
target &&
|
||||
target.getAttribute('data-a-target') ===
|
||||
'player-overlay-click-handler'
|
||||
) {
|
||||
let video = document.querySelector('video')
|
||||
if (video) {
|
||||
video.muted = !video.muted
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user