Skip to content

Instantly share code, notes, and snippets.

@debidatta
Last active January 16, 2016 16:21
Show Gist options
  • Save debidatta/5977865 to your computer and use it in GitHub Desktop.
Save debidatta/5977865 to your computer and use it in GitHub Desktop.
Javascript for clicking on all subscribe buttons on a Reddit page. Display multiple sub-reddits using this format: http://www.reddit.com/r/4sentencemoviereviews+7films+<other sub-reddits>. Run this script to subscribe to all those sub-reddits at one go from console or from address bar using the prefix "javascript:".
e=document.getElementsByClassName('add');
var i = 0,n = e.length;
function f() {
if(e[i].className.indexOf('active')>=0) e[i].click();
i++;
if( i < n ){
setTimeout( f, 3000 ); //Time out required for registering subscribe on the servers
}
}
f();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment