Commit graph

49 commits

Author SHA1 Message Date
Stephen Niedzielski ac069fbec1 [dev] Consolidate ResourceLoader LESS style files
Move styles.less to index.less and import print.less from it. This keeps
the reasoning about styles constrained to LESS instead of spread out
over LESS _and_ ResourceLoader. The former is preferable since LESS is
more standardized than ResourceLoader.

The approach of moving styles.less to index.less and then referencing
print.less was chosen with the intent that it'd be easier to assume
styles are screen styles unless a media query says otherwise.

This patch also makes the variables import common among print and screen
styles.

Bug: T246419
Change-Id: I981d0937aaacb7cba082c337f98c90e90b46b340
2020-03-10 15:29:15 -06:00
Stephen Niedzielski 713d0ac2fd [dev] Favor LESS media queries to ResourceLoader
Prior to this patch, Vector used a mixture of LESS media queries and
ResourceLoader (RL) media queries[0]. So far as I can tell[1], the
latter only instructs RL to wrap the contents of a LESS file within a
query (there are no conditionals placed on style loading). Further,
according to a coauthor of RL (Roan), RL media query support was most
likely a replacement for `@media foo { @import foo.css }` to inline
print styles from a separate style sheet which Vector itself does not
use. The LESS solution is much more intuitive since it's not MediaWiki-
specific and only the LESS code needs to be considered instead of LESS
_and_ the RL configuration in skin.json.

This patch moves both screen media queries to screen.less for the
aforementioned consistency and to avoid nesting queries. It is hoped
that these changes will help make future work easier, such as those to
margin likely to take place in making the sidebar collapsible.

[0]: https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Media_queries
[1]: http://localhost:8181/w/load.php?debug=true&lang=en&modules=skins.vector.styles&only=styles&skin=vector

Bug: T246419
Change-Id: Ic0adfa254f3e81dfa87a26899f3aa585645956f1
2020-03-10 13:13:42 -06:00
Stephen Niedzielski de76ab59c1 [Special:Preferences] [PHP] Add skin version user preference and configs
Add a Vector-specific user preference to Special:Preferences for
toggling skin version, either Legacy Vector or the latest Vector.

The presentation of the new preference section and the default values
for anonymous, new, and existing accounts are configurable via
$wgVectorShowSkinPreferences, $wgVectorDefaultSkinVersion (to be used by
the feature manager in T244481),
$wgVectorDefaultSkinVersionForExistingAccounts, and
$wgVectorDefaultSkinVersionForNewAccounts. These configurations default
to the fullest experience so that third-party configuration is minimal.
See skin.json for details. The configurations are each tested in
VectorHooksTest.php.

When presentation is enabled, the new preference appears as a checkbox;
enabled is Legacy mode and disable is latest. There are a number of
unfortunate details:

- Showing and hiding a checkbox is supported by OOUI. Showing and hiding
  a whole section (Vector skin preferences, in this case) is not so this
  additional client JavaScript functionality is added in Core (see
  Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377).
- Stylization as a checkbox is wanted. However, the implied storage type
  for OOUI checkboxes is a boolean. This is not wanted in the event that
  another skin version is added (e.g., '3' or 'alpha'). As a workaround,
  the preference is converted from a boolean to a version string ('1' or
  '2') on save in Hooks::onPreferencesFormPreSave() and from a version
  string to a checkbox enable / disable string ('1' or '0') in
  onGetPreferences(). There a number of test cases to help cover these
  concerning details.

Documentation for overriding the skin version as a URL query parameter
is provided in anticipation of T244481.

Bug: T242381
Bug: T245793
Depends-On: Iaf68b238a8ac7a4fb22b9ef5d6c5a3394ee2e377
Depends-On: Ifc2863fca9cd9efd11ac30c780420e8d89e8cb22
Change-Id: I177dad88fc982170641059b6a4f53fbb38eefad6
2020-02-26 12:56:10 -07:00
polishdeveloper 4819772ac5 Bump required MediaWiki version
1. As MediaWiki documentation says, in order to use AutoloadNamespaces,
   we require at MediaWiki 1.31. See
   https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#AutoloadNamespaces

2. The most recent obsolete version of MW is v1.30. Bump the required
   version to the most recent LTS version, v1.31

Bug: T244481
Change-Id: I735fd64085601376bf1917b2df5a7dbeeb55108f
2020-02-26 16:58:14 +00:00
Sam Smith 9177c22365 features: Add minimalist feature manager
With complex additions to Vector's codebase like the Desktop Improvement
Program upcoming, it's important that we have a shared, intuitive
language to talk about features and their requirements. Centralising
the registration of features and creating an API satisfies does exactly
this.

This change introduces a greatly-reduced version of Piotr Miazga's
(polishdeveloper, pmiazga) original proposed API and associated
scaffolding classes for feature management in Vector, which itself was
based upon his work in MobileFrontend/MinervaNeue. This is done to
establish a foundation upon which we can build the more sophisticated
parts of Piotr's proposal in a piecemeal basis, thereby minimising risk.

Distinct from Piotr's proposed API is the ability to register sets and
features that are always enabled or disabled.

Additionally:

- A Vector.FeatureManager service is registered but not used

- A list of proposed immediate next steps is included

Bug: T244481
Change-Id: Ie53c41d479eaf15559d5bb00f269774760360bde
2020-02-26 11:49:29 +00:00
James D. Forrester 1cbb7ee653 Follow-up 2dbe4d7: Stop documenting wgVectorPrintLogo, never read
Change-Id: Ia968e72e1672e9afb4a11ddbfc89ef7e891dc0d3
2020-02-18 13:22:35 -08:00
jdlrobson 2dbe4d7af1 Drop usage of mediawiki.skinning.interface module in favor of SkinModule
Thanks to the dependent change, the print logo is now provided
in core so we can remove the custom Vector ResourceLoader module

ResourceLoaderLessModule is replaced with a ResourceLoaderSkinModule
and gains the features capability replacing the need for
'mediawiki.skinning.interface' making use of the changes added in
6845912bcf1.

Note that for cached HTML both 'mediawiki.skinning.interface'
and skins.vector.styles will be loaded. We can avoid this
by renaming skins.vector.styles if necessary (but I'm not
sure if we'd want to do that)

Bug: T232140
Depends-On: I00899c16c0325f36b671baf17e88c2b5187b3526
Change-Id: I569e0d800e147eabc7852567acd140108613f074
2020-02-05 10:02:47 +08:00
jdlrobson 58457f8ae8 Dev: Vector is rearranged like other skins and extensions
A resources folder is the defacto-standard across mediawiki repos.
Vector now mirrors those by describing where files served by ResourceLoader
are located.

Change-Id: Ib7d8575112e8afaaa84221a6f30a15b34b51eb24
2020-01-28 16:57:38 +08:00
Stephen Niedzielski 11d60dd88a [hygiene] [skin.json] simplify BeforePageDisplayMobile hook
Since only one hook is specified for the BeforePageDisplayMobile hook,
replace the array of hooks with the single hook used.

Change-Id: Ic89a262f3fdba93c3ee10387b3b05137ce9dc4ad
2020-01-17 20:08:01 +00:00
jenkins-bot 9cf4eb0e7e Merge "Hygiene: remove vectorConfig and use the getConfig" 2020-01-13 22:43:12 +00:00
Piotr Miazga 02d4e4929f Hygiene: remove vectorConfig and use the getConfig
The SkinVector implements IContextSource, thus it has to provide
the getConfig() method. Vector skin is currently using
it's own `vectorConfig` in one place and it passes the VectorConfig
to the VectorTemplate class. Sadly the VectorConfig is the same
thing what $this->getConfig() provides. There is no need to make
this code more complex by handling two different config containers
which at the end are the same GlobalVarConfig instances.

If we decide to handle VectorConfigs differently, let's thing it
through, for now we should simplify code and remove all uncessary
logic. Thanks to that, there is also no need to override the
setupTemplate().

Change-Id: I89c8a77f7d96f867c8c72e61f9e104e14d9512d9
2020-01-13 23:01:42 +01:00
Ammar Abdulhamid 672dd7b9a8 Upgrade skin.json schema to manifest_version 2
Bug: T242469
Change-Id: Idb96560efc8517ee8d353e856eb3a272af51ed4c
2020-01-13 04:40:02 +01:00
Timo Tijhof b7b8c77c1e Update ResourceModuleSkinStyles for jquery.ui change
Follows-up I9070ad905 in MediaWiki core.

Depends-On: I9070ad9052319f5ca2bc67e0ffaf502db0f13ceb
Bug: T219604
Change-Id: Ib13bf24f4d8fa8da932b57439e2b52ec10545f3c
2019-10-16 23:44:40 +01:00
Timo Tijhof e5c837e3eb Remove unused 'jquery.tabIndex' dependency
Follows-up bfc5a57.

Bug: T226148
Bug: T233676
Change-Id: Icb4a2458c40482a45172ce09f6ec14c4f7d1ccdf
2019-10-04 00:07:44 +00:00
DannyS712 5de3655dfc Fix typo in skin.json ResourceModuleSkinStyles
Bug: T234003
Change-Id: I75ca8af43f68ea88eaed2244abac312de6d3edc4
2019-09-27 18:35:00 +00:00
Timo Tijhof f169c8b3f9 Use mw.util.debounce() in collapsibleTabs.js
Bug: T213426
Depends-On: If370b959b2617d0f506ac3ed344af8c6a667e70d
Change-Id: Ib006a570f9405bbd48bb7e81a3d98b562df22b00
2019-09-11 19:29:46 +00:00
Isarra e08fc06fbd Style RelatedArticle cards
If RelatedArtcles uses the SkinAfterContent hook (depends-on patch)
and we move the hook out of the main content block (parent patch),
it needs some styles to remain consistent.

Bug: T181242
Change-Id: I2c5d4034890a5164896c1ef0570b31465a275890
Depeds-on: Iebd759c0d1a536768d18953f372664df762d9e04
2019-06-20 18:14:27 +00:00
Ed Sanders 10ed1061bf Remove jquery.ui.spinner skin styles
Bug: T219403
Depends-On: Ifed9074cb49d146b4cd7e366bfc028854daf027b
Change-Id: If10a09e2bd2266244c4916ce480a77048de8736d
2019-03-28 19:19:41 +00:00
Volker E 221b0b165a Remove obsolete Special:Preferences styles after its transformation to OOUI
These removed styles match no elements in the
Special:Preferences page since the OOUI transformation.

Bug: T208923
Change-Id: Iccbdcea5d5f769edfd8640c536e31289da9ee954
2018-11-07 12:50:57 -08:00
Volker E 7f308fa6b2 Restructure 'screen-hd' CSS rules
Concatenating all `margin-left` rules. This has 0 byte-saving
impact after gzipping at all, it's just about code style.
Also applying coding convention on media query in 'skin.json'.

Change-Id: Ica8557fcd519dea913fe4c30b1be1bfe0d0919c0
2018-10-13 12:02:06 -07:00
Timo Tijhof 2fa3b7f69a Move class files to includes/
Cleans up the top-level directory a bit.

Change-Id: I29d3b8b7098def77e643232a386d8ba834d35704
2018-03-12 16:52:48 -07:00
Kunal Mehta 1c2eeb1fdc Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: Ie8a20191fd9505eb5f0a6a3a010a602d2a44a58e
2018-02-16 10:41:02 -08:00
Tulsi Bhagat 336e7e5084 Removed deprecated position statements from resource loader module
Bug: T184257
Change-Id: I7be029b0ca3c44e1fb049d5987742c83585b54a7
2018-02-12 21:09:09 +00:00
Bartosz Dziewoński 7abf395766 Revert "Revert "Print styles in Vector are no longer feature flagged""
The revert looks like it has been performed incorrectly,
and I found a much better solution to the task anyway.

This reverts commit 7d2fc6df27.

Bug: T178028
Bug: T183640
Change-Id: Ib46c69b061b522fc6365459297ad3f3d4f4d0d0d
2017-12-27 11:26:29 +00:00
Paladox 7d2fc6df27 Revert "Print styles in Vector are no longer feature flagged"
This reverts commit c863b94302.

This breaks the MediaWiki Installer ui.

Bug: T183640
Change-Id: I9f249db503c4df6ab9d87b97d9f2d1dca80744ba
2017-12-23 19:17:49 +00:00
Umherirrender 1c0725da94 Rename file Hooks.php to match class
Change-Id: I59058d580d6b4ced5b7744c46baf074042467df7
2017-12-09 21:32:56 +01:00
jdlrobson c863b94302 Print styles in Vector are no longer feature flagged
Remove feature flagging of print styles

Changes:
* Merge experimental module into skins.vector.styles
* Update skins.vector.styles RL class to support LESS variable
* Remove feature flag class in HTML and LESS (update indents in
LESS file)

Bug: T178028
Change-Id: I8d5c59c5c9f415ffbd7fa41a512cbea87887e9e7
2017-11-02 11:04:58 -07:00
Baha 413870d350 Add print logo
Logo cannot be displayed as a background image because it won't be
visible in print unless the user prints backgrounds too.

A sample configuration looks like this:

$wgVectorPrintLogo = [
	'url' => 'https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg',
	'width' => 174,
	'height' => 27
];

The solution presented in the patch has a downside of not being able
to scale images down if their dimensions are bigger than the
dimensions specified in the config variable. For example, if we want
to go with an SVG image, then IE8 won't be able to render it.
Alternatively, if we want to go with a PNG image, its dimensions need
to match the exact dimensoins in the config variable, otherwise the
image will show up larger or smaller depending on its dimensions.

A more complicated approach of scaling images using `transform: scale`
hasn't been used because we wanted to keep the configuration simple
while supporting the majority of our users. With the current change,
we can reuse the existing configuration options from Minerva, for
exmaple. It would look something like this:

$wgVectorPrintLogo = [
	'url' => $wgMFCustomLogos['copyright'],
	'width' => $wgMFCustomLogos['copyright-width'],
	'height' => $wgMFCustomLogos['copyright-height']
];

Bug: T169826
Change-Id: If8f9f8d95fd3c955ece37d6c8ab6995596189667
2017-08-01 10:55:53 -04:00
jdlrobson 3a3e7ac046 Feature flagged print styles
These are feature flagged to allow editors to test before making
them the default. A class is added to the body tag to allow us
to switch between old and new styles at a later date.

To start with we introduce some typography improvements.
Further iterations will focus on other elements.

Changes:
* headings were previously diluted in the body content and difficult to spot.
This evens out the spacing between last content and its own content block.
* clear ownership of <p>s with its heading
* We would like to match Latex style body typography with single column.
The new styles reduce the number of pages by around 20-25%
* hyperlink underline -
This is a community requested feature. We do not use color in print styles
because it's printer friendly. Because of this, it is not possible to indicate
blue links in articles. If a user wants to know if this article exists on wikipedia,
it's not possible given solution.
We would like to underline the <a> tags in print styles.
it's better for accessibility as well.

Bug: T169823
Change-Id: I453ae43099796a74c39d965b796f2fa13942106c
2017-07-20 11:54:55 -07:00
jdlrobson e53b4cf522 Vector should operate in responsive mode when the mobile skin
With MobileFrontend installed applying
?useskin=vector&useformat=mobile will ensure that responsive vector
mode is invoked.

I'm keen to do this, as it would help to have more examples of skins
that are MobileFrontend aware as part of the work I am doing in
T166748

Change-Id: I81edd855a5e96400d1179fb10907fcc30ea43ef7
2017-07-03 15:57:49 -07:00
Jack Phoenix d575e3878a Optimization: move styles specific to redirect pages out of common.less
HT MatmaRex

Change-Id: I6169692547378379dbc935976ad83cf4f366eeeb
2017-06-15 16:13:42 +03:00
Ed Sanders 53cabcfe66 Use new placeholder mixin
Also fix site search to use use the same shade of grey
as is used in OOUI and mw-ui.

Depends-On: I96686bb53cee1a833db8f4d0b691d5e4a1b82885
Change-Id: Ib6437b13760e8c13d06927cb45ef674a5f301e35
2017-02-23 16:37:16 +00:00
jo12bar 565011c5c4
Use global variable for tablet media query in responsive.less
The Vector skin's responsive mode originally used 768px as a hardcoded
value for the media query set up in skin.json. I attempted to
switch to the @deviceWidthTablet global Less variable provided by
MediaWiki inside skin.json, but this would not work under any
circumstances. Evidently, ResourceLoader does not compile Less, so
it just ignores the media query if it contains a Less variable.
I was forced to leave the media query within skin.json blank
and hard-code it into responsive.less. When using the
@deviceWidthTablet variable inside responsive.less, it worked
fine. Obviously this is not ideal, as I am bypassing ResourceLoader,
but I have no other choice. See this comment (T124994#2864136) for
details.

Bug: T124994
Change-Id: I28565e5ba88be41dcd9cb38fc09cffe29d263e06
2016-12-13 15:27:38 -08:00
David Lynch d7bb03f11d oojs-ui.styles is now oojs-ui-core.styles
Bug: T127742
Change-Id: Ic32f721cd5fd5d7cf524c83fefd39c490a94f2d1
2016-02-29 10:59:59 -06:00
Matt Russell f71e92733a Remove mediawiki.sectionAnchor
The feature was reverted in 5205405385397782b5288b429f49c9d8c97ac6c6 almost a
year ago, so it's pretty safe to say this styling is unnecessary.

This essentially reverts 2466e550e5.

Change-Id: I88b6465d5554d334cc34893bb0acf548a5fc440b
2016-02-23 18:49:01 +11:00
jdlrobson 3603dce8ea Allow styles to run on mobile
Any skins. prefixed ResourceLoader style modules are okay to run on mobile
given they should only run in the context of the skin.

See I7c000165c61a4bd2094f23b6ffd96335f7f7818f
with that patch and the following enabled:
$wgMFDefaultSkinClass = 'SkinVector';
$wgVectorResponsive = true;

you'll be able to use the Vector skin in mobile mode.

Change-Id: I7b796385ce9786c2c7900e5acc36b1b4dbbb5b97
2016-01-29 16:16:50 +00:00
Bartosz Dziewoński 7f977f572d Actually apply personal bar z-index hack to modal OOUI window managers
Follow-up to 15a990b888. That didn't
work, the module is not named 'ooui'. And had it worked, it'd have
removed all the regular OOjs UI styles from the Vector skin, by
replacing them instead of adding.

Bug: T105300
Change-Id: Ic11147e9800788152621402eef7819191024aa71
2015-12-18 22:30:23 +01:00
Derk-Jan Hartman 33d736d0f2 Rework Vector style of Preferences to prevent FOUC
Depends on: I24d9b16

Bug: T115692
Change-Id: I59f0f4538132e60a457c5c93139c04fff24fd2b2
2015-11-08 19:43:21 +00:00
Siebrand a5496bcd75 Revert "Update namemsg to convention"
My bad... skinname-<skinname> is used in core to get the skin name.

This reverts commit ac0d123ba8.

Change-Id: I3c7780f9f08081238744fde094804ea8f5dd191a
2015-09-28 09:42:39 +00:00
Paladox ac0d123ba8 Update namemsg to convention
Bug: T113632
Change-Id: I86323ac69d420927c852eb9197fba3d589e73f1b
2015-09-25 18:26:57 +01:00
Kunal Mehta d65660be53 Add MediaWiki version requirement to skin.json
Change-Id: I081e837641119bff4a16e442302f0e4503c5d04a
2015-09-23 08:31:56 -07:00
Ed Sanders 15a990b888 Apply personal bar z-index hack to modal OOUI window managers
Bug: T105300
Change-Id: I1b618b76f0ed917aad74394881115399d9636030
2015-08-08 14:15:06 -07:00
Kunal Mehta ac43e74cfb Unbreak styles for installer
The installer hardcodes and expects to find a "skin.vector.styles"
module in skin.json, so moving it into a hook broke the styles. Moved it
back into skin.json, and left a comment so future developers don't make
the same mistake.

The responsive code is now a separate module,
"skins.vector.styles.responsive", which is only added to the page output
if VectorResponsive is enabled.

Bug: T106747
Change-Id: I7540b7871531ef650e799f012477cef6cdd32fb7
2015-07-23 17:05:26 -07:00
Jack Phoenix cec2337aac Make Vector more responsive
This functionality is off by default, behind a configuration variable
($wgVectorResponsive) by popular developer demand.

CSS/LESS code by James Hare, with tweaks and testing by Jack Phoenix.

Bug: T46387
Change-Id: Ib611357bbce739b1d193abaf89c228ba52613d6a
2015-07-18 16:54:33 +00:00
Kunal Mehta b7df704d1e Set manifest_version in skin.json
Bug: T100745
Change-Id: I0ed0f42d5cb40b26043b829c9b85a15a19ce53c0
2015-06-08 13:28:29 -07:00
jenkins-bot d564596781 Merge "Skin styles for mediawiki.notification should not be overriden" 2015-05-07 13:38:02 +00:00
Gilles Dubuc d4fef458af Explicitly define module position
Style modules currently added through addModuleStyles default
to being in the head ("top" position). This is an unhealthy default,
since only critical styles that are needed at pageload should be
in the head. In order to be able to switch the default to "bottom",
existing module positions have to be defined explicitly.

Bug: T97410
Change-Id: Ic3d188fe5a833a97027a06cd62c4acef691669bf
2015-05-05 17:36:36 +02:00
jdlrobson e1ce793b53 Skin styles for mediawiki.notification should not be overriden
Should be concatenated.
See: Iba35692d38a8248096153146bc296b1079352f01

Change-Id: Ib4891ff0b3b123d49871b5887d05b885bcea6b4f
2015-05-04 21:04:08 +01:00
paladox 23f2c6a8fc Add skin.json, deprecate and empty PHP entry point
Bug: T87875
Change-Id: I0e298137e27e2a4c7ced5213ea90aef4cd991376
2015-04-30 20:02:32 +01:00