(function() { var countUp, setCount, url; url = "http://colourco.de/"; $.getJSON("http://urls.api.twitter.com/1/urls/count.json?url=" + url + "&callback=?", function(json) { return setCount($(".twCount"), json.count); }); countUp = function($item) { return setTimeout(function() { var current, newCount, target; current = $item.attr("data-current-count") * 1; target = $item.attr("data-target-count") * 1; newCount = current + Math.ceil((target - current) / 2); $item.attr("data-current-count", newCount); $item.html(newCount); if (newCount < target) { return countUp($item); } }, 50); }; setCount = function($item, count) { if (count == null) { count = null; } $item.attr("data-target-count", count); $item.attr("data-current-count", 0); return countUp($item); }; }).call(this); //$('.popup').click(function(event) { // var width = 575, // height = 400, // left = ($(window).width() - width) / 2, // top = ($(window).height() - height) / 2, // url = this.href, // opts = 'status=1' + // ',width=' + width + // ',height=' + height + // ',top=' + top + // ',left=' + left; // window.open(url, 'twitter', opts); // return false; //});