Advertisement
Yunga

JDP - Copy Uptobox Link.user.js

Apr 24th, 2021
1,302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name              Journal du Pirate - Copy Link
  3. // @namespace         YP
  4. // @version           2021.0414.0749
  5. // @description       Copy uptobox.com links from JdP
  6. // @author            Yunga Palatino <[email protected]>
  7. //
  8. // @grant             GM_setClipboard
  9. // @run-at            idle
  10. // @inject-into       auto
  11. // @noframes
  12. //
  13. // @match             https://*.journaldupirate.net/go_to/*
  14. // ==/UserScript==
  15.  
  16.  
  17. function yp_jdp_copy_link() {
  18.     "use strict";
  19.     const myName = `jdpCopyLink`;
  20.  
  21.     let btn = document.getElementsByClassName("button button-blue button-full set-button")
  22.     console.log(`${myName}: Found ${btn.length} buttons`);
  23.  
  24.     if (btn.length === 1) {
  25.         btn[0].click();
  26.     } else {
  27.         for (let lnk of document.links) {
  28.             if (lnk.href.match("uptobox")) {
  29.                 console.log(`${myName}: Found url: ${lnk.href}`);
  30.                 GM_setClipboard(lnk.href);
  31.             }
  32.         }
  33.     }
  34. }
  35.  
  36. yp_jdp_copy_link();
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement