🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

框架网页全屏

iframe网页全屏

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         框架网页全屏
// @namespace    iframeWebFull.xinggsf
// @version      0.2
// @description  iframe网页全屏
// @author       xinggsf
// @include      https://www.imeiju.pro/Play/*
// @include      https://www.imeiju.pro/new/Play/*
// @include      http://www.hanjutvaa.com/player/*
// @include      https://www.hanjutvaa.com/player/*
// @include      *olevod.com/index.php/vod/play/id/*
// @include      *olevod.tv/index.php/vod/play/id/*
// @noframes
// @run-at       document-body
// @grant        GM_addStyle
// ==/UserScript==

(function(doc, by) {
'use strict';
const q = (css, p = doc) => p.querySelector(css);
const goNextMV = () => {
	const s = location.pathname;
	const m = s.match(/(\d+)(\D*)$/);
	const d = +m[1] + 1;
	location.assign(s.slice(0, m.index) + d + m[2]);
};
const getMainDomain = host => {
	const a = host.split('.');
	let i = a.length - 2;
	if (/^(com?|cc|tv|net|org|gov|edu)$/.test(a[i])) i--;
	return a[i];
};
const u = getMainDomain(location.hostname);
const doClick = e => {
	if (typeof e === 'string') e = q(e);
	if (e) { e.click ? e.click() : e.dispatchEvent(new MouseEvent('click')) };
};

class FullPage {
	constructor(frm, onSwitch = null) {
		this._onSwitch = onSwitch;
		this.frame = frm;
		GM_addStyle(
			`.gm-fp-body .gm-fp-zTop {
				position: relative !important;
				z-index: 2147483647 !important;
			}
			.gm-fp-wrapper, .gm-fp-body{ overflow:hidden !important; }
			.gm-fp-wrapper {
				display: block !important;
				position: fixed !important;
				width: 100% !important;
				height: 100% !important;
				top: 0 !important;
				left: 0 !important;
				background: #000 !important;
				z-index: 2147483647 !important;
			}`
		);
	}
	static isFull() {
		return by.classList.contains('gm-fp-body');
	}
	toggle() {
		this._onSwitch?.(this);
		by.classList.toggle('gm-fp-body');
		this.frame.classList.toggle('gm-fp-wrapper');
		let e = this.frame.parentNode;
		while (e != by) {
			e.classList.toggle('gm-fp-zTop');
			e = e.parentNode;
		}
	}
}

const config = {
	hanjutvaa: {
		nextCSS: 'a.playLink.active + a',
		origin: 'https://ww4.hanjutvaa.com:443' //必须带端口号
	},
	olevod: {
		nextCSS: 'i.next-p'
	}
};
// const origin = config[u]?.origin || '/';

let ffp, mvWin, topFrame;
window.addEventListener("message", ev => {
	if (!ev.source || !ev.data?.id) return;
	switch (ev.data.id) {
	case 'gm-h5-init-MVframe':
		mvWin = ev.source;
		topFrame = [...doc.getElementsByTagName('iframe')]
			.find(e => e.allowfullscreen || e.offsetWidth > 99);
		ffp = new FullPage(topFrame);
		break;
	case 'gm-h5-toggle-iframeWebFull':
		ffp.toggle();
		break;
	case 'gm-h5-is-iframeWebFull': //响应子框架的ESC按键
		FullPage.isFull() && ffp.toggle();
		break;
	case 'gm-h5-play-next':
		config[u]?.nextCSS ? doClick(config[u].nextCSS) : goNextMV();
	}
}, false);

by.addEventListener('keydown', ev => {
	if (!ffp) return;
	switch (ev.keyCode) {
	case 78: // N 下一集
		config[u]?.nextCSS ? doClick(config[u].nextCSS) : goNextMV();
		break;
	case 13: //回车键。 全屏
		if (ev.shiftKey) {
			ffp.toggle();
		} else {
			mvWin.postMessage({id: 'gm-h5-toggle-fullScreen'}, '*');
		}
		break;
	case 27: //esc
		if (doc.fullscreen) {
			mvWin.postMessage({id: 'gm-h5-toggle-fullScreen'}, '*');
		} else if (FullPage.isFull()) {
			ffp.toggle();
		}
	}
});

})(document, document.body);