MediaWiki:Common.js

From Billy Meier
Revision as of 19:31, 19 June 2019 by Jamesm (talk | contribs)

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 / Edge: 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. */

//collapsible table column test, based on: https://codepen.io/feger/pen/eDybC
$("#btnHideEnglish").click(function(){
  console.log ('Hiding first column of table with an id of report');
  $( "table#collapsible_report tbody tr th:nth-child(1)" ).toggle();
  $( "table#collapsible_report tbody tr td:nth-child(1)" ).toggle();
  if ($(this).text() == "[Hide English]"){
    $(this).text("[Show English]");
  } else {
    $(this).text("[Hide English]");
  }
});

$("#btnHideGerman").click(function(){
  console.log ('Hiding second column of table with an id of report');
  $( "table#collapsible_report tbody tr th:nth-child(2)" ).toggle();
  $( "table#collapsible_report tbody tr td:nth-child(2)" ).toggle();
  if ($(this).text() == "[Hide German]"){
    $(this).text("[Show German]");
  } else {
    $(this).text("[Hide German]");
  }
});


// uses table class 
$("#hideEnglish").click(function(){
  console.log ('Hiding first column of table with an id of report');
  $( "table .collapsible_table tbody tr th:nth-child(1)" ).toggle();
  $( "table .collapsible_table tbody tr td:nth-child(1)" ).toggle();
  if ($(this).text() == "[Hide English]"){
    $(this).text("[Show English]");
  } else {
    $(this).text("[Hide English]");
  }
});

$("#hideGerman").click(function(){
  console.log ('Hiding second column of table with an id of report');
  $( "table .collapsible_table tbody tr th:nth-child(2)" ).toggle();
  $( "table .collapsible_table tbody tr td:nth-child(2)" ).toggle();
  if ($(this).text() == "[Hide German]"){
    $(this).text("[Show German]");
  } else {
    $(this).text("[Hide German]");
  }
});