2012-10-07 00:41:25 +00:00
|
|
|
( function ( $, mw ) {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Debug console
|
|
|
|
* Based on JavaScript Shell 1.4 by Jesse Ruderman (GPL/LGPL/MPL tri-license)
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* * Refactor, more jQuery, etc.
|
|
|
|
* * Spinner?
|
|
|
|
* * A prompt in front of input lines and the textarea
|
|
|
|
* * Collapsible backtrace display
|
|
|
|
*/
|
|
|
|
|
|
|
|
var
|
2015-09-12 15:21:20 +00:00
|
|
|
histList = [ '' ],
|
2012-10-07 00:41:25 +00:00
|
|
|
histPos = 0,
|
|
|
|
question,
|
2013-12-10 23:05:26 +00:00
|
|
|
input,
|
|
|
|
output,
|
|
|
|
$spinner,
|
2012-10-07 00:41:25 +00:00
|
|
|
lastError = null,
|
|
|
|
sessionContent = null,
|
|
|
|
sessionKey = null,
|
|
|
|
pending = false,
|
|
|
|
clearNextRequest = false;
|
|
|
|
|
|
|
|
function refocus() {
|
2013-12-10 23:05:26 +00:00
|
|
|
// Needed for Mozilla to scroll correctly
|
|
|
|
input.blur();
|
|
|
|
input.focus();
|
2012-10-07 00:18:42 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function initConsole() {
|
2013-12-10 23:05:26 +00:00
|
|
|
input = document.getElementById( 'mw-scribunto-input' );
|
|
|
|
output = document.getElementById( 'mw-scribunto-output' );
|
|
|
|
$spinner = $.createSpinner( { size: 'small', type: 'block' } );
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
recalculateInputHeight();
|
|
|
|
println( mw.msg( 'scribunto-console-intro' ), 'mw-scribunto-message' );
|
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
/**
|
|
|
|
* Use onkeydown because IE doesn't support onkeypress for arrow keys
|
2016-02-08 22:44:01 +00:00
|
|
|
*
|
2013-12-10 23:05:26 +00:00
|
|
|
* @param {jQuery.Event} e
|
|
|
|
*/
|
2012-10-07 00:41:25 +00:00
|
|
|
function inputKeydown( e ) {
|
2013-12-10 23:05:26 +00:00
|
|
|
/*jshint noempty:false */
|
2012-10-07 00:41:25 +00:00
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
if ( e.shiftKey && e.keyCode === 13 ) {
|
|
|
|
// shift-enter
|
2012-10-07 00:41:25 +00:00
|
|
|
// don't do anything; allow the shift-enter to insert a line break as normal
|
2013-12-10 23:05:26 +00:00
|
|
|
} else if ( e.keyCode === 13 ) {
|
|
|
|
// enter
|
2012-10-07 00:41:25 +00:00
|
|
|
// execute the input on enter
|
|
|
|
go();
|
2013-12-10 23:05:26 +00:00
|
|
|
} else if ( e.keyCode === 38 ) {
|
|
|
|
// up
|
2012-10-07 00:41:25 +00:00
|
|
|
// go up in history if at top or ctrl-up
|
2013-12-10 23:05:26 +00:00
|
|
|
if ( e.ctrlKey || caretInFirstLine( input ) ) {
|
2012-10-07 00:41:25 +00:00
|
|
|
hist( 'up' );
|
|
|
|
}
|
2013-12-10 23:05:26 +00:00
|
|
|
} else if ( e.keyCode === 40 ) {
|
|
|
|
// down
|
2012-10-07 00:41:25 +00:00
|
|
|
// go down in history if at end or ctrl-down
|
2013-12-10 23:05:26 +00:00
|
|
|
if ( e.ctrlKey || caretInLastLine( input ) ) {
|
2012-10-07 00:41:25 +00:00
|
|
|
hist( 'down' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setTimeout( recalculateInputHeight, 0 );
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
function inputFocus() {
|
2012-10-07 00:41:25 +00:00
|
|
|
if ( sessionContent === null ) {
|
|
|
|
// No previous state to clear
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( clearNextRequest ) {
|
|
|
|
// User already knows
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( getContent() !== sessionContent ) {
|
2013-02-08 22:32:28 +00:00
|
|
|
printClearBar( 'scribunto-console-cleared' );
|
2012-10-07 00:41:25 +00:00
|
|
|
clearNextRequest = true;
|
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function caretInFirstLine( textbox ) {
|
2015-09-12 15:21:20 +00:00
|
|
|
var firstLineBreak;
|
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
// IE doesn't support selectionStart/selectionEnd
|
|
|
|
if ( textbox.selectionStart === undefined ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-12 15:21:20 +00:00
|
|
|
firstLineBreak = textbox.value.indexOf( '\n' );
|
2012-10-07 00:41:25 +00:00
|
|
|
|
2015-09-12 15:21:20 +00:00
|
|
|
return ( ( firstLineBreak === -1 ) || ( textbox.selectionStart <= firstLineBreak ) );
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function caretInLastLine( textbox ) {
|
2015-09-12 15:21:20 +00:00
|
|
|
var lastLineBreak;
|
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
// IE doesn't support selectionStart/selectionEnd
|
|
|
|
if ( textbox.selectionEnd === undefined ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-12 15:21:20 +00:00
|
|
|
lastLineBreak = textbox.value.lastIndexOf( '\n' );
|
2012-10-07 00:41:25 +00:00
|
|
|
|
|
|
|
return ( textbox.selectionEnd > lastLineBreak );
|
2012-10-07 00:18:42 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function recalculateInputHeight() {
|
2013-12-10 23:05:26 +00:00
|
|
|
var rows = input.value.split( /\n/ ).length +
|
|
|
|
// prevent scrollbar flickering in Mozilla
|
|
|
|
1 +
|
|
|
|
// leave room for scrollbar in Opera
|
|
|
|
( window.opera ? 1 : 0 );
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
// without this check, it is impossible to select text in Opera 7.60 or Opera 8.0.
|
2013-12-10 23:05:26 +00:00
|
|
|
if ( input.rows !== rows ) {
|
|
|
|
input.rows = rows;
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
2012-10-07 00:18:42 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function println( s, type ) {
|
2015-09-12 15:21:20 +00:00
|
|
|
var newdiv;
|
2012-10-07 00:41:25 +00:00
|
|
|
if ( ( s = String( s ) ) ) {
|
2015-09-12 15:21:20 +00:00
|
|
|
newdiv = document.createElement( 'div' );
|
2012-10-07 00:41:25 +00:00
|
|
|
newdiv.appendChild( document.createTextNode( s ) );
|
|
|
|
newdiv.className = type;
|
2013-12-10 23:05:26 +00:00
|
|
|
output.appendChild( newdiv );
|
2012-10-07 00:41:25 +00:00
|
|
|
return newdiv;
|
|
|
|
}
|
2012-10-07 00:18:42 +00:00
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
|
2013-02-08 22:32:28 +00:00
|
|
|
function printClearBar( msg ) {
|
2013-12-10 23:05:26 +00:00
|
|
|
$( '<div>' )
|
2012-10-07 00:41:25 +00:00
|
|
|
.attr( 'class', 'mw-scribunto-clear' )
|
2013-02-08 22:32:28 +00:00
|
|
|
.text( mw.msg( msg ) )
|
2013-12-10 23:05:26 +00:00
|
|
|
.appendTo( output );
|
2012-10-07 00:18:42 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function hist( direction ) {
|
|
|
|
// histList[0] = first command entered, [1] = second, etc.
|
|
|
|
// type something, press up --> thing typed is now in "limbo"
|
|
|
|
// (last item in histList) and should be reachable by pressing
|
|
|
|
// down again.
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
var L = histList.length;
|
|
|
|
|
|
|
|
if ( L === 1 ) {
|
|
|
|
return;
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
|
|
|
|
if ( direction === 'up' ) {
|
|
|
|
if ( histPos === L - 1 ) {
|
|
|
|
// Save this entry in case the user hits the down key.
|
2015-09-12 15:21:20 +00:00
|
|
|
histList[ histPos ] = input.value;
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( histPos > 0 ) {
|
|
|
|
histPos--;
|
|
|
|
// Use a timeout to prevent up from moving cursor within new text
|
|
|
|
// Set to nothing first for the same reason
|
|
|
|
setTimeout(
|
|
|
|
function () {
|
2015-09-12 15:21:20 +00:00
|
|
|
var caretPos;
|
2013-12-10 23:05:26 +00:00
|
|
|
input.value = '';
|
2015-09-12 15:21:20 +00:00
|
|
|
input.value = histList[ histPos ];
|
|
|
|
caretPos = input.value.length;
|
2013-12-10 23:05:26 +00:00
|
|
|
if ( input.setSelectionRange ) {
|
|
|
|
input.setSelectionRange( caretPos, caretPos );
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
0
|
|
|
|
);
|
|
|
|
}
|
2013-12-10 23:05:26 +00:00
|
|
|
} else {
|
|
|
|
// direction down
|
2012-10-07 00:41:25 +00:00
|
|
|
if ( histPos < L - 1 ) {
|
|
|
|
histPos++;
|
2015-09-12 15:21:20 +00:00
|
|
|
input.value = histList[ histPos ];
|
|
|
|
} else if ( histPos === L - 1 ) {
|
2012-10-07 00:41:25 +00:00
|
|
|
// Already on the current entry: clear but save
|
2013-12-10 23:05:26 +00:00
|
|
|
if ( input.value ) {
|
2015-09-12 15:21:20 +00:00
|
|
|
histList[ histPos ] = input.value;
|
2012-10-07 00:41:25 +00:00
|
|
|
++histPos;
|
2013-12-10 23:05:26 +00:00
|
|
|
input.value = '';
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
|
|
|
|
function printQuestion( q ) {
|
2013-12-10 23:05:26 +00:00
|
|
|
println( q, 'mw-scribunto-input' );
|
2012-10-07 00:18:42 +00:00
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
|
|
|
|
function printError( er ) {
|
|
|
|
var lineNumberString;
|
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
// for debugging the shell
|
|
|
|
lastError = er;
|
2012-10-07 00:41:25 +00:00
|
|
|
if ( er.name ) {
|
2013-12-10 23:05:26 +00:00
|
|
|
// lineNumberString should not be '', to avoid a very wacky bug in IE 6.
|
2015-09-12 15:21:20 +00:00
|
|
|
lineNumberString = ( er.lineNumber !== undefined ) ? ( ' on line ' + er.lineNumber + ': ' ) : ': ';
|
2012-10-07 00:41:25 +00:00
|
|
|
// Because IE doesn't have error.toString.
|
2013-12-10 23:05:26 +00:00
|
|
|
println( er.name + lineNumberString + er.message, 'mw-scribunto-error' );
|
2012-10-07 00:41:25 +00:00
|
|
|
} else {
|
2013-12-10 23:05:26 +00:00
|
|
|
// Because security errors in Moz /only/ have toString.
|
|
|
|
println( er, 'mw-scribunto-error' );
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function setPending() {
|
|
|
|
pending = true;
|
2013-12-10 23:05:26 +00:00
|
|
|
input.readOnly = true;
|
|
|
|
$spinner.insertBefore( input );
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function clearPending() {
|
2013-12-10 23:05:26 +00:00
|
|
|
$spinner.remove();
|
2012-10-07 00:41:25 +00:00
|
|
|
pending = false;
|
2013-12-10 23:05:26 +00:00
|
|
|
input.readOnly = false;
|
2012-10-07 00:18:42 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function go() {
|
2013-12-10 23:05:26 +00:00
|
|
|
var params, api, content, sentContent;
|
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
if ( pending ) {
|
|
|
|
// If there is an XHR request pending, don't send another one
|
|
|
|
// We set readOnly on the textarea to give a UI indication, this is
|
|
|
|
// just for paranoia.
|
|
|
|
return;
|
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
question = input.value;
|
2012-10-07 00:41:25 +00:00
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
if ( question === '' ) {
|
2012-10-07 00:41:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2015-09-12 15:21:20 +00:00
|
|
|
histList[ histList.length - 1 ] = question;
|
|
|
|
histList[ histList.length ] = '';
|
2012-10-07 00:41:25 +00:00
|
|
|
histPos = histList.length - 1;
|
|
|
|
|
|
|
|
// Unfortunately, this has to happen *before* the script is run, so that
|
|
|
|
// print() output will go in the right place.
|
2013-12-10 23:05:26 +00:00
|
|
|
input.value = '';
|
2012-10-07 00:41:25 +00:00
|
|
|
// can't preventDefault on input, so also clear it later
|
|
|
|
setTimeout( function () {
|
2013-12-10 23:05:26 +00:00
|
|
|
input.value = '';
|
2012-10-07 00:41:25 +00:00
|
|
|
}, 0 );
|
|
|
|
|
|
|
|
recalculateInputHeight();
|
|
|
|
printQuestion( question );
|
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
params = {
|
2012-10-07 00:41:25 +00:00
|
|
|
action: 'scribunto-console',
|
2013-02-07 17:37:14 +00:00
|
|
|
title: mw.config.get( 'wgPageName' ),
|
2012-10-07 00:41:25 +00:00
|
|
|
question: question
|
|
|
|
};
|
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
content = getContent();
|
|
|
|
sentContent = false;
|
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
if ( !sessionKey || sessionContent !== content ) {
|
|
|
|
params.clear = true;
|
|
|
|
params.content = content;
|
2013-02-08 22:32:28 +00:00
|
|
|
sentContent = true;
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
|
|
|
if ( sessionKey ) {
|
|
|
|
params.session = sessionKey;
|
|
|
|
}
|
|
|
|
if ( clearNextRequest ) {
|
|
|
|
params.clear = true;
|
|
|
|
clearNextRequest = false;
|
|
|
|
}
|
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
api = new mw.Api();
|
2012-10-07 00:41:25 +00:00
|
|
|
setPending();
|
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
api.post( params )
|
|
|
|
.done( function ( result ) {
|
2013-02-08 22:32:28 +00:00
|
|
|
if ( result.sessionIsNew === '' && !sentContent ) {
|
|
|
|
// Session was lost. Resend query, with content
|
|
|
|
printClearBar( 'scribunto-console-cleared-session-lost' );
|
|
|
|
sessionContent = null;
|
|
|
|
clearPending();
|
2013-12-10 23:05:26 +00:00
|
|
|
input.value = params.question;
|
2013-02-08 22:32:28 +00:00
|
|
|
go();
|
|
|
|
return;
|
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
sessionKey = result.session;
|
|
|
|
sessionContent = content;
|
|
|
|
if ( result.type === 'error' ) {
|
2015-06-25 04:57:08 +00:00
|
|
|
$( '<div>' ).addClass( 'mw-scribunto-error' ).html( result.html ).appendTo( output );
|
2012-10-07 00:41:25 +00:00
|
|
|
} else {
|
|
|
|
if ( result.print !== '' ) {
|
|
|
|
println( result.print, 'mw-scribunto-print' );
|
|
|
|
}
|
2015-09-12 15:21:20 +00:00
|
|
|
if ( result[ 'return' ] !== '' ) {
|
|
|
|
println( result[ 'return' ], 'mw-scribunto-normalOutput' );
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
clearPending();
|
|
|
|
setTimeout( refocus, 0 );
|
2013-12-10 23:05:26 +00:00
|
|
|
} )
|
|
|
|
.fail( function ( code, result ) {
|
|
|
|
if ( result.error && result.error.info ) {
|
2012-10-07 00:41:25 +00:00
|
|
|
printError( result.error.info );
|
2013-12-10 23:05:26 +00:00
|
|
|
} else if ( result.exception ) {
|
2012-12-03 06:14:56 +00:00
|
|
|
printError( 'Error sending API request: ' + result.exception );
|
2012-10-07 00:41:25 +00:00
|
|
|
} else {
|
2013-12-10 23:05:26 +00:00
|
|
|
mw.log( result );
|
2012-10-07 00:41:25 +00:00
|
|
|
printError( 'error' );
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
clearPending();
|
|
|
|
setTimeout( refocus, 0 );
|
2013-12-10 23:05:26 +00:00
|
|
|
} );
|
2012-10-07 00:41:25 +00:00
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
function getContent() {
|
|
|
|
var $textarea = $( '#wpTextbox1' ),
|
|
|
|
context = $textarea.data( 'wikiEditor-context' );
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2012-10-07 00:41:25 +00:00
|
|
|
if ( context === undefined || context.codeEditor === undefined ) {
|
|
|
|
return $textarea.val();
|
|
|
|
} else {
|
|
|
|
return $textarea.textSelection( 'getContents' );
|
|
|
|
}
|
|
|
|
}
|
2012-10-07 00:18:42 +00:00
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
function onClearClick() {
|
2012-10-07 00:41:25 +00:00
|
|
|
$( '#mw-scribunto-output' ).empty();
|
|
|
|
clearNextRequest = true;
|
|
|
|
refocus();
|
2012-07-14 04:23:42 +00:00
|
|
|
}
|
|
|
|
|
2015-03-18 14:59:21 +00:00
|
|
|
function initEditPage() {
|
2015-09-12 15:21:20 +00:00
|
|
|
var $wpTextbox1,
|
|
|
|
$console = $( '#mw-scribunto-console' );
|
2015-03-27 16:32:19 +00:00
|
|
|
if ( !$console.length ) {
|
|
|
|
// There is no console in the DOM; on read-only (protected) pages,
|
|
|
|
// we need to add it here, because the hook does not insert
|
|
|
|
// it server-side.
|
2015-09-12 15:21:20 +00:00
|
|
|
$wpTextbox1 = $( '#wpTextbox1' );
|
2015-03-27 16:32:19 +00:00
|
|
|
if ( !$wpTextbox1.length || !$wpTextbox1.prop( 'readonly' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-12 15:21:20 +00:00
|
|
|
$console = $( '<div>' ).attr( { id: 'mw-scribunto-console' } );
|
2015-03-27 16:32:19 +00:00
|
|
|
$wpTextbox1.after( $console );
|
2015-03-18 14:59:21 +00:00
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
|
2015-03-18 14:59:21 +00:00
|
|
|
$( '<fieldset>' )
|
|
|
|
.attr( 'class', 'mw-scribunto-console-fieldset' )
|
|
|
|
.append( $( '<legend>' ).text( mw.msg( 'scribunto-console-title' ) ) )
|
|
|
|
.append( $( '<div id="mw-scribunto-output"></div>' ) )
|
|
|
|
.append(
|
|
|
|
$( '<div>' ).append(
|
|
|
|
$( '<textarea>' )
|
|
|
|
.attr( {
|
|
|
|
id: 'mw-scribunto-input',
|
|
|
|
'class': 'mw-scribunto-input',
|
|
|
|
wrap: 'off',
|
|
|
|
rows: 1,
|
|
|
|
dir: 'ltr',
|
|
|
|
lang: 'en'
|
|
|
|
} )
|
|
|
|
.bind( 'keydown', inputKeydown )
|
|
|
|
.bind( 'focus', inputFocus )
|
2012-07-14 04:23:42 +00:00
|
|
|
)
|
2015-03-18 14:59:21 +00:00
|
|
|
)
|
|
|
|
.append(
|
|
|
|
$( '<div>' ).append(
|
|
|
|
$( '<input>' )
|
|
|
|
.attr( {
|
|
|
|
type: 'button',
|
|
|
|
value: mw.msg( 'scribunto-console-clear' )
|
|
|
|
} )
|
|
|
|
.bind( 'click', onClearClick )
|
2012-07-14 04:23:42 +00:00
|
|
|
)
|
2015-03-18 14:59:21 +00:00
|
|
|
)
|
|
|
|
.wrap( '<form>' )
|
2015-03-27 16:32:19 +00:00
|
|
|
.appendTo( $console );
|
2013-12-10 23:05:26 +00:00
|
|
|
|
2015-03-18 14:59:21 +00:00
|
|
|
initConsole();
|
|
|
|
}
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2013-12-10 23:05:26 +00:00
|
|
|
$( function () {
|
2015-03-18 14:59:21 +00:00
|
|
|
var action = mw.config.get( 'wgAction' );
|
|
|
|
if ( action === 'edit' || action === 'submit' || action === 'editredlink' ) {
|
|
|
|
initEditPage();
|
|
|
|
}
|
2012-10-07 00:41:25 +00:00
|
|
|
} );
|
2012-07-14 04:23:42 +00:00
|
|
|
|
2016-02-08 22:44:01 +00:00
|
|
|
}( jQuery, mediaWiki ) );
|