Last active
December 5, 2016 17:07
-
-
Save AyozeVera/8ca19ba95843affc884dc04b7a3ec9ca to your computer and use it in GitHub Desktop.
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
(function(document) { | |
var json = document.getElementsByTagName('pre')[0].innerText | |
var obj = JSON.parse(json) | |
var cards = obj.cards | |
var output = 0 | |
cards.map(function(card, index) { | |
var pre = card.name.indexOf('[') + 1 | |
var post = card.name.indexOf(']') | |
var value = card.name.substring(pre, post) | |
if (value && !isNaN(value)) { | |
output += parseFloat(value) | |
} | |
}) | |
console.log(output) | |
})(document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice