jenkins-bot has submitted this change and it was merged.

Change subject: Switch to using $.inArray instead of indexOf for arrays
......................................................................


Switch to using $.inArray instead of indexOf for arrays

Add support for IE8
This makes things actally work in IE8.

Bug: 70963
Change-Id: Iaf1171a82d86ef370012c331ff06eef1004afa07
---
M javascripts/common/Page.js
M javascripts/common/api.js
M javascripts/common/modes.js
M javascripts/modules/editor/EditorOverlay.js
M javascripts/modules/editor/editor.js
M javascripts/modules/lastEdited/time.js
6 files changed, 8 insertions(+), 8 deletions(-)

Approvals:
  MaxSem: Looks good to me, approved
  Bmansurov: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/javascripts/common/Page.js b/javascripts/common/Page.js
index a898725..8ed4e25 100644
--- a/javascripts/common/Page.js
+++ b/javascripts/common/Page.js
@@ -72,7 +72,7 @@
                        user.getGroups().done( function( groups ) {
                                var editable = false;
                                $.each( groups, function( i, group ) {
-                                       if ( editProtection.indexOf( group ) > 
-1 ) {
+                                       if ( $.inArray( group, editProtection ) 
> -1 ) {
                                                editable = true;
                                                return false;
                                        }
diff --git a/javascripts/common/api.js b/javascripts/common/api.js
index a7a2527..a3623ed 100644
--- a/javascripts/common/api.js
+++ b/javascripts/common/api.js
@@ -126,7 +126,7 @@
                        } else if ( isCacheable && this.tokenCache[ endpoint 
].hasOwnProperty( tokenType ) ) {
                                return this.tokenCache[ endpoint ][ tokenType ];
                        // If the token is available from mw.user.tokens, get 
it from there.
-                       } else if ( easyTokens.indexOf( tokenType ) > -1 && 
!endpoint && !caToken ) {
+                       } else if ( $.inArray( tokenType, easyTokens ) > -1 && 
!endpoint && !caToken ) {
                                token = user.tokens.get( tokenType + 'Token' );
                                if ( token && ( token !== '+\\' || 
mw.config.get( 'wgMFAnonymousEditing' ) ) ) {
                                        d.resolve( token );
diff --git a/javascripts/common/modes.js b/javascripts/common/modes.js
index 2478b2b..e7a545a 100644
--- a/javascripts/common/modes.js
+++ b/javascripts/common/modes.js
@@ -36,7 +36,7 @@
         */
        assertMode: function( modes ) {
                var mode = mw.config.get( 'wgMFMode' );
-               if ( modes.indexOf( mode ) === -1 ) {
+               if ( $.inArray( mode, modes ) === -1 ) {
                        throw new Error( 'Attempt to run module outside 
declared environment mode ' + mode  );
                }
        }
diff --git a/javascripts/modules/editor/EditorOverlay.js 
b/javascripts/modules/editor/EditorOverlay.js
index 8f52cbd..860a97f 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -2,7 +2,7 @@
        var EditorOverlayBase = M.require( 'modules/editor/EditorOverlayBase' ),
                isVisualEditorEnabled = M.isWideScreen() &&
                        mw.config.get( 'wgVisualEditorConfig' ) &&
-                       mw.config.get( 'wgVisualEditorConfig' 
).namespaces.indexOf( mw.config.get( 'wgNamespaceNumber' ) ) > -1 &&
+                       $.inArray( mw.config.get( 'wgNamespaceNumber' ), 
mw.config.get( 'wgVisualEditorConfig' ).namespaces ) > -1 &&
                        mw.config.get( 'wgTranslatePageTranslation' ) !== 
'translation' &&
                        mw.config.get( 'wgPageContentModel' ) === 'wikitext',
                Section = M.require( 'Section' ),
diff --git a/javascripts/modules/editor/editor.js 
b/javascripts/modules/editor/editor.js
index 9b3ffd7..0161909 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -127,7 +127,7 @@
                                page.isWikiText() &&
 
                                // Only in enabled namespaces
-                               visualEditorNamespaces.indexOf( mw.config.get( 
'wgNamespaceNumber' ) ) > -1 &&
+                               $.inArray( mw.config.get( 'wgNamespaceNumber' 
), visualEditorNamespaces ) > -1 &&
 
                                // Not on pages which are outputs of the Page 
Translation feature
                                mw.config.get( 'wgTranslatePageTranslation' ) 
!== 'translation' &&
diff --git a/javascripts/modules/lastEdited/time.js 
b/javascripts/modules/lastEdited/time.js
index 242f96c..99afdae 100644
--- a/javascripts/modules/lastEdited/time.js
+++ b/javascripts/modules/lastEdited/time.js
@@ -1,4 +1,4 @@
-( function( M ) {
+( function( M, $ ) {
        var units = ['seconds', 'minutes', 'hours', 'days', 'months', 'years'],
                limits = [1, 60, 3600, 86400, 2592000, 31536000];
 
@@ -18,7 +18,7 @@
 
        function isRecent( delta ) {
                var u = delta.unit;
-               return [ 'seconds', 'minutes', 'hours' ].indexOf( u ) > -1;
+               return $.inArray( u, [ 'seconds', 'minutes', 'hours' ] ) > -1;
        }
 
        function isNow( delta ) {
@@ -32,4 +32,4 @@
                isRecent: isRecent
        } );
 
-}( mw.mobileFrontend ) );
+}( mw.mobileFrontend, jQuery ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf1171a82d86ef370012c331ff06eef1004afa07
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to