Skip to content

Instantly share code, notes, and snippets.

@napsternxg
Created October 23, 2012 09:10
Show Gist options
  • Save napsternxg/3937784 to your computer and use it in GitHub Desktop.
Save napsternxg/3937784 to your computer and use it in GitHub Desktop.
Collect data containing sitename, total(questions, answers, comments, tags) on the page: http://data.stackexchange.com/
//collect data containing sitename, total(questions, answers, comments, tags) on the page: http://data.stackexchange.com/
data = [];
$(".site-list > li").each(function(){
obj = {};
obj.name = $(this).find("img").attr("alt");
obj.totalQ = $(this).find(".totalQuestions > .pretty-short").attr("title");
obj.totalA = $(this).find(".totalAnswers > .pretty-short").attr("title");
obj.totalC = $(this).find(".totalComments > .pretty-short").attr("title");
obj.totalT = $(this).find(".totalTags > .pretty-short").attr("title");
data.push(obj);
});
jsonData = JSON.stringify(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment