Greasy Fork is available in English.

Stop videos looping

Stop videos looping (Youtube, Twitter, Tiktok, Instagram)

// ==UserScript==
// @name         Stop videos looping
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Stop videos looping (Youtube, Twitter, Tiktok, Instagram)
// @author       @dmtri
// @match        https://*.youtube.com/*
// @match        https://*.twitter.com/*
// @match        https://*.tiktok.com/*
// @match        https://*.instagram.com/*
// @license MIT

// @icon
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  // Get the video element

  const init = () => {
    const vids = document.querySelectorAll("video");
    vids.forEach((vid) => {
      // Remove the loop attribute
      vid.removeAttribute("loop");

      // Add an event listener for the 'ended' event
      vid.addEventListener("ended", () => {
        setTimeout(vid.pause(), 200);
      });
    });
  };

  setInterval(init, 2000);
})();