TikTok Autoscroll

try to take over the world!

目前為 2020-09-08 提交的版本,檢視 最新版本

// ==UserScript==
// @name         TikTok Autoscroll
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  try to take over the world!
// @author       @Masiosare
// @match        https://www.tiktok.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function scrollTo(e) {

        e.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.nextSibling.scrollIntoView()

    }

    document.addEventListener("DOMNodeInserted", function (e) {
        if (e.target.tagName == "VIDEO") {

            e.target.addEventListener('loadeddata', function (v) {

                v.target.loop = false;
                v.target.muted = false;
                v.target.controls = true;
                let duration = v.target.duration
                console.log("Scrolling in " + (duration + 3) * 1000);
                setTimeout(function () {
                    scrollTo(v.target)
                }, (duration + 3) * 1000);
            }, false);


        }

    }, false);

})();