HotPot.ai ResultCount

Add Result Count how many iamges genereated.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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 });
    }
})();