Intro skipper

try to take over the world!

  1. // ==UserScript==
  2. // @name Intro skipper
  3. // @version 0.2
  4. // @description try to take over the world!
  5. // @author lolamtisch@gmail.com
  6. // @license Creative Commons; http://creativecommons.org/licenses/by/4.0/
  7. // @supportURL https://discord.gg/cTH4yaw
  8. // @include *
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @grant GM_notification
  12. // @namespace https://greasyfork.org/users/92233
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. var five = GM_getValue(document.domain, 0);
  18. var map = {};
  19. var timeout = 0;
  20. onkeydown = onkeyup = function(e){
  21. e = e || event;
  22. map[e.keyCode] = e.type == 'keydown';
  23. console.log(map);
  24. if (map[17] && map[39]) {
  25. videoJump(80);
  26. }
  27. if (map[17] && map[37]) {
  28. videoJump(-80);
  29. }
  30. if(five){
  31. if (map[39]) {
  32. videoJump(5);
  33. }
  34. if (map[37]) {
  35. videoJump(-5);
  36. }
  37. }
  38. if (map[17] && map[53] && !timeout) {
  39. map = {};
  40. if(five){
  41. five = 0;
  42. }else{
  43. five = 1;
  44. }
  45.  
  46. var message = "5 second skip "+ ((five) ? "activated" : "deactivated") +" for "+document.domain;
  47. try{
  48. GM_notification(message);
  49. }catch(e){
  50. alert(message);
  51. }
  52. GM_setValue(document.domain, five);
  53. timeout = 1;
  54. setTimeout(function(){
  55. timeout = 0;
  56. }, 1000);
  57. }
  58. }
  59.  
  60. function videoJump(time){
  61. var videos = document.getElementsByTagName("video");
  62. for (var i=0;i<videos.length;i++){
  63. var video = videos[i];
  64. video.currentTime = parseInt(video.currentTime) + time;
  65. }
  66. }
  67. })();