kp4jd2

Generate a list of links for JD2 from kemono posts.

اعتبارا من 20-04-2022. شاهد أحدث إصدار.

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.

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

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         kp4jd2
// @namespace    https://sleazyfork.org/en/scripts/441628-kp4jd2
// @version      0.30
// @description  Generate a list of links for JD2 from kemono posts.
// @author       You
// @match        https://kemono.party/*/user/*/post/*
// @icon         https://www.google.com/s2/favicons?domain=kemono.party
// @grant        none
// @require      http://code.jquery.com/jquery-latest.min.js
// @license      MIT
// ==/UserScript==
var $ = window.jQuery;

(function() {
    'use strict';

    $(document).ready(function () {
        $(".post__header").after("<div class='kpdlh'></div>");
        $(".kpdlh").append(`<button class="kpdl">Generate List for JD2</button>`).css("padding","0.5rem");
        $(".kpdl").click(function() {genList();});

        function genList() {
            let srcList = "";
            let idx = 0;
            let imgcount = $(".post__files .post__thumbnail a.image-link").length;

            $(".post__files .post__thumbnail a.image-link").each(function() {
                let tmtl = $(this).attr("href");
                let tmfi = tmtl.lastIndexOf("?f=");
                let tmei = tmtl.lastIndexOf(".") + 1;
                let tmnf = tmtl.slice(tmfi);
                let tmex = tmtl.substr(tmei);
                tmtl = tmtl.slice(0,tmfi);

                let kpid = window.location.pathname;
                kpid = kpid.substr(kpid.lastIndexOf("/")+1);
                let lidx = idx.toString().padStart(Math.max(2,imgcount.toString().length),'0');

                //jd2 for some reason dislikes .jpe files
                if (tmex == "jpe") tmex = "jpeg";

                let url = "https://kemono.party"+tmtl+"?f="+kpid+"_"+lidx+"."+tmex;
                srcList += url + "\n";
                idx += 1;
            });

            $(".post__attachment a.post__attachment-link").each(function() {
                let tmtl = $(this).attr("href");
                let url = "https://kemono.party"+tmtl;
                srcList += url + "\n";
            });

            srcList += $.trim($(".post__title").text());
            navigator.clipboard.writeText(srcList);

            $(".kpdlh").append(`<span class="kpdlfb">List copied to Clipboard.</span>`);
            $(".kpdlfb").css("margin-left","0.5rem");
            setTimeout(function() {
                $(".kpdlfb").fadeOut(500, function() {
                    $(".kpdlfb").remove()});
            }, 2000);
        }
    });
})();