您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Showing MC of each krc20 token
// ==UserScript== // @name krc20 MC Calculator // @namespace http://tampermonkey.net/ // @version 2024-09-18 // @description Showing MC of each krc20 token // @author 0xJChen (Twitter@0xJChen) // @match https://kas.fyi/krc20-tokens // @icon https://www.google.com/s2/favicons?sz=64&domain=kas.fyi // @license MIT // ==/UserScript== (function() { 'use strict'; async function fetchKaspaPrice() { try { const response = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=kaspa&vs_currencies=usd'); const data = await response.json(); return data.kaspa.usd; } catch (error) { console.error('Error fetching Kaspa price:', error); return null; } } async function addTotalValueColumn() { const kaspaPriceInUSD = await fetchKaspaPrice(); if (!kaspaPriceInUSD) { console.error('Could not fetch Kaspa price. Aborting script.'); return; } const rows = document.querySelectorAll('.ant-table-tbody tr'); if (rows.length === 0) return; rows.forEach(row => { const totalSupplyElement = row.querySelector('td:nth-child(3) span'); const priceElement = row.querySelector('td:nth-child(6) span'); if (totalSupplyElement && priceElement) { const totalSupplyText = totalSupplyElement.textContent; const priceText = priceElement.textContent; const totalSupply = parseFloat(totalSupplyText.replace(/[^0-9.]/g, '')); const price = parseFloat(priceText.replace(/[^0-9.]/g, '')); const totalValueInKAS = totalSupply * price; const totalValueInUSD = totalValueInKAS * kaspaPriceInUSD; const newCell = document.createElement('td'); newCell.textContent = isNaN(totalValueInKAS) || isNaN(totalValueInUSD) ? '-' : `${totalValueInKAS.toLocaleString()} KAS ($${totalValueInUSD.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })})`; newCell.style.textAlign = 'center'; row.appendChild(newCell); } }); const headerRow = document.querySelector('.ant-table-thead tr'); if (headerRow) { const newHeader = document.createElement('th'); newHeader.textContent = 'Total Value (KAS/USD)'; newHeader.style.textAlign = 'center'; headerRow.appendChild(newHeader); } } const tableInterval = setInterval(() => { const rows = document.querySelectorAll('.ant-table-tbody tr'); if (rows.length > 0) { clearInterval(tableInterval); addTotalValueColumn(); } }, 500); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址