Greasy Fork

Greasy Fork is available in English.

西瓜视频自动自适应网页全屏剧场模式

This script does something cool.

当前为 2023-06-09 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        西瓜视频自动自适应网页全屏剧场模式
// @namespace   476321082
// @match       https://www.ixigua.com/*
// @description  This script does something cool.
// @license      MIT
// @grant       none
// @version     0.1
// @author      -
// ==/UserScript==

(function() {
  'use strict';

  const header = document.querySelector('header');
  header.classList.add('hide');
  const showHeaderDistance = 10; // distance in pixels from the top of the page

  const style = document.createElement('style');
  style.innerHTML = `
    header.hide {
      visibility: hidden;
    }
    .Page_Projection.new-style .xgplayer:not(.xgplayer-is-fullscreen) {
      max-height: 100vh;
    }
    .layoutstatus-header--Normal .v3-app-layout__content {
      padding-top: 0px;
    }
  `;
  document.head.appendChild(style);

  window.addEventListener('mousemove', (event) => {
    if (event.clientY < showHeaderDistance) {
      header.classList.remove('hide');
    }
  });

  header.addEventListener('mouseleave', () => {
    header.classList.add('hide');
  });

  window.addEventListener('load', () => {
    const theaterModeButton = document.querySelector('[tabindex="0"][aria-label="剧场模式"]');
    if (theaterModeButton) {
      theaterModeButton.click();
    }
  });
})();