Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Please sign up or log in to edit the wiki.

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.
/*
<pre><nowiki>
*/ 

// IE is just barely compliant, if you use a deprecated style of
//  attribute setting
navigator.appVersion.indexOf("MSIE") > 0 ? isIE = true : isIE = false;

function spellMediawikiConsole()
{

  this.gadgetList = new Array();


  this.registerGadget = function(gadget)
  {
    this.gadgetList[this.gadgetList.length] = gadget;
  }

  this.format = function(gadgetId)
  {
    var gadget = this.gadgetList[gadgetId];

    /* if (! supportsRegexp()) { exit; } */

    this.textarea.focus();


}
  this.start = function()
  {
    var wps = document.getElementById('toolbar');
    if (! wps) {
      return;
    }

    for (i = 0; i < this.gadgetList.length; i++)
    {
      gadget = this.gadgetList[i];

      img = document.createElement("img");
      img.setAttribute("src", gadget.image1);
      anchor = document.createElement("a");
      anchor.setAttribute("href", gadget.link1);
      anchor.appendChild(img);

    }

    wps.appendChild(anchor);
  }

  this.setStatus = function(status)
  {
void(0);
  }
}

function setStyle(element, style)
{
  if (isIE) {
    element.style.cssText = style;
  } else {
    element.setAttribute("style", style);
  }
}


function TGAGadget()
{
  this.image1 = "http://tolkiengateway.net/w/images/e/e6/Button_sp.png";
  this.link1 = "javascript:checkdocspelling();";
}

function addTGCommands()
{
  spellConsole = new spellMediawikiConsole();

  spellConsole.registerGadget(new TGAGadget());
 
  spellConsole.start();
}

/**
 *
 * Start of ieSpell API JavaScript
 * Copyright (C) 2002-2004 Red Egg Software. 
 * All rights reserved. 
 *
 * @author Sidney Chong
 * @version $Revision: 1.1 $ $Date: 2004/11/19 16:06:03 $
 * @srcpath $Source: e:/coderepo/iespell/src/app/api/ieSpell.js,v $
 *
 **/

var myAgent = navigator.userAgent.toLowerCase();
var myVersion = parseInt(navigator.appVersion);

var is_ie = ((myAgent.indexOf("msie") != -1) 
         && (myAgent.indexOf("opera") == -1));
var is_nav = ((myAgent.indexOf('mozilla')!=-1) 
           && (myAgent.indexOf('spoofer')==-1) 
           && (myAgent.indexOf('compatible') == -1) 
           && (myAgent.indexOf('opera')==-1)
           && (myAgent.indexOf('webtv') ==-1) 
           && (myAgent.indexOf('hotjava')==-1));

var is_win = ((myAgent.indexOf("win")!=-1) 
           || (myAgent.indexOf("16bit")!=-1));

var is_mac = (myAgent.indexOf("mac")!=-1);

//this function will invoke ieSpell on the ENTIRE document.
function checkdocspelling() {
  try {
    var tmpis = new ActiveXObject("ieSpell.ieSpellExtension");
    tmpis.CheckAllLinkedDocuments(document);
  } catch(exception) {
    if (is_ie&&is_win) {
      window.open("http://www.iespell.com/download.php","Download");
    }
  }
}

//this function will invoke ieSpell on the specified node. The rest of the document is 
//not touched
function checknodespelling(node) {
  try {
    var tmpis = new ActiveXObject("ieSpell.ieSpellExtension");
    tmpis.CheckDocumentNode(node);
  } catch(exception) {
    if (is_ie&&is_win) {
      window.open("http://www.iespell.com/download.php","Download");
    }
  }
}


hookEvent("load", addTGCommands); 
//addOnloadHook(addTGCommands);

/* </nowiki></pre> 
*/