/* generated javascript */
if (!window.skin) {
	var skin = 'monaco';
	var stylepath = 'http://images.wikia.com/common/releases_200911.3/skins';
}

/* MediaWiki:Common.js */
/*
   Changes <span class="NH_replacechars"><span class="nhsym clr-cyan">@</span></span>
   so that it'll show the logical color symbol, but clicking on it
   will do insertTags('<span class="nhsym clr-cyan">@</span>', '', '')

   Used in http://nethack.wikia.com/wiki/MediaWiki:Edittools

   Relies on specific behaviour of the logical color templates:
   http://nethack.wikia.com/wiki/Category:Function_templates
*/
function WikiHack_replacechars()
{
  var l = document.getElementsByTagName('span');
  if (!l) return;
  for (var i = 0; i < l.length; i++) {
    if (l[i].className == "NH_replacechars") {
      for (var j = 0; j < l[i].childNodes.length; j++) {
        var fc = l[i].childNodes[j];
        if (fc.className && fc.className.match(/^nhsym clr-/)) {
          var clr = fc.className.replace("nhsym clr-", "");
          var chr = fc.innerHTML;
          var a = document.createElement('a');
          a.setAttribute('href', 'javascript:insertTags("{"+"{"+"'+clr+'|'+chr+'"+"}"+"}","","");');
          a.appendChild(fc.cloneNode(true));
          l[i].replaceChild(a, fc);
        }
      }
    }
  }
}

if(wgAction == 'edit' || wgAction == 'submit') addOnloadHook(WikiHack_replacechars)

/* MediaWiki:Monaco.js */
