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
Changes:
- introduced new config variable: RelatedArticlesEnabledSamplingRate
- do not trigger RelatedArticles clientside scripts if feature is disabled
- do not log events when navigator.sendBeacon is not available
Bug: T156039
Change-Id: I7e9773131c5b9aea9e9fb554d4508842cdedede7
Introduce a new config variable `RelatedArticlesFooterBlacklistedSkins`
to control skins that are allowed to show ReadMore in the footer.
As before Minerva beta mode is always allowed to show.
Depends-on: I366c8656a0f14a7069053b2e6199caac20471ea4
Depends-on: Ie4ac3c11e81eeea9f5b4a7161a64477cb5d60f07
Bug: T144047
Change-Id: I1663ab25083d9d907f288e60d506831bebb67945
The ParserOutput object is already reset when state is reset, so there's no
point in setting or unsetting properties on it.
And since the only unit test was deleted, remove the hook for that too.
Change-Id: Idf12365e8c4b14e527d923edc1086bdaf349df32
Only triggers RelatedArticles module load and query after user has scrolled
through half the document height.
Bug: T116838
Change-Id: If290988fb7cc187cad37dd4a8a2c4f38abed9bb9