Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/269566
Change subject: Provide low-resolution NetSpeed option in Special:MobileOptions
......................................................................
Provide low-resolution NetSpeed option in Special:MobileOptions
After chatting with Ori,
given the images saving in bytes, the lower fully loaded time
(35s to 22s) and the fact the code is written let's make
this an available option to our users.
On long term it's probably a better option than disabling images altogether
(We may want to remove the image disabling feature if we see a drop in usage
as a result of this new option)
Have okayed with Jon Katz and Nirzar.
Change-Id: I1fe8538eb679fb7397f482407ba88c4286174e39
---
M i18n/en.json
M i18n/qqq.json
M includes/MobileContext.php
M includes/specials/SpecialMobileOptions.php
4 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/66/269566/1
diff --git a/i18n/en.json b/i18n/en.json
index 755b5f5..578c040 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -246,6 +246,7 @@
"mobile-frontend-nearby-title": "Nearby",
"mobile-frontend-nearby-sectiontext": "Near the topic of this page",
"mobile-frontend-news-items": "In the news",
+ "mobile-frontend-low-res-explain": "Receive lower resolution images to
save on bandwidth on a slow connection.",
"mobile-frontend-opt-in-explain": "By joining the beta, you will get
access to the latest experimental features which may be subject to software
defects.",
"mobile-frontend-overlay-close": "Close",
"mobile-frontend-overlay-continue": "Continue",
@@ -297,6 +298,7 @@
"mobile-frontend-search-submit": "Go",
"mobile-frontend-settings-images-explain": "Load all image content that
appears in a page.",
"mobile-frontend-settings-beta": "Beta",
+ "mobile-frontend-settings-lowres": "Low-resolution images",
"mobile-frontend-settings-site-description": "{{SITENAME}} is available
in $1 {{PLURAL:$1|language|languages}}. All available versions are listed
below",
"mobile-frontend-settings-site-header": "{{SITENAME}} Languages",
"mobile-frontend-sign-in-error-heading": "Whoops",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1f9b628..66c01fc 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -244,6 +244,7 @@
"mobile-frontend-nearby-title": "Title of
[[Special:Nearby]].\n{{Identical|Nearby}}",
"mobile-frontend-nearby-sectiontext": "Name of the link, which links
the user to [[Special:Nearby]] if the article has coordinates.",
"mobile-frontend-news-items": "The title that will appear before the
element with the mf-itn selector.",
+ "mobile-frontend-low-res-explain": "Used as description for the
\"low-resolution images\" setting in [[Special:MobileOptions]].",
"mobile-frontend-opt-in-explain": "Used as description for the \"Beta\"
in [[Special:MobileOptions]], if the beta is not enabled.",
"mobile-frontend-overlay-close": "Text for the button in an overlay
that, when clicked, dismisses the overlay.\n{{Identical|Close}}",
"mobile-frontend-overlay-continue": "Text for the button in an overlay
that, when clicked, continues to the next screen or
step.\n{{Identical|Continue}}",
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 66c19a0..2d0b81b 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -198,6 +198,20 @@
}
/**
+ * Set NetSpeed designation.
+ * @param boolean [$isFast] whether net speed should be fast or slow
+ */
+ public function setNetSpeed( $isFast=false ) {
+ if ( $isFast ) {
+ $this->netSpeed = self::NETSPEED_FAST;
+ } else {
+ $this->netSpeed = self::NETSPEED_SLOW;
+ }
+ $this->getRequest()->response()
+ ->setCookie( 'NetSpeed', $this->netSpeed, 0, array(
'prefix' => '' ) );
+ }
+
+ /**
* Whether the user is allowed to upload
* @return boolean
*/
diff --git a/includes/specials/SpecialMobileOptions.php
b/includes/specials/SpecialMobileOptions.php
index 2da4b37..ad6d033 100644
--- a/includes/specials/SpecialMobileOptions.php
+++ b/includes/specials/SpecialMobileOptions.php
@@ -114,6 +114,13 @@
'id' => 'enable-images-toggle',
);
+ $options['lowres'] = array(
+ 'checked' => $context->getNetSpeed() ===
MobileContext::NETSPEED_SLOW ? 'checked' : '',
+ 'label' => $this->msg(
'mobile-frontend-settings-lowres' )->parse(),
+ 'description' => $this->msg(
'mobile-frontend-low-res-explain' )->parse(),
+ 'name' => 'enableLowResImages',
+ );
+
// beta settings
if ( $this->getMFConfig()->get( 'MFEnableBeta' ) ) {
$options['beta'] = array(
@@ -235,6 +242,10 @@
return;
}
wfIncrStats( 'mobile.options.saves' );
+
+ // set the net speed cookie
+ $context->setNetSpeed( !$request->getBool( 'enableLowResImages'
) );
+
if ( $request->getBool( 'enableBeta' ) ) {
$group = 'beta';
if ( !$context->isBetaGroupMember() ) {
--
To view, visit https://gerrit.wikimedia.org/r/269566
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1fe8538eb679fb7397f482407ba88c4286174e39
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits