Last active
August 20, 2024 19:26
-
-
Save dcdunkan/50e9e7b52384ef38e84fd727d6937082 to your computer and use it in GitHub Desktop.
userscript to open the magnet link right in the 1337x-to-search.pages.dev proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Open Magnet Links in 1337x-to-search.pages.dev | |
// @namespace Violentmonkey Scripts | |
// @match https://1337x-to-search.pages.dev/ | |
// @grant none | |
// @version 0.1 | |
// @author Dunkan <https://github.com/dcdunkan> | |
// @description 8/20/2024, 11:24:01 PM | |
// @run-at document-end | |
// @homepageURL https://gist.github.com/dcdunkan/50e9e7b52384ef38e84fd727d6937082#file-1337x-proxy-open-link-userscript-js | |
// @updateURL https://gist.githubusercontent.com/dcdunkan/50e9e7b52384ef38e84fd727d6937082/raw/1337x-proxy-open-link.userscript.js | |
// @downloadURL https://gist.githubusercontent.com/dcdunkan/50e9e7b52384ef38e84fd727d6937082/raw/1337x-proxy-open-link.userscript.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const container = document.getElementById("magnetLinkContainer"); | |
const openLink = document.createElement("a"); | |
openLink.innerHTML = "Open"; | |
openLink.classList.add("btn", "btn-primary", "mt-2") | |
container.appendChild(openLink); | |
const observer = new MutationObserver(function () { | |
const modal = document.getElementById("torrentMagnetModal"); | |
if (modal.style.display != "block") return; | |
const loadingSpinner = document.getElementById("loadingSpinner"); | |
const errorMessage = document.getElementById("errorMessage"); | |
if (modal.style.display == "none" || loadingSpinner.style.display != "none" || errorMessage.style.display != "none") return; | |
const magnetInput = document.getElementById("magnetLinkInput"); | |
openLink.href = magnetInput.value; | |
}); | |
observer.observe(document.body, { | |
subtree: true, | |
childList: true, | |
attributes: true, | |
attributeFilter: ["style"] | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment