TikTok Homepage and FYP Disable Autoplay

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
})();