Greasy Fork

Greasy Fork is available in English.

Simple Amazon Shortcuts

Shortcuts to price trackers and review authenticity for amazon products

当前为 2021-06-03 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Simple Amazon Shortcuts
// @namespace   flightless22.SAS
// @description Shortcuts to price trackers and review authenticity for amazon products
// @version     2021.06.02
// @author      flightless22
// @license     MIT
// @homepageURL http://greasyfork.icu/en/scripts/427433
// @icon        none
// @include     https://*.amazon.*/*
// @match		    https://*.amazon.*/*
// @grant       GM_openInTab
// @grant       GM_registerMenuCommand
// ==/UserScript==
(function() {

    'use strict';

    // [1] TLD / [2] ASIN
    var a = /^https:\/\/[a-zA-Z]+\.amazon\.([.a-zA-Z]+).*\/([a-zA-Z0-9]{10})/.exec(location.href);
    var k_d, cx3_d, rm_d;

    function keepa() {
        var e = ((k_d !== undefined && k_d !== 1) ? k_d : 1);
        GM_openInTab("https://keepa.com/#!product/" + e + "-" + a[2]);
    }

    function keepa_d(t) {
        var r = { "com": 1, "co.uk": 2, "de": 3, "co.jp": 4, "ca": 5, "it": 7, "es": 8, "in": 9, "com.mx": 10 };
        return r[t];
    }

    function camelx3() {
        var e = ((cx3_d !== undefined && cx3_d !== "") ? cx3_d + "." : "");
        GM_openInTab("https://" + e + "camelcamelcamel.com/product/" + a[2]);
    }

    function camelx3_d(t) {
        var r = { "com": "", "au": "au", "ca": "ca", "fr": "fr", "de": "de", "es": "es", "co.uk": "uk" };
        return r[t];
    }

    function reviewmeta() {
        var e = ((rm_d !== undefined && rm_d !== "") ? "-" + rm_d : "");
        GM_openInTab("https://reviewmeta.com/amazon" + e + "/" + a[2]);
    }

    function reviewmeta_d(t) {
        var r = { "com": "", "co.uk": "uk", "co.jp": "jp", "au": "au", "ca": "ca", "de": "de", "es": "es", "fr": "fr", "it": "it", "in": "in", "com.mx": "mx" };
        return r[t];
    }

    function setup() {
        if (a !== null && a.length > 2) {

            k_d = keepa_d(a[1]);
            cx3_d = camelx3_d(a[1]);
            rm_d = reviewmeta_d(a[1]);

            GM_registerMenuCommand("Keepa.com : Price History" + (k_d == undefined ? " (" + a[1] + " is unsupported. Default to .com)" : ""), keepa, "k");
            GM_registerMenuCommand("Camel Camel Camel : Price History" + (cx3_d == undefined ? " (" + a[1] + " is unsupported. Default to .com)" : ""), camelx3, "c");
            GM_registerMenuCommand("Review Meta : Review Authenticity" + (rm_d == undefined ? " (" + a[1] + " is unsupported. Default to .com)" : ""), reviewmeta, "r");
        }
    }

    setup();

})();