Nintendo Amiibo Hero Image Downloader

Download Nintendo amiibo hero's image with one click

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Nintendo Amiibo Hero Image Downloader
// @version      0.2
// @description  Download Nintendo amiibo hero's image with one click
// @icon         https://www.nintendo.com/images/mobile-icon/appicon_152.png
// @license      GPL version 3
// @encoding     utf-8
// @date         01/27/2018
// @modified     01/27/2018
// @author       Franklin Chen
// @supportURL   http://franklin614.com
// @include      https://www.nintendo.com/amiibo/detail/*
// @grant        GM_setClipboard
// @copyright	 2018, Franklin Chen
// @namespace https://gf.qytechs.cn/users/4544
// ==/UserScript==


(function() {
    'use strict';

    function getheroImgUrl() {
        var heroDiv = document.getElementById('detail-hero');
        if(heroDiv){
            var heroImg = heroDiv.getElementsByClassName('panel-img')[0];
            return heroImg.style.backgroundImage.slice(4, -1).replace(/"/g, "");
        }
    }

    function getFileName() {
        return window.location.href.replace("https://www.nintendo.com/amiibo/detail/", "");
    }

    function addDownloadButton() {
        var nav = document.getElementsByClassName('secondary-nav')[0];
        if(nav){
            var ullist = nav.getElementsByTagName('ul')[0];
            var firstChild = ullist.getElementsByTagName('li')[0];
            var newli = document.createElement('li');
            newli.className = "games";
            newli.innerHTML = '<a id="heroImageLink" href="' + getheroImgUrl() + '" tabindex="0" download="' + getFileName() + '">Download hero image</a>';
            ullist.insertBefore(newli, firstChild);

            var link = document.getElementById("heroImageLink");
            link.addEventListener("click", copyToClipboard);
        }
    }

    function addFileNameInput() {
        var breadcrumb = document.getElementsByClassName('breadcrumbs')[0];
        var newSpan = document.createElement('span');
        newSpan.innerHTML = '<input type="text" value="' + getFileName() + '" id="fileNameInput">';
        breadcrumb.append(newSpan);
    }

    function copyToClipboard() {
        try {
            var fileName = getFileName();
            GM_setClipboard (fileName);
            alert("Copied the file name: " + fileName);
        } catch (err) {
            alert('Cannot copy text');
        }
    }

    addDownloadButton();
})();

QingJ © 2025

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