market_selection_filter

Функционал на скринах. Добавляет фильтр при выборе артефакта на рынке. Пример: юзер пишет "лук" в специальное поле, в списке артефактов для выбора будут все доступные луки. Работает при выставлении нового лота и поиске артефакта

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         market_selection_filter
// @namespace    http://tampermonkey.net/
// @version      0.6.6
// @description  Функционал на скринах. Добавляет фильтр при выборе артефакта на рынке. Пример: юзер пишет "лук" в специальное поле, в списке артефактов для выбора будут все доступные луки. Работает при выставлении нового лота и поиске артефакта
// @author       You
// @license      none
// @match        https://www.heroeswm.ru/auction*
// @match        https://my.lordswm.com/auction*
// @match        https://www.lordswm.com/auction*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

function add_text_area(select, extra_function = () =>{return false}) {
    const options = select.options;
    let filteredOptions = [...options];

    const textArea = document.createElement("textarea");
    textArea.style.maxWidth = "90%";
    textArea.placeholder = "Ввести лот для поиска:";
    textArea.addEventListener("input", () => {
        [...options].forEach(option => option.style.display = "block");
        const filterValue = textArea.value.trim().toLowerCase();
        filteredOptions = [...options].filter(option => option.textContent.toLowerCase().includes(filterValue));
        [...options].forEach(option => {
            if (!filteredOptions.includes(option)) option.style.display = "none";
            option.onclick = () => {
            select.dispatchEvent(new Event("change"));
                select.size = 1
            }
        });
        if (filteredOptions.length > 0) {
            filteredOptions[0].selected = true;
            if (filteredOptions.length == 1){
                extra_function() || setTimeout(()=>{let count_el_input = document.getElementById("anl_count");
                count_el_input.value = ""; count_el_input.focus()
                }, 500)
            }
        }
        filteredOptions.forEach(option => select.add(option));
        let max_length = Math.min(filteredOptions.length, 20)
        select.size = textArea.value.length === 0 ? 1 :max_length;

    });

    select.parentNode.insertBefore(textArea, select);
}
if (window.location.href.includes("auction_new_lot")){
    add_text_area(document.getElementById("sel"))
}
else{
    let el = document.querySelector('select[name="ss2"]')
    add_text_area(el, window.findsel)
}