Skip to content

Instantly share code, notes, and snippets.

@rossng
Created February 25, 2016 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rossng/78a69c5ef3c8d742079d to your computer and use it in GitHub Desktop.
Save rossng/78a69c5ef3c8d742079d to your computer and use it in GitHub Desktop.
ParasomNO
// ==UserScript==
// @name ParasomNO
// @namespace parasomno
// @include https://www.amazon.co.uk/gp/buy/spc/handlers/display.html*
// @version 1
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
// ==/UserScript==
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
$(".place-order-button-link").hide();
var first = getRandomInt(0, 50);
var second = getRandomInt(0, 50);
$('<p>' + first + ' plus ' + second + '</p>').insertBefore(".place-order-button-link");
$('<input type="text" id="parasomno-answer" />').insertBefore(".place-order-button-link");
$('<a href="#" id="parasomno-submit">Submit</a>').insertBefore(".place-order-button-link");
$('#parasomno-submit').click(function(event) {
if (first+second == $('#parasomno-answer').val()) {
$(".place-order-button-link").show();
}
even.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment