• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Javascript Counter - Apple

i'm not looking at code, but most likely its just counting up and using a starting point based on the time (precalculated based on their estimated time of the goal)

they may have taken it one step further and made it count up with a variable rate
the rate is could adjusted up or down constantly to keep the counter more accurate.

or the value of the counter could be updated hourly or daily with an accurate count
 
it is counting up at a set rate. Though, it does look like it is pulling actual sales data when you first visit the page.

If you sit on the site for a little bit, and then hit the reset button. The counter will sometimes jump a couple hundred songs.
 
Starts with the value that is taken from this script:

http://www.apple.com/autopush/us/itunes/includes/countdown.inc?r=0.3068124672344378

It will stop once it reaches 9999999990 and the actual counter is a sprite map background image which is shifted in position on each delegate callback.

Code:
<script src="http://images.apple.com/global/scripts/downloadcounter.js" type="text/javascript" charset="utf-8"></script>

	<script type="text/javascript">
		var downloadCounter = new DownloadCounter('/autopush/us/itunes/includes/countdown.inc'),
			pageSwap, content,
			maxCount = 9999999990,
			setup = function() {
				var currentCount = downloadCounter.currentCount();
				if (currentCount >= maxCount) {
					downloadCounter.stop();
				}
				downloadCounter.setElement($('counter'));
			};

		downloadCounter.setMaxCount(maxCount);
		downloadCounter.setDigitImageHeight(103);
		downloadCounter.setDelegate({
			counterDidReachValue: function(downloadCounter, currentCount) {
				if (currentCount >= maxCount) {
					downloadCounter.stop();
				}
			}
		});

		Event.onDOMReady(setup);
	</script>
 
Back
Top