Tronscan Transfers Summary

Summarizes total outgoing and incoming transfers on Tronscan's transfers page with a button trigger

  1. // ==UserScript==
  2. // @name Tronscan Transfers Summary
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Summarizes total outgoing and incoming transfers on Tronscan's transfers page with a button trigger
  6. // @author DevZam
  7. // @match https://tronscan.org/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Step 1: Check if the current page is the transfers tab
  16. if (!window.location.href.includes('/transfers')) {
  17. return; // Silently exit if not on transfers page
  18. }
  19.  
  20. // Create a button to trigger the summary
  21. const triggerButton = document.createElement('button');
  22. triggerButton.textContent = 'Calculate Transfers Summary';
  23. triggerButton.style.position = 'fixed';
  24. triggerButton.style.top = '10px';
  25. triggerButton.style.right = '10px';
  26. triggerButton.style.padding = '10px';
  27. triggerButton.style.backgroundColor = '#4CAF50';
  28. triggerButton.style.color = '#fff';
  29. triggerButton.style.border = 'none';
  30. triggerButton.style.borderRadius = '5px';
  31. triggerButton.style.cursor = 'pointer';
  32. triggerButton.style.zIndex = '1000';
  33.  
  34. // Create a div to display the results
  35. const resultDiv = document.createElement('div');
  36. resultDiv.style.position = 'fixed';
  37. resultDiv.style.top = '50px';
  38. resultDiv.style.right = '10px';
  39. resultDiv.style.backgroundColor = '#fff';
  40. resultDiv.style.padding = '10px';
  41. resultDiv.style.border = '1px solid #000';
  42. resultDiv.style.zIndex = '1000';
  43. resultDiv.style.maxWidth = '300px';
  44. resultDiv.style.display = 'none'; // Hidden until calculation
  45.  
  46. // Append button and result div to the page
  47. document.body.appendChild(triggerButton);
  48. document.body.appendChild(resultDiv);
  49.  
  50. // Button click event to calculate and display summary
  51. triggerButton.addEventListener('click', () => {
  52. // Step 2: Get all token-amount elements and extract amounts with signs
  53. const amountDomList = document.querySelectorAll('.token-amount .text-truncate');
  54. let incomingSum = 0;
  55. let outgoingSum = 0;
  56.  
  57. amountDomList.forEach((element) => {
  58. // Get the text content (e.g., "+10" or "-10")
  59. const text = element.textContent.trim();
  60. // Extract the sign and amount
  61. const sign = text.startsWith('+') ? '+' : '-';
  62. const amount = parseFloat(text.replace(/[^0-9.]/g, '')) || 0; // Remove non-numeric chars except decimal
  63.  
  64. // Step 3: Add to incoming or outgoing sum based on sign
  65. if (sign === '+') {
  66. incomingSum += amount;
  67. } else {
  68. outgoingSum += amount;
  69. }
  70. });
  71.  
  72. // Display the results
  73. resultDiv.innerHTML = `
  74. <strong>Transfers Summary (Current Page):</strong><br>
  75. Total ↓: ${incomingSum.toFixed(3)}<br>
  76. Total ↑: ${outgoingSum.toFixed(3)}
  77. `;
  78. resultDiv.style.display = 'block'; // Show the result div
  79. });
  80. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址