Animixplay Fast Forward

Add a button to fast forward by a large amount to skip openings

  1. // ==UserScript==
  2. // @name Animixplay Fast Forward
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Add a button to fast forward by a large amount to skip openings
  6. // @match https://plyr.link/p/player.html
  7. // @icon https://www.google.com/s2/favicons?sz=64&domain=animixplay.to
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. let seconds = 85
  12. // New button with the same style
  13. let newFastForward = `<button id="new-fast-forward" class="plyr__controls__item plyr__control" type="button" data-plyr="fast-forward">
  14. <svg aria-hidden="true" focusable="false"><use xlink:href="/assets/lib/plyr3.6.9.svg#plyr-fast-forward"></use></svg>
  15. <span class="plyr__tooltip">Forward ${seconds}s</span>
  16. </button>`
  17.  
  18. //Observe changes to the DOM
  19. const observer = new MutationObserver((mutationsList, observer) => {
  20. let fastForward = document.querySelector('#videocontainer > div > div.plyr__controls > button:nth-child(3)')
  21. //keep trying until found
  22. if(fastForward){
  23. fastForward.insertAdjacentHTML('afterend', newFastForward)
  24. //Click listener
  25. document.getElementById('new-fast-forward').addEventListener('click', () => {
  26. document.querySelector('video').currentTime += seconds
  27. })
  28. observer.disconnect() //once
  29. }
  30.  
  31. })
  32.  
  33. observer.observe(document, {subtree:true, childList:true, attributes:true})