# User talk:Cacycle/wikEdDiff

This is the discussion page for the improved diff for Wikipedia article revisions wikEdDiff and its diff library wikEd diff. Feel free to leave your comments, suggestions, and bug reports at the end of this page.

.

## block move, incorrect diff

test case --Jeremyb (talk) 15:53, 18 August 2014 (UTC)

Jeremyb: Fixed in wDiff 1.0.0/wikEdDiff 0.9.26. Thanks for reporting - Cacycle (talk) 23:30, 25 August 2014 (UTC)

## Unable to select a word by double clicking

The scripts seems to cause the page to scroll when I attempt to select a word in a diff by double clicking over it. Helder 01:01, 1 September 2014 (UTC)

Helder: That is a new feature so that you can quickly jump to the edit field by double-clicking on the diff area. I thought that this is more important than being able to select by double clicking. What's your opinion? Cacycle (talk) 17:57, 8 September 2014 (UTC)
@Cacycle: I think this should be optional (preferably disabled by default), since I use double/triple clicks quite often. Notice also that in the link above there is no edit field. Helder 19:42, 8 September 2014 (UTC)
Helder: This has been fixed in version 0.9.34. If you double-click on text, it gets selected, if you click on empty space, you move. Only under IE you have to click outside blocks in order to not always select text. BTW, scrolling is also nice to have without the edit field so that you can jump to the preview. Cacycle (talk) 19:08, 13 September 2014 (UTC)
@Cacycle: Thank you! This is better, but not much: I usually triple click in the empty space after the paragraph to select it and be sure that no links will be clicked. Helder 14:03, 28 September 2014 (UTC)
Any suggestions on how can I remove this "feature" other than disabling it? Helder 11:51, 21 October 2014 (UTC)

## Special:ComparePages

Could you allow the script to be used on Special:ComparePages too? Helder 01:26, 1 September 2014 (UTC)

Helder: wikEdDiff already works on Special:ComparePages, see here: [1]. Cacycle (talk) 20:54, 8 September 2014 (UTC)
@Cacycle: I don't see the button on that page (tested with Firefox and Chrome). Helder 21:16, 8 September 2014 (UTC)
Helder: any error messages in the console (F12)? How Do you load wikEdDiff (Gadget or user script)? Cacycle (talk) 07:06, 9 September 2014 (UTC)
Oh... never mind. I had an if(mw.util.getParamValue('diff')!==null){ ... } around the call which imports your script. Helder 12:21, 9 September 2014 (UTC)

## Accessibility

Red-green is the commonest form of colour-blindness. Please check your colour combinations against web standards, using tools recommended at WP:COLOUR. The Accessibility wikiproject can advise further. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 22:40, 1 September 2014 (UTC)

The new red/blue scheme has been chosen for color-blindness contrast. Cacycle (talk) 17:57, 8 September 2014 (UTC)
Why not to use the colors which were chosen by MediaWiki designers for the default diffs (in use since MW 1.20)? Helder 19:44, 8 September 2014 (UTC)
Helder: It is currently white characters on dark colored background because of the moved block detection colors (black on light colors). Since these have currently been disabled in favor of light grey, your suggestion has actually become an option. I will look into it. Cacycle (talk) 20:59, 8 September 2014 (UTC)
Helder: A new skin/sky/gray/bold color scheme is now in place (version 1.0.12). Cacycle (talk) 22:10, 10 September 2014 (UTC)
Ugh, I'm really sorry to bother you, but these pale colors are much less usable. With the bright colors we had before, it was so much easier to spot changes, especially when it's about additions or removals of a single space character, for example. — Dsimic (talk | contribs) 22:13, 10 September 2014 (UTC)

## Diffs with no content are collapsed

Due to recent changes, diffs with no content are collapsed to the left.

Please fix, thanks. Gary (talk · scripts) 05:45, 3 September 2014 (UTC)

@Cacycle: I confirm that (I've seen this in a few other diffs). Helder 14:17, 8 September 2014 (UTC)
User:Gary, Helder: What do you mean by "Diffs with no content are collapsed". To me the example diff looks fine, i.e. a small empty block as an indicator for no changes. Cacycle (talk) 17:57, 8 September 2014 (UTC)
http://snag.gy/RSt9X.jpg. Helder 19:37, 8 September 2014 (UTC)
Please could you elaborate? Cacycle (talk) 19:50, 8 September 2014 (UTC)
@Cacycle: It's about too narrow columns for the revision information ("Revision as of..."); for non-empty diffs those columns are filling the entire horizontal space, while for empty diffs they shrink to only around 50% of the available space. I'd also love to see this fixed. — Dsimic (talk | contribs) 19:52, 8 September 2014 (UTC)

Gary, Helder, Dsimic: fixed in wikEdDiff 0.9.31, thanks for reporting this. Cacycle (talk) 20:51, 8 September 2014 (UTC)

Awesome, thank you for such a quick bugfix! — Dsimic (talk | contribs) 21:02, 8 September 2014 (UTC)

## A bug in the improved version

Hey everyone! Unfortunately, there seems to be a bug in the recently improved wikEdDiff, which is by the way much better than it was before! Here are two examples where differences aren't correctly displayed:

Hope it helps, as there's obviously something wrong. — Dsimic (talk | contribs) 19:35, 8 September 2014 (UTC)

Here's another example, this time showing a changed link that isn't recognized, with a screenshot as well. — Dsimic (talk | contribs) 19:58, 8 September 2014 (UTC)
Dsimic: This has just been fixed in version 0.1.11. Thanks for reporting! Cacycle (talk) 20:10, 8 September 2014 (UTC)
Great, thank you for fixing it so quickly! — Dsimic (talk | contribs) 20:16, 8 September 2014 (UTC)

There seems to be another bug, which feels like it was introduced with the wikEdDiff 1.2 release. Please have a look at this diff that shows an example of way too much unchanged text included after the last changed/compared segment. — Dsimic (talk | contribs) 23:02, 14 October 2014 (UTC)

Here's another diff that displays too much unchanged text, though there's also too much of the unchanged text displayed before (not just after) the last changed/compared segment. — Dsimic (talk | contribs) 04:38, 15 October 2014 (UTC)
... and, one more example, this time with too much text only after the last change. — Dsimic (talk | contribs) 05:40, 15 October 2014 (UTC)
Based on another example, it seems like the excess trailing text is displayed for the last change only, taking everything to the end of article's Wiki code, but only if there's more than one change displayed. — Dsimic (talk | contribs) 08:39, 15 October 2014 (UTC)
Cacycle, this really should be fixed as it significantly reduces the usabilty of wikEdDiff... Just have a look at another example, please – despite the fact there are only two small changes, wikEdDiff displays a huge chunk of text that requires a lot of scrolling and (what's more important) a lot of "brain scanning" effort to make sure there are no more changes in all that. Hope you agree. — Dsimic (talk | contribs) 05:11, 21 October 2014 (UTC)
Dsimic: Thanks, I have fixed this in version 1.2.3. Sorry for seeing this late - please could you start a new section at the bottom for every bug report? Thanks, Cacycle (talk) 09:36, 21 October 2014 (UTC)
Cacycle, thank you for fixing it, and no worries about the delay. Sure thing, moving forward I'll submit bug reports in separate sections – if I manage to catch any more bugs, of course. :) — Dsimic (talk | contribs) 19:29, 21 October 2014 (UTC)

If I open a diff (example) and run the following code on console (instead on my personal/global JS)

importScript('User:Cacycle/wikEdDiff.js');


the button does not appear. The same problem happens if I use

mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js&action=raw&ctype=text/javascript' );


The line

wikEd.DiffAddEventListener(window, 'load', wikEd.DiffSetup, false);


is executed, but the function wikEd.DiffSetup is never called. Helder 12:38, 9 September 2014 (UTC)

wikEdDiff brings its own loader, also because it has to load its own library as soon as possible. Cacycle (talk) 22:08, 10 September 2014 (UTC)
Helder: importScript('User:Cacycle/wikEdDiff.js'); from the console now works in version 0.9.33. Cacycle (talk) 15:48, 12 September 2014 (UTC)

## An improvement possibility

Hello again! Please have a look at this diff; changes made to {{Talk archive navigation}} templates aren't recognized down to the word level, and instead of displaying that only "August" was changed to "September", wikEdDiff displays whole-line changes. On the other hand, "old shool" diff shows word-level changes. It would be nice to have wikEdDiff display word-level changes as well, if possible. — Dsimic (talk | contribs) 19:43, 10 September 2014 (UTC)

Dsimic: Bug fixed in version 1.0.13. Thanks for reporting! Cacycle (talk) 23:46, 10 September 2014 (UTC)
Awesome, thank you very much! — Dsimic (talk | contribs) 23:56, 10 September 2014 (UTC)

## Test cases for new version of WikEdDiff

Hi Cacycle.

I was excited to see the new version of WikEdDiff. Love the new way of showing moved text and the fact that it shows this Honda Accord diff perfectly.

I thought I would share with you two diffs that may help you tweak the code.

1. Foldamer diff currently has a false positive on a moved block and an example of where showing a single-character change would simplify the diff.
2. Tom Jones diff has record companies reordered in the infobox but these aren't detected.

Eliminating the false positive in the Foldamer diff while enabling detection of the moves in the Tom Jones diff sounds like a big ask but I thought I'd see what you made of it.

Yaris678 (talk) 14:05, 9 September 2014 (UTC)

Yaris678: Thanks for your help! Both issues have been solved in version 0.1.12. Problem 1. was a bug and has been fixed, problem 2 has been addressed by introducing an new inline chunk splitting step. Have fun... Cacycle (talk) 22:03, 10 September 2014 (UTC)
Hi Cacylce. The Tom Jones reordering is working nicely now. I am still getting a false positive on references in the Foldamer diff (and in the Tom Jones diff!) Does this mean that bug fix hasn't been rolled out? User:Cacycle/diff.js says you are on version 1.0.13.
Yaris678 (talk) 11:55, 11 September 2014 (UTC)
Yaris678: The moved block detection (actually rejection) has now been fixed in version 1.0.16. Thanks for your help - Cacycle (talk) 13:57, 13 September 2014 (UTC)
It works great now. Thanks. Yaris678 (talk) 14:35, 14 September 2014 (UTC)

Here are two more test cases:

1. Logistic regression diff has a definite false positive around "is usually ... defined as ... ,". There are also some false positives around shared text that is not shown as moved. Phrases like "or more" or "of the" appear in white in the middle of of large patches of blue or orange. Does the algotithm currently seek to reject this sort of thing?
2. Loose coupling diff doesn't detect some cases where single-character changes would simplify the diff.

Yaris678 (talk) 08:06, 16 September 2014 (UTC) (overwiting a post from 11:59, 15 September 2014‎)

Hi Yaris678: these should be fixed in the current version 1.1.2. Thanks again for your participation! Cacycle (talk) 14:36, 21 September 2014 (UTC)
Hi Cacycle. The loose coupling diff is now looking good. The Logistic regression diff has fewer of the single white words but it is still has some false positives, including "is usually ... defined as". Also, I have noticed that the Tom Jones diff now has a false positive on "<ref>" (but not "</ref>", strangely).
How do you work out what to reject? Is there a formula that includes the distance moved and the number or character and/or words?
Yaris678 (talk) 20:24, 21 September 2014 (UTC)
I have added a unit test to prove that a certain diff is consistent with the original versions (add var wDiff; if (wDiff === undefined) { wDiff = {}; } wDiff.unitTesting = true; to your common.js to see the results in your browser console). These tests says that Tom Jones as well as Logistic regression are formally correct (they do not say these are the "best" (i.e. most intuitive) options). As for the "formula": the basic procedure and the optimizations cannot be described in a few sentences. But in general, corresponding word blocks are determined, then it is calculated which of them are fixed (black on white) and which of them are moved (gray) by minimizing the total moved block length. After that, deletions and insertions are sorted-in in a way that is most intuitive for humans. Then, in order to scrap false-positive correspondings, blocks that are too short and/or consist of common words are eliminated by splitting them into insertion/deletion pairs and the whole process is repeated until nothing changes. For details simply check the code, it is extensively commented. Cacycle (talk) 22:07, 21 September 2014 (UTC)
My apologies. I mentioned the Tom Jones diff above. I meant to say that the Foldamer diff has a false positive on a moved "<ref>". If you have a step to exclude common words, should it exclude "<ref>"? Yaris678 (talk) 11:19, 22 September 2014 (UTC)
Hey Yaris678, I have thought about it, but I see no reasonable way to improve that specific diff without cutting down on specificity for other diffs. I think, we currently have a good compromise between false positives and too fragmented outputs. BTW, have a look at the new wikEd diff online tool and demo, where you can also play around with settings. Cacycle (talk) 21:46, 25 September 2014 (UTC)
That online tool is awesome! I can use it in future if I am comparing some text files and I don't want to upload them to Wikipedia.
Yes. Balancing false positives and false negatives is tricky. I have an idea, but I don't know how easy it would be to implement. At the moment, you reject blocks if they are smaller than a certain amount. Could you also take distance moved into account? e.g. to accept a block, distance moved has to be less than three times the size of the block, unless the block is greater than five words long, in which case it can move as far as it likes.
Yaris678 (talk) 07:28, 26 September 2014 (UTC)

## Dizzy from GUI twitch

I've used the improved inline diff as my primary display of changes since the day I discovered it was available, and had been very happy with it; but recently I've become more and more frustrated at having to re-learn the display conventions every time I sign in to Wikipedia.

• The “obvious” red-and-green color code for deleted-and-inserted words changed to red-and-blue.
• Its position after the traditional diff display changed to a position before.
• Moved text changed from a highly-visible yellow highlight to an almost invisible, and thus useless, faint gray.
• Now the new well-saturated red-and-blue has changed again, today, to something involving washed-out blue and yellow.

Could you publish the CSS tag and class details, along with the various historical color settings, so that a user can just put them into his common.css settings once and for all? I would really prefer to continue to use this tool, but if I can't achieve any degree of stability in the user interface, I'm afraid it becomes more of a problem than it's worth. 03:54, 11 September 2014 (UTC)

I can't speak for Cacycle, but I imagine these things will stay stable now. The new colours reflect the new(ish) standard in the default MediaWiki diff. I like them, they are less painful to the eye. I also like the new location of the diff because it means I don't have to scroll past the default diff.
I don't know if Cacycle has tried a few shades of grey recently, but I find the grey moved text easy enough to see. Do you still find it difficult?
Yaris678 (talk) 12:54, 11 September 2014 (UTC)
Unician: I am sorry that the changes have frustrated you. After about 8 years, the diff library behind the improved diff has been more or less completely rewritten and improved. Together with these background changes, I felt that the design had to be updated to make it easier to use and understand, especially for new users. I am currently putting a lot of time and effort into this, but I think we are more or less there and the UI will not change much for a while to come. However, as you can see from the discussions above, I am always open for suggestions and bug reports. To address your points in detail:
1. The reason for NOT using a red/green scheme is responsive design for colorblind users (8 % of males!). The skin/sky colors have been optimized for color contrast for these users.
2. Moving wikEdDiff up makes it more prominent and visible without scrolling. This also reflects the maturity that the library has reached: it is essentially as reliable as the default diff and, hopefully, much easier to understand.
3. I have switched off the rainbow colors to identify block/mark pairs so that the new black-on-skin/sky color scheme could be used. This is a major improvement because you now have the same color code for default and improved diff. I have tested the shades of gray on different monitors and using different backlight intensities and it seemed to be a good compromise, especially together with their bold style. Instead of the color coding, there is the new block/mark highlighting if you move the mouse over them. By left-clicking you can even jump between them.
Of course, WP:wDiff and WP:wikEdDiff are fully customizable and you can use any color scheme, turn the rainbow scheme back on, or tweak (downgrade) the diff algorithm settings. Please give me some time to update the documentation to reflect the recent changes and to tweak the code for this. Cacycle (talk) 14:54, 11 September 2014 (UTC)
Here's an example of the problem:
Earlier today I spent some time on a watchlist entry trying to discover what an editor had changed. The improved inline diff showed nothing obvious. But the old, baseline diff showed a big difference, with whole paragraphs changing their sizes as a result of the edit. It turned out that the editor had deleted an extra newline which had broken a paragraph into two. The old baseline diff showed one entire paragraph deleted and the preceeding one extended, with all of the relevent text in bold, twice, making it obvious. Using that old diff as a guide, I searched the improved inline diff and discovered one blank space which, rather than being colored white like the others, had been colored in slightly-yellowish off-white, the current color for “deleted”, and which unfortunately is the closest thing to being invisible. Oops.
More vivid and saturated colors, such as the ones used earlier, would have completely eliminated the problem. Of course, I'm sure that preference of colors will vary between editors, with the case of color-blindness an obvious example.
My fix was to use the Firefox HTML inspector to show the span class names, then restore the older colors in my “common.css” style sheet. While I was there, I also set the newlines to appear as “¶” again.
Oh, and I actually prefer the new inline diff appearing first, as it does now — it was just disorienting to scroll down by habit to where the Δ button had always appeared, only to find it suddenly gone.
If all is stable again, I have no complaints, and a hearty Thank You for making this enormously-helpful tool available.
07:53, 12 September 2014 (UTC)
Unician: I also think that single-blank changes are extremely difficult to see (despite using colors that are a bit darker than the default ones), but I have not yet come up with a good solution for this. Cacycle (talk) 13:16, 12 September 2014 (UTC)
@Cacycle: Just had a look at the wikEdDiff documentation, especially the User:Cacycle/diff § Customization section, and unfortunately I wasn't able to figure out exactly how to turn the "rainbow scheme" back on? Please don't get me wrong, it's all extremely customizable, but links to the diffs that changed the color scheme would by highly usable as they could be used for the extraction of various required settings. Any advice would be highly appreciated! — Dsimic (talk | contribs) 16:45, 12 September 2014 (UTC)
Dsimic: use wDiff.coloredBlocks = true; Cacycle (talk) 17:31, 12 September 2014 (UTC)
Thanks. However, I've added wDiff.coloredBlocks = true; to my User:Dsimic/common.js and tried with clearing the browser cache, but unfortunately it doesn't seem to work as I still have pale colors in wikEdDiff. Could it be that I've misunderstood what the rainbow color scheme is? Any suggestions, please? — Dsimic (talk | contribs) 19:08, 13 September 2014 (UTC)

Unician, Dsimic: I have added the newline sign back in, you can see it when hovering over the block. Also, I have made blank-only changes darker so hat they are now easily visible. Dsimic: If you still want to change the colors, then you have to set the insert/delete styles (wDiff.styleDelete and wDiff.styleInsert). wDiff.coloredBlocks refers to moved block coloring (previously rainbow colors, now all-gray). Cacycle (talk) 02:11, 14 September 2014 (UTC)

Thank you very much, Cacycle, newline sign looks great! Also, I've managed to customize the colors, making me a happy camper. :) — Dsimic (talk | contribs) 02:54, 14 September 2014 (UTC)
@Cacycle: After using customized colors for a while, I've spotted something that looks like a small bug... In a few words, everything works great regarding customizing the colors, except for what's displayed as one-character changes; for such changes, custom colors are applied as expected when a wikEdDiff is initially displayed (as seen here, for example), but the default colors are erroneously applied to detected one-character changes whenever the mouse pointer is placed anywhere inside frame-fenced sets of changes (as seen here, for example).
Hope this is good enough description for a bug report; at the same time, this diff could be used as an example. If this small issue could be fixed somehow, wikEdDiff would be perfect. :) — Dsimic (talk | contribs) 07:27, 26 September 2014 (UTC)
Dsimic: This is not a bug but an intentional feature. Simply set wDiff.styleInsertBlank and wDiff.styleDeleteBlank to your preferred color css. Cacycle (talk) 00:00, 27 September 2014 (UTC)
Thank you very much for the clarification, and sorry for my misinterpretation that this feature was a bug. I've added two CSS definitions and it works great! Just as a small suggestion, it might be good to add this into the wikEdDiff documentation (User:Cacycle/diff § Customization section in particular), for later reference by anyone who goes into color customization. — Dsimic (talk | contribs) 01:56, 27 September 2014 (UTC)
Dsimic: done. BTW, the current defaults are not that bad after all... :-) Cacycle (talk) 11:27, 27 September 2014 (UTC)
Looking good, thank you very much; I've just touched it up, hope you're fine with that. Current default colors are totally fine, it's just that using a bit stronger shades of the same colors makes spotting changes easier to me. :) — Dsimic (talk | contribs) 04:04, 28 September 2014 (UTC)

Thank you, Cacycle, for updating the wikEdDiff customizations in my common.js! However, what happened to the customization descriptions in User:Cacycle/diff § Customization section, a large portion of them was deleted? — Dsimic (talk | contribs) 13:14, 10 October 2014 (UTC)

The update is complete now. Color customization is now only possible via common.css. Cacycle (talk) 13:18, 10 October 2014 (UTC)
Sorry, I've jumped the gun a bit; as I can see that's going to be provided in User:Cacycle/diff.js. — Dsimic (talk | contribs) 13:19, 10 October 2014 (UTC)
Got it working; it's much better now that the color customizations are performed via common.css, as that makes it possible to change only the desired CSS properites and leave others untouched. However, I'd say that an example or two in User:Cacycle/diff § Customization would be highly usable. — Dsimic (talk | contribs) 14:19, 10 October 2014 (UTC)
By the way, adding "(no difference)" is a nice touch, thank you for such an attention to detail! — Dsimic (talk | contribs) 01:44, 11 October 2014 (UTC)

## Show improved diff view not working

Hi, I was directed to you to let you know show improved diff view is not working for the most recent version of Safari for windows 7 available. Here's a diff https://en.wikipedia.org/w/index.php?title=Wikipedia%3AHelp_desk&diff=628731807&oldid=628716392 that doesn't work, although the green delta does appear. I was told to let you know which version of safari I have. I am not sure how to do that, all I can say is that this has stopped working recently and I have windows 7. This has happened before and been quickly fixed if you check the help page archives. Thanks. μηδείς (talk) 01:37, 8 October 2014 (UTC)

(talk page stalker) Hello there! Just as a note, this might help in determining the Safari version. — Dsimic (talk | contribs) 10:31, 8 October 2014 (UTC)
I found it under help, it's version 5.1.7 μηδείς (talk) 15:36, 8 October 2014 (UTC)

Hi μηδείς: Please could you update to the latest wikEdDiff/wikEd diff versions (Wikipedia:bypass your cache) and check your browser console for wikEd diff-related errors? Thanks, Cacycle (talk) 13:22, 10 October 2014 (UTC)

THanks, I emptied the cache and rebooted, and am still having no luck with this either with Safari or chrome. I haven't added any add-ons recently that I can think of that would have caused this. The only thing was I recently had to remove and then reinstall flash player and realdownload and its higher components when my videos stopped working. I am not sure how to check my browser console for wikEd diff-related errors. In any case, I have firefox and IE and can try them as well. Thanks. μηδείς (talk) 18:52, 10 October 2014 (UTC)
μηδείς: Please see http://www.inmotionhosting.com/support/website/javascript/diagnose-javascript-errors Cacycle (talk) 11:33, 11 October 2014 (UTC)

• Version: maybe later 0.9.38 (October 14, 2014) diff
• Attention line: if ( /\b( diff-context|diff-deletedline|diff-addedline )\b/.test( cell.className ) === true ) {

In diff page, DiffLinkify of some is not working. It is work in deletedline, but it is not working in other parts. Thank you. --Frozen-mikan (talk) 09:01, 17 October 2014 (UTC)

Frozen-mikan: Sorry, fixed in version 0.9.39 (October 21, 2014). Cacycle (talk) 09:41, 21 October 2014 (UTC)

## Moving a single character

This looks like a particularly odd false positive. A single character (n) is shown as moved several paragraphs.

Yaris678 (talk) 12:07, 24 November 2014 (UTC)

Yaris678: Thanks, generally, this works actually as intended even if this example looks strange. I will look into it and try to tweak it. Cacycle (talk) 11:47, 22 February 2015 (UTC)

## Endless Loop?

wikEdDiff doesn't work at all for most of the diffs I try it out on. The page just shows "loading" status forever, with the green triangle never appearing. For example it works here in diff 1, but in the next edit on the same article, diff 2 , it fails to load. The strangest thing is this problem is not entirely consistent. I got diff 2 to load twice by using the Twinkle "next edit" link from diff 1. But it didn't work the third time, and it doesn't seem to ever work for diff 2 when I try to get there from the "View History" page for the article. TBSchemer (talk) 22:38, 18 December 2014 (UTC)

After updating to the latest version of Java (8u25), now neither diff works (most of the time). I get three errors:
TypeError: this._wloPluginObj.SetFocus is not a function websiteLogon.js:206
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help http://xhr.spec.whatwg.org/ index.php:172
TypeError: this._wloPluginObj.SetFocus is not a function websiteLogon.js:63

TBSchemer: Please could you provide a full error report (e.g. see User_talk:Cacycle/wikEd#wikEd_Bug_reports for the required infos). Thanks - Cacycle (talk) 11:42, 22 February 2015 (UTC)

## Removing and then adding the same piece of text

This is an interesting false negative. I was generally impressed with how this diff detects the moved text blocks. However, if you look at the bottom, you will see </syntaxhighlight> being removed and then immediately added. Yaris678 (talk) 22:16, 21 December 2014 (UTC)

## Obsolete globals

This script is trying to access the deprecated globals wgServer, wgArticlePath, wgScriptPath and wgCurRevisionId wgPageName instead of using mw.config.get('wg...') to acess them (check the multiple warnings in the console). Helder 23:23, 14 January 2015 (UTC)

See discussion and notes at commons:MediaWiki_talk:Gadget-HotCat.js/Archive03#Errors in webconsole - deprecated for tips on how to fix. (I think; IANAD!) Hope that helps. :-) --Quiddity (WMF) (talk) 23:34, 20 January 2015 (UTC)

## Edit preview diff?

When editing a page, there are five buttons:

Cancel

Clicking gives a diff view, but I'm not seeing the button like I do for ordinary diffs. This would be very helpful if it were there. 21:37, 4 February 2015 (UTC)

Eman235: You could use the gadget wikEd for this. Cacycle (talk) 11:34, 22 February 2015 (UTC)
Just another reason I should be using Firefox then...*slaps self* 22:24, 22 February 2015 (UTC)
Cacycle, would it be difficult to make the WikEd's Δ button ("Show current changes below") available under the textarea to WikEdDiff-only users as well? --V111P (talk) 12:17, 8 October 2015 (UTC)

## WikEd-diff-tool options non-functional?

I played with the below options of the wikEd-diff-tool:

- "Reject blocks if too short and common"

- "Words: reject blocks if shorter"

- "Maximum rejection cycles"

- "Repeated diff"

- "Recursive diff"

...but could not see any effects. Are these non-functional in the online demo?

Also, the "moved text" recognition is too sensitive in some cases (it detects single words erroneusly as moved that are actually edits). Is there something that can be done such that only whole blocks of text are recognized as moved but not single words?

84.56.98.120 (talk) 20:45, 21 April 2015 (UTC)

Please see User:Cacycle/diff for a more detailed explanation of the options. In short: the options mainly play a role in the fine tuning of very complex cases with many changes and block moves. Also, diffing is - and cannot be - an exact science and there will always be ambiguities. The program does its best to guess your intentions, but it still is a relatively simple program. Cacycle (talk) 09:43, 27 April 2015 (UTC)

## Documentation for changing wikEdDiff styling is inaccurate

Hi there. First off, thanks for this great piece of software.

   var wikEdConfig = {};
wikEdConfig.diffCSS = {
....
}


... does not reflect the content of wikEdDiff.js: There is no mention of wikEdConfig og the diffCSS property in the code. There is, however, mention of a wikEdDiffConfig that is assumed to be a global variable. If this one is present, it will be deep-copied into this.config. This seems the most likely interpretation.

It seems that there is only one property related to styling called stylesheet that contains a string of all the style. If one wants to change the styling, one has to add a <style /> tag and write !important in case the styling conflicts with the default, or completely redefine the stylesheet property of the config. It would be nice if there was something in-between like the documentation suggests. I.e., if a CSS property is listed, use it, otherwise use the default. Just a suggestion.

Also, why are there both the classes .wikEdDiffDeleteBlank / .wikEdDiffInsertBlank and .wikEdDiffNewline and .wikEdDiffSpace? From the internal variable regExpBlanks, I would assume it has to do with unicode-compatible whitespace detection. Is this because one should be able to differentiate between regular spacing and unicode spacing?

Kindly, Doc Daneeka (talk) 10:28, 1 July 2015 (UTC)

Doc Daneeka: I am not sure what you mean: wikEdConfig and wikEdConfig.diffCSS are mentioned in the wikEdDiff.js code and changing the styles works fine for me. As for the classes: these are needed for displaying whitespace symbols on hovering. Cacycle (talk) 16:51, 20 July 2015 (UTC)

## wikEd diff online tool and demo: could use a couple extra options

I've been playing with this handy tool and testing it with large texts (300kb), with mostly great results.

There is, however, room for some improvements:

• a 'clear' button. I added it easily to my local copy by cloning the 'example' code.
• 'Load file' functionality, besides copy/pasting. Would be great, particularly if filenames also appeared (color-coded) heading the result.
• 'Case Insensitive' option. A must for some situations.

I've also noticed IE9 hogged the CPU after diff was complete, becoming mostly unresponsive, while up-to-date FF worked flawlessly.

Cheers, — Preceding unsigned comment added by 94.126.240.2 (talk) 08:12, 10 July 2015 (UTC)

Hi, thanks for your suggestions. I have added a 'Clear' button and files can now be dropped onto the text areas. Unfortunately, a case insensitive option would require major code changes of the library. Cacycle (talk) 17:05, 29 July 2015 (UTC)
I was afraid that'd be the case. The other changes (I tweaked the filename display to add the modified date) work like a charm! :-) Also, I tested with 'subtitle' files, in srt format, resulting in an unresponsive, neverending execution, perhaps related to so many differing timestamps. — Preceding unsigned comment added by 193.228.187.242 (talk) 12:50, 30 July 2015 (UTC)
Update: I finally got around to try a couple simple tweaks to make the tool even more useful: a "compare as lower case" checkbox, which just converts toLowerCase the datastrings to be compared, as a kind of poor man's 'Ignore Case' option, and also a "Coalesce Whitespace" checkbox, which just "compresses" tabs and spaces to single whitespace before launching the diff, as a kind of poor man's 'Ignore spacing' option. I'm now wondering about a "trim leading/trailing spaces" checkbox. :-) — Preceding unsigned comment added by 193.127.207.152 (talk) 10:46, 23 November 2015 (UTC)

## A possible improvement

Hello! Please have a look at this diff, it clearly shows some room for improvements in wikEdDiff. If possible, it would be much better not to display changes as two text moves, and be closer to how the "traditional" diff displays those changes. Hope you'll find this report helpful. — Dsimic (talk | contribs) 08:38, 25 July 2015 (UTC)

Another example is this diff – although being of different nature, displaying those changes in a way closer to the "traditional" diff would also be beneficial. If possible, of course. :) — Dsimic (talk | contribs) 08:59, 25 July 2015 (UTC)
Dsimic: thanks for your feedback. These are edge cases that have to do in what order the texts are split into smaller entities for comparison (i.e. first lines, then chunks including templates, then words). There is probably no simple way to catch these. Every method has these problems. Cacycle (talk) 17:23, 29 July 2015 (UTC)
Cases that are sensitive to the order of calculation... I can think of a good way to deal with this, but it would need a major change to the way the code works...
You would need to specify a cost function that you want to minimise, and then try different steps and go with the answer that gives you the lowest value of the cost function. For example the cost could be
${\displaystyle \sum _{\forall d}{\sqrt {d.length}}+\sum _{\forall a}{\sqrt {a.length}}+\sum _{\forall m}{\sqrt {m.length+m.distance}}}$
where a, d and m are additions, deletions and moves, respectively.
I'm not saying the above cost function is perfect. It can probably be improved just by thinking about it and could definitely be improved by trial and error, once such a system has been developed.
Using this approach would mean than calculating a diff would be an optimisation problem. There are many ways to solve optimisation problems. For example, we could try calculating the diff using several existing methods and then just use the version that gives the lowest cost... but it might be more clever to use an iterative approach.
Yaris678 (talk) 12:26, 5 August 2015 (UTC)
You can also backtrack, giving up on a diff calculation approach when it becomes more "costly" than the already found "cheapest" one. — Dsimic (talk | contribs) 13:28, 5 August 2015 (UTC)
Dsimic, Yaris678: The main problem is how to detect possible solutions and what entities to use to calculate your costs. And more importantly: your mathematically optimal solution will not always be what you intuitively think it should be! You do have to consider human editing behavior and statistics. Beside that: see KISS principle :-) Cacycle (talk) 12:16, 13 August 2015 (UTC)
Totally agreed, that absolutely wouldn't be a walk in the park. :) The KISS principle is good, but if we can have more usable results with some additional logic in place, taking that route would IMHO be a good thing. Here are a few sources we could use as a starting point:
Thoughts? — Dsimic (talk | contribs) 18:50, 13 August 2015 (UTC)
Dsimic: A mathematically optimal solution is usually not intuitive and does not reflect what has actually happened during the editing process. Sure, wikEd is not always optimal, but then there can never be an optimal solution - because the actual editing process is hidden from us. We can only take educated guesses and formalize them (e.g. that blocks of certain size (paragraphs, lines, sentences, words) are often moved or changed in one piece). Handling text is completely different from diffing code where you are interested mainly in changed lines for the purpose of merging versions. Cacycle (talk) 10:22, 1 October 2015 (UTC)
That's all true, at least to a certain extent, but what keeps me intrigued is that I often see more usable diffs produced by the "old" diff displayed beside wikEdDiff. If we could have good parts from the "old" diff combined into wikEdDiff, that would be awesome. — Dsimic (talk | contribs) 10:47, 1 October 2015 (UTC)

## Font family for the displayed diffs

Hello! Would it be possible to configure wikEdDiff to display the diffs using a monospaced font? I already had a look at the JavaScript source code, and it seems like it should be configurable, but thought to ask here before spending a lot of time on trials and errors. Any help would be appreciated! — Dsimic (talk | contribs) 18:10, 16 August 2015 (UTC)

Dsimic: try adding this to User:Dsimic/common.js: Cacycle (talk) 10:42, 1 October 2015 (UTC)
window.wikEdConfig = {};
wikEd.config.diffCSS = {
'.wikEdDiffFragment': 'font-family: monospace,Courier;'
};

Thank you very much, I'll try it out. — Dsimic (talk | contribs) 15:04, 1 October 2015 (UTC)
Produces multiple errors beginning with Expected LBRACE at line 4 [your line 1], col 20. No apparent change to display. ―Mandruss  12:10, 3 February 2016 (UTC)

## "Use of "wgServer" is deprecated. Use mw.config instead."

On all pages I visit on Wikipedia, I get the following in my Console: "Use of "wgServer" is deprecated. Use mw.config instead."

I'm guessing it's probably this script? Since it gets the wg variables directly, rather than through mw.config.get.

Any chance the script could be updated to use mw.config.get?

Thanks! Gary (talk · scripts) 18:41, 22 August 2015 (UTC)

Lets ping Cacycle :) --Edgars2007 (talk/contribs) 09:53, 1 October 2015 (UTC)

## Python port

Hello, I have ported the great wikEdDiff library to Python: python-wikeddiff. Is it OK to use "wikEdDiff" as part of the port's name? Should I change anything else in the description or licensing?

I don't plan to do any further development on the diff engine, except for writing an ANSI color formatter. I will try to keep the port in sync with fixes to the JavaScript library and report back any issues relevant to the original code.

Are you also interested in simplifications of the data structures and algorithms to possibly make other ports more easy? For instance, there is no direct counterpart for null in Python (and many other languages) and mixing true, false and null for assumably boolean variables (e.g. the .fixed property of groups) is probably not the greatest idea. I think that the only relevant place (the main loop in the insertMarks method/function) can be fixed by considering also the .oldNumber property in addition to .fixed (see [2]).

-- Lahwaacz (talk) 10:09, 16 September 2015 (UTC)

Lahwaacz: that is really cool! Of course you can call it wikEdDiff if it is a port and not a fork. If you give me detailed instructions I will add them to the JavaScript and PHP versions. Cacycle (talk) 10:50, 1 October 2015 (UTC)
Do you have a strong opinion on using GPL over PD? I am OK with closed source use of my MediaWiki scripts. Cacycle (talk) 11:03, 1 October 2015 (UTC)

## common question - color change

Hello, sorry for asking such a common question, but.. How to change the colors? In the manual it is said to use CSS, but adding styles to my common.css does not help. Firebug says that styles are defined as inline, !important cantt help neither. Adding some variables to the js is not clear, because wikEdDiffConfig.stylesheet is defined as a plain text and I dont know how to customize it partly. Thanks for the answer. The-city-not-present (talk) 20:00, 27 November 2015 (UTC)

Moreover, for using !important I get a warning, I shouldnt do this? The-city-not-present (talk) 20:04, 27 November 2015 (UTC)

Sorry for false representation, !important started to work, maybe I did some typo when first tried this. The-city-not-present (talk) 20:06, 27 November 2015 (UTC)

## Installation on own Mediawiki, works with resource loader debug mode only

• added the wikEdDiff JS-code to MediaWiki:Gadget-wikEdDiff.js of my own MediaWiki installation
• activated the gadget → the wikEdDiff-button appears, but pressing it has no effect
• JavaScript-debugger (Chrome 47.0.2526.106) shows the error message at line 1548 sel.collapseToEnd();
Uncaught InvalidStateError: Failed to execute 'collapseToEnd' on 'Selection': there is no selection.wikEd.DiffWrapperHandler @ load.php?debug=false&lang=en&modules=ext.gadget.DotsSyntaxHighlighter%2CwikEdDiff|ext.headertabs|jq…:49
• then I enabled \$wgResourceLoaderDebug = true; in my LocalSettings.php (?debug=true as parameter does not work in version comparison)
• wikEdDiff is working now
• still I would like to get it without the debug mode, any suggestions? Might be there any conflicts with other extensions or libraries?
• MediaWiki 1.25.1

--Escalator~enwikibooks (talk) 09:25, 14 January 2016 (UTC)

## wikEdDiff on the fritz

wikEdDiff is on the fritz. Go to any English Wikipedia talk page → click on New section link at top of page → click on the Changes or Show changes button at the bottom of the edit window → enable wikEdDiff → page appears to be blanked.

See Phabricator for screen shot. Cheers! {{u|Checkingfax}} {Talk} 14:22, 20 February 2016 (UTC) @Cacycle, Edgars2007, and Redrose64: {{u|Checkingfax}} {Talk} 14:27, 20 February 2016 (UTC)

Hi Checkingfax, thanks for reporting this, I will check into it. The problem simply seems to be that wikEdDiff fetches the wrong old version (i.e. the whole article instead of the non-existing new section) for comparison. There is no risk of losing content. Cacycle (talk) 15:17, 20 February 2016 (UTC)
Dear Cacycle. Yes, that is why I couched my report here with the word "appears" . For now, wikEdDiff is fairly useless for doing a wide improved/integrated Diff on Talk page adds or edits. Cheers! {{u|Checkingfax}} {Talk} 22:56, 22 February 2016 (UTC)

## Trouble report: wikEdDiff is erroneously reporting "no difference"

Hi Cacycle. In this diff on Kazi Nazrul Islam, the single column improved wikEdDiff is showing (no difference) but the edit history showed a 48b change so I knew there should be a difference so I scrolled down to the 2-column standard Wikipedia diff view and sure enough there were lots of little changes. Cheers! {{u|Checkingfax}} {Talk} 03:24, 24 February 2016 (UTC)

## Trouble report: Wide diff showing extra edits

Hi, Cacycle. The wide diff here shows me adding HTML escape codes for non-breaking spaces, which I did not add. You can see in the normal diff view, below the wide diff view, that I did not add them. Ping me back. Cheers! {{u|Checkingfax}} {Talk} 19:43, 15 April 2016 (UTC)

## Minor feature request

Is it possible to show diff after the line "(n intermediate revisions by k users not shown)"? Otherwise when the diff is large one can think that this is the difference made only by the last edit. Example: [3]. Alexei Kopylov (talk) 17:49, 15 June 2016 (UTC)

## RevisionSlider & WikEdDiff interaction

Hi! You are receiving this message as it looks like you have a copy of the WikEdDiff user script in your user space on this wiki.

When using the RevisionSlider and WikEdDiff together WikEdDiff will not function correctly when the RevisionSlider is used to load a new diff. This can be fixed by adding a simple hook listener to your copy.

You can find the relevant phabricator ticket here which contains the code that you will need to add to your copy of the script (in most cases). Please also use this ticket for further questions & discussion.

·addshore· talk to me! 11:35, 23 September 2016 (UTC)
Fixed in https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js&diff=741585034&oldid=630494053 ·addshore· talk to me! 12:25, 28 September 2016 (UTC)

## Diff with trailing whitespaces

Here is a diff [4] which merely converts HTML table syntax  <th> </th> <tr> </tr> <td> </td>  into pipe synthax  ! |- | , leaving the table content intact. wikEdDiff parses it spectacularly well - except for several rows where the user added a trailing white space to cell contents, which wikEdDiff treats as a block move (see Church Organ, Funk Guitar, and Telephone). I played with the wikEdDiff online tool to see if tweaking the parameters would help, but no luck. Is there a simple fix for this?--Dmitry (talkcontibs) 22:14, 6 October 2016 (UTC)

## Problem: wikEdDiff not showing most of the times

It has been a while (maybe more than a month) that I'm having problems with wikEdDiff. The tool does not show most of the times, apparently at random. After reloading several times the diff page, eventually it would show up. I am using Google Chrome (last version) and I activated the tool from Preferences>Gadgets. It seems I have the same problem also on Firefox and Edge. It is a great tool and I am really missing it, so I would really like to fix this! Thanks for all the work!! --Ita140188 (talk) 17:11, 7 November 2016 (UTC)

I've been having the problem too, but more consistently—the improved diff version never appears. I use Firefox and I have wikEdDiff selected in my Preferences>Gadgets page. Is this the place to report it or should I go elsewhere? --SteveMcCluskey (talk) 17:54, 7 November 2016 (UTC)
Same problem with Google Chrome and Safari. Alexei Kopylov (talk) 04:16, 9 November 2016 (UTC)
+1 Win10 Firefox 49.0.2. One or two page refreshes usually gets it. ―Mandruss  05:07, 9 November 2016 (UTC)
Thanks for the suggtestion. I found the procedures on this Firefox support page describing how to force a complete page refresh to solve my problem. --SteveMcCluskey (talk) 14:36, 12 November 2016 (UTC)
Hmmm. I've just been using the normal refresh button at the right end of the address bar. Actually the tooltip you get when you mouseover that button is "Reload current page", not refresh. ―Mandruss  15:31, 12 November 2016 (UTC)
I'm having the same problem on Chrome, Win 10 for about the same duration as the others. Seemed to have started about a week and change ago. Sometimes refreshing helps, but sometimes it does not. Blowing out my history and cookies and all that hasn't resolved the issue either. I haven't changed any of my other Wikipedia settings. Firefox seems to be unaffected, but I don't care to use Firefox at present. Cyphoidbomb (talk) 01:45, 19 November 2016 (UTC)

I also have had this problem for some time (a month or three?). It used to be random, but lately it seems not to work at all. Since I'm stubbornly still using Internet Explorer 11 on Windows 10, I had assumed you'd simply stopped supporting it. --Ørjan (talk) 05:18, 26 November 2016 (UTC)

Just after I posted this, it happened to work on a page again, once (ironically, on User talk:Cacycle/wikEd). Further repeated tries didn't work, even for the same diff. --Ørjan (talk) 05:37, 26 November 2016 (UTC)

Any updates on this? I've noticed wikEdDiff working sporadically for the past few months now. Recently it stubbornly refuses to work on Wikipedia no matter what I do, though for some reason it works fine on Wikia (Strange cause I usually expect things to break on Wikia, given their history). —k6ka 🍁 (Talk · Contributions) 20:24, 18 December 2016 (UTC)

@K6ka: I'm getting the impression in the last few days that it's working better again, knock on wood. In fact right now I don't seem able to get it to break... --Ørjan (talk) 06:31, 26 January 2017 (UTC)
Working better for me too recently, still not showing up sometimes though --Ita140188 (talk) 08:11, 26 January 2017 (UTC)
Yes, it's working a bit better for me right now. It's working... most of the time. Occasionally it still fails to load, but I see the button appearing more and more often now. —k6ka 🍁 (Talk · Contributions) 12:27, 26 January 2017 (UTC)

## Is It Possible for wikEdDiff to Show Differences Without Wikitext and HTML Markup?

Can wikEdDiff show differences on the rendered HTML (i.e. how the page appears in the article), as opposed to showing differences on the raw wikitext and HTML markup? John P New 22:14, 6 April 2017 (UTC) — Preceding unsigned comment added by John p new (talkcontribs)

## wikEdDiff not working in Pale Moon

About a month ago, I switched from Firefox to Pale Moon, a fork of that project. Since then, wikEdDiff doesn't work—which I consider strange, because wikEd doesn't seem any different. None of the other Wikipedia preferences, gadgets, or scripts I have seem to have been impacted negatively by the change in browsers.

When I click on the button with the green triangle to show the improved diff, the text box opens with three dots in it. In Firefox that would last a second or so and the diff would appear in the text box. In Pale Moon, nothing happens except that the cursor spins if I hold it over the button with the green triangle. If I click on the button again, the text box closes and the cursor stops spinning.

I use Pale Moon 27.5.1 in Windows 7. I have a host of warnings in the Error Console, of which these are a few examples:

Warning: Error in parsing value for 'background-image'. Declaration dropped.
Warning: Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped.
Warning: Unknown property 'zoom'. Declaration dropped.
Warning: Expected ';' or '}' to terminate declaration but found '!'. Declaration dropped.

I've never looked at the Error Console before, so I don't know if I've had warnings in the past or if that's something new to Pale Moon.

Any suggestions would be appreciated. I can provide a list of my browser extensions if that would be helpful. Thank you. — Malik Shabazz Talk/Stalk 05:56, 3 November 2017 (UTC)

I don't know whether it has to do with changes in the Pale Moon code—there have been a few updates and the version number is now 27.6.1—but I tried using wikEdDiff again today and it's working fine. — Malik Shabazz Talk/Stalk 21:38, 19 November 2017 (UTC)

## Bug when strip trailing newline

Inside the diff function the is a little mistake at line 944:
if ( newString.substr( -1 ) === '\n' && oldString.substr( -1 === '\n' ) ) {

And here the correction:
if ( newString.substr( -1 ) === '\n' && oldString.substr( -1 ) === '\n' ) {`

## Highlights in old and new versions?

I like this so much!

• highlight deleted text from Old Version (OV)
• highlight inserted text from New Version (NV)
• highlight moved text in both OV and NV
• save a session - to allow for longer test sessions
• ignore white space changes - to reduce trivial change clutter - an option?
• ignore (or otherwise indicate) capitalisation changes - to reduce trivial change clutter - an option?
• somehow highlight text from either OV or NV or Diff when mouse hovers over text in any other windows - to show where text came from or went to. — Preceding unsigned comment added by Philcolbourn (talkcontribs) 04:33, 16 November 2018 (UTC)

## A bug

Hello. There is a new bug in the tool, and I'll be glad if you could fix it. Reproduction steps:

1. Go to Firefox.
2. Open some revisions diff.
3. Double click on some word in the diff.
4. Expected: the word gets blue background color, so it can be copied to clipboard. Got: the word blinks for a second.
5. A triple click works fine, the whole line is colored.

Thank you, IKhitron (talk) 16:40, 9 July 2019 (UTC)

Same behavior in the "standard" part of the diff, but only if this gadget is enabled. The problem doesn't affect me—I don't double-click anything to select it—but I just wanted to note this as it might help with diagnosis. ―Mandruss  16:53, 9 July 2019 (UTC)

## Activated by default

This is one of the most used gadgets and I've found new users find it much more intuitive than the standard paragraph-by-paragraph viewer (especially for small changes). Is there the possibility for it to be activated by default? T.Shafee(Evo&Evo)talk 05:34, 11 July 2019 (UTC)