WavesExplorerLite icon indicating copy to clipboard operation
WavesExplorerLite copied to clipboard

NFT Tags

Open affiliatepayday opened this issue 4 years ago • 0 comments

Not sure if there was a better way to do this, or if this will help anyone else... but I have added some code to add tags NFT on NFT assets and on NFT issue asset pages of the explorer.

This was added to src/js/components/Dictionary/Dictionary.view.js directly before the render().

    componentDidMount(){
        var qtf = document.querySelector(".dictionary .dictionary-pair:nth-child(8) .dictionary-pair-value") !== null;
        var dtf = document.querySelector(".dictionary .dictionary-pair:nth-child(9) .dictionary-pair-value") !== null;
        var rtf = document.querySelector(".dictionary .dictionary-pair:nth-child(11) .dictionary-pair-value") !== null;
        if (qtf && dtf && rtf) {
            var quan = document.querySelector(".dictionary .dictionary-pair:nth-child(8) .dictionary-pair-value").innerHTML
            var quant = quan.charAt(0);
            var quanti = quan.charAt(1)
            var dec = document.querySelector(".dictionary .dictionary-pair:nth-child(9) .dictionary-pair-value").innerHTML;
            var reiss = document.querySelector(".dictionary .dictionary-pair:nth-child(11) .dictionary-pair-value").innerHTML;
            if (quant == 1 && quanti == ' ' && dec == 0 && reiss == 'false') {
                var typ = document.querySelector(".dictionary .dictionary-pair .dictionary-pair-value");
                typ.insertAdjacentHTML('beforeend', '<span class="badge" style="background-color: #ff5e00;margin-left: 5px;">Non-Fungible</span>');
            }
        }
        var dtfa = document.querySelector(".dictionary .dictionary-pair:nth-child(7) .dictionary-pair-value") !== null;
        var rtfa = document.querySelector(".dictionary .dictionary-pair:nth-child(8) .dictionary-pair-value") !== null;
        var qtfa = document.querySelector(".dictionary .dictionary-pair:nth-child(9) .dictionary-pair-value") !== null;
        if (qtfa && dtfa && rtfa) {
            var quana = document.querySelector(".dictionary .dictionary-pair:nth-child(9) .dictionary-pair-value").innerHTML
            var quanta = quana.charAt(0);
            var quantaa = quana.charAt(1);
            var deca = document.querySelector(".dictionary .dictionary-pair:nth-child(7) .dictionary-pair-value").innerHTML;
            var reissa = document.querySelector(".dictionary .dictionary-pair:nth-child(8) .dictionary-pair-value").innerHTML;
            if (quanta == 1 && quantaa == ' ' && deca == 0 && reissa == 'false') {
                var typa = document.querySelector(".headline");
                typa.insertAdjacentHTML('beforeend', '<span class="badge" style="background-color: #ff5e00;margin-left: 5px;width: 100px;height: 28px;text-align: center;padding-top: 6px;">Non-Fungible</span>');
            }
        }
    }

The results: image image

affiliatepayday avatar Oct 10 '21 19:10 affiliatepayday