NI Revert item status icons

xD

目前為 2023-03-08 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         NI Revert item status icons
// @version      1.0
// @description  xD
// @author       You
// @match        http*://*.margonem.pl/
// @match        http*://*.margonem.com/
// @exclude      http*://margonem.*/*
// @exclude      http*://www.margonem.*/*
// @exclude      http*://new.margonem.*/*
// @exclude      http*://forum.margonem.*/*
// @exclude      http*://commons.margonem.*/*
// @exclude      http*://dev-commons.margonem.*/*
// @run-at       document-body
// @grant        none
// @namespace https://tampermonkey.net/
// ==/UserScript==
(function() {
    const replaceFunction = () => {
        if (!window.MargoTipsParser) {
            return setTimeout(replaceFunction, 50);
        }

        const original = MargoTipsParser.getTip;
        MargoTipsParser.getTip = function(){
            const res = original.apply(this, arguments);

            const { cl, stat } = arguments[0];

            const oldIcons = [cl, "binds", "soulbound", "permbound", "artisan_worthless", "noauction", "nodepo", "nodepoclan"];
            const stats = stat.split(";");
            const arr = $(res).toArray().filter(el => !el.classList.contains("s-8"));
            const head = arr[0];
            const oldHeadIcons = oldIcons.map(status =>  !isNaN(status) || stats.includes(status) ? `<div class='cl-icon icon-${status}'></div>` : undefined);

            head.lastChild.innerHTML += oldHeadIcons.filter(v => v).join("");

            return arr.map(item => item.outerHTML).join("");
        }
    }

    replaceFunction();
})();