Kemono Video Linker & Image Loader

Turns the video name into a clickable link, and automatically loads image previews.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Kemono Video Linker & Image Loader
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  Turns the video name into a clickable link, and automatically loads image previews.
// @author       https://github.com/xskutsu/
// @match        *://kemono.party/*
// @match        *://kemono.su/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=kemono.party
// @grant        none
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
    "use strict";
    window.addEventListener("load", function () {
        setInterval(function () {
            if (window.location.href.split("/").filter(o => o.length > 1).splice(-2, 1)[0] !== "post") return;
            document.querySelectorAll('.post__video').forEach(videoElement => {
                const summary = videoElement.parentElement.parentElement.children[0];
                const videoSource = videoElement.children[0].src;
                const link = document.createElement('a');
                link.textContent = summary.textContent;
                link.href = videoSource;
                link.target = '_blank';
                link.appendChild(document.createElement('br'));
                summary.parentElement.prepend(link);
                summary.remove();
                videoElement.classList.remove("post__video");
            });
            const thumbnails = document.querySelectorAll('.post__thumbnail');
            thumbnails.forEach((thumbnail, index) => {
                setTimeout(() => {
                    const targetElement = thumbnail.children[0]?.children[0];
                    if (targetElement?.classList.contains('image-link')) {
                        targetElement.children[0]?.click();
                        thumbnail.classList.remove("post__thumbnail");
                    }
                }, index * 800);
            });
        }, 1000);
    });
})();