Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/373364 )

Change subject: Hygiene: Drop usages of inArray
......................................................................

Hygiene: Drop usages of inArray

We can guarantee ES5 support so we can guarantee indexOf
availability

Change-Id: I663a7a74032822de21fa202ccaf15afff17c8e71
---
M resources/mobile.categories.overlays/CategoryLookupInputWidget.js
M resources/mobile.editor.overlay/EditorOverlay.js
M resources/mobile.search.util/extendSearchParams.js
M resources/mobile.startup/time.js
M resources/mobile.talk.overlays/TalkSectionOverlay.js
M tests/qunit/mobile.search.util/test_extendSearchParams.js
6 files changed, 9 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/64/373364/1

diff --git a/resources/mobile.categories.overlays/CategoryLookupInputWidget.js 
b/resources/mobile.categories.overlays/CategoryLookupInputWidget.js
index 54350a4..04b92b8 100644
--- a/resources/mobile.categories.overlays/CategoryLookupInputWidget.js
+++ b/resources/mobile.categories.overlays/CategoryLookupInputWidget.js
@@ -76,7 +76,7 @@
                data.results.forEach( function ( value ) {
                        if (
                                !$( 'div[data-title="' + value.title + '"]' 
).length &&
-                               $.inArray( value.displayTitle, self.categories 
) === -1
+                               self.categories.indexOf( value.displayTitle ) 
=== -1
                        ) {
                                result.push(
                                        new OO.ui.MenuOptionWidget( {
diff --git a/resources/mobile.editor.overlay/EditorOverlay.js 
b/resources/mobile.editor.overlay/EditorOverlay.js
index 1114fd1..a725bc0 100644
--- a/resources/mobile.editor.overlay/EditorOverlay.js
+++ b/resources/mobile.editor.overlay/EditorOverlay.js
@@ -95,7 +95,9 @@
                 */
                isVisualEditorEnabled: function () {
                        return mw.config.get( 'wgVisualEditorConfig' ) &&
-                               $.inArray( mw.config.get( 'wgNamespaceNumber' 
), mw.config.get( 'wgVisualEditorConfig' ).namespaces ) > -1 &&
+                               mw.config.get( 'wgVisualEditorConfig' 
).namespaces.indexOf(
+                                       mw.config.get( 'wgNamespaceNumber' )
+                               ) > -1 &&
                                mw.config.get( 'wgTranslatePageTranslation' ) 
!== 'translation' &&
                                mw.config.get( 'wgPageContentModel' ) === 
'wikitext';
                },
@@ -489,7 +491,7 @@
                                        } else {
                                                if ( key === 'editconflict' ) {
                                                        msg = mw.msg( 
'mobile-frontend-editor-error-conflict' );
-                                               } else if ( $.inArray( key, 
whitelistedErrorInfo ) > -1 ) {
+                                               } else if ( 
whitelistedErrorInfo.indexOf( key ) > -1 ) {
                                                        msg = 
response.error.info;
                                                } else {
                                                        msg = mw.msg( 
'mobile-frontend-editor-error' );
diff --git a/resources/mobile.search.util/extendSearchParams.js 
b/resources/mobile.search.util/extendSearchParams.js
index 2fede9f..7650e01 100644
--- a/resources/mobile.search.util/extendSearchParams.js
+++ b/resources/mobile.search.util/extendSearchParams.js
@@ -50,7 +50,7 @@
                result.prop = result.prop.concat( mw.config.get( 
'wgMFQueryPropModules' ) );
 
                if ( displayWikibaseDescriptions[feature] ) {
-                       if ( $.inArray( 'pageterms', result.prop ) === -1 ) {
+                       if ( result.prop.indexOf( 'pageterms' ) === -1 ) {
                                result.prop.push( 'pageterms' );
                        }
 
diff --git a/resources/mobile.startup/time.js b/resources/mobile.startup/time.js
index 54d87d7..841cb13 100644
--- a/resources/mobile.startup/time.js
+++ b/resources/mobile.startup/time.js
@@ -38,8 +38,7 @@
         * @ignore
         */
        function isRecent( delta ) {
-               var u = delta.unit;
-               return $.inArray( u, [ 'seconds', 'minutes', 'hours' ] ) > -1;
+               return [ 'seconds', 'minutes', 'hours' ].indexOf( delta.unit ) 
> -1;
        }
 
        /**
diff --git a/resources/mobile.talk.overlays/TalkSectionOverlay.js 
b/resources/mobile.talk.overlays/TalkSectionOverlay.js
index d1c4f49..6c9fc31 100644
--- a/resources/mobile.talk.overlays/TalkSectionOverlay.js
+++ b/resources/mobile.talk.overlays/TalkSectionOverlay.js
@@ -134,7 +134,7 @@
 
                                        if (
                                                response.error &&
-                                               $.inArray( response.error.code, 
whitelistedErrorInfo ) > -1
+                                               whitelistedErrorInfo.indexOf( 
response.error.code ) > -1
                                        ) {
                                                msg = response.error.info;
                                        } else {
diff --git a/tests/qunit/mobile.search.util/test_extendSearchParams.js 
b/tests/qunit/mobile.search.util/test_extendSearchParams.js
index f312c22..7504f6a 100644
--- a/tests/qunit/mobile.search.util/test_extendSearchParams.js
+++ b/tests/qunit/mobile.search.util/test_extendSearchParams.js
@@ -49,7 +49,7 @@
 
                QUnit.expect( 2 );
 
-               assert.equal( $.inArray( params.prop, 'pageterms' ), -1 );
+               assert.equal( params.prop.indexOf( 'pageterms' ), -1 );
                assert.equal( params.wbptterms, undefined );
        } );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I663a7a74032822de21fa202ccaf15afff17c8e71
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to