YouTube Intro Skipper

Skip youtubers long intros with set-up rules (coded)

  1. // ==UserScript==
  2. // @name YouTube Intro Skipper
  3. // @namespace http://www.diamonddownload.weebly.com
  4. // @version 0.1
  5. // @description Skip youtubers long intros with set-up rules (coded)
  6. // @author R.F Geraci
  7. // @include *youtube.*/watch?v=*
  8. // @require https://craig.global.ssl.fastly.net/js/mousetrap/mousetrap.min.js?71631
  9. // @grant none
  10. // @runat document-body
  11. // @locale en
  12. // ==/UserScript==
  13.  
  14. var EXS = 'YouTube Intro Skipper: ';
  15. var HOTKEY = '\\';
  16.  
  17. var video = document.getElementsByTagName('video')[0];
  18. var user = document.getElementsByClassName('yt-user-info')[0].children[0].innerText;
  19. //YoutuberName, IntroLength (in seconds)
  20. var IntroLengths = ["NIkkiandJohnVLOG", 16,
  21. "HouseholdHacker", 4,
  22. "CrazyRussianHacker", 4,
  23. ];
  24.  
  25.  
  26. if (video !== undefined || user !== ''){
  27. Mousetrap.bind(HOTKEY, function() { skip(); });
  28. // alert("You Pressed " + HOTKEY);
  29. }else{
  30. console.error(EXS + 'Could not find video or username element in the HTML');
  31. }
  32.  
  33. function skip(){
  34.  
  35. var user_lwr = user.toLowerCase();
  36. for(var i=0;i<IntroLengths.length;i++){
  37. if (typeof IntroLengths[i] == 'string' || IntroLengths[i] instanceof String){
  38. var ItrLen_lwr = IntroLengths[i].toLowerCase();
  39. if (ItrLen_lwr == user_lwr){
  40. video.currentTime += IntroLengths[i+1];
  41. }
  42. }
  43. }
  44. }