MediaWiki:Gadget-CodeEditor.js

From RimWorld Wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/**
 * MediaWiki:Gadget-codeeditor.js
 * Stub to load [[Extension:CodeEditor]] and Ace syntax-highlighting editor 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:CodeEditor JS bits are GPLv2 -- https://www.mediawiki.org/wiki/Extension:CodeEditor
 *
 * Syntax highlighting, auto-indenting code editor widget for on-wiki JS and CSS pages.
 * Uses embedded Ajax.org Cloud9 Editor: http://ace.ajax.org/
 * MPL/LGPL/GPL
 */

mw.log( '[[mw:MediaWiki:Gadget-CodeEditor.js]] has been disabled' );
/*
jQuery(document).ready(function ($) {
    // @fixme need an SSL alternative
    mw.config.set('wgCodeEditorAssetsPath', '//toolserver.org/~brion/extensions');
    var modules, i, ping,
        config = mw.config.get(['wgCodeEditorAssetsPath', 'wgNamespaceNumber', 'wgTitle']),
        moduleBase = config.wgCodeEditorAssetsPath + '/CodeEditor/modules',
        $box = $('#wpTextbox1'),
        matches = /\.(js|css)$/.exec(config.wgTitle);
    if ($box.length && matches && (config.wgNamespaceNumber === 2 || config.wgNamespaceNumber === 8)) {
        modules = [
            moduleBase + '/ace/ace.js',
            moduleBase + '/ace/mode-javascript.js',
            moduleBase + '/ace/mode-css.js',
            moduleBase + '/jquery.codeEditor.js',
            moduleBase + '/ext.codeEditor.js'
        ];
        i = 0;
        // @fixme loading serially is kinda lame, but it works for now
        ping = function () {
            if ( i < modules.length ) {
                var url = modules[i];
                $.getScript(url, function () {
                    i++;
                    ping();
                });
            }
        };
        ping();
    }
});
*/