Play with VLC Button for scloud.ninja and Subdomains (iOS Compatible)

Adds a Play with VLC button to each result card on scloud.ninja and its subdomains to open videos in VLC for Mobile on iOS

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
    // @name         Play with VLC Button for scloud.ninja and Subdomains (iOS Compatible)
    // @namespace    http://tampermonkey.net/
    // @version      1.2
    // @description  Adds a Play with VLC button to each result card on scloud.ninja and its subdomains to open videos in VLC for Mobile on iOS
    // @author       Grok
    // @match        https://*.scloud.ninja/*
    // @match        https://scloud.ninja/*
    // @grant        none
    // @license MIT
    // ==/UserScript==

    (function() {
        'use strict';

        // Function to create and style the VLC button
        function createVLCButton(url) {
            const button = document.createElement('button');
            button.textContent = 'Play with VLC';
            button.style.padding = '6px 12px';
            button.style.marginLeft = '10px';
            button.style.backgroundColor = '#e53e3e'; // Matches red-500 from the card
            button.style.color = 'white';
            button.style.borderRadius = '8px';
            button.style.border = 'none';
            button.style.cursor = 'pointer';
            button.style.fontSize = '14px';
            button.style.transition = 'background-color 0.2s';
            button.onmouseover = () => button.style.backgroundColor = '#c53030';
            button.onmouseout = () => button.style.backgroundColor = '#e53e3e';
            button.onclick = () => {
                window.location.href = `vlc:// ${encodeURIComponent(url)}`;
            };
            return button;
        }

        // Find all result cards
        const resultCards = document.querySelectorAll('.result-card');

        resultCards.forEach(card => {
            // Find the input element with the URL
            const input = card.querySelector('input.copy-checkbox[data-url]');
            if (input) {
                const url = input.getAttribute('data-url');
                if (url) {
                    // Create a container for the button
                    const buttonContainer = document.createElement('div');
                    buttonContainer.style.display = 'flex';
                    buttonContainer.style.alignItems = 'center';
                    buttonContainer.style.marginTop = '10px';

                    // Create and append the VLC button
                    const vlcButton = createVLCButton(url);
                    buttonContainer.appendChild(vlcButton);

                    // Append the button container below the card content
                    card.appendChild(buttonContainer);
                }
            }
        });
    })();