TikTok Homepage and FYP Disable Autoplay

Pauses first video on homepage and FYP load, meant for navigation.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        TikTok Homepage and FYP Disable Autoplay
// @namespace   Violentmonkey Scripts
// @match        https://www.tiktok.com/
// @match        https://www.tiktok.com/foryou
// @match        https://www.tiktok.com/following
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tiktok.com
// @run-at          document-start
// @compatible      chrome
// @compatible      firefox
// @compatible      opera
// @compatible      edge
// @compatible      safari
// @version     0.2.0
// @author      jcosentino (https://github.com/jcosentino/TikTok-Homepage-and-FYP-Disable-Autoplay)
// @description Pauses first video on homepage and FYP load, meant for navigation.
// @license      MIT
// ==/UserScript==

(() => {
  const config = {
    childList: true,
    subtree: true
  };

  const callback = () => {
    const firstVideo = document.getElementById('one-column-item-0')?.querySelector('video');
    if(firstVideo){
      firstVideo.pause();
      MutationObserver.disconnect();
    }
  };

  const observer = new MutationObserver(callback);
  observer.observe(document, config);
})();