jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/364418 )

Change subject: Move scrollType detection to utils
......................................................................


Move scrollType detection to utils

Change-Id: I465e0b74a7d7a6682b22bdd6e7aafb794bce9b24
---
M modules/ext.RevisionSlider.SliderView.js
M modules/ext.RevisionSlider.util.js
2 files changed, 38 insertions(+), 38 deletions(-)

Approvals:
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ext.RevisionSlider.SliderView.js 
b/modules/ext.RevisionSlider.SliderView.js
index 7611310..62058df 100644
--- a/modules/ext.RevisionSlider.SliderView.js
+++ b/modules/ext.RevisionSlider.SliderView.js
@@ -93,7 +93,7 @@
                        this.dir = $container.css( 'direction' ) || 'ltr';
 
                        if ( this.dir === 'rtl' ) {
-                               this.rtlScrollLeftType = 
this.determineRtlScrollType();
+                               this.rtlScrollLeftType = 
mw.libs.revisionSlider.determineRtlScrollType();
                        }
 
                        this.pointerOlder = this.pointerOlder || new 
mw.libs.revisionSlider.Pointer( 'mw-revslider-pointer-older' );
@@ -704,43 +704,6 @@
                        );
 
                        this.alignPointers( duration );
-               },
-
-               /**
-                * Based on jQuery RTL Scroll Type Detector plugin by othree: 
https://github.com/othree/jquery.rtl-scroll-type
-                *
-                * @return {string} - 'default', 'negative' or 'reverse'
-                */
-               determineRtlScrollType: function () {
-                       var isChrome = /chrom(e|ium)/.test( 
navigator.userAgent.toLowerCase() ),
-                               $dummy;
-
-                       // in Chrome V8 5.8.283 and 5.9.211 the detection below 
gives wrong results leading to strange behavior
-                       // Chrome V8 6.0 seems to fix that issue so this 
workaround can be removed then
-                       if ( isChrome ) {
-                               return 'default';
-                       }
-
-                       $dummy = $( '<div>' )
-                               .css( {
-                                       dir: 'rtl',
-                                       width: '1px',
-                                       height: '1px',
-                                       position: 'absolute',
-                                       top: '-1000px',
-                                       overflow: 'scroll'
-                               } )
-                               .text( 'A' )
-                               .appendTo( 'body' )[ 0 ];
-                       if ( $dummy.scrollLeft > 0 ) {
-                               return 'default';
-                       } else {
-                               $dummy.scrollLeft = 1;
-                               if ( $dummy.scrollLeft === 0 ) {
-                                       return 'negative';
-                               }
-                       }
-                       return 'reverse';
                },
 
                /**
diff --git a/modules/ext.RevisionSlider.util.js 
b/modules/ext.RevisionSlider.util.js
index d161897..6d9450d 100644
--- a/modules/ext.RevisionSlider.util.js
+++ b/modules/ext.RevisionSlider.util.js
@@ -77,6 +77,43 @@
                return offset;
        };
 
+       /**
+        * Based on jQuery RTL Scroll Type Detector plugin by othree: 
https://github.com/othree/jquery.rtl-scroll-type
+        *
+        * @return {string} - 'default', 'negative' or 'reverse'
+        */
+       mw.libs.revisionSlider.determineRtlScrollType = function () {
+               var isChrome = /chrom(e|ium)/.test( 
navigator.userAgent.toLowerCase() ),
+                       $dummy;
+
+               // in Chrome V8 5.8.283 and 5.9.211 the detection below gives 
wrong results leading to strange behavior
+               // Chrome V8 6.0 seems to fix that issue so this workaround can 
be removed then
+               if ( isChrome ) {
+                       return 'default';
+               }
+
+               $dummy = $( '<div>' )
+                       .css( {
+                               dir: 'rtl',
+                               width: '1px',
+                               height: '1px',
+                               position: 'absolute',
+                               top: '-1000px',
+                               overflow: 'scroll'
+                       } )
+                       .text( 'A' )
+                       .appendTo( 'body' )[ 0 ];
+               if ( $dummy.scrollLeft > 0 ) {
+                       return 'default';
+               } else {
+                       $dummy.scrollLeft = 1;
+                       if ( $dummy.scrollLeft === 0 ) {
+                               return 'negative';
+                       }
+               }
+               return 'reverse';
+       };
+
        mw.libs.revisionSlider.calculateRevisionsPerWindow = function ( margin, 
revisionWidth ) {
                return Math.floor( ( $( '#mw-content-text' ).width() - margin ) 
/ revisionWidth );
        };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I465e0b74a7d7a6682b22bdd6e7aafb794bce9b24
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/RevisionSlider
Gerrit-Branch: master
Gerrit-Owner: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Andrew-WMDE <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to