mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-12 01:11:55 +00:00
Don't open multiple error dialogs
If a Scribunto error dialog is open and the user clicks another error, or the same error again, don't open another dialog window, instead close the old one and reuse it. Change-Id: I50b8d48ee551cfb8cb4e1e672a0e36e15b5ae216
This commit is contained in:
parent
8fcaa128ac
commit
886c6ae06d
|
@ -10,6 +10,12 @@ mw.scribunto = {
|
|||
'init': function () {
|
||||
var regex = /^mw-scribunto-error-(\d+)/;
|
||||
var that = this;
|
||||
var dialog = $( '<div/>' );
|
||||
dialog.dialog({
|
||||
title: mw.msg( 'scribunto-parser-dialog-title' ),
|
||||
autoOpen: false
|
||||
});
|
||||
|
||||
$('.scribunto-error').each( function( index, span ) {
|
||||
var matches = regex.exec( span.id );
|
||||
if ( matches == null ) {
|
||||
|
@ -26,12 +32,11 @@ mw.scribunto = {
|
|||
return;
|
||||
}
|
||||
var error = that.errors[ errorId ];
|
||||
$( '<div/>' )
|
||||
dialog
|
||||
.dialog( 'close' )
|
||||
.html( error )
|
||||
.dialog({
|
||||
'title': mw.msg( 'scribunto-parser-dialog-title' ),
|
||||
'position': [ evt.clientX + 5, evt.clientY + 5 ],
|
||||
});
|
||||
.dialog( 'option', 'position', [ evt.clientX + 5, evt.clientY + 5 ] )
|
||||
.dialog( 'open' );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue