User:Icier/global.js

importScriptPage('WHAM/code.2.js', 'dev');

/** * disableCodeEditor.js * * Disables code editor on css/js pages introduced with the new syntax highlighting for source editor * The editor is overall buggy, slow and annoying * This script is the ajax equivalent of the editor that was used before the code editor * Looks Monobook-ish * * @author: w:user:Fubuki風吹 */ if (/\.(css|js)/g.test(mw.config.get('wgPageName')) || mw.config.get('wgCanonicalNamespace') == 'Module') { $('#ca-edit').on('click', function(e) {       e.preventDefault;        $('#mw-content-text').html('  Loading editor... ');       $.get(mw.util.wikiScript('api'), { action: 'query', titles: mw.config.get('wgPageName'), prop: 'revisions', rvprop: 'content', format: 'json' }, function(data) { $('#mw-content-text').html('' + data.query.pages[mw.config.get('wgArticleId')].revisions[0]['*'] + ' Edit summary:   Minor edit Publish '); $('#wpSubmit').on('click', function {               $('#status').css('display', 'inline').html(' Publishing edit...');                var data = {                    action: 'edit',                    title: mw.config.get('wgPageName'),                    text: $('#wpTextbox').val,                    token: mw.user.tokens.values.editToken,                    format: 'json'                };                if ($('#wpEditSummary').val.length) data.summary = $('#wpEditSummary').val;                if ($('#wpMinorEdit:checked').length) data.minor = '';                $.post(mw.util.wikiScript('api'), data, function(data) { if (!data.error) { $('#status').css('color', 'green').html('Edit successfully made!'); window.location.reload; } else { $('#status').css('color', 'red').html('Failed to edit page. Try again.'); }               });            });        });    }); }