User:Connel MacKenzie/headingtooltips.js

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Note – after saving, you may have to bypass your browser’s cache to see the changes.

  • Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
  • Konqueror and Chrome: click Reload or press F5;
  • Opera: clear the cache in Tools → Preferences;
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.

/*
<pre>
*/

// add tooltips to standard headings
function headingToolTips() {
  var allh345s = document.getElementById('bodyContent').getElementsByTagName('h3', 'h4', 'h5');

  if (allh345s != -1) {
    for (var i = 0; i < allh345s.length; i++) {
      if (allh345s[i].innerHTML == 'Anagrams') {
        allh345s[i].title = 'Terms spelled with the same letters in a different order';
      } else if (allh345s[i].innerHTML == 'Antonyms') {
        allh345s[i].title = 'Terms with the opposite meaning in at least one sense';
      } else if (allh345s[i].innerHTML == 'Etymology') {
        allh345s[i].title = 'The origin of this term';
      } else if (allh345s[i].innerHTML == 'Derived terms') {
        allh345s[i].title = 'Terms which are derived through applying derivational suffixes etc.';
      } else if (allh345s[i].innerHTML == 'Homophones') {
        allh345s[i].title = 'Terms with the same pronunciation as this term in at least one dialect or accent';
      } else if (allh345s[i].innerHTML == 'Pronunciation') {
        allh345s[i].title = 'How to pronounce this term, possibly in various dialects';
      } else if (allh345s[i].innerHTML == 'Related terms') {
        allh345s[i].title = 'Terms which are related etymologically other than simple derivations';
      } else if (allh345s[i].innerHTML == 'See also') {
        allh345s[i].title = 'Terms which have a semantic relationship but not an etymological one';
      } else if (allh345s[i].innerHTML == 'Synonyms') {
        allh345s[i].title = 'Terms with the same meaning in at least one sense';
      } else {
        allh345s[i].title = 'This is not a standard Wiktionary heading';
      }
    }
  }
}

addOnloadHook( headingToolTips ) ;

/*
</pre>
*/