Greasy Fork 支持简体中文。

Hide Youtube Mobile Top Comment

Hide the top comment to avoid spoilers.

// ==UserScript==
// @name         Hide Youtube Mobile Top Comment
// @namespace    http://tampermonkey.net/
// @version      2024-09-10
// @author       mesmere
// @description  Hide the top comment to avoid spoilers.
// @match        https://m.youtube.com/watch*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        window.onurlchange
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

function attempt() {
    if (window.location.href.match(/^https:\/\/m.youtube.com\/watch.+/) === null) {
        return;
    }
    const cep = document.querySelector(".ytm-comments-entry-point-teaser-content [role=text]");
    if (cep) {
        cep.innerText = "The top comment is hidden. Tap to view.";
    } else {
        window.setTimeout(attempt, 200);
    }
}

attempt();
window.addEventListener("urlchange", attempt);