Kemono Video Linker & Image Loader

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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);
    });
})();