daily pastebin goal
48%
SHARE
TWEET

YouHook

a guest Oct 1st, 2017 4,300 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         YouHook
  3. // @namespace    youhook
  4. // @version      1.1
  5. // @description  Redirects external YouTube search and watch requests to HookTube
  6. // @author       unknown
  7. // @include      *youtube.com/*
  8. // @include      *youtube.com/*
  9. // @include      *hooktube.com/*
  10. // @include      *hooktube.com/*
  11. // @grant        GM_addStyle
  12. // @run-at       document-start
  13. // ==/UserScript==
  14.  
  15. let url      = window.location.href;
  16. let youtube  = (url.indexOf("youtube") !== -1);
  17. let hooktube = (url.indexOf("hooktube") !== -1);
  18. let search   = (url.indexOf("?search_query") !== -1);
  19. let watch    = (url.indexOf("watch?") !== -1);
  20. let referred = (url.indexOf("youhook=0") !== -1);
  21.  
  22. if (youtube && (search || watch) && !referred) {
  23.     window.location.href = url.replace("you", "hook");
  24. } else if (hooktube && watch) {
  25.     window.onload = function() {
  26.         GM_addStyle(".btn-youhook{background-color:#e52d27;border-color:#e52d27;margin-left:4px;}.btn-youhook:hover{background-color:#e11913;border-color:#e11913}.btn-youhook:focus{box-shadow:0 0 0 3px rgba(229,45,39,0.5);}");
  27.         let ytlink = document.createElement("a");
  28.         let dlmenu = document.getElementById("download-menu");
  29.         ytlink.href = (url.replace("hook", "you") + "&youhook=0");
  30.         ytlink.innerHTML = "YouTube";
  31.         ytlink.className = "btn btn-success mb-2 btn-youhook";
  32.         dlmenu.parentNode.insertBefore(ytlink, dlmenu.nextSibling);
  33.     };
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top