Etherscan - Absolute Times

Show absolute instead of relative times on Etherscan

  1. // ==UserScript==
  2. // @name Etherscan - Absolute Times
  3. // @description Show absolute instead of relative times on Etherscan
  4. // @author TheRealHawk
  5. // @license MIT
  6. // @namespace https://greasyfork.org/en/users/18936-therealhawk
  7. // @match https://etherscan.io/address*
  8. // @match https://etherscan.io/txs*
  9. // @match https://etherscan.io/token*
  10. // @version 1.8
  11. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
  12. // @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js
  13. // ==/UserScript==
  14.  
  15. // Workaround to get rid of "is not defined" warnings
  16. /* globals $, jQuery, moment */
  17.  
  18. $('.table th:contains("Age")').css("width","14%");
  19.  
  20. $('.table span:contains(" ago")').each(function() {
  21. var relTime = $(this).text();
  22. var absTime = $(this).attr('title');
  23. if (!absTime) absTime = $(this).attr('data-original-title');
  24. // absTime = moment(absTime, "MMM-DD-YYYY hh:mm:ss A", "en").add(1, 'h').format("YYYY-MM-DD HH:mm:ss");
  25. absTime = moment(absTime).add(1, 'h').format("YYYY-MM-DD HH:mm:ss");
  26. $(this).attr('title', relTime);
  27. $(this).attr('data-original-title', relTime);
  28. $(this).text(absTime);
  29. });