Tobias Gritschacher has uploaded a new change for review.

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


Change subject: $.ui.suggester: Added functionality to flip horizontal offset
......................................................................

$.ui.suggester: Added functionality to flip horizontal offset

Change-Id: Ic9138468c4aa6426fec5236d609c19cbe8bf658a
---
M ValueView/resources/jquery.ui/jquery.ui.suggester.css
M ValueView/resources/jquery.ui/jquery.ui.suggester.js
2 files changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/76/100576/1

diff --git a/ValueView/resources/jquery.ui/jquery.ui.suggester.css 
b/ValueView/resources/jquery.ui/jquery.ui.suggester.css
index 98cc6f7..24c833d 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.suggester.css
+++ b/ValueView/resources/jquery.ui/jquery.ui.suggester.css
@@ -23,6 +23,7 @@
 
 .ui-suggester-list {
        padding: 0;
+       position: absolute;
 }
 
 .ui-suggester-list .ui-menu-item a {
diff --git a/ValueView/resources/jquery.ui/jquery.ui.suggester.js 
b/ValueView/resources/jquery.ui/jquery.ui.suggester.js
index ac3a845..b1d0f5d 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.suggester.js
+++ b/ValueView/resources/jquery.ui/jquery.ui.suggester.js
@@ -478,6 +478,13 @@
                                ) {
                                this.options.position.my = 'right top';
                                this.options.position.at = 'right bottom';
+
+                               if( this.options.position.offset ) {
+                                       this.options.position.offset = 
flipHorizontalOffset(
+                                               this.options.position.offset
+                                       );
+                               }
+
                                this.menu.element.position( $.extend( {
                                        of: this.element
                                }, this.options.position ) );
@@ -541,4 +548,19 @@
 
        } );
 
+       /**
+        * Flips the horizontal offset of a offset specified as string to be 
used as offset parameter
+        * for jQuery.ui.position (1.8)
+        *
+        * @param {string} offset
+        * @return {string}
+        */
+       function flipHorizontalOffset( offset ) {
+               var offsets = offset.split( ' ' ),
+                       hOffset = parseInt( offsets[0], 10 );
+
+               hOffset = ( hOffset <= 0 ) ? Math.abs( hOffset ) : hOffset * -1;
+               return hOffset + ' ' + offsets[1];
+       }
+
 } )( jQuery );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9138468c4aa6426fec5236d609c19cbe8bf658a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: mw1.23-wmf6
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de>

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

Reply via email to