Created
February 25, 2016 21:27
-
-
Save rossng/78a69c5ef3c8d742079d to your computer and use it in GitHub Desktop.
ParasomNO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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