Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367471 )

Change subject: Allow us to run mobile formatter on desktop skin
......................................................................

Allow us to run mobile formatter on desktop skin

We won't use this in production but the new config variable
MFAlwaysUseMobileFormatter will allow us to test the new print
styles on real world content with the following three lines:

$wgMFContentProviderClass = 
'MobileFrontend\ContentProviders\MwApiContentProvider';
$wgMFMwApiContentProviderBaseUri = "https://en.m.wikipedia.org/w/api.php";;
$wgMFAlwaysUseMobileFormatter = true;

Change-Id: Id600e1f06b0f59de0134d91d77fd68991d45f4a3
---
M README.md
M extension.json
M includes/MobileFrontend.hooks.php
3 files changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/71/367471/1

diff --git a/README.md b/README.md
index 3a5e24f..07b303d 100644
--- a/README.md
+++ b/README.md
@@ -196,6 +196,13 @@
 * Type: `string`
 * Default: `https://en.wikipedia.org/w/api.php`
 
+#### $wgMFAlwaysUseMobileFormatter
+
+When enabled the MobileFormatter will run on desktop views as well as mobile 
views.
+
+* Type: `boolean`
+* Default: `false`
+
 #### $wgMFMobileFormatterHeadings
 
 This is a list of html tags, that could be recognized as the first heading of
diff --git a/extension.json b/extension.json
index 3772ed9..473a130 100644
--- a/extension.json
+++ b/extension.json
@@ -1272,6 +1272,7 @@
                        "_merge_strategy": "array_plus_2d"
                },
                "MFEnableJSConsoleRecruitment": false,
+               "MFAlwaysUseMobileFormatter": false,
                "MFMobileFormatterHeadings": [
                        "h1",
                        "h2",
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 5a9ad14..aaa7d7c 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -193,13 +193,14 @@
        public static function onOutputPageBeforeHTML( &$out, &$text ) {
                $context = MobileContext::singleton();
                $title = $context->getTitle();
+               $config =  MediaWikiServices::getInstance()->getService( 
'MobileFrontend.Config' );
 
                if ( !$title ) {
                        return true;
                }
 
                // Perform a few extra changes if we are in mobile mode
-               if ( $context->shouldDisplayMobileView() ) {
+               if ( $context->shouldDisplayMobileView() || $config->get( 
'MFAlwaysUseMobileFormatter' ) ) {
                        $text = ExtMobileFrontend::DOMParse( $out, $text );
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id600e1f06b0f59de0134d91d77fd68991d45f4a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

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

Reply via email to