🏠 Home 

Greasy Fork is available in English.

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

This script does something cool.

// ==UserScript==
// @name        西瓜视频自动自适应网页全屏剧场模式
// @namespace   476321082
// @match       https://www.ixigua.com/*
// @description  This script does something cool.
// @license      MIT
// @grant       none
// @version     0.2
// @author      -
// ==/UserScript==
(function() {
'use strict';
const header = document.querySelector('header');
const showHeaderDistance = 10; // distance in pixels from the top of the page
// Add style to the document
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);
header.classList.add('hide');
// Toggle header visibility based on mouse position or event
function toggleHeaderVisibility(event) {
if (event.type === 'mousemove' && event.clientY < showHeaderDistance) {
header.classList.remove('hide');
} else if (event.type === 'mouseleave') {
header.classList.add('hide');
}
}
window.addEventListener('mousemove', toggleHeaderVisibility);
header.addEventListener('mouseleave', toggleHeaderVisibility);
// Click theater mode button on page load
window.addEventListener('load', () => {
const theaterModeButton = document.querySelector('[tabindex="0"][aria-label="剧场模式"]');
if (theaterModeButton) {
theaterModeButton.click();
}
});
})();