User:RCSDevs/common.js

var lang = mw.config.get('wgUserLanguage'); messages = { 'en': { 'link': 'Test tool', 'tooltip': 'Click to test tool', 'alert': 'you clicked me!' } };

mw.messages.set(messages['en']);

if(lang && lang != 'en' && lang in messages) {   mw.messages.set(messages[lang]); }

$(document).ready(function {	// Add a link to the toolbox	var link = mw.util.addPortletLink('p-tb', '#', mw.message('link').plain, 't-prettylinkwidget', mw.message('tooltip').plain, '/', '#t-whatlinkshere' );	// Create a jQuery object for this link so that we get	// to use jQuery awesomeness like .click for binding functions to events	// and methods like e.preventDefault;	$(link).click( function( e ) { // Avoid the browser going to '#' e.preventDefault; alert(mw.message('alert').plain); }); });