token copy

 avatar
unknown
javascript
2 years ago
1.4 kB
1
Indexable
// ==UserScript==
// @name         GS token copy
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Quick copy of tokens
// @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';

    document.addEventListener('keydown', function (a) {
        if(a.which === 67){
           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 = "COPY TOKEN";
            newButton.style = "position:absolute;z-index:999;background: #e2e2e2;border: 1px solid black;width: 100%;bottom: -10px;padding: 5px;";
            item.appendChild(newButton)

            newButton.addEventListener('click', function () {
                const token = item.querySelector('a').href.split('/').pop();
                var data = [new ClipboardItem({ "text/plain": new Blob([token], { type: "text/plain" }) })];
                navigator.clipboard.write(data)
                console.log(token);

            });

        };
    };
})();