Patreon Pledge Totals

To anyone who is familiar with LoadingReadyRun, we have announced a project recently that ties into our upcoming office move. Since the ability (and necessity) to move to a new, larger and better equipped office is in large part due to the amazing generosity of our Patreon supporters, we wanted to say thank you by recognizing them on what we are calling the “Load-bearing Gratitude Wall”. We decided that anyone who, by February 2015, has supported us for a total of $150 during the Patreon will be included on the wall. I like the idea of looking at the total Patreon contribution because it rewards people who have been consistently supporting us instead of asking for a one-time “buy a brick”-style donation.

The small problem that we have run into  is that it turns out that Patreon doesn’t have an easy way for people to see how much they have already contributed. You have to actually go to your contribution history page and just manually add up all the amounts.  Whenever there is something repetitive to do online (particularly involving math), I immediately think about how to automate it. To that end, I have written a little javascript bookmarklet that you can activate to automatically give you the total you have pledged to each Patreon campaign.

To use the bookmarklet, just drag this link:

Patreon Pledge Totals

to your bookmark bar.

Or if you are on an iOS device, make a new bookmark and then edit it and replace the url with the bookmarklet code below

javascript:(function(){var page = $('body').html(), re = /You pledged \$([0-9.]+)\s+to (.+) for/g,totals = {},out = ''; while ((myArray = re.exec(page)) !== null) { if(typeof totals[myArray[2]] == 'undefined'){ totals[myArray[2]] = Number(myArray[1]); } else { totals[myArray[2]] += Number(myArray[1]); } } for (user in totals){ out += user+': $'+totals[user]+'<br/>'; } $('<div />').attr('style','width:200px;position:fixed;top:50px;left:50px;background-color:white;border:black 1px solid').html(out).appendTo('body')})();

Then go to your Completed Pledges Page and click the bookmarklet. You should see a box appear int he top left corner of the window with all the campaigns you have contributed to and how much to have pledged to date.

Note: Obviously you have to login to your Patreon account to get to the Completed Pledges page. This bookmarklet does not access your personal information in any way. It just adds up all the numbers that are already on the page.

If you are interested to see a more readable version of the code, check it out after the jump:

var page = $('body').html();
var re = /You pledged \$([0-9.]+)\s+to (.+) for/g;
var totals = {};
var out = '';

while ((myArray = re.exec(page)) !== null) {
	if(typeof totals[myArray[2]] == 'undefined'){
		totals[myArray[2]] = Number(myArray[1]);
	}
	else {
		totals[myArray[2]] += Number(myArray[1]);
	}
}
for (user in totals){
	out += user+': $'+totals[user]+'<br/>';
}
$('<div />').attr('style','width:200px;position:fixed;top:50px;left:50px;background-color:white;border:black 1px solid').html(out).appendTo('body');

Comments (15)