TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/109262


Change subject: Conditionally load jquery.ui.dialog for Scribuntu errors
......................................................................

Conditionally load jquery.ui.dialog for Scribuntu errors

Bug: 59808
Change-Id: If9e295d0320e22934c71a18c56b00de82ffbb418
---
M Scribunto.php
M modules/ext.scribunto.js
2 files changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/62/109262/1

diff --git a/Scribunto.php b/Scribunto.php
index 5ead8af..1a86d8b 100644
--- a/Scribunto.php
+++ b/Scribunto.php
@@ -74,7 +74,6 @@
 $wgResourceModules['ext.scribunto'] = $sbtpl + array(
        'scripts' => 'ext.scribunto.js',
        'styles' => 'ext.scribunto.css',
-       'dependencies' => array( 'jquery.ui.dialog' ),
        'messages' => array(
                'scribunto-parser-dialog-title'
        ),
diff --git a/modules/ext.scribunto.js b/modules/ext.scribunto.js
index 8cb9646..d76933b 100644
--- a/modules/ext.scribunto.js
+++ b/modules/ext.scribunto.js
@@ -9,14 +9,22 @@
 
                init: function () {
                        var regex = /^mw-scribunto-error-(\d+)/,
+                               $errors,
                                $dialog = $( '<div>' );
 
-                       $dialog.dialog( {
-                               title: mw.msg( 'scribunto-parser-dialog-title' 
),
-                               autoOpen: false
-                       } );
 
-                       $( '.scribunto-error' ).each( function ( index, span ) {
+                       $errors = $( '.scribunto-error' );
+
+                       if ( $errors.length > 0 ) {
+                               mw.loader.using( 'jquery.ui.dialog', function() 
{
+                                       $dialog.dialog( {
+                                               title: mw.msg( 
'scribunto-parser-dialog-title' ),
+                                               autoOpen: false
+                                       } );
+                               } );
+                       }
+
+                       $errors.each( function ( index, span ) {
                                var errorId,
                                        matches = regex.exec( span.id );
                                if ( matches === null ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/109262
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9e295d0320e22934c71a18c56b00de82ffbb418
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to