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

Change subject: Fix loading related articles on small screens
......................................................................


Fix loading related articles on small screens

Related articles are loaded when the user scrolls past
half the document height, which used to be calculated on
page load. This height, however, changes after all sections
are collapsed on small screens, thus never loading the
related articles for the page. Calculating the document height
just before showing related articles allows us to correctly
decide whether it's time to load the needed modules.

Bug: T121263
Change-Id: I1266894ab763cfb571b14f067086445fb6be1887
---
M resources/ext.relatedArticles.readMore.bootstrap/index.js
1 file changed, 4 insertions(+), 3 deletions(-)

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



diff --git a/resources/ext.relatedArticles.readMore.bootstrap/index.js 
b/resources/ext.relatedArticles.readMore.bootstrap/index.js
index edaa342..208bb76 100644
--- a/resources/ext.relatedArticles.readMore.bootstrap/index.js
+++ b/resources/ext.relatedArticles.readMore.bootstrap/index.js
@@ -12,13 +12,14 @@
                debouncedLoad = $.debounce( 100, function () {
                        loadRelatedArticles();
                } ),
-               $window = $( window ),
+               $window = $( window );
+
+       function loadRelatedArticles() {
                /**
                 * Threshold value to load related articles - after about half 
scroll
                 */
-               scrollThreshold = ( $( document ).height() / 2 ) - 
$window.height();
+               var scrollThreshold = ( $( document ).height() / 2 ) - 
$window.height();
 
-       function loadRelatedArticles() {
                if ( $window.scrollTop() > scrollThreshold ) {
                        $.when(
                                // Note we load dependencies here rather than 
ResourceLoader

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1266894ab763cfb571b14f067086445fb6be1887
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RelatedArticles
Gerrit-Branch: dev
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to