corrosiontears

Tampermonkey® - RARBG Search from IMDB

Apr 20th, 2020
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.01 KB | None | 0 0
  1. // ==UserScript==
  2. // @name         RARBG Search from IMDB
  3. // @namespace    http://t...content-available-to-author-only...y.net/
  4. // @version      0.1
  5. // @description  Bla
  6. // @author       Varrus
  7. // @match        *.imdb.com/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     let url = new URL(window.location.href);
  15.     let rar = url.pathname;
  16.     console.log(rar);
  17.  
  18.     function searchRARbg() {
  19.         window.open('https://rarbg.to/torrents.php?imdb=' +rar)
  20.     }
  21.  
  22.     // 1. Create the button
  23.     var button = document.createElement("button");
  24.     button.innerHTML = "Search RARBG";
  25.  
  26.     button.setAttribute("style", "background-color: #3860BB; color: white; font-size: small; border: 2px solid #6489db; line-height: 0; padding: 1em;");
  27.  
  28.     // 2. Append somewhere
  29.     var titleReviewBar = document.getElementsByClassName("titleReviewBar")[0];
  30.     titleReviewBar.appendChild(button);
  31.  
  32.     // 3. Add event handler
  33.     button.addEventListener ("click", searchRARbg);
  34.  
  35.  
  36. })();
Add Comment
Please, Sign In to add comment