Jump to content

User:Xeworlebi/replace.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
var replacements = [
  ["Series<br>\n#", "№"],
  ["Season<br>\n#", "#"],
  ["Series<br>\nepisode", "№"],
  ["Season<br>\nepisode", "#"],
  ["No. in<br>\nseries", "№"],
  ["No. in<br>\nseason", "#"],
  ["No. by<br>\nseries", "№"],
  ["No. by<br>\nseason", "#"],
  ["Series<br\>no.", "№"],
  ["Season<br\>no.", "#"],
  ["Story No.", "№"],
  ["Episode", "#"]
];

function runReplacement() {
  $(".wikitable th").each(function() {
    var $this = $(this);
    var ih = $this.html();
    $.each(replacements, function(index, value) {
      ih = ih.replace(value[0], value[1]);
    });
    $this.html(ih);
  });
}

$(runReplacement);