Skip to content

Instantly share code, notes, and snippets.

@marufsiddiqui
Created January 7, 2017 21:36
Show Gist options
  • Save marufsiddiqui/f9f822e994074f95f2fd421c9863a415 to your computer and use it in GitHub Desktop.
Save marufsiddiqui/f9f822e994074f95f2fd421c9863a415 to your computer and use it in GitHub Desktop.
Amazon Offerlisting UserScript
// ==UserScript==
// @name Amazon Offerlisting
// @version 1.0.6
// @description Add CamelCamelCamel graph, link to Amazon product pages.
// @author Andrew Metzger
// @namespace http://static.nerdoncloud.com/userscripts/
// @include https://www.amazon.de/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// ==/UserScript==
function addButton(prodId) {
var url = 'https://www.amazon.de/gp/offer-listing/' + prodId;
var link = '<a href=' + url + '>All Offers</a>';
$('#titleSection').append(link);
}
$(document).ready(function () {
var url = document.location.href;
var regex = /([a-zA-Z0-9]{10})(?:[/?]|$)/;
var m = url.match(regex);
if (m) {
addButton(m[1]);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment