[Brick-Kill] Clothing Bumper

Updates clothing to bump to the top of the shop.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// discord.gg/JjszyaD63A

// ==UserScript==
// @name         [Brick-Kill] Clothing Bumper
// @version      3003
// @author       Spacekiller
// @description  Updates clothing to bump to the top of the shop.
// @match        https://www.brick-hill.com/*
// @run-at       document-body
// @grant        none
// @icon         https://www.brick-hill.com/favicon.ico
// @license      MIT
// @namespace    bhclothingbumper
// ==/UserScript==

(function () {
    'use strict';

    /*-    SETTINGS    -*/
    const Update_link = 'https://www.brick-hill.com/shop/#'
    // The clothing you want to bump, like this: https://www.brick-hill.com/shop/#

    const Seconds_between_updates = 30
    // Amount of seconds to wait between each update.


    function runScript() {

        localStorage.setItem('updateItem', Update_link);
        const url = window.location.href;

        const tasks = [{
            condition: url.includes("brick-hill.com/shop/") && url.includes("/edit"),
            action: () => {
                localStorage.setItem('loopModify', true)
                modifyTextAreaContent();
            }
        },
                       {
                           condition: url.includes(Update_link),
                           action: () => {
                               setTimeout(() => {
                                   localStorage.setItem('loopModify', true);
                                   window.location.href = Update_link + '/edit';
                               }, Seconds_between_updates * 1000);
                           }
                       }
                      ];

        tasks.forEach(task => {
            if (task.condition) {
                task.action();
            }
        });
    }

    window.addEventListener('load', runScript);

    function modifyTextAreaContent() {
        if (localStorage.getItem('loopModify') === "true") {
            const textarea = document.querySelector('textarea[type="text"]');
            if (textarea) {
                localStorage.setItem('loopModify', false);
                const originalText = textarea.value;
                localStorage.setItem('originalTextareaContent', originalText);
                textarea.value = "Not a permanent description replacement.";
                const saveButton = document.querySelector('button.blue');
                if (saveButton) {
                    saveButton.click();
                }
            }
        }
    }
})();