Sleazy Fork is available in English.

98预告贴小助手

即点即看不跳转,周周预告看到爽

// ==UserScript==
// @name         98预告贴小助手
// @license      MIT
// @namespace    http://tampermonkey.net/
// @version      3.41
// @description  即点即看不跳转,周周预告看到爽
// @author       Lsssy
// @include      *://*.sehuatang.*/*
// @include      *://sehuatang.*/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAejSURBVGhD7Zh/cJTFGce/u+97l0suuUtILj+AhkACzqixzYQKNBSDRaOUDm2lASeDM9gaWiyC4DAdRVqG0AIytIigpIVaOkoTJNVKBdROQRxooyGARE2JQCDEkCOX3IXLXe69d7d/5K6+t7nLvXcJlD/4/HX7PO/tu999nt199gVuc5sbAhENMaL9P9f81kOkd8faDzBEZ5EgNfOeNk3ITL3HZjLfS4ACzngGA/cYKW31+tWGT5ztx3/wp63OSAPaWVxpKJk2oSg1wfAg53wyCLUBHOD8KgdOu1Xl6AdfXKhffKDaE6mPcOgVQhoXPzs6MyVjmYHShSA0mzEmPgNCCAiIS2HqXzp7e35TtHNtq2YwtGXFxplmatwkUVrEOA/7bkoIOMeXCtiO4xc/21a+r9qlR1DYzrRsfeihhB/eVbbCJEvPqYyZRX8kJErd/Ypvzdyje7cBwNszK9ZJVFrFIwgIByX0isfvWzJuyzMHAAyeOQ1Ddvrewl+kF2ZnvwagTPTpgYBAYerrFMQuUbIs6rSGgYAwn6pUrTu6t6q6oUER/UEiCvlzxVJL2ZiCQ4zzaaLv/4FfVX87dsvKVQD8og8AqGgAgPsAedbo/G23iggAMEjy8tYVm5+INOZwESHnlm2ca0kw1cWSzzcDiVJPy7XO4mm7qj4XN4BB6iqL5yQmG4wbbzURAKAylphrTXsBgCT6RCFkeUlJGaV0kmC/ZZAl+eH6J54vErNJFCKZJcOPOY9nf7k5cHCak2JdLI49pLF5zqOpiQbDDK0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paUA4GDrHtn3UCeR+stDgigfGbvqCh9dcPbALyiP0i0qVHK9+1oOOew/5yQge2OJBhhmR/4FKwy9Oz5O5TLN0YEAG7vu76x9NUNBwH0i04t0YRwAN6SXev3tTu7q+R0Kx+1dAGkdCvAOVxvHYGvuVX8z4jR4/Xs+fb21ZsB9IVbF1r0ziNNS0tLOdnQsD5v/PgnfRfa4T50HL7zbbp2nFghANxK//4Zu9dXtrlcTvHwC0cso5CsVmtK/a9eXGNt61oOqqOeiAMCgl6f9/UZu6ueau/tdUZa3CKxDkYCkFxf+fyT46wZazn48I51AQKone7rW6fvWL3OObDN6hKBOIQgsK7M7z/2zNzCrLHbOWARH4gHAjibrrWvvP+Pm/YBcOtJJy36rmShcAD+PaePt0ywpL87yZZTQgmxiQ/FgqKqp2qb/lX+6BvV/wwsbJ3V91fEE5EgBIDxvoIC2ysPP74mPdG8iPHYUo0Q4rnicmx5rO7lbWc7O3swUAwOuTtFYjhCgsgAzDXzfjb9W7kFG4yyfHe0r/mUUObsd79T0/Tx2tXv728ORCGmVBIZCSEI9JOQZTZb6hYsW5BrTX8qQZbztd+RSSACDo/70IlLLdsXvbW7ISBAiTcKWkZKSBAJQEKm2Zzyh7k/Kc1Ps33PKMl5Kle7XF7vsQ0n3jlQd7ahA4BnOGkUjpEWEoQCMAAwBsTxwMz7Aik0YgKC3CghQbT9j/jgb3Mr81+LB8wWSH6WmgAAAABJRU5ErkJggg==
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const fixUrl = url => {
        if (!/^https?:\/\//.test(url)) {
            url = 'https://' + url;
        }
        return url.replace(/^(https?:\/\/)?(?:[a-zA-Z0-9.-]+)?\.dmm\.co\.jp/, 'https://cc3001.dmm.co.jp');
    };

    const formatNumber = num => num.toUpperCase().replace(/^([a-zA-Z]+)0*(\d+)$/, (_, prefix, digits) => {
        return `${prefix}-${digits.padStart(3, '0')}`;
    });

    const replaceTextWithLink = node => {
        if (node.nodeType === Node.TEXT_NODE) {
            const regex = /((?:https?:\/\/)?(?:[a-zA-Z0-9.-]+)?\.dmm\.co\.jp\/.*?\/)([\w]+_\w+_\w+\.mp4)/g;
            let text = node.nodeValue, match, parent = node.parentNode, lastIndex = 0;

            while ((match = regex.exec(text)) !== null) {
                parent.insertBefore(document.createTextNode(text.slice(lastIndex, match.index)), node);
                const link = document.createElement('a');
                link.href = fixUrl(match[1] + match[2]);
                link.textContent = formatNumber(match[2].split('_')[0]);
                parent.insertBefore(link, node);
                lastIndex = regex.lastIndex;
            }

            parent.insertBefore(document.createTextNode(text.slice(lastIndex)), node);
            parent.removeChild(node);
        } else if (node.nodeType === Node.ELEMENT_NODE) {
            Array.from(node.childNodes).forEach(replaceTextWithLink);
        }
    };

    replaceTextWithLink(document.body);
})();

(function() {
    'use strict';

    document.querySelectorAll('a[href*="pv3001"], a[href*="dmm.com"], a[href*="_dm_w"]')
        .forEach(function(link) {
            link.href = link.href
                .replace('pv3001', 'cc3001')
                .replace('dmm.com', 'dmm.co.jp')
                .replace('_dm_w', 'hhb');
        });
})();

(function () {
    'use strict';
    const isMobile = /Mobi|Android|iPhone/i.test(navigator.userAgent);
    const videoModal = document.createElement('div');
    videoModal.style.cssText = 'position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:rgba(0,0,0,0.7);display:none;justify-content:center;align-items:center;z-index:1000;cursor:pointer;';
    document.body.appendChild(videoModal);

    const videoElement = document.createElement('video');
    videoElement.style.cssText = isMobile
        ? 'width:90%;height:auto;border:2px solid white;border-radius:10px;'
        : 'max-width:80%;max-height:80%;border:2px solid white;border-radius:10px;';
    videoElement.setAttribute('controls', true);
    videoElement.muted = true;
    videoModal.appendChild(videoElement);

    const videoTitle = document.createElement('div');
    videoTitle.style.cssText = isMobile
        ? 'position:absolute;top:5%;width:90%;text-align:center;font-size:18px;color:white;z-index:1001;font-family: Arial, sans-serif;opacity:0.9;'
        : 'position:absolute;top:10px;width:100%;text-align:center;font-size:22px;color:white;z-index:1001;font-family: Arial, sans-serif;opacity:0.9;';
    videoModal.appendChild(videoTitle);

    const leftButton = document.createElement('button');
    leftButton.innerText = '◁';
    leftButton.style.cssText = isMobile
        ? 'position:absolute;bottom:10%;left:10%;font-size:24px;color:white;background-color:rgba(0,0,0,0.5);border:none;padding:10px 20px;border-radius:5px;cursor:pointer;'
        : 'position:absolute;left:20px;top:50%;transform:translateY(-50%);font-size:32px;font-weight:bold;color:white;background-color:rgba(0,0,0,0.5);border:none;padding:12px 20px;border-radius:30px;cursor:pointer;';
    videoModal.appendChild(leftButton);

    const rightButton = document.createElement('button');
    rightButton.innerText = '▷';
    rightButton.style.cssText = isMobile
        ? 'position:absolute;bottom:10%;right:10%;font-size:24px;color:white;background-color:rgba(0,0,0,0.5);border:none;padding:10px 20px;border-radius:5px;cursor:pointer;'
        : 'position:absolute;right:20px;top:50%;transform:translateY(-50%);font-size:32px;font-weight:bold;color:white;background-color:rgba(0,0,0,0.5);border:none;padding:12px 20px;border-radius:30px;cursor:pointer;';
    videoModal.appendChild(rightButton);

    const videoIndexDisplay = document.createElement('div');
    videoIndexDisplay.style.cssText = isMobile
        ? 'position:fixed;top:5%;left:5%;font-size:16px;color:white;z-index:1002;font-family: Arial, sans-serif;opacity:0.9;'
        : 'position:fixed;top:10px;left:10px;font-size:18px;color:white;z-index:1002;font-family: Arial, sans-serif;opacity:0.9;';
    document.body.appendChild(videoIndexDisplay);

    let videoLinks = [];
    let currentIndex = -1;
    let isNavigatingVideos = false;

    function bindVideoLinks() {
        document.querySelectorAll('a[href*=".mp4"]').forEach(link => {
            link.addEventListener('click', function (e) {
                e.preventDefault();
                videoElement.src = link.href;
                videoElement.play();
                videoModal.style.display = 'flex';
                videoLinks = Array.from(document.querySelectorAll('a[href*=".mp4"]')).map(link => link.href);
                currentIndex = videoLinks.indexOf(link.href);
                const videoName = link.textContent.trim();
                videoTitle.textContent = videoName;
                updateVideoIndexDisplay();
            });
        });
    }

    function updateVideoIndexDisplay() {
        videoIndexDisplay.textContent = `${currentIndex + 1} / ${videoLinks.length}`;
    }

    videoModal.addEventListener('click', function (e) {
        if (e.target === videoModal) {
            videoElement.pause();
            videoModal.style.display = 'none';
        }
    });

    window.addEventListener('keydown', function (e) {
        if (e.key === 'ArrowLeft') {
            if (isNavigatingVideos) {
                loadPreviousVideo();
            } else {
                videoElement.currentTime -= 5;
            }
        } else if (e.key === 'ArrowRight') {
            if (isNavigatingVideos) {
                loadNextVideo();
            } else {
                videoElement.currentTime += 5;
            }
        }
    });

    leftButton.addEventListener('click', function () {
        isNavigatingVideos = true;
        loadPreviousVideo();
    });

    rightButton.addEventListener('click', function () {
        isNavigatingVideos = true;
        loadNextVideo();
    });

    function loadPreviousVideo() {
        if (videoLinks.length > 0) {
            currentIndex = (currentIndex === 0) ? videoLinks.length - 1 : currentIndex - 1;
            videoElement.src = videoLinks[currentIndex];
            videoElement.play();
            const videoName = document.querySelectorAll('a[href*=".mp4"]')[currentIndex].textContent.trim();
            videoTitle.textContent = videoName;
            updateVideoIndexDisplay();
        }
    }

    function loadNextVideo() {
        if (videoLinks.length > 0) {
            currentIndex = (currentIndex === videoLinks.length - 1) ? 0 : currentIndex + 1;
            videoElement.src = videoLinks[currentIndex];
            videoElement.play();
            const videoName = document.querySelectorAll('a[href*=".mp4"]')[currentIndex].textContent.trim();
            videoTitle.textContent = videoName;
            updateVideoIndexDisplay();
        }
    }

    videoElement.addEventListener('fullscreenchange', function () {
        if (document.fullscreenElement) {
            videoElement.style.border = 'none';
        } else {
            videoElement.style.border = '2px solid white';
        }
    });

    videoElement.addEventListener('click', function () {
        isNavigatingVideos = false;
    });

    window.addEventListener('load', bindVideoLinks);

    const observer = new MutationObserver(bindVideoLinks);
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();