diff --git a/modules/ext.codeEditor.geshi.js b/modules/ext.codeEditor.geshi.js index cc8681dc..6a6e6bd7 100644 --- a/modules/ext.codeEditor.geshi.js +++ b/modules/ext.codeEditor.geshi.js @@ -4,33 +4,33 @@ * Needs some code de-dup with the full-page JS/CSS page editing. */ -$(function() { - var $sources = $('.mw-geshi'); - if ($sources.length > 0) { - var setupEditor = function($div) { - var $link = $('') - .text(mediaWiki.msg('editsection')) - .attr('href', '#') - .attr('title', 'Edit this code section') - .click(function(event) { - openEditor($div); +$( function () { + var $sources = $( '.mw-geshi' ); + if ( $sources.length > 0 ) { + var setupEditor = function ( $div ) { + var $link = $( '' ) + .text( mediaWiki.msg( 'editsection' ) ) + .attr( 'href', '#' ) + .attr( 'title', 'Edit this code section' ) + .click( function ( event ) { + openEditor( $div ); event.preventDefault(); - }); - var $edit = $('') - .addClass('mw-editsection') - .append('[') - .append($link) - .append(']'); - $div.prepend($edit); + } ); + var $edit = $( '' ) + .addClass( 'mw-editsection' ) + .append( '[' ) + .append( $link ) + .append( ']' ); + $div.prepend( $edit ); }; - var openEditor = function($div) { - var $main = $div.find('div'), + var openEditor = function ( $div ) { + var $main = $div.find( 'div' ), geshiLang = null, - matches = /(?:^| )source-([a-z0-9_-]+)/.exec($main.attr('class')); - if (matches) { + matches = /(?:^| )source-([a-z0-9_-]+)/.exec( $main.attr( 'class' ) ); + if ( matches ) { geshiLang = matches[1]; } - mediaWiki.loader.using('ext.codeEditor.ace.modes', function() { + mediaWiki.loader.using( 'ext.codeEditor.ace.modes', function () { // @fixme de-duplicate var map = { c: 'c_cpp', @@ -55,95 +55,93 @@ $(function() { scala: 'scala', xml: 'xml' }; - // Disable some annoying commands - var canon = require('pilot/canon'); - canon.removeCommand('replace'); // ctrl+R - canon.removeCommand('transposeletters'); // ctrl+T - canon.removeCommand('gotoline'); // ctrl+L + var canon = require( 'pilot/canon' ); + canon.removeCommand( 'replace' ); // ctrl+R + canon.removeCommand( 'transposeletters' ); // ctrl+T + canon.removeCommand( 'gotoline' ); // ctrl+L - var $container = $('
') - .attr('style', 'top: 32px; left: 0px; right: 0px; bottom: 0px; border: 1px solid gray') - .text($main.text()); // quick hack :D + var $container = $( '
' ) + .attr( 'style', 'top: 32px; left: 0px; right: 0px; bottom: 0px; border: 1px solid gray' ) + .text( $main.text() ); // quick hack :D - var $label = $('