Greasy Fork

Greasy Fork is available in English.

Amazon.co.jpの商品ページに各種リンク追加

Amazon.co.jpの商品ページに固定URL、サクラチェッカー、keepaなどのリンクを追加します

当前为 2022-03-05 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Amazon.co.jpの商品ページに各種リンク追加
// @namespace    https://www.amazon.co.jp/dp/
// @version      1.0
// @description  Amazon.co.jpの商品ページに固定URL、サクラチェッカー、keepaなどのリンクを追加します
// @include      https://www.amazon.co.jp/dp/*
// @include      https://www.amazon.co.jp/*/dp/*
// @license      MIT
// @author       nanashi <[email protected]>
// ==/UserScript==

(() => {
    "use strict";

    const element_asin = document.getElementById("ASIN");
    const element_tell_a_friend = document.getElementById("tell-a-friend");
    if(!element_asin || !element_tell_a_friend){
        return;
    }

    let t = String(element_asin.getAttribute("value")).match(/[0-9A-Za-z]{10}/);
    if(!t) return;
    const asin = t[0];

    const div_outer = document.createElement("div");

    const div_fix = document.createElement("div");
    const a_fix = document.createElement("a");
    a_fix.setAttribute("href", "https://www.amazon.co.jp/dp/" + asin + "/");
    a_fix.textContent = "固定URL";
    div_fix.appendChild(a_fix);
    div_outer.appendChild(div_fix);

    const div_sakura = document.createElement("div");
    const a_sakura = document.createElement("a");
    a_sakura.setAttribute("href", "https://sakura-checker.jp/search/" + asin + "/");
    a_sakura.setAttribute("target", "_blank");
    a_sakura.textContent = "サクラチェッカーで検索";
    div_sakura.appendChild(a_sakura);
    div_outer.appendChild(div_sakura);

    const div_keepa = document.createElement("div");
    const a_keepa = document.createElement("a");
    a_keepa.setAttribute("href", "https://keepa.com/#!product/5-" + asin);
    a_keepa.setAttribute("target", "_blank");
    a_keepa.textContent = "keepaで検索";
    div_keepa.appendChild(a_keepa);
    div_outer.appendChild(div_keepa);

    element_tell_a_friend.parentNode.insertBefore(div_outer, element_tell_a_friend.nextElementSibling);
})();