Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: mediawiki.special.apisandbox: Stop using double scrollbars
......................................................................

mediawiki.special.apisandbox: Stop using double scrollbars

Resize the panel to current page's height when changing pages
and when changing their content.

Change-Id: I64e5eb128f2e2b7d36afae66c49bab4ad1727b58
---
M resources/src/mediawiki.special/mediawiki.special.apisandbox.js
1 file changed, 14 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/80/273980/1

diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js 
b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
index a2d106d..d1acfa2 100644
--- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
+++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
@@ -636,6 +636,7 @@
                                );
 
                        $( window ).on( 'resize', ApiSandbox.resizePanel );
+                       booklet.on( 'set', ApiSandbox.resizePanel );
 
                        ApiSandbox.resizePanel();
                },
@@ -663,18 +664,17 @@
                 * Set the height of the panel based on the current viewport.
                 */
                resizePanel: function () {
-                       var height = $( window ).height(),
-                               contentTop = $content.offset().top;
+                       var page, height;
 
                        if ( $( document.body ).hasClass( 
'mw-apisandbox-fullscreen' ) ) {
+                               height = $( window ).height();
                                height -= panel.$element.offset().top - $( 
'#mw-apisandbox-ui' ).offset().top;
                                panel.$element.height( height - 1 );
                        } else {
-                               // Subtract the height of the intro text
-                               height -= panel.$element.offset().top - 
contentTop;
-
-                               panel.$element.height( height - 10 );
-                               $( window ).scrollTop( contentTop - 5 );
+                               // Match height of current page to avoid double 
scrollbars
+                               page = booklet.getCurrentPage();
+                               height = page.$element[ 0 ].scrollHeight;
+                               panel.$element.height( height );
                        }
                },
 
@@ -1036,7 +1036,7 @@
         * @param {Object} [config] Configuration options
         */
        ApiSandbox.PageLayout = function ( config ) {
-               config = $.extend( { prefix: '' }, config );
+               config = $.extend( { prefix: '', expanded: false }, config );
                this.displayText = config.key;
                this.apiModule = config.path;
                this.prefix = config.prefix;
@@ -1421,7 +1421,10 @@
                                                        $( '<legend>' ).append(
                                                                new 
OO.ui.ToggleButtonWidget( {
                                                                        label: 
mw.message( 'apisandbox-deprecated-parameters' ).text()
-                                                               } ).on( 
'change', tmp.toggle, [], tmp ).$element
+                                                               } )
+                                                                       .on( 
'change', tmp.toggle, [], tmp )
+                                                                       .on( 
'change', ApiSandbox.resizePanel )
+                                                                       
.$element
                                                        ),
                                                        tmp.$element
                                                )
@@ -1451,6 +1454,8 @@
                                                        label: mw.message( 
'apisandbox-retry' ).text()
                                                } ).on( 'click', 
that.loadParamInfo, [], that ).$element
                                        );
+                       } ).always( function () {
+                               ApiSandbox.resizePanel();
                        } );
        };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I64e5eb128f2e2b7d36afae66c49bab4ad1727b58
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

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

Reply via email to