Skip to content

Instantly share code, notes, and snippets.

@stevewilhelm
Created November 2, 2012 20:31
Show Gist options
  • Save stevewilhelm/4004142 to your computer and use it in GitHub Desktop.
Save stevewilhelm/4004142 to your computer and use it in GitHub Desktop.
Romney's "Expand the Map" flipcounter hard codes amountRaised
/*
Code fragment from: view-source:https://www.mittromney.com/donate/seven-in-seven
*/
<script type="text/javascript">
$(document).ready(function(){
if(!$('body').hasClass('mobile')){
MR.getScript('/sites/all/modules/custom/romney_js/flipcounter/js/flipcounter.min.js', function(){
/*
NOTES:
amountRaised is the number of dollars raised at a certain time
amountRaisedTime is the time when we hit that many dollars raised (MUST be in the past)
perSecond is the number of dollars we're raising per second
updatesPerSecond is the speed to refresh the amount shown and has no impact on the amount raised
WARNING: Make sure the perSecond amount is evenly divisible by the updatesPerSecond value!
*/
// START CONFIG: Modify these values as necessary -- IMPORTANT: Read notes above first:
var amountRaised = 7437800;
var amountRaisedTime = new Date('11/02/2012 11:35 AM EDT');
var perSecond = 15;
var updatesPerSecond = 5;
// END CONFIG
var startValue = amountRaised + (parseInt((new Date() - amountRaisedTime) / 1000) * perSecond);
var myCounter = new flipCounter("donationcounter", {auto:true, value: startValue, inc: (perSecond/updatesPerSecond), pace: (1000/updatesPerSecond)});
$('#donationcounter').prepend('<ul class="cd"><li class="d" style="background-position: 0 -1030px; width: 53px; height: 80px;"></li></ul>');
});
}
});
@raullenchai
Copy link

Blame his sidekicks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment