HWM Hunting top

Кнопка для просмотра своих охот и фильтр по названию существ

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         HWM Hunting top
// @namespace    http://tampermonkey.net/
// @version      2023-12-19
// @description  Кнопка для просмотра своих охот и фильтр по названию существ
// @author       Tags
// @match https://www.heroeswm.ru/pl_hunter_stat.php?id=*
// @match        https://www.heroeswm.ru/pl_info.php?id=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=heroeswm.ru
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    if(location.href.includes(`pl_info.php`)){
        const row = document.querySelectorAll(".wb[valign=middle]")[0].querySelectorAll("td[align=right]")[0];
        const loopa = row.querySelector("td");
        const img = document.createElement("td");
        const insertedElement = loopa.parentNode.insertBefore(img, loopa);
        let params = new URLSearchParams(location.search);
        let uid = params.get('id') // 'chrome-instant'
        insertedElement.innerHTML = `<a href="pl_hunter_stat.php?id=${uid}"><img class="show_hint" width="24" height="24" border="0" src="https://dcdn.heroeswm.ru/i/mobile_view/icons_add/lapa.png" hint="Достижения в охоте" align="right" hwm_hint_added="1"></a>`;
    }


    if(location.href.includes(`pl_hunter_stat.php`)){
        
        function filter(table){
            let input, filter, tr, td, i, txtValue;
            input = document.getElementById("creatureFilterInput");
            filter = input.value.toUpperCase();
            tr = table.getElementsByTagName("tr");

            for (i = 0; i < tr.length; i++) {
                td = tr[i].getElementsByTagName("td")[0];
                if (td) {
                    txtValue = td.textContent || td.innerText;
                    if (txtValue.toUpperCase().indexOf(filter) > -1) {
                        tr[i].style.display = "";
                    } else {
                        tr[i].style.display = "none";
                    }
                }
            }
        }
        const table = document.querySelector(`table`);

        const search = Object.assign(document.createElement("input"), {
            type: `text`,
            id:`creatureFilterInput`,
            placeholder:`Поиск по названию существа`,
            onchange:function(e){filter(table)},
            onkeyup:function(e){filter(table)}

        });
        
        table.parentNode.insertBefore(search, table);


    }
})();