Greasy Fork is available in English.

functional market for dh3

lol4

Pada tanggal 20 Juli 2020. Lihat %(latest_version_link).

// ==UserScript==
// @name         functional market for dh3
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  lol4
// @author       shtos
// @match        dh3.diamondhunt.co
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const oldPopulate = window.populateMarketTable
    localStorage.setItem('market-stored-item', '')
    window.populateMarketTable = function(){
        oldPopulate()
        let itemTest = localStorage.getItem('market-stored-item')
        if (itemTest !== ''){
            document.querySelectorAll('#market-table > tbody')[0].childNodes.forEach(e=>{
                e.style.display = ''})
            Array.from(document.querySelectorAll('#market-table > tbody')[0].childNodes).filter(f=>{
                return f.childNodes[0].textContent.toLowerCase() !== itemTest
            }).forEach(f=>{
                f.style.display = 'none'
            })
        }else{
            document.querySelectorAll('#market-table > tbody')[0].childNodes.forEach(e=>{
                e.style.display = ''})
        }
        if (!$('#market-buttons-wrapper').length){
            $('#market-buttons-section').after(`<div id="market-buttons-wrapper" style="display: flex; justify-content: center;"></div>`)
            $('#market-buttons-wrapper').append(`<div id="market-buttons-xd" style="width: 50vw; margin-top: 5px; display: flex; justify-center:center; flex-wrap: wrap"></div>`)
            let button = document.createElement('button')
            button.style.width = '54px'
            button.style.height = '38px'
            button.textContent = 'All'
            button.onclick = ()=> {
                localStorage.setItem('market-stored-item', '')
                document.querySelectorAll('#market-table > tbody')[0].childNodes.forEach(e=>{
                    e.style.display = ''})
            }
            $('#market-buttons-xd').append(button)
        }
        if (document.querySelectorAll('#market-buttons-xd > button').length < 2){
            addMarketButtons()
        }
    }
    function addMarketButtons(){
        if (window.global_TradablesData.length > 0){
            window.global_TradablesData.forEach(e=>{
                let button = document.createElement('button')
                button.onclick = ()=>{
                    let name
                    if (e.itemName === 'stardust1000'){
                        name = 'stardust x 1000'
                    }else{
                        name = e.itemName.replace(/([A-Z])/g, ' $1').trim().toLowerCase()
                    }
                    document.querySelectorAll('#market-table > tbody')[0].childNodes.forEach(e=>{
                        e.style.display = ''})
                    Array.from(document.querySelectorAll('#market-table > tbody')[0].childNodes).filter(f=>{
                        return f.childNodes[0].textContent.toLowerCase() !== name
                    }).forEach(f=>{
                        f.style.display = 'none'
                    })
                    localStorage.setItem('market-stored-item', name)
                }
                button.innerHTML = `<img src="images/${e.itemName}.png" style="height:32px;width:32px"/>`
                document.getElementById('market-buttons-xd').appendChild(button)
            })
        }else{
            setTimeout(addMarketButtons, 500)
        }
    }
})();