This simplifies the codebase by avoiding some unnecesary custom hooks,
and also improves Parsoid compatibility.
We look for old extensiondata coming from cached pages for
compatibility, but that code can be removed once the ParserCache expires
(T371421) for further simplification.
Bug: T263772
Change-Id: I843a920a0476290a8b0efd5eba4d8d44777d27d0
Changes:
- Removes redundant styles now inside Codex
- With the new component, it's not possible to display 3 cards in a
single line at a tablet resolution, so the media query responsible
is bumped to apply only at the desktop threshold
- Decisions are documented in ADR
Bug: T286835
Change-Id: I493e8e601ccc31b3cf1f16c0b5a8975f12ef336c
This requires 1.42 for some new names
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: I738fa5cd78d9b662326afc268bc2a90cb1540948
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.
Remove optional return from hook handlers
Bug: T346560
Change-Id: I4e42f7cf361e41c3ee687abcf41409a4704b7bf6
Replacing 'mediawiki.ui/variables.less' `@import`
with new skin-aware 'mediawiki.skin.variables.less' standard.
Also
- replacing several static values with skin variables featuring new
Codex design tokens for following properties:
- background-color
- color
- border-width, border-style, border-color and border shorthand
Bump required MediaWiki core version to >= v1.41.0.
Bug: T319381
Bug: T332541
Depends-On: I04f9e48a1cf9dee915cf51e1e12b17ff0a595a06
Change-Id: I32c2996dedc9b3a54e1f916623dbe1c4da910083
We currently require support for IntersectionObserver.
which is supported on Edge >= 15 (15 has partial support),
Firefox >55, Chrome >58, Safari 12.1, Opera >=38,
iOS Safari >=12.2, Android 100
Full ES6 is supported in Edge >=15, Firefox >=54, Chrome >=51,
Safari >=10, Opera >=38, iOS Safari >=10, so such a change
would only drop support for Edge 15 and Firefox 54.
CSS.escape is guaranteed in all these browsers according to
caniuse, with the only discrepancy being the Edge browser (versions
16-18) so it is also suggested we remove support for those browsers.
Firefox 54 accounts for 0.0026% of page views
Edge 15-18 accounts for 0.069% of page views
Bug: T306355
Change-Id: Id2987e3456607b610c38da9ee157a026d1d00ada
mw.experiments is never used in this codebase. Presumably this
dates back to when we did A/B tests for this feature.
Change-Id: I7d5bc63349686063ecd2c1fc63d078af91d2c541
useful for testing real world data
Suggested test config:
```
$wgRelatedArticlesUseCirrusSearchApiUrl = "https://en.wikipedia.org/w/api.php";
$wgRelatedArticlesUseCirrusSearch = true;
$wgRelatedArticlesDescriptionSource = 'wikidata';
```
This will allow us to enable on patchdemo with production content.
Change-Id: I73c0d73d3369f27ed2fd74b37ae71bfc12b6ee57
The RelatedPagesGateway is an OO class.
There is no reason for it to be, we don't use any
of it's features e.g. the event emitter
Change-Id: I8f807d35b0ce36ea5764508a66f88d74577e3653
1) Merge ext.relatedArticles.readMore and ext.relatedArticles.cards modules
These are always loaded together. No need to have them in separate modules.
In process switch to packagefiles
2) Merge ext.relatedArticles.readMore.bootstrap and ext.relatedArticles.readMore.gateway
Always loaded together.
Bug: T306228
Change-Id: I9442b0336e22ca795cc06f76068215266fe81271
Previously RelatedArticles required the Cards extension
This code refers to that old state and is cleaned up.
ext.relatedArticles.cards is added a dependency of
ext.relatedArticles.readMore since it now belongs to the same
extension
Change-Id: I4a89ed4256a4ae9fd22b0191748bd47ac3ffc593
For IntersectionObserver to work the element we listen on needs to
have a non-zero height.
Bug: T223844
Change-Id: I308f646670b112e42b0aaa11c438dbc5cdc5edd8
Currently, the extension queries the prop=description api to fetch the
description, but this api is only available if Wikibaseclient is installed.
Let's support other sources to fetch the page description from, too, or
disable it (by default) to sabe 85 bytes from each response by avoiding the
warning returned from the api when prop=description is not recognized.
A new configuration setting has been added: RelatedArticlesDescriptionSource.
It defaults to false (no description is fetched), but can be set to one of
those string values:
- wikidata: What's being used right now on WMF wikis
- textextracts: Extension:TextExtracts provides the prop=extracts api.
- pagedescription: Extension:Description2 provides a description page property, that can be queried by prop=pageprops&ppprop=description
Bug: T230947
Change-Id: I34410334ba9d6db1f686c7efb5722e2a51957145
This allows skins to determine where the cards appear in a consistent
fashion with other extensions, and require minimal special handling from
the extension itself.
Also change default settings as to when RelatedArticle cards will appear
- keep the whitelist to allow projects to configure their usage such as
in the case of only wanting it on mobile, etc, but now that it should
just work in any given skin, default it to on for all so that it's easier
for the average third party to install for whatever use.
Note that this default setting change will not affect WMF wikis, as
wmgRelatedArticlesFooterWhitelistedSkins is explicitly set in the
wmf-config regardless.
Bug: T181242
Depends-On: I5b0ad889e633fde88c392577ce5373c81fc5486a
Change-Id: Iebd759c0d1a536768d18953f372664df762d9e04
Bundle these with the module that needs it instead, this means
1. It is naturally only downloaded on pages where it is needed.
2. It doesn't block download/parse/render of the article HTML.
3. It doesn't delay time to mw.loader.load() for interactive
functionality.
Bug: T219342
Change-Id: I5c6809392b0621bd0d58049597f6c0306e572607
This enables use of module.exports and require() within the module,
and makes it easy to bundle additional data and scripts generated
by the server (without needing to subclass FileModule in PHP).
In particular, to bundle mw.config values with the module.
Currently the extension is adding these to the <head> of all
articles which delays rendering of the article content, and the
time to when JS can start to be fetched.
See <https://phabricator.wikimedia.org/T219342#5116773>.
Bug: T219342
Change-Id: I3f174418af8bfd83b0faabe484226e323714cb5b
Removes the muhogan module along with the templates and replacing
them with jQuery DOM construction.
Bug: T219846
Change-Id: I246f9c46ea2cc5721ddd57efcf58fae9fd947c58
With RelatedArticlesEnabledBucketSize now removed, installation of this
extension will turn it on for 100% users without any mechanism to turn
it off.
Additional changes:
* Bump version
* Add Readers team to contributors
Bug: T202306
Change-Id: I7dc270a06dd3afd4e894c8298165d6d6d4fda8d6
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: Id06c20eb9e1d97b6b8aa1fd2195ec1002066690d
RelatedArticles will now only render related articles in the footer of
skins.
Bump version to 3.0.0
Bug: T165991
Change-Id: Ia4e28c0ed76b3aff37c0aea8eb713923312ba23c
Wikivoyage pages have more than 3 related articles as they make use
of the {{#related:}} magic word.
After speaking with Nirzar we should allow this project to show more than 3.
This change allows this while keeping the existing behaviour on other wikis and
will pave the way for removing a bunch of code from this extension.
Additional changes:
* Cleanup skinStyles definitions
* Limit cards to 30% maximum width and give margin top to account for
situations where the number of cards are multiple of 3
** In Minerva hardcode the max-width to pixels.
* Margins are switched from hardcoded 10px to percentage based. Yes
this changes the right margin slightly but is more maintable and visually
the same.
Bug: T164765
Change-Id: I41119de3228c2df799f740d4bd00082101c21b97
In order to avoid further confusion, clarify that we're bucketing users
for experiments.
Bug: T167236
Depends-On: I752cdf068ca25bffb38229380785e7da1a208049
Change-Id: I6508ab8fa3d436ae295eb047e170fdc5417d25fc
* Move across all files
* Rename ext-card- prefix to ext-related-articles- prefix
** Since all code using these prefixes is JS
we do not have to worry about cached HTML
Bug: T137021
Change-Id: I784fd132c36329fa0dcc49fe2804460061940347
This change removes RelatedArticles from beta features.
It repurposes the BlacklistSkins config to be a whitelist that describes
when related pages should be shown in the footer.
To avoid enabling related pages on desktop, this depends on a config
change that makes use of the new configuration option.
Simplify browser tests to reflect the new status quo.
Bug: T146436
Bug: T160076
Depends-On: I522e0182d1c3d9261bd0561c3ec0c789b6431c7a
Change-Id: I84da1fb33a901a6365375d00d192af35422ff0b0
Since we're always depending on the event logging module, we can
make it a dependency in extension.json, rather than loading it
lazily.
Bug: T157375
Change-Id: Ia57f390586e123c6010a7daf23a3d851daf079ce
This allows us to decouple the event logging code from the
`ext.relatedArticles.readMore' module. As a result we'll be able to
log events without loading the above mentioned module.
Bug: T157375
Change-Id: I55cf4f40cafc88d6baeb5cc1b41fc2d6bcd2fbb9