Add Keepa Links(JP)

Amazon商品ページにKeepaの価格履歴のリンクを追加

目前為 2022-02-18 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Add Keepa Links(JP)
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Amazon商品ページにKeepaの価格履歴のリンクを追加
// @author       himuro_majika
// @match        https://www.amazon.co.jp/*dp/*
// @icon         https://www.google.com/s2/favicons?domain=keepa.com
// @license MIT
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  init();
  function init() {
    insertButton();
  }
  function getUrl() {
    return location.href.match(/dp\/([^/]+)/)[1];
  }
  function getTargetElement() {
      return document.getElementById("buybox");
  }
  function createKeepaLinkButton() {
    const button = document.createElement("div");
    const a = document.createElement("a");
    const keepaUrl = "https://keepa.com/#!search/5-";
    a.setAttribute("target", "_blank");
    a.innerText = "Keepaで価格を確認する.";
    a.addEventListener("click", (e) => {
      e.target.setAttribute("href", keepaUrl + getUrl());
    })
    button.appendChild(a);
    return button;
  }
  function insertButton() {
    const tEle = getTargetElement();
    tEle.appendChild(createKeepaLinkButton());
  }
})();

QingJ © 2025

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