Jump to content

User:Raphael1/monobook.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 collapseCaption = "hide";
var expandCaption = "show";

var hide_offer = 'Even though Wikipedia is not censored, we do respect the religious sentiments of our readers. When you click <a onClick=\"collapseAllTables();\" href=\"#\">here</a> all depictions of Muhammad will be hidden on this page.';
var show_offer = 'Currently all depictions of Muhammad on this page are hidden. You can make them all at once visible again by clicking <a onClick=\"expandAllTables();\" href=\"#\">here</a>.';


$( function() {
  var ambox_text = document.getElementById('ambox_text');
  if (ambox_text) ambox_text.innerHTML = hide_offer;
});

function collapseAllTables() {
  for (var tableIndex=0; tableIndex < 50; tableIndex++) {
    var Table = document.getElementById("collapsibleTable" + tableIndex);
    var Button = document.getElementById( "collapseButton" + tableIndex );
    if ( Table && Button && ( Button.firstChild.data == collapseCaption )) collapseTable(tableIndex);
  }
  document.getElementById('ambox_text').innerHTML = show_offer;
}

function expandAllTables() {
  for (var tableIndex=0; tableIndex < 50; tableIndex++) {
    var Table = document.getElementById("collapsibleTable" + tableIndex);
    var Button = document.getElementById( "collapseButton" + tableIndex );
    if ( Table && Button && ( Button.firstChild.data == expandCaption )) collapseTable(tableIndex);
  }
  document.getElementById('ambox_text').innerHTML = hide_offer;
}