MediaWiki:Common.js: differenze tra le versioni

nessun oggetto della modifica
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 107:
// Supporto ai template
// ============================
 
/**
* Utilizzata in [[template:USERNAME]] (?)
*/
 
function usernameReplace() {
var spanList = $('span.insertusername');
if(!spanList.length) {
return;
}
var defaultText = '<Dio>';
if(wgUserName) {
spanList.text(wgUserName);
return;
}
else {
spanList.text(defaultText);
}
var userPage = $('#pt-anonuserpage');
if(userPage.length > 0) {
var IP = $('a:first', userPage);
if(!IP.length) {
return;
}
spanList.each(function() {
if($(this).text() == defaultText) {
$(this).text(IP.text());
}
});
return;
}
var IP = undefined;
$.ajax({
url: wgServer + wgScriptPath + '/api.php?action=query&meta=userinfo&format=xml',
dataType: 'xml',
async: false,
success: function(data) {
IP = $('userinfo', data).attr('name');
}
});
if(!IP) {
return;
}
spanList.each(function() {
if($(this).text() == defaultText) {
$(this).text(IP);
}
});
return;
}
$( usernameReplace );
 
/**