Skip to content

Instantly share code, notes, and snippets.

@user19
Created October 14, 2014 13:56
Show Gist options
  • Save user19/c6b13dc92c50ae0bafcc to your computer and use it in GitHub Desktop.
Save user19/c6b13dc92c50ae0bafcc to your computer and use it in GitHub Desktop.
var subscriberElement = document.getElementById('c4-primary-header-contents').getElementsByClassName('yt-subscription-button-subscriber-count-branded-horizontal yt-uix-tooltip')[0];
var i = another = Number(subscriberElement.innerHTML.replace(",",""));
var count = setInterval(function(){
counter(i);
i += 9;
if(i >= another+10000){
clearInterval(count);
}
},10);
function counter(num){
subscriberElement.innerHTML = String(num).replace(/(\d)(?=(\d\d\d)+(?!\d))/g,'$1,');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment