[WikiEN-l] Download history tool?

Steve Bennett stevage at gmail.com
Sat Mar 11 22:12:59 UTC 2006


Hi again,
  Ok I had my own attempt at adding "group edits". It works, but has
the obvious limitation that displaying the diff across a group of
collapsed diffs shows not quite what you're expecting. In other words:

Time t0  User A comment1
Time t1  User A
Time t2  User A comment2
Time t3  User B comment 3

It shows this as
Time t0 User A comment1//---//comment2
Time t3 User B

So if you attempt to compare between t0 and t3, you of course get all
the changes made in t1, t2 and t3, whereas you probably just wanted
t3. Not sure how to deal with that one.

Anyway, feel free to use this code if at all helpful.

Also...I'm sure by now we're on the wrong list. What's the right one? wikitech?

Steve

// ==UserScript==

// @name           Compress history

// @namespace      stevage

// @description    Collapses consecutive edits from the same person into one

// @include        *.wikipedia.org/*action=history

// ==/UserScript==

var hist;
hist = document.getElementById('pagehistory');

if (hist) {
  var diffs;
  diffs = document.evaluate(
    "LI",
    hist,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null
  );
  var last='*x!', prevdiffcomment;

  for (var i = 0; i < diffs.snapshotLength; i++) {

    var diff = diffs.snapshotItem(i);
    var comment = document.evaluate(
      'SPAN[@class="comment"]',
      diff,
      null,
      XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
      null
    ).snapshotItem(0);
    //GM_log(comment.innerHTML);
    var a = document.evaluate(
      "SPAN/A",
      diff,
      null,
      XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
      null
    );
    eacha = a.snapshotItem(0);
    if (eacha.title==last) {
      if (comment) {
        prevdiffcomment.innerHTML = prevdiffcomment.innerHTML + '//'
+comment.innerHTML;
      } else {
        prevdiffcomment.innerHTML = prevdiffcomment.innerHTML + '//---';
      }
      diff.parentNode.removeChild(diff);
    } else {
      last = eacha.title;
      if (!comment) {
        comment = document.createElement('SPAN');
        comment.className='comment';
        comment.innerHTML=' ---';
        diff.insertBefore(comment, null);
      }
      prevdiffcomment = comment;
    }
  }
}


On 3/11/06, Jonathan <dzonatas at dzonux.net> wrote:
> It has been updated to animate and export a basic Excel xml:
> http://dzonux.net/wikipedia-animate-hack.user.js
>
> "Group edits" is not finished.
>
> Steve Bennett wrote:
>
> >On 3/10/06, Jonathan <dzonatas at dzonux.net> wrote:
> >
> >
> >>I started to fix the script:
> >>http://dzonux.net/wikipedia-animate-hack.user.js
> >>
> >>It shows the basic layout, but it stops right before it animates.
> >>
> >>Steve, are there are any other features you would like?
> >>
> >>Jonathan
> >>
> >>
> >
> >Ooh, interesting question :) I can now get that script to activate,
> >but yeah, doesn't do much useful yet.
> >
> >Hard to ask for *more* features when I haven't seen what it does yet.
> >But things that would be useful would be grouping all subsequent edits
> >by a single editor (would be useful in general in Wikipedia), and,
> >yeah like my original quest, somehow being able to download a list of
> >all changes into Excel or something (with dates and URLs would be
> >brilliant...)
> >
> >Steve
> >_______________________________________________
> >WikiEN-l mailing list
> >WikiEN-l at Wikipedia.org
> >To unsubscribe from this mailing list, visit:
> >http://mail.wikipedia.org/mailman/listinfo/wikien-l
> >
> >
> >
> >
> _______________________________________________
> WikiEN-l mailing list
> WikiEN-l at Wikipedia.org
> To unsubscribe from this mailing list, visit:
> http://mail.wikipedia.org/mailman/listinfo/wikien-l
>



More information about the WikiEN-l mailing list