MediaWiki:WiktionaryLookup-external.js

/***********

NOTE: If this script is loaded after the page loads, use http://en.wikinews.org/wiki/MediaWiki:WiktionaryLookup-external-bookmarklet.js instead.

This script is for external sites (blogs) to add the wiktionary look up gadget.

Add 

To the head (FIXME: that url should probably have a s-maxage param)...

- This script implements the following functions/variables normally provided by the mediawiki environment: wgUserLanguage, wgContentLanguage, hookEvent.

This script than loads the main script.



if (!window.wgContentLanguage) { var wgContentLanguage; if (document.documentElement && document.documentElement.lang) { wgContentLanguage = document.documentElement.lang; } /** body not loaded yet else if (document.body && document.body.lang) { wgContentLanguage = document.body.lang; } else { //default to english. wgContentLanguage = "en"; } } if (!window.wgUserLanguage) { var wgUserLanguage = wgContentLanguage; }

/********** The following are adapted from mediawiki's wikibits.js. See http://mediawiki.org. As such they are under the GPL function hookEvent(attach, handler) { if (window.addEventListener) { document.addEventListener(attach, handler, false); } else if (window.attachEvent) { document.attachEvent("on" + attach, handler); } }

//This is assumed to be called well the document is loading. //this is temp url for testing. document.write(" ");