Vimeo - Disable Autoplay

Disable autoplay on Vimeo everywhere

  1. // ==UserScript==
  2. // @name Vimeo - Disable Autoplay
  3. // @namespace https://openuserjs.org/
  4. // @description Disable autoplay on Vimeo everywhere
  5. // @include https://vimeo.com/*
  6. // @version 1.0
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. document.addEventListener('DOMNodeInserted', function() {
  11. if ( (document.getElementsByClassName("js-title").length > 0) || (document.getElementsByClassName("iris_link").length > 0) ) {
  12. var vids = document.querySelectorAll("a.js-title, a.iris_link, a.iris_link-box, ol.js-browse_list li > a");
  13. for (var i = 0; i < vids.length; i++) {
  14. if (vids[i].href.match(/autoplay=1/i)) {
  15. vids[i].href = vids[i].href.replace("?autoplay=1", "");
  16. }
  17. if (!vids[i].href.match(/autoplay/i) && !vids[i].href.match(/\/user/i) && !vids[i].href.match(/\/forums/i) && !vids[i].href.match(/javascript/i) && !vids[i].href.match(/#language/i)) {
  18. vids[i].href = vids[i].href + "?autoplay=0";
  19. vids[i].setAttribute("rel", "nofollow noopener noreferrer");
  20. }
  21. }
  22. }
  23. }, false);