jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/372559 )

Change subject: MobileFrontend should not add Minerva modules for its special 
pages
......................................................................


MobileFrontend should not add Minerva modules for its special pages

The styles/js should apply to the special pages in all skins when
operating in mobile mode.

This improves rendering of other skins when operating in mobile mode.
e.g.
?title=Special:EditWatchlist&useskin=vector&useformat=mobile

Additional changes:
* Add an icon pack `mobile.special.user.icons` for special pages
so its not using Minerva

Bug: T173597
Change-Id: I665f6fe60939475249786fdc951149c38473fda6
---
M extension.json
M includes/MobileFrontend.hooks.php
M includes/specials/MobileSpecialPageFeed.php
M includes/specials/SpecialMobileContributions.php
M includes/specials/SpecialMobileDiff.php
M includes/specials/SpecialMobileEditWatchlist.php
M includes/specials/SpecialMobileWatchlist.php
M mobile.less/mobile.variables.less
A resources/mobile.special.styles/common.less
A resources/mobile.special.styles/forms.less
A resources/mobile.special.user.icons/userAnonymous.svg
A resources/mobile.special.user.icons/userNormal.svg
A resources/mobile.special.watchlist.scripts/watchlist.js
A resources/mobile.special.watchlist.styles/specialWatchlist.less
M resources/mobile.watchlist/WatchList.js
15 files changed, 199 insertions(+), 11 deletions(-)

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



diff --git a/extension.json b/extension.json
index 585f996..f3f8325 100644
--- a/extension.json
+++ b/extension.json
@@ -974,6 +974,40 @@
                        ],
                        "class": "MobileSiteModule"
                },
+               "mobile.special.styles": {
+                       "targets": "mobile",
+                       "position": "top",
+                       "styles": [
+                               "resources/mobile.special.styles/common.less",
+                               "resources/mobile.special.styles/forms.less"
+                       ]
+               },
+               "mobile.special.watchlist.styles": {
+                       "targets": "mobile",
+                       "position": "top",
+                       "styles": [
+                               
"resources/mobile.special.watchlist.styles/specialWatchlist.less"
+                       ]
+               },
+               "mobile.special.user.icons": {
+                       "class": "ResourceLoaderImageModule",
+                       "selector": ".mw-ui-icon-{name}:before",
+                       "position": "bottom",
+                       "images": {
+                               "user": 
"resources/mobile.special.user.icons/userNormal.svg",
+                               "anonymous": 
"resources/mobile.special.user.icons/userAnonymous.svg"
+                       }
+               },
+               "mobile.special.watchlist.scripts": {
+                       "targets": "mobile",
+                       "dependencies": [
+                               "mobile.startup",
+                               "mobile.watchlist"
+                       ],
+                       "scripts": [
+                               
"resources/mobile.special.watchlist.scripts/watchlist.js"
+                       ]
+               },
                "mobile.special.mobilecite.styles": {
                        "targets": "mobile",
                        "styles": [
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 787a00d..6ec31c1 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -580,8 +580,13 @@
                $isMobileView = 
MobileContext::singleton()->shouldDisplayMobileView();
                $name = $special->getName();
 
-               if ( $isMobileView && ( $name === 'Userlogin' || $name === 
'CreateAccount' ) ) {
-                       $special->getOutput()->addModules( 
'mobile.special.userlogin.scripts' );
+               if ( $isMobileView ) {
+                       $special->getOutput()->addModuleStyles(
+                               [ 'mobile.special.styles', 
'mobile.messageBox.styles' ]
+                       );
+                       if ( $name === 'Userlogin' || $name === 'CreateAccount' 
) {
+                               $special->getOutput()->addModules( 
'mobile.special.userlogin.scripts' );
+                       }
                }
 
                return true;
@@ -784,6 +789,10 @@
                        // We load MediaWiki:Mobile.css/js instead
                        $out->addModules( [ 'mobile.site' ] );
 
+                       if ( $out->getRequest()->getText( 'oldid' ) ) {
+                               $styles[] = 'mobile.messageBox.styles';
+                       }
+
                        // Allow modifications in mobile only mode
                        Hooks::run( 'BeforePageDisplayMobile', [ &$out, &$sk ] 
);
 
diff --git a/includes/specials/MobileSpecialPageFeed.php 
b/includes/specials/MobileSpecialPageFeed.php
index b932ddca..84dd22d 100644
--- a/includes/specials/MobileSpecialPageFeed.php
+++ b/includes/specials/MobileSpecialPageFeed.php
@@ -19,7 +19,7 @@
                $out = $this->getOutput();
                $out->addModuleStyles( [
                        'mobile.special.pagefeed.styles',
-                       'skins.minerva.icons.images.scripts'
+                       'mobile.special.user.icons'
                ] );
                $this->setHeaders();
                $out->setProperty( 'unstyledContent', true );
diff --git a/includes/specials/SpecialMobileContributions.php 
b/includes/specials/SpecialMobileContributions.php
index 83d0014..5a5ca8e 100644
--- a/includes/specials/SpecialMobileContributions.php
+++ b/includes/specials/SpecialMobileContributions.php
@@ -59,7 +59,7 @@
                                $out = $this->getOutput();
                                $out->addModuleStyles( [
                                        'mobile.pagelist.styles',
-                                       'skins.minerva.icons.images.scripts',
+                                       'mobile.special.user.icons',
                                        'mobile.pagesummary.styles',
                                ] );
                                $out->setHTMLTitle( $this->msg(
diff --git a/includes/specials/SpecialMobileDiff.php 
b/includes/specials/SpecialMobileDiff.php
index 39d9133..9108099 100644
--- a/includes/specials/SpecialMobileDiff.php
+++ b/includes/specials/SpecialMobileDiff.php
@@ -121,7 +121,7 @@
                ) );
 
                $output->addModuleStyles( [
-                       'skins.minerva.icons.images.scripts',
+                       'mobile.special.user.icons',
                        'mobile.pagesummary.styles',
                        // @todo FIXME: Don't add these styles. This is only 
needed for the user
                        // icon to the left of the username
diff --git a/includes/specials/SpecialMobileEditWatchlist.php 
b/includes/specials/SpecialMobileEditWatchlist.php
index 871117b..2ba13ad 100644
--- a/includes/specials/SpecialMobileEditWatchlist.php
+++ b/includes/specials/SpecialMobileEditWatchlist.php
@@ -221,11 +221,10 @@
                }
                $out = $this->getOutput();
                $out->addHtml( $html );
-               $out->addModules( 'skins.minerva.special.watchlist.scripts' );
+               $out->addModules( 'mobile.special.watchlist.scripts' );
                $out->addModuleStyles(
                        [
-                               'skins.minerva.special.styles',
-                               'skins.minerva.special.watchlist.styles',
+                               'mobile.special.watchlist.styles',
                                'mobile.pagelist.styles',
                                'mobile.pagesummary.styles',
                                'mobile.special.pagefeed.styles'
diff --git a/includes/specials/SpecialMobileWatchlist.php 
b/includes/specials/SpecialMobileWatchlist.php
index e381e51..3cbcf2d0 100644
--- a/includes/specials/SpecialMobileWatchlist.php
+++ b/includes/specials/SpecialMobileWatchlist.php
@@ -62,9 +62,9 @@
 
                $user = $this->getUser();
                $output = $this->getOutput();
-               $output->addModules( 'skins.minerva.special.watchlist.scripts' 
);
+               $output->addModules( 'mobile.special.watchlist.scripts' );
                $output->addModuleStyles( [
-                       'skins.minerva.special.watchlist.styles',
+                       'mobile.special.watchlist.styles',
                        'mobile.pagelist.styles',
                        'mobile.pagesummary.styles',
                ] );
diff --git a/mobile.less/mobile.variables.less 
b/mobile.less/mobile.variables.less
index e4980ff..5a2a73e 100644
--- a/mobile.less/mobile.variables.less
+++ b/mobile.less/mobile.variables.less
@@ -31,6 +31,7 @@
 @colorTutorial: #2e76ff;
 
 // TODO: Can these be made to use core variables (or swapped out for some)?
+@colorErrorBackground: #fae3e3;
 @colorSuccessBackground: #e1fddf;
 @colorSuccessText: #009000;
 
diff --git a/resources/mobile.special.styles/common.less 
b/resources/mobile.special.styles/common.less
new file mode 100644
index 0000000..70f177e
--- /dev/null
+++ b/resources/mobile.special.styles/common.less
@@ -0,0 +1,58 @@
+@import 'mediawiki.ui/variables';
+@import 'mobile.variables';
+
+// used in Special:Nearby and Special:UserLogin
+.errorbox,
+.error {
+       color: @colorErrorText;
+       background: @colorErrorBackground;
+}
+
+.mw-ui-button-group,
+.page-list {
+       margin: 0;
+}
+
+.ns-special {
+       ul {
+               list-style: none;
+       }
+
+       .content-header {
+               padding: 0 0 20px;
+               border-bottom: 1px solid @colorGray12;
+
+               ul {
+                       &:after {
+                               content: ' ';
+                               clear: both;
+                               display: block;
+                       }
+               }
+
+               h2 {
+                       padding: 0;
+                       font-size: 1.1em;
+                       font-weight: bold;
+                       border-bottom: 0;
+                       text-align: center;
+               }
+       }
+
+       .content {
+               // don't apply these styles to headings in message boxes
+               > h2 {
+                       text-align: center;
+                       margin: 0.7em 0;
+                       font-size: 1.1em;
+                       color: @grayMedium;
+               }
+       }
+
+       .error {
+               h2 {
+                       margin-top: 0;
+                       text-transform: none;
+               }
+       }
+}
diff --git a/resources/mobile.special.styles/forms.less 
b/resources/mobile.special.styles/forms.less
new file mode 100644
index 0000000..ea5ec70
--- /dev/null
+++ b/resources/mobile.special.styles/forms.less
@@ -0,0 +1,49 @@
+@import 'mobile.variables';
+
+form {
+       // FIXME: work out what to do with these
+       #mw-prefs-restoreprefs {
+               display: none;
+       }
+
+       fieldset {
+               font-size: 0.9em;
+
+               .htmlform-tip {
+                       display: none;
+               }
+
+               .mw-label,
+               .mw-ui-checkbox {
+                       font-style: italic;
+                       font-size: 0.9em;
+               }
+
+               legend {
+                       color: @grayMedium;
+                       font-size: 0.8em;
+                       font-weight: bold;
+                       text-transform: uppercase;
+               }
+
+               fieldset {
+                       margin: 0 0 1em 0.3em;
+               }
+       }
+}
+
+// For old style forms
+// Special:MovePage?target=San%20Francisco
+// Special:Import
+// Special:NewPages
+// Special:RecentChanges
+// Special:Prefixindex
+// Special:Contributions
+// Special:ChangePassword
+// Special:ChangeEmail
+// Special:Allpages
+.mw-input [type='submit'],
+.mw-submit {
+       margin-top: 8px;
+       min-width: 80%;
+}
diff --git a/resources/mobile.special.user.icons/userAnonymous.svg 
b/resources/mobile.special.user.icons/userAnonymous.svg
new file mode 100644
index 0000000..9cc3c56
--- /dev/null
+++ b/resources/mobile.special.user.icons/userAnonymous.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg 
xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 16 16"><path d="M2.112 0C.117 0 
0 1.932 0 1.994V16h13.888C15.883 16 16 14.068 16 14.006V0H2.112zm.426 
4.89s.726.726 2.295.726l2.233-.726c0 1.026-1.027 1.81-2.295 
1.81s-2.23-.782-2.23-1.81zm8.935 
6.517c-.543.3-1.148.542-1.81.726-.544.12-1.15.18-1.754.18-.73 
0-1.39-.122-2.056-.3-.605-.18-1.206-.422-1.69-.727-.3-.18-.42-.605-.18-.905.18-.3.606-.42.907-.176.364.242.848.42
 1.328.542 1.026.3 2.173.3 3.2.058a5.11 5.11 0 0 0 
1.45-.542c.3-.18.724-.057.904.243.125.305.004.726-.3.905zM11.415 6.7c-1.27 
0-2.295-.846-2.295-1.81 0 0 .726.726 2.295.726l2.233-.726c.063 1.026-.964 
1.81-2.233 1.81z" fill="#e7beba"/></svg>
\ No newline at end of file
diff --git a/resources/mobile.special.user.icons/userNormal.svg 
b/resources/mobile.special.user.icons/userNormal.svg
new file mode 100644
index 0000000..5f14d62
--- /dev/null
+++ b/resources/mobile.special.user.icons/userNormal.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg 
xmlns="http://www.w3.org/2000/svg"; viewBox="271.5 72.8 16 16"><g><path 
d="M273.59 72.8c-2.03 0-2.09 1.907-2.09 2.032V88.8h13.91c2.03 0 2.09-1.907 
2.09-2.032V72.8h-13.91z" fill="#d0d0d0"/><g fill="#fff" transform="matrix(.042 
0 0 .042 259.047 68.752)"><circle cx="437" cy="234.1" r="28"/><circle 
cx="553.5" cy="234.1" r="28"/></g><path d="M279.88 85.338c-1.8 
0-3.533-.617-4.583-1.61-.248-.247-.248-.68 0-.927s.68-.245.928 0c.806.81 2.167 
1.24 3.654 1.24 1.42 0 2.786-.43 3.59-1.24.246-.245.68-.245.926 0s.248.68 0 
.93c-1.113.988-2.722 1.61-4.52 1.61z" fill="#fff"/></g></svg>
\ No newline at end of file
diff --git a/resources/mobile.special.watchlist.scripts/watchlist.js 
b/resources/mobile.special.watchlist.scripts/watchlist.js
new file mode 100644
index 0000000..0f50f6a
--- /dev/null
+++ b/resources/mobile.special.watchlist.scripts/watchlist.js
@@ -0,0 +1,31 @@
+( function ( M, $ ) {
+       var WatchList = M.require( 'mobile.watchlist/WatchList' );
+
+       /**
+        * Initialises JavaScript on Special:Watchlist
+        * @method
+        * @ignore
+        */
+       function init() {
+               var $watchlist = $( 'ul.page-list' );
+
+               // FIXME: find more elegant way to not show watchlist stars on 
recent changes
+               if ( $( '.mw-mf-watchlist-selector' ).length === 0 ) {
+                       // eslint-disable-next-line no-new
+                       new WatchList( {
+                               api: new mw.Api(),
+                               el: $watchlist,
+                               funnel: 'watchlist',
+                               enhance: true
+                       } );
+                       $watchlist.find( '.page-summary .info' ).css( 
'visibility', 'visible' );
+               }
+               // not needed now we have JS view which has infinite scrolling
+               $( '.more' ).remove();
+       }
+
+       $( function () {
+               init();
+       } );
+
+}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.special.watchlist.styles/specialWatchlist.less 
b/resources/mobile.special.watchlist.styles/specialWatchlist.less
new file mode 100644
index 0000000..9dd75a0
--- /dev/null
+++ b/resources/mobile.special.watchlist.styles/specialWatchlist.less
@@ -0,0 +1,5 @@
+.client-js {
+       .page-summary .info {
+               visibility: hidden;
+       }
+}
diff --git a/resources/mobile.watchlist/WatchList.js 
b/resources/mobile.watchlist/WatchList.js
index 5834ca4..4ef1623 100644
--- a/resources/mobile.watchlist/WatchList.js
+++ b/resources/mobile.watchlist/WatchList.js
@@ -85,6 +85,6 @@
 
        } );
 
-       M.define( 'mobile.watchlist/WatchList', WatchList ); // 
resource-modules-disable-line
+       M.define( 'mobile.watchlist/WatchList', WatchList );
 
 }( mw.mobileFrontend, jQuery ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I665f6fe60939475249786fdc951149c38473fda6
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to