lister v2

mail@pastecode.io avatar
unknown
javascript
2 years ago
2.4 kB
5
Indexable
Never
// ==UserScript==
// @name         GS lister
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Quick Lister for GameStop NFTs
// @author       Lvl5Mage
// @match        https://nft.gamestop.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gamestop.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const listPrice = 0.013;  // EDIT THIS VALUE. This is the list price in ETH.

    document.addEventListener('keydown', function (a) {
        if(a.which === 82){
           getShortcut();
        }
    }, false);

    const getShortcut = () => {
        var nfts = document.getElementsByClassName('ckgRiB');
        for(let i=0;i<nfts.length;i++){
            const newButton = document.createElement("button");
            const item = nfts[i];
            newButton.innerText = "LIST ME";
            newButton.style = "position:absolute;z-index:999;background: #68d6c4;border: 1px solid black;width: 100%;bottom: -10px;padding: 5px;";
            item.appendChild(newButton)

            newButton.addEventListener('click', function () {
                item.querySelector('button[aria-label="Open Menu"]').click();//menu
                item.querySelector('button[aria-label="Manage NFT"]').click();//manage btn

                setTimeout(function(){
                    const sidebar = document.getElementsByClassName('ManageSidebar-sc-e23qc5-4')[0];
                    sidebar.querySelector('button[aria-label="Open Menu"]').click();//manage dropdown
                    document.querySelector('[aria-label="List for sale"]').click();//list4sale

                    setTimeout(function(){
                        const priceInput = document.getElementById('Set Price');
                        let input = priceInput;
                        let lastValue = input.value;
                        input.value = listPrice;
                        let event = new Event('input', { bubbles: true });
                        event.simulated = true;
                        let tracker = input._valueTracker;
                        if (tracker) {
                            tracker.setValue(lastValue);
                        }
                        input.dispatchEvent(event);
                    },200)

                },200);

            });

        };
    };
})();