Created
November 7, 2020 03:45
-
-
Save carmona/bfe7d15798344d3b5a194025fb2dc05e to your computer and use it in GitHub Desktop.
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
(function() { | |
let window_code = findCode(window.location.pathname); | |
if (window_code && window_code.includes('tt')) { | |
openbj(window_code); | |
// openrarbg(window_code); | |
} | |
let all_buttons = document.querySelectorAll("a"); | |
for (let button of all_buttons) { | |
if (button.href.includes('/tt')) { | |
button.addEventListener('click', clickHandler); | |
} | |
} | |
function openbj(imdb_code) { | |
let destination = "https://bj-share.info/torrents.php?searchstr=" + imdb_code; | |
window.open(destination, '_blank'); | |
} | |
function openrarbg(imdb_code) { | |
let destination = "https://rarbgprx.org/torrents.php?order=seeders&by=DESC&search=" + imdb_code; | |
window.open(destination, '_blank'); | |
} | |
function clickHandler(event) { | |
event.preventDefault(); | |
let url = event.currentTarget.href; | |
let parts = url.split('/'); | |
let imdb_code = findCode(url); | |
openrarbg(imdb_code); | |
} | |
function findCode(url) { | |
let parts = url.split('/'); | |
let imdb_code; | |
parts.forEach(function(part) { | |
if (part.startsWith('tt')) { | |
imdb_code = part; | |
} | |
}); | |
return imdb_code; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment