AltSoft Links Generator

Генерирует ссылки для скачивания изображений с сайтов на движке КАИСА-Архив (Альт-Софт)

31.05.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         AltSoft Links Generator
// @namespace    nikku
// @license      MIT
// @version      0.3
// @description  Генерирует ссылки для скачивания изображений с сайтов на движке КАИСА-Архив (Альт-Софт)
// @author       nikku
// @match        https://archiveslo.ru/*/imageViewer/*
// @match        https://fgurgia.ru/imageViewer/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=archiveslo.ru
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/FileSaver.min.js
// @grant        unsafeWindow
// ==/UserScript==

/* global saveAs */

(function() {
    'use strict';

    var urls, pages, ids;
    var page = window.location.pathname;
    var path = unsafeWindow.hostPath;

    if (page.endsWith('/turn')) {
        urls = unsafeWindow.urls;
        pages = unsafeWindow.numberOfPages;
    } else {
        ids = document.querySelector('#btnLast').getAttribute('onclick').match(/\((.*)\./)[1];
        urls = unsafeWindow[ids];
        pages = unsafeWindow.pages.length;
    }

    var rand = crypto.randomUUID().substring(0, 8);
    var file = window.location.hostname + '_links-' + pages + '_' + rand + '.txt';
    var btnHtml = '<button type="button" title="Скачать список ссылок" class="button btnDownload" id="btn_links"></button>';
    var text = '';

    if (urls.length) {
        urls.forEach(function (id) {
           text += path + '/image?url=' + id + '\r\n';
        });
    }

    document.querySelector('.slide_buttons').insertAdjacentHTML('beforeend', btnHtml);
    document.querySelector('#btn_links').addEventListener('click', function() {
        saveAs(new Blob([text], {type: 'text/plain;charset=utf-8'}), file);
    });
})();