MediaWiki:Gadget-ParserPlayground.js

Uit informatiestandaarden
Versie door Ahenket (overleg | bijdragen) op 19 jul 2013 om 20:08 (Nieuwe pagina aangemaakt met '/** * MediaWiki:Gadget-ParserPlayground.js * Stub to load Extension:ParserPlayground as a gadget. * * Requires enhanced editing toolbar (WikiEditor extensio...')
(wijz) ← Oudere versie | Huidige versie (wijz) | Nieuwere versie → (wijz)
Ga naar: navigatie, zoeken

Opmerking: nadat u de wijzigingen hebt opgeslagen is het wellicht nodig uw browsercache te legen.

  • Firefox / Safari: houd Shift ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-Shift-R op een Mac)
  • Google Chrome: druk op Ctrl-Shift-R (⌘-Shift-R op een Mac)
  • Internet Explorer: houd Ctrl ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5
  • Opera: ga naar Menu → Instellingen (Opera → Voorkeuren op een Mac) en daarna naar Privacy & beveiliging → Browsegegevens wissen... → Tijdelijk opgeslgen afbeeldingen en bestanden.
/**
 * 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);