您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
batch download etherscan verified contract
当前为
您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
- // ==UserScript==
- // @name Etherscan Contract Downloader
- // @namespace http://tampermonkey.net/
- // @version 0.1.7
- // @description batch download etherscan verified contract
- // @author jason@trillion.fi
- // @match https://*.etherscan.io/address/*
- // @match https://ftmscan.com/address/*
- // @match https://bscscan.com/address/*
- // @match https://snowtrace.io/address/*
- // @match https://polygonscan.com/address/*
- // @match https://hecoinfo.com/address/*
- // @match https://optimistic.etherscan.io/address/*
- // @match https://arbiscan.io/address/*
- // @match https://aurorascan.dev/address/*
- // @match https://cronoscan.com/address/*
- // @icon https://etherscan.io/images/brandassets/etherscan-logo-circle.png
- // @grant unsafeWindow
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- // Your code here...
- let editorIds = $("[id^=editor]")
- let spans = $("span[class=text-secondary]").toArray();
- spans.shift();
- console.log(`found ${editorIds.length-1} editors`);
- function getAddr() {
- const regex = /0x[0-9A-Fa-f]{40}/g;
- const found = window.location.href.match(regex);
- return found[0]
- }
- function getDethUrl() {
- let host = window.location.host;
- let newHost = host.split(".")[0] + ".deth.net"
- let url = window.location.href;
- return url.replace(host, newHost);
- }
- function downloadEditor(index) {
- let addr = getAddr()
- let editor = ace.edit(editorIds[index])
- let filename;
- try {
- filename = `${addr}-${spans[index].innerText.split(":")[1].trim()}`
- } catch {
- filename = `${addr}.sol`
- }
- console.log(filename)
- let HTMLhiddenElement = document.createElement("a");
- HTMLhiddenElement.href = 'data:attachment/text,' + encodeURIComponent(editor.getValue());
- HTMLhiddenElement.target = '_blank';
- HTMLhiddenElement.download = filename;
- HTMLhiddenElement.click();
- }
- function downloadAll() {
- if (editorIds.length == 1) {
- downloadEditor(0)
- return
- }
- for (let i = 0; i < editorIds.length - 1; i++) {
- downloadEditor(i)
- }
- }
- if (!unsafeWindow.downloadAll) {
- unsafeWindow.downloadAll = downloadAll;
- }
- $("#nav_subtabs").append('<li class="nav-item"><a class="nav-link show" href="#download" data-toggle="tab" onclick="javascript:downloadAll();"><span>Download</span></a></li>');
- $("#nav_subtabs").append(`<li class="nav-item"><a class="nav-link show" href="#vscode" onclick="window.open('${getDethUrl()}','_blank')" data-toggle="tab""><span>Edit on Deth.net</span></a></li>`);
- $('.table th:contains("Age")').css("width", "14%");
- $('.table span:contains(" ago")').each(function() {
- var relTime = $(this).text();
- var absTime = $(this).attr('title');
- if (!absTime) absTime = $(this).attr('data-original-title');
- // absTime = moment(absTime, "MMM-DD-YYYY hh:mm:ss A", "en").add(1, 'h').format("YYYY-MM-DD HH:mm:ss");
- absTime = moment(absTime).add(8, 'h').format("YYYY-MM-DD HH:mm:ss");
- $(this).attr('title', relTime);
- $(this).attr('data-original-title', relTime);
- $(this).text(absTime);
- });
- //
- })();