Cillian.deRoiste has uploaded a new change for review.

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


Change subject: Wrap jQuery in an anonymous function to avoid conflicts
......................................................................

Wrap jQuery in an anonymous function to avoid conflicts

Change-Id: Ifdd4b10063221a4967d812eafd43858623ec5d28
---
M modules/ext.wikiEditor.dialogs.js
M modules/ext.wikiEditor.js
M modules/ext.wikiEditor.toolbar.hideSig.js
M modules/ext.wikiEditor.toolbar.js
4 files changed, 47 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiEditor 
refs/changes/66/92666/1

diff --git a/modules/ext.wikiEditor.dialogs.js 
b/modules/ext.wikiEditor.dialogs.js
index 0e0dd09..4994037 100644
--- a/modules/ext.wikiEditor.dialogs.js
+++ b/modules/ext.wikiEditor.dialogs.js
@@ -1,15 +1,16 @@
 /*
  * JavaScript for WikiEditor Dialogs
  */
-
-$( document ).ready( function() {
-       if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.dialogs ) ) {
-               return;
-       }
-       
-       // Replace icons
-       $.wikiEditor.modules.dialogs.config.replaceIcons( $( '#wpTextbox1' ) );
-       
-       // Add dialogs module
-       $( '#wpTextbox1' ).wikiEditor( 'addModule', 
$.wikiEditor.modules.dialogs.config.getDefaultConfig() );
-} );
+(function($){
+    $( document ).ready( function() {
+           if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.dialogs ) ) {
+                   return;
+           }
+           
+           // Replace icons
+           $.wikiEditor.modules.dialogs.config.replaceIcons( $( '#wpTextbox1' 
) );
+           
+           // Add dialogs module
+           $( '#wpTextbox1' ).wikiEditor( 'addModule', 
$.wikiEditor.modules.dialogs.config.getDefaultConfig() );
+    } );
+})(jQuery);
diff --git a/modules/ext.wikiEditor.js b/modules/ext.wikiEditor.js
index 6056e63..3b1a049 100644
--- a/modules/ext.wikiEditor.js
+++ b/modules/ext.wikiEditor.js
@@ -1,8 +1,9 @@
 /*
  * JavaScript for WikiEditor
  */
-
-$( document ).ready( function() {
-       // Initialize wikiEditor
-       $( '#wpTextbox1' ).wikiEditor();
-} );
+(function($){
+    $( document ).ready( function() {
+           // Initialize wikiEditor
+           $( '#wpTextbox1' ).wikiEditor();
+    } );
+})(jQuery);
diff --git a/modules/ext.wikiEditor.toolbar.hideSig.js 
b/modules/ext.wikiEditor.toolbar.hideSig.js
index 3bc0f0b..29ba22e 100644
--- a/modules/ext.wikiEditor.toolbar.hideSig.js
+++ b/modules/ext.wikiEditor.toolbar.hideSig.js
@@ -1,14 +1,16 @@
 /*
  * Remove the signature button if the main namespace is edited.
  */
-$( document ).ready( function() {
-       // This module is designed not to depend on ext.wikiEditor or 
jquery.wikiEditor.
-       // Removing this dependency fixed various bugs, but it does mean that 
we have to
-       // account for the situation where $.wikiEditor is not present
-       if ( !$.wikiEditor || !$.wikiEditor.isSupported( 
$.wikiEditor.modules.toolbar ) ) {
-               return;
-       }
-       if ( $( 'body' ).hasClass( 'ns-0' ) ) {
-               $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 
'section': 'main', 'group': 'insert', 'tool': 'signature' } );
-       }
-});
+(function($){
+    $( document ).ready( function() {
+           // This module is designed not to depend on ext.wikiEditor or 
jquery.wikiEditor.
+           // Removing this dependency fixed various bugs, but it does mean 
that we have to
+           // account for the situation where $.wikiEditor is not present
+           if ( !$.wikiEditor || !$.wikiEditor.isSupported( 
$.wikiEditor.modules.toolbar ) ) {
+                   return;
+           }
+           if ( $( 'body' ).hasClass( 'ns-0' ) ) {
+                   $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 
'section': 'main', 'group': 'insert', 'tool': 'signature' } );
+           }
+    });
+})(jQuery);
diff --git a/modules/ext.wikiEditor.toolbar.js 
b/modules/ext.wikiEditor.toolbar.js
index 5cdeae5..b81299c 100644
--- a/modules/ext.wikiEditor.toolbar.js
+++ b/modules/ext.wikiEditor.toolbar.js
@@ -1,17 +1,18 @@
 /*
  * JavaScript for WikiEditor Toolbar
  */
-
-$( document ).ready( function() {
-       if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.toolbar ) ) {
-               $( '.wikiEditor-oldToolbar' ).show();
-               return;
-       }
-       // The old toolbar is still in place and needs to be removed so there 
aren't two toolbars
-       $( '#toolbar' ).remove();
-       // Add toolbar module
-       // TODO: Implement .wikiEditor( 'remove' )
-       $( '#wpTextbox1' ).wikiEditor(
-               'addModule', 
$.wikiEditor.modules.toolbar.config.getDefaultConfig()
-       );
-} );
+(function($){
+    $( document ).ready( function() {
+           if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.toolbar ) ) {
+                   $( '.wikiEditor-oldToolbar' ).show();
+                   return;
+           }
+           // The old toolbar is still in place and needs to be removed so 
there aren't two toolbars
+           $( '#toolbar' ).remove();
+           // Add toolbar module
+           // TODO: Implement .wikiEditor( 'remove' )
+           $( '#wpTextbox1' ).wikiEditor(
+                   'addModule', 
$.wikiEditor.modules.toolbar.config.getDefaultConfig()
+           );
+    } );
+})(jQuery);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifdd4b10063221a4967d812eafd43858623ec5d28
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiEditor
Gerrit-Branch: master
Gerrit-Owner: Cillian.deRoiste <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to