MediaWiki:Gadget-ParserPlayground.js
Ir a la navegación
Ir a la búsqueda
Nota: Después de publicar, quizás necesite actualizar la caché de su navegador para ver los cambios.
- Firefox/Safari: Mantenga presionada la tecla Shift mientras pulsa el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
- Google Chrome: presione Ctrl+Shift+R (⌘+Shift+R en Mac)
- Internet Explorer/Edge: mantenga presionada Ctrl mientras pulsa Actualizar, o presione Ctrl+F5
- Opera: Presiona Ctrl+F5.
/**
* MediaWiki:Gadget-ParserPlayground.js
* Stub to load [[Extension:ParserPlayground]] as a gadget.
*
* Requires enhanced editing toolbar (WikiEditor extension); integrates with toolbar.
*
* Gadget stub CC-BY-SA 2
* (c) 2011 Brion Vibber <brion @ pobox.com>
*
* Extension:ParserPlayground JS bits are GPLv2 or compat -- http://www.mediawiki.org/wiki/Extension:ParserPlayground
*/
( function($) {
// @fixme need an SSL alternative
mw.config.set('wgParserPlaygroundAssetsPath', 'http://toolserver.org/~brion/extensions');
var moduleBase = mw.config.get('wgParserPlaygroundAssetsPath') + '/ParserPlayground/modules';
var $box = $('#wpTextbox1');
if ($box.length) {
$(function() {
var scripts = [
'lib.jsdiff.js',
'lib.pegjs.js',
'jquery.nodetree.js',
'ext.parserPlayground.hashMap.js',
'ext.parserPlayground.classicParser.js',
'ext.parserPlayground.serializer.js',
'ext.parserPlayground.renderer.js',
'ext.parserPlayground.pegParser.js',
'ext.parserPlayground.js'
],
styles = [
'jquery.nodetree.css',
'ext.parserPlayground.css'
],
$head = $('head');
mw.messages.set({
'vis-edit-source-ok': 'Ok',
'vis-edit-source-cancel': 'Cancel'
});
$.each(styles, function(i, style) {
var $link = $('<link>')
.attr('rel', 'stylesheet')
.attr('href', moduleBase + '/' + style)
.attr('type', 'text/css');
$head.append($link);
});
$.each(scripts, function(i, script) {
var $script = $('<script>').attr('src', moduleBase + '/' + script);
$head.append($script);
});
});
}
})(jQuery);