User:Ricordisamoa/UnloggedContributions.js

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.
/* <nowiki>
 * UnloggedContributions.js by [[User:Ricordisamoa]]
 *
 * adds a link to check the presence of contributions by the user's IP address
 * (useful for users who often forget to login)
*/
$(document).ready(function(){
	if(Geo.IP&&Geo.IP!=null&&Geo.IP!=""){
		var messages={
			en:{
				text:"Contributions (unlogged)",
				title:"View your IP's contributions (in case you previously forgot to login)"
			},
			it:{
				text:"Contributi da sloggato",
				title:"Visualizza i contributi del tuo IP (nel caso avessi precedentemente dimenticato di effettuare il login)"
			}
		};
		var i18n=function(msg){
			return messages[wgUserLanguage][msg]||messages[wgContentLanguage][msg]||messages["en"][msg];
		}
		mw.util.addPortletLink("p-navigation",mw.util.getUrl("Special:Contributions/"+Geo.IP),i18n("text"),"UnloggedContributions",i18n("title"));
	}
});
//</nowiki>