Created
April 2, 2015 02:27
-
-
Save halkeye/5c1d8664905cccf33345 to your computer and use it in GitHub Desktop.
This file contains hidden or 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() { | |
if (document.getElementsByClassName('show_more_backings')[0].offsetParent !== null) { | |
alert("You must click 'Show More Pledges' and load all your pledges before running this bookmarklet"); | |
return false; | |
}; | |
var collectData = function collectData() { | |
var nodes = $$('#collected .money'); | |
var ksData = [["Project", "Amount", "Currency", "Got It!"]]; | |
for (var i = 0; i < nodes.length; i++) { | |
var ksRow = []; | |
var cells = nodes[i].parentNode.parentNode.getElementsByTagName('td'); | |
ksRow[0] = '"' + cells[0].getElementsByTagName('strong')[0].textContent.replace(/"/g, '""') + '"'; // projectName | |
var money = cells[1].getElementsByClassName('money')[0]; | |
ksRow[1] = money.textContent.substr(1); // Money | |
if (money.classList.contains('usd')) { ksRow[2] = "USD"; } | |
if (money.classList.contains('cad')) { ksRow[2] = "CAD"; } | |
if (money.textContent.substr(0,1) === "£") { ksRow[2] = "GBP"; } | |
ksRow[3] = cells[3].getElementsByClassName('.completed').length === 0 ? "YES" : "NO"; | |
ksData.push(ksRow.join(",")); | |
} | |
var blob = new Blob([ksData.join("\n")], {type: "text/csv;charset=" + document.characterSet}); | |
saveAs(blob, "kickstarter_spending.csv"); | |
}; | |
if (!window.saveAs) { | |
var script = document.createElement('script'); | |
script.src = 'https://cdn.rawgit.com/eligrey/FileSaver.js/239f3c427f68809e17a9c747e4cb31376782efca/FileSaver.js'; | |
script.onload = collectData; | |
script.onreadystatechange = function () { if (script.readyState == 'loaded') { collectData(); } }; | |
document.head.appendChild(script); | |
} else { collectData(); } | |
})(); |
Otherwise bookmarklet version (Make new bookmark, copy following code into it)
javascript:(function() { var script = document.createElement('script'); script.src='https://cdn.rawgit.com/halkeye/5c1d8664905cccf33345/raw/374f1b6e623989424a4f3dd463ba05f453a71dec/kickstarter-spending.js'; document.head.appendChild(script); })();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lazy way of running it:
Goto https://www.kickstarter.com/profile/backings?ref=nav
Open your developer tools and goto console (Chrome, ctrl+shift+j)
Paste script