Greasy Fork

Greasy Fork is available in English.

douyin-mobile-web

douyin mobile web

目前为 2023-08-27 提交的版本。查看 最新版本

// ==UserScript==
// @name         douyin-mobile-web
// @description  douyin mobile web
// @version      1.1.5
// @match       https://www.douyin.com/
// @namespace   https://trim21.me/
// @grant        GM_addStyle
// @license MIT
// ==/UserScript==

(function () {
    "use strict";

    // 添加 CSS 样式
    GM_addStyle(`
    /* 展开评论后评论宽高及位置 */
    #videoSideBar {
        position: absolute;
        left: 0;
        width: 100%;
        height: 61%;
        top: 39%;
    }
    #relatedVideoCard {
        margin-top: 1vh;
        height: 95%
    }
    .mQjJJImN._8RdwESC {
        line-height: 1.2!important
    }
    .mQjJJImN._8RdwESC * {
        line-height: inherit!important;
    }
    .comment-input-container {
        display: none
    }
    .comment-reply-expand-btn {
        height: auto!important
    }
    .comment-item-stats-container {
        height: auto!important
    }
    .comment-item-tag {
        height: auto!important
    }
    /*评论区登录提示删除*/
    #related-video-card-login-guide {
        display: none
    }
    .T3p4lV8L {
        filter: none!important
    }
    .IXR56A9B {
        width: 144px!important;
        height: 144px!important;
        position: relative!important;
        top: 144px!important;
    }
    .ojlTaq_K {
        width: 100%!important;
        height: 100%!important;
    }
    /*评论区表情包大小*/
    .jZ9bChTp {
        height: 1em!important;
        width: 1em!important;
    }
    .avatar-component-avatar-container {
        height: 1em!important;
        width: 1em!important;
    }
    /* 展开评论后视频高度及位置 */
    .WQ9IVUcw {
        height: 39%;
        top: 0%
    }
    /*TA的作品字体*/
    .author-card-user-name {
        height: auto!important;
    }
    .Nu66P_ba.MDEPW30B {
        max-width: unset!important;
        line-height: 1!important;
        height: auto!important;
    }
    .author-card-user-stats {
        height: auto!important;
    }
    .B3AsdZT9.Onp3QgDp {
        height: auto!important;
    }
    .author-card-follow-btn {
        height: auto!important;
    }
    /*播放器进度粗细*/
    /* 视频宽度 */
    .playerContainer {
        width: 100% !important;
    }
    /*视频点击高亮框去除*/
    .xgplayer {
        cursor: unset
    }
    /* 播放器高度 */
    .xg-video-container {
        height: 100%
    }
    /* 视频标题宽度 */
    .tSXOCvQc {
        bottom: 5vh!important
    }
    .video-info-detail {
        padding-right: 15%!important;
        opacity: 0.5;
    }
    .video-info-mask {
        display: none
    }
    /*标题作者名*/
    #video-info-wrap div.account-name {
        max-width: 80vw!important
    }
    /* 视频功能按钮宽度 */
    .xg-inner-controls {
        height: 5vh!important;
    }
    .xgplayer-icon {
        height: auto!important;
    }
    .xg-left-grid {
        margin-right: 0!important;
    }

    xg-icon {
        width: auto!important
    }
    div > div.btn {
        width: 100px!important
    }
    .xgplayer-playback-setting {
        display: none
    }
    .xgplayer-playclarity-setting {
        display: none!important;
        width: 100px!important
    }
    .xgplayer-immersive-switch-setting {
        display: none!important
    }
    svg {
        width: 1.5em;
        height: 1.5em
    }

    /*展开按钮样式*/
    .npIvCX5K:before {
        height: calc(100% - var(--lineHeight) - 1.2vh)
    }
    ._f3D05pF {
        width: auto!important;
        line-height: 0!important
    }
    /* 视频和评论整体字体大小... */
    .page-recommend-container {
        font-size: 3vh!important
    }
    .page-recommend-container * {
        font-size: inherit!important;
    }
    /* 视频竖版功能按钮宽度 */
    .OFZHdvpl {
        font-size: 1vh!important
    }
    .xgplayer-playswitch {
        display: none
    }
    /*去掉登录弹窗*/
    .mPWahmAI {
        display: none
    }
    .JsAsIOEV {
        display: none
    }
    .cL3t_Mk2 {
        display: none
    }
    /*删除上下滚动视频提示图片*/
    .I6ivXmaS {
        display: none;
    }
    /*删除验证码图片#captcha_container*/
    .c1aptcha_verify_container {
        width: 100vw !important;
        font-size: 3vh!important
    }
    .c1aptcha_verify_container * {
        font-size: inherit!important;
    }
    .c1aptcha_verify_img--wrapper {
        width: 95.2vw!important;
        height: 59.36vw!important;
    }
    /*删除关闭按钮*/
    .verify-bar-close--icon {
        height: 3vh!important;
        width: 3vh!important;
    }
    .captcha_verify_bar--close {
        right: 3vh!important;
    }
    /*验证码下方工具条宽高*/
    .captcha_verify_action.sc-jDwBTQ.dhdXHN div.sc-gPEVay.hdkDPH {
        line-height: initial;
    }
    .verify-captcha-submit-button {
        width: 7vh!important;
        height: 4vh!important;
        line-height: 4vh!important;
    }
      `);
    function waitForElementAndClick(selector, interval, maxAttempts) {
        let attempts = 0;

        function checkAndClick() {
            const element = document.querySelector(selector);

            if (element) {
                element.click();
                console.log('Element found and clicked.');
            } else {
                attempts++;
                if (attempts < maxAttempts) {
                    console.log('Element not found. Retrying in ' + interval + 'ms...');
                    setTimeout(checkAndClick, interval);
                } else {
                    console.log('Max attempts reached. Element not found.');
                }
            }
        }

        checkAndClick();
    }

    // 使用示例
    waitForElementAndClick('.xgplayer-page-full-screen', 1000, 20);

})();