HotPot.ai ResultCount

Add Result Count how many iamges genereated.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name            HotPot.ai ResultCount
// @namespace       Wizzergod
// @version         1.0.5
// @description     Add Result Count how many iamges genereated.
// @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/logo-generator*
// @match           *://hotpot.ai/headshot/train*
// @match           *://hotpot.ai/colorize-picture*
// @match           *://hotpot.ai/restore-picture*
// @match           *://hotpot.ai/enhance-face*
// @match           *://hotpot.ai/drive*
// @match           *://hotpot.ai/s/*
// @match           *://hotpot.ai/upscale-photo*
// @match           *://hotpot.ai/sparkwriter*
// @match           *://hotpot.ai/background-generator*
// @match           *://hotpot.ai/lunar-new-year-headshot*
// @match           *://hotpot.ai/ai-avatar*
// @grant           none
// ==/UserScript==

(function() {
    'use strict';

    var lastCount = -1;

    function countAndDisplayResultBoxes() {
        var resultListBox = document.getElementById('resultListBox');
        if (resultListBox) {
            var resultBoxes = resultListBox.querySelectorAll('.resultBox');
            var count = resultBoxes.length;

            // Проверяем, изменилось ли количество
            if (count !== lastCount) {
                updateWindowTitle(count);
            }
        }
    }

    function updateWindowTitle(count) {
        var originalTitle = document.title;

        // Удаляем предыдущее GENERATED: и добавляем новое значение
        document.title = originalTitle.replace(/ ✨ GENERATED: \d+ ✨/, '') + ' ✨ GENERATED: ' + count + ' ✨';

        lastCount = count;
    }

    countAndDisplayResultBoxes();

    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            // Проверяем, произошли ли изменения внутри #resultListBox
            if (mutation.target.id === 'resultListBox' && mutation.addedNodes.length > 0) {
                countAndDisplayResultBoxes();
            }
        });
    });

    // Наблюдаем только за изменениями внутри #resultListBox
    var resultListBox = document.getElementById('resultListBox');
    if (resultListBox) {
        observer.observe(resultListBox, { childList: true });
    }
})();