User:SiBr4/DiffApostrophes.js

/*

This script adds 0.1em of padding around apostrophes ('') in diffs, to ease distinguishing them from quotation marks ("). See Village pump (technical)/Archive 139.

Install by adding the following row to your Special:MyPage/common.js or Special:MyPage/skin.js:

importScript('User:SiBr4/DiffApostrophes.js');



function repapos(elem) { elem.innerHTML = elem.innerHTML.replace(/(?<!<[^>]+)\'/g,"' "); } var diff = document.getElementsByClassName("diff")[0]; if (diff) { var del = diff.getElementsByClassName("diff-deletedline"); for (i=0; i<Math.min(del.length,50); i++) {repapos(del[i]);} var add = diff.getElementsByClassName("diff-addedline"); for (i=0; i<Math.min(add.length,50); i++) {repapos(add[i]);} var ctx = diff.getElementsByClassName("diff-context"); for (i=0; i<Math.min(ctx.length,50); i++) {repapos(ctx[i]);} }