MediaWiki:Gadget-Doppel-s-Schreibung.js

From Wikivoyage association
Revision as of 09:39, 14 November 2010 by RolandUnger (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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: Clear the cache in Tools → Preferences
// Uebernommen von http://de.wikipedia.org/wiki/MediaWiki:Gadget-Doppel-s-Schreibung.js
// JavaScript zum Ändern aller "ß" in allen Artikeln, Portalen und Kategorien nach "ss".
// Alleinstehende "ß" werden nicht geändert.
 
// Die Rechtschreibprüfung (Wikipedia:Helferlein/Rechtschreibprüfung) muss schweizerisch sein
var RP_CH = true;
 
function text_sz_to_ss(text) {
  return text.replace(/([\wäöü])ß/gi, "$1ss")
             .replace(/ß([\wäöü])/gi, "ss$1");
}
 
function node_sz_to_ss(node) {
  if (node.nodeType == 3) {
    node.data = text_sz_to_ss(node.data);
  } else {
    for (var i=0; i<node.childNodes.length; i++) {
      if ((node.id != 'editform') && (node.className != 'Zitat'))
        node_sz_to_ss(node.childNodes[i]);
    }
  }
}
 
function document_sz_to_ss() {
  if ( wgNamespaceNumber == 0 || wgNamespaceNumber == 6 || wgNamespaceNumber == 14 || wgNamespaceNumber == 100 ) {
    var node = document.getElementsByTagName('body')[0];
    document.title = text_sz_to_ss(document.title);
    node_sz_to_ss(document.getElementById('content'));
  }
}
 
addOnloadHook(document_sz_to_ss);
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox