User:DieBuche/whatis.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at User:DieBuche/whatis. |
- Report page listing warnings and errors.
importScript('MediaWiki:Utilities.js');
//To get addToolLink, the skin-independent version of addPortletLink.
function whatisthat_call() {
OpenWindow = window.open("http://toolserver.org/~magnus/whatisthat.php?onlynew&raw&image=" + encodeURIComponent(mw.config.get('wgPageName')), "whatisthat-results", "height=550, width=800,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no");
}
function whatisthat() {
start_attempts = 0;
max_start_attempts= 5;
if (typeof(addToolLink) == 'undefined')
{
if (start_attempts++<max_start_attempts) {
window.setTimeout(whatisthat, 500);
// Maximum 10 * 0.5 = 5 seconds
} else {
return;
}
}
addToolLink('p-tb', 'javascript:whatisthat_call()', "WhatIsThat?", 'whatisthat', 'Add new language descriptions');
}
if (wgNamespaceNumber == 6) addOnloadHook(whatisthat);