thisVID.com Native Player (HTML5) and download

Replace video player with HTML5 native player (also enables download of videos)

当前为 2025-02-10 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         thisVID.com Native Player (HTML5) and download
// @namespace    _pc
// @version      2.1
// @license      MIT
// @description  Replace video player with HTML5 native player (also enables download of videos)
// @author       verydelight
// @match        *://thisvid.com/videos/*
// @icon         https://www.thisvid.com/favicon.ico
// @compatible   Firefox Tampermonkey
// @grant        none
// ==/UserScript==
(function() {
	'use strict';
	function insertVideo() {
		const videoElement = document.querySelector('video.fp-engine');
		if (!videoElement) return;
		const videoUrl = videoElement.src;
		const posterUrl = document.querySelector('.video-holder img').src;
		const newVideoElement = document.createElement('video');
		newVideoElement.poster = posterUrl;
		newVideoElement.src = videoUrl;
		newVideoElement.controls = true;
		newVideoElement.style.width = '100%';
		const videoHolder = document.querySelector('.video-holder');
		if (videoHolder) {
			videoHolder.innerHTML = '';
			videoHolder.appendChild(newVideoElement);
			newVideoElement.play();
		}
	}
	const targetNode = document.getElementById('kt_player');
	if (targetNode) {
		const observer = new MutationObserver((mutationsList) => {
			for (const mutation of mutationsList) {
				if (mutation.type === 'childList') {
					const videoElement = targetNode.querySelector('video');
					if (videoElement) {
						insertVideo();
						observer.disconnect();
					}
				}
			}
		});
		observer.observe(targetNode, { childList: true, subtree: true });
		//console.log('MutationObserver is monitoring for <video> elements within kt_player');
	} else {
		//console.error('The element with ID "kt_player" was not found.');
	}
})();