抖音全屏&自动清屏

抖音全屏优化,自动清屏,隐藏控制栏

// ==UserScript==
// @name         抖音全屏&自动清屏
// @version      1.1.3
// @author       akFace
// @description  抖音全屏优化,自动清屏,隐藏控制栏
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAF19JREFUeF7tnQl8U1X2x38vabqlLWOFrpStUMrWsrdUEARkEREQCoiAghswHQdQEFREGXfhD24MjOiMIqKD4IyICCObFCgt1JaC0ELpmq0L3ZLuyft/bkpL8pI07yUvaVre/Xz6KTT3nnvOud93381dzqXAU+riGzJarMMoGogGqD4A3RXAPQC8eKribhSjBVBJA0UUkAfgGgXq90YRzpZUybL4cAhlj5BAn9DxoOkFAGYB8LdHllCWsweuAfgvDWpvkUaWzrn07QI2ARDkExpPg14FGqNsrVgox58HaFCHAd2HRRrFEa5SOQEQ7B08VEdR7wCYxLUiIb8TPEDjB0qke1WpVv7BtjbWAARJQ9bQwPtsBQv52tID9CqVRrGNjQZsAKACpSG7ATzORqCQxzU8QIHerdQoFlvTplUAuvp19W/Q0gcAeqw1QcLnrugB+qRELJ5dWFl4y5J2FgFoanztYYAa6YqmCTqx9QCdLBGLp1qCwCIAgdLgEwA1jm01Qj5X9gB1SqWRPQCAZmppFoAgafBXNKhFrmySoBtnD+xRaeQLrQIQKA1eCVBbOYsXCri8ByhgrVIj/8BQUaMeIMgnqD9Ni664vCWCgjZ7QETTwxTVitRmAUYABHqHHACln9YVUsf1wFGVRj7ZBIAAafBkCtQvHddu85aJ40bYbbL2bIrdMpwpgKKouUq1bB+ps6UHCJCG/kyBnupMRVyhLj/VZbvUqN/5FWpfa2cTpBTOqdTyuBYAAqSh0RToNLs80U4L2wtAw76DqElY3/6sp6gJKrXsuL4HCJSGvAvgpfZnhf0a2wtA45GTqF6cYL8izpfwuUojf7oZgKsAIp2vQ9vXyARg2NVsTkr1u5aPtJWvmpQ5W1vBSU4bZL6l0sjvpTr7hkaI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CW4eDmlIc1JTcVY3e7Asa1OEijewh8v8WAIJ8QuNpmv63MxrPUXWQbdrNQHR384RSW3+7wcnvOn3sYCEBNOgpRRrFESMAbg8GyR8nCU7qwB6g8YOqWt50YMOwByD/CfYOHqqjqPa/xNWB289e0yhKN0CpVv5hFgDyR1ebGLLXYKG8oQfoVSqNYpvhX4wv1739iStNDwsNyI8HKNC7lRrFYqY0swA07RUMPQHQHG534EdRQYojPECfVGkUD5iTbAkAdPXr6t+g1R4GKMetyDjCVkEmwwN0skQsnlpYWXiLEwAk820I9gPUOMGv7dED1CmJmHrUUuObfAuwZGKQNPgrGtSi9uiCu1jnPSqNnLRZq9G1Lb4CmI4LlAavBKitd7FD243pFLBWqZF/wEZh1gDovyL6BPWndaI3QWEWG+FCHqd74KiIptcrqhWsI2tzAqDZnABp8GRA9FcK9FSnmyhUaOoBCucoUFuVatk+ru6xCYA7IIRGU6BJrFWyiY/9ldtctRTym/MAGdX/AIr6RqWWHbfVRXYBYFhpZ9/QCDcd4mjQJMxmJA10pwASG44E/bXzinBbzesQ5Ui0zDKAKgTo6xSQrhXhXHGVPJEP6/4fAayH1yFvEgIAAAAASUVORK5CYII=
// @supportURL   https://greasyfork.org/scripts/413593
// @match        *://*.douyin.com/*
// @match        *://*.iesdouyin.com/*
// @license      GPL-3.0 License
// @run-at       document-start
// @namespace    https://greasyfork.org/scripts/413593
// @supportURL   https://greasyfork.org/zh-CN/users/1368522
// @homepageURL  https://github.com/akFace/userScript
// ==/UserScript==

(function () {
  "use strict";
  let style_Add = document.createElement("style");
  style_Add.innerHTML = `.isCssFullScreen .xg-video-container{bottom: 0 !important;}
    .isCssFullScreen .xgplayer-inactive .xg-inner-controls{opacity: 0 !important;}
    .isCssFullScreen .xg-inner-controls{opacity: 1;}
    .isCssFullScreen .xgplayer-inactive .positionBox{opacity: 0 !important;}
    .isCssFullScreen .positionBox{opacity: 1;}
    .isCssFullScreen .immersive-player-switch-on-hide-video-info.xgplayer-inactive .xgplayer-controls{background: none !important;}
    `;
  if (document.head) {
    document.head.appendChild(style_Add);
  } else {
    let timer = setInterval(function () {
      if (document.head) {
        document.head.appendChild(style_Add);
        clearInterval(timer);
      }
    });
  }
  document.addEventListener("DOMContentLoaded", () => {
    initClear();
  });
  var initClear = function () {
    var isCleared = false;
    var lastClearTime = 0;
    var minClearInterval = 1000; // 最小清屏间隔时间(毫秒)

    // 添加监听器以检测页面变化
    var observer = new MutationObserver(function (mutations) {
      mutations.forEach(function (mutation) {
        var currentTime = Date.now();
        if (currentTime - lastClearTime >= minClearInterval) {
          clearScreen();
          lastClearTime = currentTime;
        }
      });
    });

    // 开始监听 DOM 变化
    observer.observe(document.body, { childList: true, subtree: true });

    function clearScreen() {
      try {
        var controlsDom = document.querySelectorAll(
          '[data-e2e="feed-active-video"]'
        );
        var wei = "xg-switch"; // 未清屏状态
        var wei1 = "xg-switch xg-switch-checked"; // 清屏状态
        if (controlsDom.length) {
          var qingping = controlsDom[0].getElementsByClassName("xg-switch");
          if (qingping.length && qingping[0].className == wei) {
            qingping[0].click();
            console.log("清屏了");
            isCleared = true;
          } else if (qingping.length && qingping[0].className == wei1) {
            if (isCleared) {
              console.log("已清屏");
              isCleared = false;
            }
          }
        }
      } catch (error) {
        console.error("清屏操作时出现错误:", error);
      }
    }
  };
})();