HotPot.ai show all styles

Add all styles

当前为 2024-03-03 提交的版本,查看 最新版本

// ==UserScript==
// @name            HotPot.ai show all styles
// @namespace       Wizzergod
// @version         1.0.6
// @description     Add all styles
// @description:ru  Добавляет всех стилей
// @icon            https://www.google.com/s2/favicons?sz=64&domain=hotpot.ai
// @license         MIT
// @author          Wizzergod
// @match           *://hotpot.ai/art-generator*
// @match           *://hotpot.ai/remove-background*
// @match           *://hotpot.ai/anime-generator*
// @match           *://hotpot.ai/headshot/train*
// @match           *://hotpot.ai/logo-generator*
// @match           *://hotpot.ai/background-generator*
// @match           *://hotpot.ai/lunar-new-year-headshot*
// @match           *://hotpot.ai/ai-avatar*
// @grant           GM_setValue
// @grant           GM_getValue
// @grant           GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Объединяем функции
    function updateData() {
        var iframe = document.getElementById('hotpotCatalogOverlay');

        if (!iframe) {
            console.error('iframe not found');
            return;
        }

        var iframeContent = iframe.contentDocument || iframe.contentWindow.document;
        var galleryItems = iframeContent.querySelectorAll('.itemBox');
        var galleryData = [];

        galleryItems.forEach(function(item) {
            var itemId = item.getAttribute('data-itemid');
            var imgElement = item.querySelector('.imageBox img');

            if (imgElement && imgElement.hasAttribute('src')) {
                var imgSrc = imgElement.src;
                var itemName = item.querySelector('.name').textContent;

                if (itemId !== null && itemId !== "null") {
                    galleryData.push({ itemId: itemId, imgSrc: imgSrc, itemName: itemName });
                }
            }
        });

        var key = "galleryData";
        localStorage.setItem(key, JSON.stringify(galleryData));
        console.log('Gallery data saved:', galleryData);

        // Обновляем historyBox
        updateHistoryBox();
    }

    function updateHistoryBox() {
        var galleryData = JSON.parse(localStorage.getItem('galleryData'));
        var historyBox = document.querySelector('.historyBox');
        historyBox.innerHTML = '';

        galleryData.forEach(function(data) {
            var thumbnailBox = document.createElement('div');
            thumbnailBox.className = 'thumbnailBox';
            thumbnailBox.setAttribute('styleid', data.itemId);
            thumbnailBox.setAttribute('stylelabel', data.itemName);

            var img = document.createElement('img');
            img.src = data.imgSrc;

            thumbnailBox.appendChild(img);
            historyBox.appendChild(thumbnailBox);
        });
    }

    // Вызываем функцию для создания кнопки после полной загрузки страницы
    window.addEventListener('load', function() {
        updateData();
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址