Xrares priv video view

see xrares priv videos

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            Xrares priv video view
// @description     see xrares priv videos
// @namespace       sebaalosrom
// @version         1.0.0
// @author          Sebastian Osses
// @license         MIT
// @match           *://*.xrares.com/*
// @homepageURL     https://sleazyfork.org/en/users/1606647-shawn-parker
// ==/UserScript==

(function () {
    'use strict';

    function procesarVideo() {
        const container = document.querySelector('.video-container');
        if (!container) return;

        const privMsg = container.querySelector('.privMSG');
        if (!privMsg) return;

        let vkey = "";
        if (typeof window.evideo_vkey !== 'undefined') {
            vkey = window.evideo_vkey;
        } else if (typeof evideo_vkey !== 'undefined') {
            vkey = evideo_vkey;
        }

        if (!vkey) {
            console.warn('[Userscript] Se encontró .privMSG pero no existe la variable evideo_vkey.');
            return;
        }

        const videoHTML = `
            <video id="vjsplayer_html5_api" controls autoplay muted style="width:100%;height:100%;" class="vjs-tech" slideimage="https://cdn.xrares.com/media/videos/vjsslides/69/69049_progressthumb.jpg" preload="auto">
                <source src="https://www.xrares.com/vsrc/h264/${vkey}/HD" type="video/mp4" label="HD" res="720">
            </video>
        `;

        container.querySelector(".col-xs-12").innerHTML = videoHTML;
    }

    procesarVideo();

    const observer = new MutationObserver((mutations, obs) => {
        const container = document.querySelector('.video-container');
        if (container && container.querySelector('.privMSG')) {
            procesarVideo();
        }
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();