Diferencia entre revisiones de «MediaWiki:Common.js»
Página de la interfaz de MediaWiki
Más acciones
Sin resumen de edición |
Sin resumen de edición |
||
(No se muestran 2 ediciones intermedias del mismo usuario) | |||
Línea 1: | Línea 1: | ||
/* ===== | /* ===== MEDIAWIKI COMMON.JS - PANEL ===== */ | ||
// Cargar estadísticas del sitio | |||
function loadAdminStats() { | |||
// Estadísticas básicas | |||
$.get(mw.util.wikiScript('api'), { | |||
function | |||
// | |||
$.get( mw.util.wikiScript( 'api' ), { | |||
action: 'query', | action: 'query', | ||
meta: 'siteinfo', | |||
siprop: 'statistics', | |||
format: 'json' | format: 'json' | ||
} ).done( function( data ) { | }).done(function(data) { | ||
$('#stat-pages').text(data.query.statistics.pages.toLocaleString()); | |||
$( '# | $('#stat-users').text(data.query.statistics.users.toLocaleString()); | ||
$('#stat-edits').text(data.query.statistics.edits.toLocaleString()); | |||
} ); | }); | ||
// | // Cambios recientes | ||
$.get( mw.util.wikiScript( 'api' ), { | $.get(mw.util.wikiScript('api'), { | ||
action: 'query', | action: 'query', | ||
list: 'recentchanges', | list: 'recentchanges', | ||
rclimit: 1, | rclimit: 1, | ||
format: 'json' | format: 'json' | ||
} ).done( function( data ) { | }).done(function(data) { | ||
$('#stat-recent-changes').text(data.query.recentchanges.length); | |||
$( '# | |||
}); | }); | ||
} | } | ||
// Tooltips para iconos | |||
$(document).on('mouseenter', '.admin-links-item i', function() { | |||
$(this).parent().attr('title', $(this).parent().text().trim()); | |||
}); | |||
} ); | |||
// Cargar FontAwesome si no está presente | // Cargar FontAwesome si no está presente | ||
if ( !$( 'link[href*="font-awesome"]' ).length ) { | if (!$('link[href*="font-awesome"]').length) { | ||
$( 'head' ).append( | $('head').append( | ||
'<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">' | '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">' | ||
); | ); | ||
} | } |
Revisión actual - 12:31 6 julio 2025
/* ===== MEDIAWIKI COMMON.JS - PANEL ===== */
// Cargar estadísticas del sitio
function loadAdminStats() {
// Estadísticas básicas
$.get(mw.util.wikiScript('api'), {
action: 'query',
meta: 'siteinfo',
siprop: 'statistics',
format: 'json'
}).done(function(data) {
$('#stat-pages').text(data.query.statistics.pages.toLocaleString());
$('#stat-users').text(data.query.statistics.users.toLocaleString());
$('#stat-edits').text(data.query.statistics.edits.toLocaleString());
});
// Cambios recientes
$.get(mw.util.wikiScript('api'), {
action: 'query',
list: 'recentchanges',
rclimit: 1,
format: 'json'
}).done(function(data) {
$('#stat-recent-changes').text(data.query.recentchanges.length);
});
}
// Tooltips para iconos
$(document).on('mouseenter', '.admin-links-item i', function() {
$(this).parent().attr('title', $(this).parent().text().trim());
});
// Cargar FontAwesome si no está presente
if (!$('link[href*="font-awesome"]').length) {
$('head').append(
'<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">'
);
}