MediaWiki:Common.js

Revision as of 19:17, 27 November 2019 by Jason (talk | contribs) (restoring to old script that actually worked (sigh))

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */

// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// ==/ClosureCompiler==
function offerSortInline(){$(".infobox_lexicon_button").show()}
function applySort(){$("table.lexicon").addClass("sortable");$("table.lexicon tr.sublexgrabber").remove();mw.loader.using("jquery.tablesorter",function(){var a=$("table.sortable"),b=$("#wordsort");a.tablesorter();a.on("sortEnd.tablesorter",function(){b.hasClass("headerSortUp")?a.addClass("upsort").removeClass("downsort"):b.hasClass("headerSortDown")?a.removeClass("upsort").addClass("downsort"):a.removeClass("upsort").removeClass("downsort")})})}
function doApplySort(){$(".infobox_lexicon_sortbutton").hide();applySort()}function grabSubLexicon(a){a.html('<td colspan="3"><em>Loading...</em></td>').load(a.attr("data-sublexicon").replace(/ +/g,"_")+" table.sublexicon tr",function(a,c,d){"error"!=c&&$(this).text()?($(this).after($(this).html()),$(this).remove()):$(this).html('<td colspan="3">Error.</td>')}).off("click")}$("table.lexicon tr.sublexgrabber").click(function(){grabSubLexicon($(this))});var nexus=$("input[data-swapper][data-swap-interval]");
nexus.length&&nexus.each(function(){var a=$(this),b=$("#swap-override"),c=$("#swap-inverter"),d=a.attr("data-swapper"),f=a.attr("data-swap-interval");setInterval(function(){var e=a.prop("checked");b.prop("checked")||(c.prop("checked")?!e:e)||$("[data-swap-nexus="+d+"]").each(function(){var a=$(this).attr("data-swap").split(" "),e=a.shift();a.push(e);$(this).text(e).attr("data-swap",a.join(" "))})},f)});0<$("table.lexicon").length&&(offerSortInline(),$("#infoButton").click(function(){calculateInfo()}));
function calculateInfo(){var a=$("table.lexicon tr").not("tr.sublexgrabber"),b=a.length-1;$("span.lex_box_all").text(b);$("span.lex_box_undef").text(a.find("td:last-child[data-sort-value=ZZZZZ]").length);$("span.lex_box_uncr").text(a.find("td:first-child[data-sort-value=ZZZZZ]").length);$("span.lex_box_deriv").text(a.filter("tr.derivation").length);var c={},d=[],f=0;a.find("td:nth-child(2)").each(function(){var a=$(this).text().trim();""===a?f++:(a=a.replace("#","number").replace(/ +/g,"_"),c.hasOwnProperty(a)?
c[a]++:(c[a]=1,d.push(a)))});$("span.lex_box_uncat").text(f);a=0;for(b=d.length;a<b;a++)$("span.lex_box_cat_"+d[a]).text(c[d[a]])}$("span[title][data-title-override] a[title]").removeAttr("title");