Karups Images

Access to full size content and download buttons

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Karups Images
// @namespace    https://greasyfork.org/en/users/1384264-atman
// @version      2024-11-23
// @description  Access to full size content and download buttons
// @author       atman
// @match        https://*.karups.com/gallery/*
// @match        https://*.karupsow.com/gallery/*
// @match        https://*.karupsha.com/gallery/*
// @grant        none
// @license      GPL-3.0
// ==/UserScript==

(function() {
    'use strict';

    const galleryBlock = document.querySelector('.gallery-thumbs');
    const photoHolders = document.querySelectorAll('.thumb-grid-item img');

    if (photoHolders) {
        photoHolders.forEach(img => {
            const originalSrc = img.src;
            const fullImageUrl = originalSrc.replace(/lowres/g, 'highres').replace(/\.thumb/g, '').replace(/\/thumbs/g, '').replace(/1500(?!.*1500)/, '3000').replace(/1024(?!.*1024)/, '1500');

            // Set the link
            const link = document.createElement('a');
            link.href = fullImageUrl;
            link.target = '_blank';
            img.parentNode.insertBefore(link, img);
            link.appendChild(img);
        });

        const originalSrc = photoHolders[1].src.replace(/lowres/g, 'highres').replace(/\.thumb/g, '').replace(/\/thumbs/g, '').replace(/1500(?!.*1500)/, '3000').replace(/1024(?!.*1024)/, '1500');
        const downloadUrl = originalSrc.replace(/\/highres/g, '').slice(0, -8) + ".zip";
        // Create a single download button
        if (downloadUrl) {
            const downloadButton = document.createElement('a');
            downloadButton.href = downloadUrl;
            downloadButton.textContent = 'Download ZIP';
            downloadButton.style.cssText = `
            display: block;
            margin-bottom: 10px;
            padding: 10px 10px;
            background: linear-gradient(90deg, #00d478, #297d58);
            color: #FFFFFF;
            text-decoration: none;
            border-radius: 5px;
            text-align: center;
            font-weight: bold;
            transition: background 0.5s linear;
            `;

            let insertDiv = document.querySelector('.content-information');
            if(insertDiv){
                document.querySelector('.button-holder').remove();
                insertDiv.appendChild(downloadButton);
            }
            else {
                insertDiv = document.querySelector('.gallery-thumbs');
                document.querySelector('.gallery-desc.cf').remove();
                insertDiv.insertBefore(downloadButton, insertDiv.firstChild);
            }

        }
    }
})();