MediaWiki:WiktionaryLookup-external-bookmarklet.js

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

This script is for external sites (blogs) to add the wiktionary look up gadget. This is like mediawiki:WiktionaryLookup-external.js but if called after load event.

Bookmark the following link: javascript:(function%20%20%7Bvar%20src%20=%20document.createElement('script');src.type%20=%20'text/javascript';src.src%20=%20'//en.wikinews.org/w/index.php?title=MediaWiki:WiktionaryLookup-external-bookmarklet.js&action=raw&ctype=text/javascript&scrver=1';document.getElementsByTagName('head')%5B0%5D.appendChild(src);%7D);void%200

Or load this page after a load event.

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; } 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); } }

(function { var src = document.createElement('script'); src.type = 'text/javascript'; src.src = '//en.wikinews.org/w/index.php?title=MediaWiki:Gadget-dictionaryLookupHover.js&action=raw&ctype=text/javascript&scrver=1'; document.getElementsByTagName('head')[0].appendChild(src); });