User:Connel MacKenzie/sidebar.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.

function addNavigation(myHref, myText, myComment) {
  var newnav = document.createElement('li');
  var newa = document.createElement('a');
  newa.href = myHref ;
  newa.appendChild(document.createTextNode( myText ));
  newnav.appendChild(newa);
  wiktLastNav.parentNode.appendChild(newnav);
  ta[myText] = new Array('', myComment );
}

 // add "favorites" to navigation box thing on left column
function addToNav() {
  wiktLastNav = document.getElementById('n-sitesupport');
  var newnav;
  var newa;

 //First fix the Special:RC link that pathetically starts at "all"
 links=document.links;
 for (var i=0;i<links.length;i++) {
   if (links[i].href == "http://en.wiktionary.org/wiki/Special:Recentchanges") {
     links[i].href = "http://en.wiktionary.org/wiki/Special:Recentchanges/hidepatrolled" ;
    }
 }     

  // get page title
  var pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue;
  if (!pagetitle) pagetitle = wgPageName;
  if (pagetitle.search(/Search/) != -1) {
    pagetitle = document.getElementById('searchInput').value;
  }
  pagetitle = pagetitle.replace(/Editing /g, "");
  var pageexternal = pagetitle.replace(/\ /g, "_");
  var pageext =      pagetitle.replace(/\ /g, "+");

  addNavigation( 'http://connelm.homelinux.com/cgi-bin/clean', 'Cleanup random', 'Clean up a random cleanup entry that has incorrect third level headings (with no repeats until list is entirely cleared)' );

  addNavigation( 'http://tools.wikimedia.de/~cmackenzie/rnd-en-wikt.html', 'Random English term', 'A random page that is actually relevant to this project' );

  addNavigation( '/wiki/Wiktionary:Beer parlour', 'Beer Parlor', 
    'The rowdy place where policies are discussed in a chaotic manner' );

 //[[w:pagetitleexternal|w:pagetitle]]
 if (pagetitle.search(/Wiktionary:/) == -1) {
  addNavigation( '/wiki/w:' + pageexternal, 'w: ' + pagetitle, 
    'Wikipedia quicklink for this same title' );
 } else {
  // avoid links that return back here but just going to my watchlist there.
  addNavigation( '/wiki/w:Special:Watchlist', 'w: Watchlist', 'Wikipedia watchlist');
 }

 if ( pagetitle.search(/^Transwiki/) != -1) {
   var realpage = pagetitle.replace(/Transwiki:/g, "");
//   realpage = lowercasefirstchar( realpage );
   var realpagee = realpage.replace(/ /g, "_");
   var realpage2 = realpage.replace(/ /g, "+");
  pagetitle = realpage;
  pageexternal = pagetitle.replace(/\ /g, "_");
  pageext =      pagetitle.replace(/\ /g, "+");
   addNavigation( '/wiki/Special:Search/' + realpagee, realpage, realpage );
   addNavigation( '/wiki/Talk:' + realpagee, 'Talk:'+realpage, 'Talk:'+realpage);
   addNavigation( '/wiki/Transwiki_talk:' + realpagee, 'TWtalk:' + realpage, 'TWtalk:' + realpage);
   addNavigation( 'http://en.wikipedia.org/wiki/'+realpagee, 'w:' + realpage, 'w:' + realpage);
   addNavigation( '/wiki/WT:TW', 'WT:TW', 'WT:TW');
   addNavigation( 'http://en.wikipedia.org/wiki/WP:TL', 'WP:TL', 'WP:TL');
 }

 if ( pagetitle.search(/^User/) != -1 ) {
  var username = pagetitle.replace(/User:/g, "");
  username = username.replace(/User talk:/g, "");
  var usernamee = username.replace(/ /g, "_");
  var username2 = username.replace(/ /g, "+");
  addNavigation( '/wiki/' + pageexternal, pagetitle, pagetitle );
  addNavigation( '/wiki/User talk:' + usernamee, 'Talk', 'Talk: ' + usernamee);
  addNavigation( '/wiki/Special:Contributions/' + usernamee, 'Contribs', 'Contributions of ' + usernamee);
  addNavigation( '/w/index.php?title=Special:Log&type=block&page=' + username, 'Block log', 'Block log ' + username);
  addNavigation( '/wiki/Special:Blockip/' + usernamee, 'Block', 'Block ' + username);
  addNavigation( '/w/index.php?title=Special:Log&user=' + usernamee, 'Logs', 'Logs for ' + username);
  addNavigation( '/w/index.php?title=Special%3AListusers&group=&username=' + username2, 'IsUser?', 'Check account creation for ' + username);
  return;
 }

 if ( pagetitle.search(/^Wik/) != -1 ) return;

 //[http://machaut.uchicago.edu/cgi-bin/WEBSTER.sh?WORD={{PAGENAME}} ARTFL:{{PAGENAME}}]
  addNavigation( 'http://machaut.uchicago.edu/?action=search&word=' + pageext + '&resource=Webster\'s&quicksearch=on', 'ARTFL:' + pagetitle, 'Check for this title in Websters 1913 Dictionary');

 //[http://books.google.com/books?q={{PAGENAME}}&btnG=Google+Search Google:{{PAGENAME}}]
  addNavigation( 'http://books.google.com/print?q=%22' + pageext + '%22', 'Google:' + pagetitle, 'Check for this title using Google books');

 //[http://news.google.com/
  addNavigation( 'http://news.google.com/news?q="' + pageext + '"', 'G-news:' + pagetitle, 'Check for this title using Google news');


 /*
  Tracking down copyvios isn't so hard, when the most likely
 suspects are the ones that are ALWAYS used.  Still, as other 
 online sources are found, they should be added to this list,
 if we are to remain vigilant.
 */
 //http://www.bartleby.com/cgi-bin/texis/webinator/ahdsearch?search_type=enty&query={{PAGENAME}}&db=ahd&Submit=Search (AHD)
  addNavigation( 'http://www.bartleby.com/cgi-bin/texis/webinator/ahdsearch?search_type=enty&query=' + pageext + '&db=ahd&Submit=Search', 'AHD:' + pagetitle, 'Check for this title using American Heritage Dictionary');

 //http://dictionary.cambridge.org/results.asp?searchword={{PAGENAME}}&x=0&y=0
  addNavigation( 'http://dictionary.cambridge.org/results.asp?searchword=' + pageext + '&x=0&y=0', 'Cambr:' + pagetitle, 'Check for this title using Cambridge');

 //http://dictionary.reference.com/search?q={{PAGENAME}}   (dict:)
  addNavigation( 'http://dictionary.reference.com/search?q=' + pageext, 'd.com:' + pagetitle, 'Check for this title using dictionary.reference.com');

 //http://m-w.com/dictionary/{{PAGENAME}}
  addNavigation( 'http://m-w.com/dictionary/' + pageext, 'm-w:' + pagetitle, 'Check for this title using Mirriam-Webster');

 //http://wordnet.princeton.edu/perl/webwn?s={{PAGENAME}}  WordNet:{{PAGENAME}}
  addNavigation( 'http://wordnet.princeton.edu/perl/webwn?s=' + pageext, 'wordnet:' + pagetitle, 'Check for this title using Wordnet');

 //http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query={{PAGENAME}}&action=Search FOLDOC:{{PAGENAME}}
  addNavigation( 'http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=' + pageext + '&action=Search', 'FOLDOC:' + pagetitle, 'Check for this title using FOLDOC');

 //http://www.altavista.com/web/results?itag=wrx&q={{PAGENAME}}&kgs=0&kls=0 Altavista:{{PAGENAME}}
  addNavigation( 'http://www.altavista.com/web/results?itag=wrx&q=' + pageext + '&kgs=0&kls=0', 'AltaV:' + pagetitle, 'Check for this title using AltaVista');

 //http://www.urbandictionary.com/define.php?term={{PAGENAME}} Urban:{{PAGENAME}}
  addNavigation( 'http://www.urbandictionary.com/define.php?term=' + pageext, 'Urban:' + pagetitle, 'Check for nonsense entry');

 //http://www.slangcity.com
  addNavigation( 'http://www.google.com/search?q=' + pageext + 
   '&btnG=Google+Search&domains=http:www.slangcity.com&sitesearch=http:www.slangcity.com',
   'SlangD:' + pagetitle, 'Check for nonsense entry');

  addNavigation( 'http://encarta.msn.com/dictionary_/' + pageext + '.html', 'Encarta:' + pagetitle, 'See what Microsoft says');

 //http://www.ipni.org/ipni/simplePlantNameSearch.do
 //Botany copyvio search
  addNavigation( 'http://www.ipni.org/ipni/simplePlantNameSearch.do?find_wholeName=' +
    pageext + '&output_format=normal&query_type=by_query&back_page=query_ipni.html', 
    'Botany:' + pagetitle, 'Botany lookup on ipni');

  //http://plants.usda.gov/java/nameSearch
  addNavigation( 'http://plants.usda.gov/java/nameSearch?keywordquery=' +
    pageext + '&mode=sciname&submit.x=11&submit.y=15', 
    'Plants:' + pagetitle, 'Botany lookup on USDA plants');

 //http://simbad.u-strasbg.fr/simbad/sim-id?protocol=html&Ident=Red+Rectangle
  addNavigation( 'http://simbad.u-strasbg.fr/simbad/sim-id?protocol=html&Ident=' + pageext,
    'Astronomy:' + pagetitle, 'Astronomy') ;

 //Probably good to have these links, to prove that our defs are generally different?  Perhaps also to search for copyvios quickly.  Hmmm.
 //yahoo.com, + collins + answers.com + Jargon file + about.com (circular)

}