Kemono Video Linker & Image Loader

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

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

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
    });
})();