Simple Amazon Shortcuts

Shortcuts for Price Trackers and Review mtea

As of 03. 06. 2021. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Simple Amazon Shortcuts
// @namespace   userscript.SAS
// @description Shortcuts for Price Trackers and Review mtea
// @version     2021.04.06
// @author      flightless22
// @homepage    none
// @icon        none
// @include     https://*.amazon.*/*
// @match		    https://*.amazon.*/*
// @grant       GM_openInTab
// @grant       GM_registerMenuCommand
// @connect-src *
// ==/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); 

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

    //console.log("Simple Amazon Shortcuts", a);
    
    var k_d = keepa_d(a[1]);
    var cx3_d = camelx3_d(a[1]);
    var rm_d = reviewmeta_d(a[1]);
    
    function keepa() { 
      var e = ((k_d !== undefined && rm_d !== "") ? k_d : 1) ;  //default to .com
      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 && rm_d !== "") ? cx3_d + "." : "") ;  //default to .com
      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 : "") ;  //default to .com
       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];
    }
    
    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"); 
  }

})();