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

Change subject: Get rid of $wgMFPageSections config
......................................................................


Get rid of $wgMFPageSections config

This variable was used on two places to determine if we are in
mobile mode. Both places can use more intelligent conditions.

To place the toc, simply looking up if a #toc already exists and
replacing it is much easier.

For toggling of sections no check is needed at all because on the
skin's desktop version, there is a div under #content wrapping
the whole content so that the selector >h1,>h2,>h3,>h4,>h5,>h6
wont work in that place anyways and therefore the condition is not
needed.

Bug: T95884
Change-Id: Icc586d9d76f81f512e2a94d326a7f28168bc44ef
---
M includes/skins/SkinMinerva.php
M javascripts/modules/toc/init.js
M javascripts/modules/toggling/init.js
3 files changed, 8 insertions(+), 8 deletions(-)

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



diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 7861323..705250e 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -856,8 +856,7 @@
                        'wgMFDeviceWidthTablet' => $config->get( 
'MFDeviceWidthTablet' ),
                        'wgMFMode' => $this->getMode(),
                        'wgMFCollapseSectionsByDefault' => $config->get( 
'MFCollapseSectionsByDefault' ),
-                       'wgMFTocEnabled' => $this->getOutput()->getProperty( 
'MinervaTOC' ),
-                       'wgMFPageSections' => $this->isMobileMode
+                       'wgMFTocEnabled' => $this->getOutput()->getProperty( 
'MinervaTOC' )
                );
 
                if ( $this->isAuthenticatedUser() ) {
diff --git a/javascripts/modules/toc/init.js b/javascripts/modules/toc/init.js
index fdd42ef..9543910 100644
--- a/javascripts/modules/toc/init.js
+++ b/javascripts/modules/toc/init.js
@@ -22,15 +22,18 @@
                        toc = new TableOfContents( {
                                sections: sections
                        } );
-                       if ( mw.config.get( 'wgMFPageSections' ) ) {
-                               toc.appendTo( page.getLeadSectionElement() );
-                       } else {
+
+                       // if there is a toc already, replace it
+                       if ( this.$( '#toc' ).length > 0 ) {
                                // don't show toc at end of page, when no 
sections there
                                toc.insertAfter( '#toc' );
                                // remove the original parser toc
                                this.$( '#toc' ).remove();
                                // prevent to float text right of toc
                                this.$( '.toc-mobile' ).after( '<div 
style="clear:both;"></div>' );
+                       } else {
+                               // otherwise append it to the lead section
+                               toc.appendTo( page.getLeadSectionElement() );
                        }
                        toggle.enable( toc.$el, 'toc-' );
                }
diff --git a/javascripts/modules/toggling/init.js 
b/javascripts/modules/toggling/init.js
index d5cc874..5ed632c 100644
--- a/javascripts/modules/toggling/init.js
+++ b/javascripts/modules/toggling/init.js
@@ -321,9 +321,7 @@
                !mw.config.get( 'wgIsMainPage' ) &&
                mw.config.get( 'wgAction' ) === 'view'
        ) {
-               if ( mw.config.get( 'wgMFPageSections' ) ) {
-                       init( $( '#content' ), 'content-' );
-               }
+               init( $( '#content' ), 'content-' );
        }
 
        M.define( 'toggle', {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icc586d9d76f81f512e2a94d326a7f28168bc44ef
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bene <benestar.wikime...@gmail.com>
Gerrit-Reviewer: Bene <benestar.wikime...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to