Last active
December 29, 2015 17:19
-
-
Save oemebamo/7703343 to your computer and use it in GitHub Desktop.
Run this script in your browser's Developer Console on the Juno.co.uk Order History page to dazzle when you see the total amount you've spent on your vinyl addiction.
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
// Run this script in your browser's Developer Console on the Juno.co.uk Order History page to dazzle when you see the total amount you've spent on your vinyl addiction. | |
// 1. Go to https://secure.juno.co.uk/account/order-history/ | |
// 2. Open developer console | |
// 3. Paste this script in the console and run it ... | |
// Support for orders in GBP, EUR | |
// Result in EUR | |
// Set var GBPToEURRate to current rate | |
var total = 0; | |
var GBPToEURRate = 1.2; | |
$($('.generic_table tr').get().reverse()).each(function(k, el) { | |
if (!$(el).find('td.number').length) { | |
return; | |
} | |
var text = $(el).find('td.number').text(); | |
var number = text; | |
if (number.indexOf('£') >= 0) { | |
number = parseFloat(number.replace('£', '')) * GBPToEURRate; | |
} | |
else if (number.indexOf('€') >= 0) { | |
number = parseFloat(number.replace('€', '')); | |
} | |
else { | |
console.log("Sorry, I don't know this currency: " + text); | |
} | |
total += number; | |
console.log($($(el).find('td')[3]).text() + ": " + text + " (subtotal: €" + Math.round(total) + ")"); | |
}); | |
console.log("Total: €" + Math.round(total)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
added an addtional check before
total += number
– there seem to be no pull requests for gists though, hehe