// ==UserScript==
// @name Amazon ASIN Links (Preisüberwachung)
// @name:en Amazon ASIN Links (price watching)
// @namespace http://cbaoth.yav.in
// @version 0.2
// @description Fügt auf allen Amazon Produktseiten links zu den folgenden Preisüberwachungsseiten ein: mein-wunschpreis.com, snip-it.de, amapsys.de sowie ein direkter Amazon Produktlink (ohne unnütze URL Parameter, zum Teilen des Links).
// @description:en Adds links to the following price watching pages on all amazon product pages: mein-wunschpreis.com, snip-it.de, amapsys.de sowie ein direkter Amazon Produktlink (ohne unnütze URL Parameter, zum Teilen des Links).
// @include *//*amazon.*/*
// @run-at document-end
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js
// @downloadURL https://update.greasyfork.icu/scripts/7524/Amazon%20ASIN%20Links%20%28Preis%C3%BCberwachung%29.user.js
// @updateURL https://update.greasyfork.icu/scripts/7524/Amazon%20ASIN%20Links%20%28Preis%C3%BCberwachung%29.meta.js
// ==/UserScript==
/**
* This script adds a few links to each amazon product page:
* 1. A direct (clean) link to the product page which can be used e.g. to share (copy & paste)
* a product page without session information etc.:
* http://amazon.[TLD]/dp/[ASIN]
* 2. A link to the current product on "Mein-Wunschpreis":
* http://www.mein-wunschpreis.com/artikel.php?ASIN=[ASIN]
* 3. A link to the current product on "Snip-It"
* http://www.snip-me.de/preisentwicklung/[ASIN].aspx
* 4. A link to the current product on "Amapsys"
* http://www.amapsys.de/zeige-produkt-[ASIN].htm
**/
(function () {
// config
var SHOW_LINK_ICON = 1; // toggle link fav icons
var LINK_STYLE = "font-weight: bold; font-style: italic;";
// not all pages have fav icons so the following currently makes no sense
var SHOW_LINK_TEXT = 1; // toggle link text
if (! $('input#ASIN:first').length) {
return; // this doesn't seem to be a product page
}
// get the ASIN (product id)
var asin = $('input#ASIN:first').val();
// get top level domain (the simple way)
var tld = document.domain.split('.').pop();
if ([ 'au', 'br', 'mx' ].indexOf(tld) > -1) { // add .com to some domaains
tld = 'com.'+tld;
} else if ([ 'uk', 'jp' ].indexOf(tld) > -1) { // add .co to others
tld = 'co.'+tld;
}
// create all new links
// direct link
var link1url = '';
var link1 = '';
if (tld != undefined) { // add only if TLD was identified
var tooltip = (tld == 'de' ? 'Direkter und sauberer Produktlink.' : 'Direct and clean product link.');
link1url = 'http://amazon.' + tld + '/dp/' + asin;
link1 = (SHOW_LINK_ICON ? ' ' : '')
+ ''
+ (SHOW_LINK_TEXT ? (tld == 'de' ? 'Direkter Link' : 'Direct link') : '')
+ ' / ';
}
// mein-wunschpreis.com
var link2url = 'http://www.mein-wunschpreis.com/artikel.php?ASIN=' + asin;
//var link2 = (SHOW_LINK_ICON ? '
' : '')
var link2 = ''
+ (SHOW_LINK_TEXT ? 'Mein-Wunschpreis' : '') + ' / ';
// snip-me.de
var link3url = 'http://www.snip-me.de/preisentwicklung/' + asin + '.aspx';
//var link3 = (SHOW_LINK_ICON ? '
' : '')
var link3 = ''
+ (SHOW_LINK_TEXT ? 'Snip-Me' : '') + ' / ';
// amapsys.de
var link4url = 'http://www.amapsys.de/zeige-produkt-'+ asin +'.htm';
var link4 = (SHOW_LINK_ICON ? '
' : '')
+ ''
+ (SHOW_LINK_TEXT ? 'Amapsys' : '') + '';
// add the links as new table row below the price information
$('table.product > tbody:last > tr:last, table.a-lineitem > tbody:last > tr:last').after('