jenkins-bot has submitted this change and it was merged.
Change subject: Promoting mobile typography changes from beta to stable
......................................................................
Promoting mobile typography changes from beta to stable
This change promotes the updates to tablet styles to stable. The
way these styles is loaded has been changed to use a regular top
position ResourceLoader module rather than the fancy matchMedia
hack, as it seems a bit risky for stable. The tablet styles are
pretty small anyway, so it doesn't seem like it would be a
significant change to the footprint of the head.
Change-Id: Ia2ddca666c42762378e4c2bfe8e6a82ee3e43420
---
M includes/Resources.php
M includes/skins/SkinMinerva.php
M includes/skins/SkinMinervaBeta.php
M javascripts/common/application.js
D javascripts/common/matchMedia.js
M javascripts/common/modules.js
M less/tablet/common.less
M less/tablet/hacks.less
8 files changed, 89 insertions(+), 154 deletions(-)
Approvals:
JGonera: Looks good to me, but someone else must approve
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Resources.php b/includes/Resources.php
index e0c47ee..d71ec0b 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -84,12 +84,12 @@
),
),
- 'tablet.styles' => $wgMFMobileResourceBoilerplate + array(
- 'dependencies' => array( 'mobile.startup' ),
+ 'skins.minerva.tablet.styles' => $wgMFMobileResourceBoilerplate + array(
'styles' => array(
'less/tablet/common.less',
'less/tablet/hacks.less',
),
+ 'position' => 'top',
),
'mobile.toc' => $wgMFMobileResourceBoilerplate + array(
@@ -183,16 +183,6 @@
'mobile-frontend-last-modified-with-user-months',
'mobile-frontend-last-modified-with-user-years',
'mobile-frontend-last-modified-with-user-just-now',
- ),
- 'position' => 'top',
- ),
-
- 'mobile.head.beta' => $wgMFMobileResourceBoilerplate + array(
- 'dependencies' => array(
- 'mobile.head',
- ),
- 'scripts' => array(
- 'javascripts/common/matchMedia.js',
),
'position' => 'top',
),
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index f4bc4a3..b7358e0 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -792,6 +792,7 @@
'skins.minerva.buttons.styles',
'skins.minerva.content.styles',
'skins.minerva.drawers.styles',
+ 'skins.minerva.tablet.styles',
// FIXME: Rename to use skins.minerva prefix - don't
break cache in process
'mobile.styles.page',
'mobile.pagelist.styles',
diff --git a/includes/skins/SkinMinervaBeta.php
b/includes/skins/SkinMinervaBeta.php
index 6fc2aa7..5a0c341 100644
--- a/includes/skins/SkinMinervaBeta.php
+++ b/includes/skins/SkinMinervaBeta.php
@@ -14,37 +14,7 @@
# Replace page content before DOMParse to make sure images are
scrubbed
# and Zero transformations are applied.
$this->handleNewPages( $out );
- $this->prepareResponsiveStyles();
parent::outputPage( $out );
- }
-
- /**
- * Prepares head items that add conditionally loaded responsive styles.
- * FIXME: Review this approach thoroughly before pushing to stable.
- * Loosely based on:
- *
http://christianheilmann.com/2012/12/19/conditional-loading-of-resources-with-mediaqueries/
- */
- protected function prepareResponsiveStyles() {
- global $wgMFDeviceWidthTablet;
-
- $url = ResourceLoader::makeLoaderURL(
- array( 'tablet.styles' ),
- $this->getLanguage()->getCode(),
- $this->getSkinName(),
- null,
- null,
- ResourceLoader::inDebugMode(),
- 'styles'
- );
- $attrs = array(
- 'data-href' => $url,
- 'data-media' => '(min-width: ' . $wgMFDeviceWidthTablet
.'px)'
- );
- $out = $this->getOutput();
- $out->addHeadItem( 'responsiveStyles', Html::element( 'style',
$attrs ) );
- $out->addHeadItem( 'responsiveScript', Html::inlineScript(
- "jQuery.matchMedia();"
- ) );
}
protected function getSearchPlaceHolderText() {
@@ -88,7 +58,6 @@
public function getDefaultModules() {
$modules = parent::getDefaultModules();
- $modules['mobile'][] = 'mobile.head.beta';
$modules['talk'] = array( 'mobile.talk' );
$modules['beta'] = array( 'mobile.beta' );
$modules['beta'][] = 'mobile.geonotahack';
diff --git a/javascripts/common/application.js
b/javascripts/common/application.js
index 05e187d..7e9ed90 100644
--- a/javascripts/common/application.js
+++ b/javascripts/common/application.js
@@ -115,7 +115,7 @@
* @method
*/
function loadWideScreenModules() {
- var modules = [ 'tablet.styles' ];
+ var modules = [];
if ( !inWideScreenMode && isWideScreen() &&
$( 'body' ).hasClass( 'skin-minerva' ) &&
M.isBetaGroupMember() ) {
// Adjust screen for tablets
diff --git a/javascripts/common/matchMedia.js b/javascripts/common/matchMedia.js
deleted file mode 100644
index df27ecd..0000000
--- a/javascripts/common/matchMedia.js
+++ /dev/null
@@ -1,14 +0,0 @@
-( function( $ ) {
- $.matchMedia = function() {
- if ( window.matchMedia ) {
- $( 'style[data-media]' ).each( function() {
- var $el = $( this );
- if ( window.matchMedia( $el.data( 'media' )
).matches ) {
- $( '<link rel="stylesheet">' ).
- attr( 'href', $el.data( 'href'
) ).
- insertAfter( $el );
- }
- } );
- }
- };
-} ( jQuery ) );
diff --git a/javascripts/common/modules.js b/javascripts/common/modules.js
index b04f332..8a1e5ac 100644
--- a/javascripts/common/modules.js
+++ b/javascripts/common/modules.js
@@ -72,3 +72,7 @@
}
}
};
+
+// Load tablet style module
+// FIXME: Remove this after cache clears for skins.minerva.tablet.styles
+mw.loader.using( 'skins.minerva.tablet.styles', jQuery.noop );
diff --git a/less/tablet/common.less b/less/tablet/common.less
index 92ef57d..030f9a2 100644
--- a/less/tablet/common.less
+++ b/less/tablet/common.less
@@ -9,79 +9,71 @@
@contentMaxWidth: 890px + (@contentPaddingTablet * 2);
@media all and (min-width: @wgMFDeviceWidthTablet) {
- .beta, .alpha {
- #content_wrapper {
- .content_block {
- width: auto;
- clear: none;
- }
- }
-
- .pre-content {
- position: relative;
- padding: 20px @contentPaddingTablet 0
@contentPaddingTablet;
- border: none;
-
- h1#section_0 {
- border-bottom: 1px solid @sectionBorderColor;
- // FIXME: After this and the new page-action
CSS below are promoted to stable,
- // move page-actions before the h1 in the DOM,
remove the 220px padding on the
- // header, and change the absolute positioning
of page-actions to float.
- padding: 12px 220px 7px 0;
- }
-
- #page-actions {
- padding: 40px @contentPaddingTablet 0 0;
- position: absolute;
- right: 0;
- top: 0;
- li:last-child {
- margin-right: 0 !important;
- }
- }
- }
-
- // FIXME: Have a class that identifies all 4 of these
- .drawer,
- .pre-content,
- .content,
- .content-overlay {
- max-width: @contentMaxWidth;
- margin: 0 auto;
- }
-
- .content {
- padding: 1.6em @contentPaddingTablet 0
@contentPaddingTablet;
- // Classes added by thumbnails
- // e.g. [[File:Scholars mate
animation.gif|frame|left|"[[Scholar's mate]]"]]
- .thumb {
- &.tleft {
- float: left;
- clear: left;
- margin-right: 1.4em;
- }
-
- &.tright {
- float: right;
- clear: right;
- margin-left: 1.4em;
- }
- }
-
- // Blockquotes
- blockquote {
- // Increase horizontal padding
- padding-right: @blockquotePaddingRight + 10px;
- padding-left: @blockquotePaddingLeft + 10px;
- }
- }
-
- #footer {
- padding: 2em @contentPaddingTablet 1.5em
@contentPaddingTablet;
+ #content_wrapper {
+ .content_block {
+ width: auto;
+ clear: none;
}
}
+ .pre-content {
+ position: relative;
+ padding: 20px @contentPaddingTablet 0 @contentPaddingTablet;
+ border: none;
+
+ h1#section_0 {
+ border-bottom: 1px solid @sectionBorderColor;
+ // FIXME: After this and the new page-action CSS below
are promoted to stable,
+ // move page-actions before the h1 in the DOM, remove
the 220px padding on the
+ // header, and change the absolute positioning of
page-actions to float.
+ padding: 12px 220px 7px 0;
+ }
+
+ #page-actions {
+ padding: 40px @contentPaddingTablet 0 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+ li:last-child {
+ margin-right: 0 !important;
+ }
+ }
+ }
+
+ // FIXME: Have a class that identifies all 4 of these
+ .drawer,
+ .pre-content,
+ .content,
+ .content-overlay {
+ max-width: @contentMaxWidth;
+ margin: 0 auto;
+ }
+
.content {
+ padding: 1.6em @contentPaddingTablet 0 @contentPaddingTablet;
+ // Classes added by thumbnails
+ // e.g. [[File:Scholars mate
animation.gif|frame|left|"[[Scholar's mate]]"]]
+ .thumb {
+ &.tleft {
+ float: left;
+ clear: left;
+ margin-right: 1.4em;
+ }
+
+ &.tright {
+ float: right;
+ clear: right;
+ margin-left: 1.4em;
+ }
+ }
+
+ // Blockquotes
+ blockquote {
+ // Increase horizontal padding
+ padding-right: @blockquotePaddingRight + 10px;
+ padding-left: @blockquotePaddingLeft + 10px;
+ }
+
// Override rules in common/common.less
table {
display: table;
@@ -94,11 +86,16 @@
}
}
+ // For Main Page
#mw-mf-last-modified {
padding: 5px 0;
}
}
+ #footer {
+ padding: 2em @contentPaddingTablet 1.5em @contentPaddingTablet;
+ }
+
// On most pages the last modified bar is outside the content div
#mw-mf-last-modified {
padding: 5px @contentPaddingTablet;
diff --git a/less/tablet/hacks.less b/less/tablet/hacks.less
index 6748d9d..186dc72 100644
--- a/less/tablet/hacks.less
+++ b/less/tablet/hacks.less
@@ -14,41 +14,29 @@
/* Tablet specific styling */
@media all and (min-width: @wgMFDeviceWidthTablet) {
-
.content {
// Revert to showing nav boxes on tablet/desktop
.navbox, .vertical-navbox {
display: inherit;
}
-
- // Infobox styling
- .infobox {
- margin-left: 1em !important;
- width: 23em !important;
- float: right !important;
- clear: right;
- }
}
- .beta, .alpha {
- #content_wrapper {
+ #content_wrapper {
+ // Float infoboxes to the right of the page
+ table.infobox {
+ margin: .5em 0 .5em 1em !important;
+ // Note this is fixed to ensure that we leave enough
space for the sections to the infoboxes left
+ max-width: @infoboxWidth;
+ // FIXME [Templates]: Inline styles force us to use
!important
+ width: auto !important;
+ float: right !important;
+ margin-left: @contentMargin !important;
+ clear: right !important;
+ }
- // Float infoboxes to the right of the page
- table.infobox {
- margin: .5em 0 .5em 1em !important;
- // Note this is fixed to ensure that we leave
enough space for the sections to the infoboxes left
- max-width: @infoboxWidth;
- // FIXME [Templates]: Inline styles force us to
use !important
- width: auto !important;
- float: right !important;
- margin-left: @contentMargin !important;
- clear: right !important;
- }
-
- // Match caption styling from MediaWiki:Common.css
- caption {
- font-weight: bold;
- }
+ // Match caption styling from MediaWiki:Common.css
+ caption {
+ font-weight: bold;
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/134978
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia2ddca666c42762378e4c2bfe8e6a82ee3e43420
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits