User:Hippietrail/headingtooltips.js

/*

// add tooltips to standard headings function headingToolTips {

// only add heading tooltips in the article namespace if (document.getElementsByTagName('body')[0].className.match(/ns-0/)) {

// all level-2 headings are languages (or equivalents such as Translingual) var allh2s = document.getElementById('bodyContent').getElementsByTagName('h2');

if (allh2s != -1) { for (var i = 0; i < allh2s.length; i++) { allh2s[i].title = 'The language this term belongs to'; }   }

// level 3, 4, and 5 headings depend on their content var h345 = new Array('h3', 'h4', 'h5');

for (var j = 0; j < h345.length ; j++) {

var allh345s = document.getElementById('bodyContent').getElementsByTagName(h345[j]);

if (allh345s != -1) { for (var i = 0; i < allh345s.length; i++) {

// part of speech var ht = '';

ht = ht + allh345s[i].innerHTML.replace(/^(\d+(\.\d+)* )?(.*)/, "$3");

hack = ht;

if (ht == 'Adjective' || ht == 'Adverb' || ht == 'Interjection' || ht == 'Noun' || ht == 'Pronoun' || ht == 'Verb') { allh345s[i].title = 'Part of speech or function of this term';

} else if (ht == 'Alternative spellings') { allh345s[i].title = 'Other ways to spell this term in the same language'; } else if (ht == 'Anagrams') { allh345s[i].title = 'Terms spelled with the same letters in a different order'; } else if (ht == 'Antonyms') { allh345s[i].title = 'Terms with the opposite meaning in at least one sense'; } else if (ht == 'Etymology') { allh345s[i].title = 'The origin of this term'; } else if (ht == 'Derived terms') { allh345s[i].title = 'Terms which are derived through applying derivational suffixes etc.'; } else if (ht == 'Homophones') { allh345s[i].title = 'Terms with the same pronunciation as this term in at least one dialect or accent'; } else if (ht == 'Pronunciation') { allh345s[i].title = 'How to pronounce this term, possibly in various dialects'; } else if (ht == 'Related terms') { allh345s[i].title = 'Terms which are related etymologically other than simple derivations'; } else if (ht == 'See also') { allh345s[i].title = 'Terms which have a semantic relationship but not an etymological one'; } else if (ht == 'Synonyms') { allh345s[i].title = 'Terms with the same meaning in at least one sense'; } else if (ht == 'Translations') { allh345s[i].title = 'Equivalent terms in other languages'; } else if (ht == 'Usage notes') { allh345s[i].title = 'Things to keep in mind when using this term'; } else if (ht == 'References') { allh345s[i].title = 'Links to external language authorities'; } else if (ht == 'Usage') { allh345s[i].title = 'INVALID HEADING: Replace with "Usage notes" instead'; } else if (ht == 'Noun phrase') { allh345s[i].title = 'INVALID HEADING: Replace with "Noun" instead'; } else if (ht == 'Verb phrase') { allh345s[i].title = 'INVALID HEADING: Replace with "Verb" instead'; } else if (ht == 'Adverbial phrase') { allh345s[i].title = 'INVALID HEADING: Replace with "Adverb" instead'; } else {

// default case - warn that it's nonstandard (or just not handled yet) allh345s[i].title = 'This is not a standard Wiktionary heading'; }       }      }    }  } }

/*