User:GoldenRing/difflist.js

$(document).ready( function { var diff_list = $('li[data-mw-revid]');  if(diff_list.length == 0) return;

$('div#p-views ul').append($(' Diffs ')); $('div#p-views').removeClass('emptyPortlet');

$('a#ca-fetch').click( function { var api_url = "https://en.wikipedia.org/w/api.php";  var table = $(' ');  table.css('width', '100%');  var form = $('form#mw-history-compare');  if(form.length == 0) form = $('form.mw-contributions-form');

form.append(table);

$('li[data-mw-revid]').each(function( id, element ) {   $.ajax(api_url, { data: { action: 'query', format: 'json', prop: 'revisions', rvprop: 'user|parsedcomment|timestamp|flags|size|tags', rvdiffto: 'prev', revids: $(element).attr('data-mw-revid') },     success: function(data) { tr = $(' ' + $(element).html + ' ') table.append(tr); pageids = $.map(data.query.pages, function(_,i) { return i; } ); table.append(data.query.pages[pageids[0]].revisions[0].diff['*']); $(element).remove; $('tr:has(td.diff-context)').remove; //       $('li>table>tbody>tr>td.diff-empty').attr('width', '47%'); //       $('td.diff-marker').attr('width', '2%'); $('td.diff-addedline').css( {         'border-color': '#a3d3ff',          'border-style': 'solid',          'border-width': '1px 1px 1px 4px'        });//.attr('width', '47%'); $('td.diff-deletedline').css( {         'border-color': '#ffe49c',          'border-style': 'solid',          'border-width': '1px 1px 1px 4px'        });//.attr('width', '47%'); $('ins').css({         'text-decoration': 'none',          'background-color': '#a3d3ff'        }); $('del').css({         'text-decoration': 'none',          'background-color': '#ffe49c'        }); $('table.diff-table td').css({         'word-wrap': 'break-word'        }); }   });  }); }); });