Diferencia entre revisiones de «MediaWiki:Common.js»
De FSF
Sin resumen de edición |
Sin resumen de edición |
||
| Línea 5: | Línea 5: | ||
mw.loader.using(['mediawiki.api']).then(function() { | mw.loader.using(['mediawiki.api']).then(function() { | ||
$(function() { | $(function() { | ||
if ($('#toc').length) { | if ($('#toc').length) { | ||
var pageId = mw.config.get("wgArticleId"); | |||
if (!pageId || pageId <= 0) return; | |||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.post({ | api.post({ | ||
action: 'parse', | action: 'parse', | ||
text: '{{FSF Panel Diario | id1 = | text: '{{FSF Panel Diario | id1 = ' + pageId + ' }}', | ||
contentmodel: 'wikitext', | contentmodel: 'wikitext', | ||
prop: 'text', | prop: 'text', | ||
| Línea 22: | Línea 28: | ||
}); | }); | ||
} | } | ||
}); | }); | ||
}); | }); | ||
Revisión del 09:46 26 feb 2026
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */
/* 20260224 - Anexo para agregar encabezado arriba del SUMARIO del toc. Plantilla:FSF Panel Diario */
mw.loader.using(['mediawiki.api']).then(function() {
$(function() {
if ($('#toc').length) {
var pageId = mw.config.get("wgArticleId");
if (!pageId || pageId <= 0) return;
var api = new mw.Api();
api.post({
action: 'parse',
text: '{{FSF Panel Diario | id1 = ' + pageId + ' }}',
contentmodel: 'wikitext',
prop: 'text',
format: 'json'
}).done(function(data) {
if (data.parse && data.parse.text) {
$('#toc').prepend(
$('<div class="fsf-panel-container">')
.html(data.parse.text['*'])
);
}
});
}
});
});