Faster

try to take over the world!

  1. // ==UserScript==
  2. // @name Faster
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description try to take over the world!
  6. // @author Zoupers
  7. // @match *://*.bilibili.com/video/*
  8. // @grant GM_addStyle
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @license MIT2.0
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. var body = document.getElementsByTagName("body")[0]
  16. var div = document.createElement("div")
  17. div.className = "just-for-faster"
  18. body.appendChild(div)
  19. var text = document.createElement("div")
  20. text.className = "just-for-faster-text"
  21. div.appendChild(text)
  22. var show = document.createElement("show")
  23. show.className = "just-for-faster-show"
  24. div.appendChild(show)
  25. var justVideo
  26. function f(){
  27. justVideo = document.getElementsByTagName("video")[0];
  28. var rate = this.getAttribute("value")
  29. $('video')[0].playbackRate = rate;
  30. // justVideo.setAttribute("playbackRate", rate)
  31. console.log("change Rate to ", rate)
  32. }
  33. var tmp
  34. for(let i = 1;i < 6; i++){
  35. tmp = document.createElement("div")
  36. text.appendChild(tmp)
  37. tmp.className = "just-for-faster-switch"
  38. tmp.setAttribute("value", i.toString())
  39. tmp.innerText = i
  40. tmp.onclick = f;
  41. }
  42. let style = document.createElement("style")
  43. body.appendChild(style)
  44. style.appendChild(document.createTextNode(`
  45. .just-for-faster{
  46. background-color: cadetblue;
  47. position: absolute;
  48. display: block;
  49. top: 200px;
  50. left: -80px;
  51. width: 100px;
  52. height: 50px;
  53. }
  54.  
  55. .just-for-faster:hover{
  56. left: 0;
  57. }
  58.  
  59. .just-for-faster-show{
  60. background: red;
  61. height: 50px;
  62. width: 20px;
  63. float: right;
  64. }
  65.  
  66. .just-for-faster-text{
  67. float: left;
  68. width: 79px;
  69. height: 50px;
  70. }
  71.  
  72. .just-for-faster-switch{
  73. font-size: 15px;
  74. width: 15px;
  75. display: inline-block;
  76. cursor: pointer;
  77. text-decoration: none;
  78. }`))
  79. })();