User talk:Alex Smotrov/histcomb.js

From Wikipedia, the free encyclopedia

Contents

[edit] Documentation

Script improves readability of history pages:

  • Consequent edits by the same user are folded together
  • Size is replaced with difference (like in watchlist/recent changes)
  • "Talk", "contribs" and "undo" are shortened to one letter
  • Your edits are marked with light green background
  • Link «Contributors» under heading goes to useful toolserver tool ( example).


Example:

  • (cur) (last) o o 14:50, 19 June 2007   User1 (Talk | contribs) (2,250 bytes) (Question thanks) (undo)
  • (cur) (last) o o 14:07, 19 June 2007   Inattentive (Talk | contribs) (2,184 bytes) (Question no, like this) (undo)
  • (cur) (last) o o 14:06, 19 June 2007   Inattentive (Talk | contribs) (2,182 bytes) (Question oops) (undo)
  • (cur) (last) o o 14:05, 19 June 2007   Inattentive (Talk | contribs) (2,185 bytes) (Question re) (undo)
  • (cur) (last) o o 14:00, 19 June 2007   User1 (Talk | contribs) (2,131 bytes) (Question) (undo)

becomes

  • (cur) (last) o o 14:50, 19 June 2007   User1 (t | c) (+66) (Question thanks) (×)
  • (cur) (last) o o 14:07, 19 June 2007   Inattentive (t | c) (+23) [3] (×)
  • (cur) (last) o o 14:00, 19 June 2007   User1 (t | c) (+108) (Question) (×)



Demo without installation: go to any history page, copy this to browser address field and press Enter:
javascript:function addOnloadHook(f){f()};importScript('User:Alex_Smotrov/histcomb.js');void 0


Static installation: importScript('User:Alex Smotrov/histcomb.js')your monobook.js


Dynamic installation
script is loaded only after you click on a new link Improve… (after  Compare selected versions  )

if (wgAction == 'history') //add a link to call histComb.js
addOnloadHook(function(){
 var pagehis = document.getElementById('pagehistory');
 if (!pagehis) return;
 var lnk = document.createElement('a');
 lnk.style.marginLeft = '10px';
 lnk.href = '#';
 lnk.appendChild(document.createTextNode('Improve…'));
 lnk.onclick=function(){this.parentNode.removeChild(this);importScript('User:Alex_Smotrov/histcomb.js')}
 pagehis.parentNode.insertBefore(lnk, pagehis);
})

your monobook.js


Optional parameters (listed with defaul values)

histCombLeaveComment = false //if true, keep summary on the last folded edit
histCombNoCollapse = true //if true, do not collapse edits on load
histCombMyBg = '#F0FFF0' //background on your edits (light green)
histCombTalk = 't' //string to replace 'Talk'
histCombContrib = 'c' //string to replace 'contribs'


Script tested in IE 6/7, Opera 9, Firefox 1.5/2, Safari 3

Also see logPage.js script.


[edit] Discussion

[edit] IE bugs

I've got a couple of interesting bugs in this script for you: first, when multiple edits are rolled together, the links to the users' page, etc. stop working, and you have to expand the edits. Second, if you select the diff at the very bottom of a history page, and then select the diff right above it, the radio button for the bottom diff jumps out to the left. Just thought I'd give you a heads up! —Dinoguy1000 21:28, 8 February 2008 (UTC)

Thank you for letting me know. Please also specify your browser version and the exact link, because I could not reproduce the 1st bug. The second one seem to happen in IE6/IE7 on any row which is just below a "collapsed" row. I have know idea why it happens, but will try to fix it when I have some time / AlexSm 23:21, 8 February 2008 (UTC)
You're welcome. The first bug happened on IE7, although I can't remember the exact link or even page. I'll try to find another example for you, though. —Dinoguy1000 17:18, 9 February 2008 (UTC)
All right, this is on IE6 SP1, on this page's history page, at the bottom, you made two consecutive edits. Passing the cursor over any of the links in the unexpanded entry results in an I-bar, rather than a hand. In addition, expanding your edits results in the radio button jumping out to the left (you don't have to change the radio button selection for this to happen), and the links on the first of the two entries still aren't clickable, though the links for the second entry are. —Dinoguy1000 17:27, 9 February 2008 (UTC)
I still don't know why IE behaves this way, but it seems that finally I was able to fix both bugs (it was the same bug actually). P.S. Do not just say "bottom" because the number of entries on history page depends on preferences :) —AlexSm 17:51, 21 February 2008 (UTC)
Alright, I'll try to be more specific in the future... ;) In any case, you fixed one bug only to have another rear its ugly head... Unless it's another side of the same bug. This is under IE7, look at the bottom collapsed row of this page's history (yes, there's that ugly word 'bottom' again... =P ), you'll notice that the content of the whole row has been shifted to the right about two character's width, and the "cur" link is not present. The spacing problem remains in this specific row even after expanding the row and regardless of how the radio buttons have been selected, though the "cur" link returns on expanding. I'm not sure if the same thing happens on history pages without collapsed edits in the bottom row, nor do I know about the new behavior under IE6. —Dinoguy1000 19:56, 21 February 2008 (UTC)
This was simply my mistake, not IE-related, fixed. The script was supposed to hide the (last) link (that's easier than replacing it with text) . —AlexSm 20:23, 21 February 2008 (UTC)
All right, that got it. —Dinoguy1000 20:33, 21 February 2008 (UTC)