Advertisement
Guest User

CM activity

a guest
May 5th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ids = [620, 1083, 5960, 20808, 34933, 42117, 89201, 102159, 140824, 272910, 463168, 1399708, 2415655];
  2. names = ['Shog9', 'Jon', 'Gabe', 'Tim', 'Robert', 'Pops', 'animuson', 'Grace', 'Jaydles', 'Nicolas', 'Abby', 'JNat', 'Ana'];
  3. types=['answered','asked','comment','revised'];
  4. res=[];
  5. k=0;
  6. f();
  7. function f() {
  8. r=new XMLHttpRequest();
  9. r.onload=function(e) {
  10.   p=new DOMParser();
  11.   x=p.parseFromString(e.currentTarget.responseText,'text/html');
  12.   rs=x.querySelector('.history-table').children[0].children;
  13.   for (i=0;i<rs.length;i++) {
  14.     tp=rs[i].children[2].children[0].textContent;
  15.     if (types.indexOf(tp)!=-1) {
  16.       act={};
  17.       act.time=rs[i].children[0].children[0].title;
  18.       nm=document.createElement('td');
  19.       nm.textContent=names[k];
  20.       rs[i].insertBefore(nm,rs[i].firstChild);
  21.       act.cnt=rs[i].outerHTML;
  22.       res.push(act);
  23.     }
  24.   }
  25.   k++;
  26.   if (k<ids.length) {
  27.     window.setTimeout(f, 500);
  28.   }
  29.   else {
  30.     res.sort(function(a,b) {return a.time<b.time?1:-1});
  31.     document.getElementById('content').innerHTML='<table>'+res.map(function(e){return e.cnt}).join('')+'</table>';
  32.   }
  33. };
  34. u='//stackexchange.com/users/activity/'+ids[k]+'?page=1&filter=all';
  35. r.open('get', u, true);
  36. r.send();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement