Skip to content

Instantly share code, notes, and snippets.

@rystaf
Last active December 31, 2015 07:39
Show Gist options
  • Select an option

  • Save rystaf/7955532 to your computer and use it in GitHub Desktop.

Select an option

Save rystaf/7955532 to your computer and use it in GitHub Desktop.
x = {};
$('#comments_list strong').each(
function(){
if(!x[this.innerHTML]) x[this.innerHTML] = 0;
x[this.innerHTML]++;
}
);
var t = [];
for (var g in x) t.push([g, x[g]]);
t.sort(function(a,b) {return b[1] - a[1]});
text = '';
t.slice(1,10).forEach(
function(b){
text += ( b[0] + ': ' + b[1] + '\n')
}
);
alert(text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment