Popup: Build as DOM instead of HTML strings

Change-Id: Ib33b6b2a1f3e0f9c50398287822ae88305855a58
This commit is contained in:
Ed Sanders 2017-07-20 15:15:49 +01:00 committed by Jforrester
parent cec399b4e3
commit 60ab939b26

View file

@ -390,16 +390,22 @@
* Add a popup for first time users (T165003)
*/
function addPopup() {
this.popuptext = '<div class=\'codemirror-popup-div\'>' +
'<div class=\'codemirror-popup-top\'>{ <span class=\'codemirror-popup-color-blue\'>' +
mw.message( 'codemirror-popup-syntax' ).escaped() + '</span> ' +
mw.message( 'codemirror-popup-highlighting' ).escaped() + ' }</div>' +
'<div class=\'codemirror-popup-text\'>' + mw.message( 'codemirror-popup-desc' ).escaped() + '</div>' +
'<div class=\'codemirror-popup-btn codemirror-popup-btn-yes\'>' + mw.message( 'codemirror-popup-btn-yes' ).escaped() + '</div>' +
'<div class=\'codemirror-popup-btn codemirror-popup-btn-no\'>' + mw.message( 'codemirror-popup-btn-no' ).escaped() + '</div>' +
'</div>';
var $content =
$( '<div>' ).addClass( 'codemirror-popup-div' ).append(
$( '<div>' ).addClass( 'codemirror-popup-top' ).append(
'{ ',
$( '<span>' ).addClass( 'codemirror-popup-color-blue' ).text( mw.msg( 'codemirror-popup-syntax' ) ),
' ',
document.createTextNode( mw.msg( 'codemirror-popup-highlighting' ) ),
' }'
),
$( '<div>' ).addClass( 'codemirror-popup-text' ).text( mw.msg( 'codemirror-popup-desc' ) ),
$( '<div>' ).addClass( 'codemirror-popup-btn codemirror-popup-btn-yes' ).text( mw.msg( 'codemirror-popup-btn-yes' ) ),
$( '<div>' ).addClass( 'codemirror-popup-btn codemirror-popup-btn-no' ).text( mw.msg( 'codemirror-popup-btn-no' ) )
);
popup = new OO.ui.PopupWidget( {
$content: $( this.popuptext ),
$content: $content,
containerPadding: 80,
$floatableContainer: $( '#mw-editbutton-codemirror' ),
padded: false,