MediaWiki:Onlyifediting.js

From MandrakeWiki

Note: After publishing, 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: Press Ctrl-F5.
function addCharSubsetMenu() {
  var specialchars = document.getElementById('specialchars');

  if (specialchars) {
    var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
    menu += "<option>Standard</option>";
    menu += "<option>WikiSyntax</option>";
    menu += "<option>IPA-Lautschrift</option>";
    menu += "<option>Lateinisch</option>";
    menu += "<option>AHD</option>";
    menu += "<option>Altenglisch</option>";
    menu += "<option>Altgriechisch</option>";
    menu += "<option>Arabisch</option>";
    menu += "<option>DMG-Umschrift</option>";
    menu += "<option>Esperanto</option>";
    menu += "<option>Estnisch</option>";
    menu += "<option>Französisch</option>";
    menu += "<option>Galicisch</option>";
    menu += "<option>Griechisch</option>";
    menu += "<option>Hawaiianisch</option>";
    menu += "<option>Isländisch</option>";
    menu += "<option>Italienisch</option>";
    menu += "<option>Jiddisch</option>";
    menu += "<option>Katalanisch</option>";
    menu += "<option>Kroatisch</option>";
    menu += "<option>Kyrillisch</option>";
    menu += "<option>Lettisch</option>";
    menu += "<option>Litauisch</option>";
    menu += "<option>Maltesisch</option>";
    menu += "<option>Pinyin</option>";
    menu += "<option>Polnisch</option>";
    menu += "<option>Portugiesisch</option>";
    menu += "<option>Romanisch</option>";
    menu += "<option>Rumänisch</option>";
    menu += "<option>Serbisch</option>";
    menu += "<option>Skandinavisch</option>";
    menu += "<option>Slowakisch</option>";
    menu += "<option>Spanisch</option>";
    menu += "<option>Tschechisch</option>";
    menu += "<option>Türkisch</option>";
    menu += "<option>Ungarisch</option>";
    menu += "<option>Vietnamesisch</option>";
    menu += "</select>";
    specialchars.innerHTML = menu + specialchars.innerHTML;
    
    // Standard-CharSubset
    chooseCharSubset(0);
  }
}

// CharSubset-Auswahl
function chooseCharSubset(s) {
  var l = document.getElementById('specialchars').getElementsByTagName('p');
  for (var i = 0; i < l.length ; i++) {
    l[i].style.display = i == s ? 'inline' : 'none';
  }
}

addOnloadHook(addCharSubsetMenu);