Commit graph

71 commits

Author SHA1 Message Date
Volker E 9a5d59caee build: Update 'stylelint-config-wikimedia' to v0.5.0 and make pass
Also enabling 'no-descending-specificity' rule and the same time
simplify VE hidden rule.

Change-Id: Idad811e7fca681883fccbc961c70f49e2b356c02
2019-01-16 19:26:36 -08:00
Volker E 68e0e12794 Increase headline color contrast slightly to conform to AA ratio
Bug: T208343
Change-Id: I31d3c0a06de9597a8fc1367a7d3b906b8ffe9921
2018-10-30 12:33:45 -07:00
jdlrobson 6b49ddff1b Remove EventLogging/A-B test code from RelatedArticles
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
2018-09-20 11:13:13 -07:00
Fomafix 00405b0309 Remove mediaWiki and jQuery from eslint globals
Remove all mappings in the closures like in
I7cf2426cde597259e8c6f3f6f615a1a81a0ca82b in core.

Change-Id: Ie9a2fadb8e276774784a4937bb5c3ec11f213352
2018-09-15 17:54:03 +00:00
Fomafix 0464e7a7c0 Remove eslint rule "no-use-before-define": 1
Add no-use-before-define to the line where the rules is violated.

Change-Id: Ieb50b11292cff6b40fdd5f06c76d61bb01e86e4c
2018-08-17 13:29:08 +02:00
Fomafix 0fa064728f Use native JavaScript instead of jQuery
Replace
* $.each( array, function ( index, value ) { ... } ) by
  array.forEach( function ( value ) { ... } )

* $.map( array, function ( value ) { ... } ) by
  array.map( function ( value ) { ... } )

* $.isArray( var ) by
  Array.isArray( var )

* $.isFunction( var ) by
  typeof var === 'function'

Change-Id: I450f5a75eb9c3fe20517da02986b0a491ebca67a
2018-08-17 12:45:12 +02:00
Stephen Niedzielski 4e92ea4680 Fix: replace deviceTabletWidth w/ width-breakpoint-tablet in LESS
T140804 dropped the support for deviceTabletWidth in core
(https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/451648/9/includes/DefaultSettings.php).

Bug: T202021
Change-Id: I0d215bcd66654ac8646e6cc66f673e7e7b7fe945
2018-08-16 09:23:56 -05:00
jdlrobson efb41140a5 Contain code in own call stack
Per Timo's recommendation on Ife362f43d061d32fb0441dd1136fb11b46b475ae
use then instead of done for callback handling

Change-Id: I18dbfff59cb90a5076aa6f3b077ba9c264f7c139
2018-06-19 11:41:25 -07:00
jenkins-bot d76a4fde65 Merge "Correctly remove node without exception" 2018-06-06 10:42:44 +00:00
jdlrobson 7f7b2022a7 Correctly remove node without exception
$( '.read-more-container' ).get( 0 ) returns a DOMElement not a
jQuery object so there is no remove method. This will throw a
JavaScript exception.

It seems JavaScript exceptions can impact the loading of Wikidata
Page banners.

Bug: T152185
Change-Id: Ife362f43d061d32fb0441dd1136fb11b46b475ae
2018-06-06 11:27:06 +01:00
Jan Drewniak 816bda69c5 Replace pageterms with description API
Bug: T190953
Change-Id: Ia188a7bdc4d3533d6ee0e9bb06fa62da4b759c66
2018-04-13 10:02:14 +02:00
Stephen Niedzielski bc70678d22 Fix: wait to show related articles until ready
Wait until the Document is ready before appending related articles to
avoid the "last edited" link appended in afterwards.

This fix is untested as I've been unable to repro the issue reported.

Bug: T187479
Change-Id: Ieefaf644040ea057a65649a3ce14de3531ec2e72
2018-02-22 08:53:17 -06:00
Volker E 2e0c5719ea Unify SVG markup
Align SVG markup across Foundation products by
- unifying XML declaration,
- removing `enable-background` as it's deprecated and
- unifying whitespace.

Bug: T178867
Change-Id: I32972de815484fa89bd7cdacbbcd65f4663a4161
2017-12-18 19:43:17 -08:00
Ed Sanders 10de1deaf4 build: Update eslint and stylelint
Change-Id: I82bfb5fbfea4997f3048305574d2ff7d28ecd1b8
2017-10-09 15:37:28 +01:00
Volker E 6add5a1eac Align 'noimage' to WikimediaUI color palette
Aligning 'noimage' to overhauled color palette, background-color
equaling footer color and icon color going to closest,
minimally higher contrast color `#72777d`.

Bug: T172850
Change-Id: I949db4983910ef6609124adbfcd3c0d31a7f7eb4
2017-08-25 06:12:14 -07:00
Volker E 581a247d70 Replace abandoned colors with current WikimediaUI ones
Replacing abandoned `@colorGray8` (`#888`) & `@colorGray9` (`#999`)
with slightly increased contrast, WCAG 2.0 level AA conformant,
`@colorGray7` from WikimediaUI color palette.

Bug: T172850
Change-Id: I750261b83cc79c32e9ccdb2d69bb5e396b20ed35
2017-08-09 17:49:35 -04:00
jdlrobson f748c5907e Add limit via ResourceLoaderGetConfigVars
Using MakeGlobalVariablesScript hook will add config variables to
the HTML meaning cached HTML will not be able to access it leaving
it as undefined. This will mess up any existing caching.

Additional changes:
Because I'm paranoid, make sure that value is never undefined.

Bug: T170648
Change-Id: Icb8e34104c57b1e69b7e035ef89d5b4c3371132f
2017-07-14 16:42:53 -07:00
jdlrobson 9b75e0b372 Hygiene: Remove unnecessary variable
Improves readability...

Change-Id: Ib0e9cbc083e6c0a384c81815b470063698e0595f
2017-07-14 16:15:35 -07:00
jenkins-bot 38ac4650e0 Merge "Make number of RelatedArticles configurable" 2017-07-06 21:09:06 +00:00
jdlrobson 9126c7d0ef Make number of RelatedArticles configurable
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
2017-07-06 11:17:47 -07:00
Sam Smith f4c82d3a33 Hygiene: SamplingRate -> BucketSize
In order to avoid further confusion, clarify that we're bucketing users
for experiments.

Bug: T167236
Depends-On: I752cdf068ca25bffb38229380785e7da1a208049
Change-Id: I6508ab8fa3d436ae295eb047e170fdc5417d25fc
2017-06-20 05:26:29 +01:00
Sam Smith 153573dbe5 i13n: Don't sample by pageview
Currently, the mw.eventLog.Schema class samples per pageview. However,
we expect that if a user is bucketed for a session, then all
EventLogging events logged during that session are in the sample.

Unlike Popups in I4f653bba, the RelatedArticles instrumentation does
rely on another mw.eventLog.Schema behavior: distinguishing between
static and dynamic data. This and the use of mw.eventLog.Schema could be
removed in a follow-on change.

Bug: T167236
Change-Id: I9583cb98264efd7dc46b45bbce5323036a100536
2017-06-19 12:20:42 +01:00
jdlrobson 4598d9b567 Remove CardsGateway (unused)
Bug: T167647
Change-Id: I7e2a7777a5f28991d77deab520a55d3bd242104b
2017-06-14 13:10:01 -07:00
jenkins-bot 83d06e997d Merge "Migrate Cards code to RelatedArticles" 2017-06-08 16:54:10 +00:00
jdlrobson 6dee0147f4 Migrate Cards code to RelatedArticles
* 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
2017-06-07 08:35:53 -07:00
jdlrobson eb5a86908a Session id should not change on every page view
Bug: T167236
Change-Id: I7a04c5c3f959ce0e7dc50e2bc2fd64d139b78cdb
2017-06-06 16:53:12 -07:00
Umherirrender 627c254157 Add stylelint for less files
Fixed the following rules:
string-quotes
declaration-property-value-blacklist
number-leading-zero

Change-Id: I7c8021070b69cd60ac010e90b3bc13a033d695e2
2017-04-18 18:20:50 +02:00
jdlrobson 298790a944 Upgrade to eslint
We're going to want to use a newer version of JSHint
anyway to support use of ES6 in our browser tests so now
seems a good time to do this.

Bug: T149202
Change-Id: I5526b020cfc12c0e065ad15ed711a0e3a7bff1bc
2017-04-10 14:12:25 +02:00
jdlrobson dbb73c389d Remove Related Articles from desktop beta features
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
2017-04-04 23:01:36 +00:00
Baha 13c630343e Do not lazy-load an event logging module
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
2017-03-06 14:30:39 -05:00
Baha 26e4e8d1fd Schema:RelatedArticles revision update
Log the `feature-enabled` event for users who are eligible to see the
ReadMore feature. Otherwise log the 'feature-disabled' event.

Suporting changes:
* Register the latest version of the RelatedArticles schema.

Bug: T157375
Change-Id: I1557de88c7602aa066833bd55b83e6ee51d27178
2017-03-06 10:48:35 +00:00
Baha a40286c800 Hygiene: lazy-load event logging code
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
2017-03-01 14:45:32 -05:00
jdlrobson 36dfaccd2f Always show RelatedArticles to users who opted into beta feature
Additional change:
* Correct how we expose RelatedArticlesEnabledSamplingRate so that
it includes the wg prefix and is consistent with other config values

Bug: T157372
Change-Id: I274de542cf461de60f903ddbc0353a4116016007
2017-02-07 16:05:26 -08:00
Piotr Miazga 0806dbdb42 Use mw.experiment to enable related pages only to subset of users
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
2017-01-30 23:29:32 +01:00
divadsn e9102f8d35 Large gap left in footer on pages with no related articles
An empty container was left on the page despite there being no related articles.
This should prevent adding the container on pages with no related articles.

Bug: T147217
Change-Id: I074a12e2d6680403551c436a4b00c3b9ab1c8d09
2016-12-12 22:18:28 +00:00
jenkins-bot 4490e1b9bb Merge "Perf: don't load a module unless necessary" 2016-09-26 15:12:28 +00:00
Baha 613ed40d23 Perf: don't load a module unless necessary
Move logic that loads related articles in the footer to PHP from JS.
This prevents us from shipping an RL module to a client and not showing
related articles.

Also, make sure not to load related articles in footer on
Special:MobileDiff.

Bug: T144047
Change-Id: I73e39ee6b1223699cd8ac739902315d163d98c3b
2016-09-26 08:01:07 +01:00
Baha 5f98265e7e Increase threshold for loading related articles in the footer
The threshold is now 2 times the window height per Nirzar.

Bug: T144822
Change-Id: Ia72b0532e481211645364a1ed9715f6f07f28fca
2016-09-15 15:11:13 -04:00
Baha 6941c6df9a Change scroll threshold to viewport height * 1.5
The threshold used to test whether related articles need to be
loaded has been changed to the viewport height * 1.5 from the more
complicated formula used earlier.

The change should help with loading related articles more smoothly.
To eliminate the lag completely the related articles need to be
rendered in the back-end.

Bug: T144822
Change-Id: I9d189163b95533ca43fa3d8632f65b280470f12a
2016-09-13 10:25:53 -04:00
jenkins-bot 26d3633b44 Merge "Cache "morelike" requests for all users" 2016-09-06 16:01:09 +00:00
Sam Smith 8b8db66dd1 Cache "morelike" requests for all users
In order to minimize loading time of RA for as many users as possible,
we need to maximize the number of users that can be served by our edge
caches.

Currently, if you're logged in, then the API uses your language by
default and so responses are always private, i.e. they shouldn't be
cached by a shared cache and can be cached by the browser.

By requesting that the response be in the language of the content, the
API ignores your language and responses become public, i.e. they can be
cached in a shared cache and can be cached by the browser.

Changes:
* Add the `uselang=content` parameter to the morelike request
* Add the `maxage=86400` parameter to the morelike request, allowing the
  browser to cache the response for 24 hours, which'll save the device
  even making the request

Bug: T126455
Change-Id: I6216a088d865f27f7cc3725fc311191da42a27ba
2016-09-05 11:33:12 +01:00
jhobs e68d5b6599 Use mw.viewport to check when to load related pages
Does not change distance threshold.

Bug: T135607
Change-Id: I82dfa78e93f4bb7a8a28d038470265e7fd30c423
2016-09-02 12:01:17 -07:00
jdlrobson f960e7b651 Remove styles for old Minerva design
This CSS rule exists for Minerva's old footer. Considering Related
pages is currently only in mobile beta and the new footer should go
live before related pages does. The cost of maintaining 2 related
pages Minerva designs is not worth it.

In a follow up patch the read more container class will be reintroduced
to Minerva

Change-Id: I2d5c4e73c0cfa3f1107a0fd195d3e09f4e14ef2a
2016-09-02 11:56:17 -07:00
Baha 8afb02b64a Cache morelike requrests
The cache length is 24 hours.

Bug: T126455
Change-Id: Icd328f70ced16cc43fc0ad62c8a1f49ce71d6369
2016-08-29 15:54:53 -04:00
Baha 9ca3eb6dda Use 'classic_noboostlinks' search profile
Bug: T141398
Change-Id: I0db2d21fe9e4735e27af6071b2190a5829477278
2016-08-29 15:38:09 -04:00
jdlrobson fc7799b9f3 Allow skins a mechanism to decide on placement of related pages
* If a footer-content element is present prepend there
* If no footer-content element given wrap the component in a container that is known to be compatible
with known skins - this has post-content class (for backwards compatiblity with
old Minerva skins) and a class to apply the correct margin to Vector

Bug: T141002
Change-Id: Iac11948f8f5fdaad45d51b905bb7494a84775710
2016-08-23 11:51:33 -07:00
Florian 66a05df808 Remove 70px margin-bottom in mobile view
Combined with the padding top of the footer, this results in a
massive unused white space area between the related articles box
and the footer, which is now removed.

Extra points: Removed unused less import

Bug: T138185
Change-Id: Iaf008977bce3c003fe0fad7c16ed6bf94aef60f9
2016-07-19 18:29:45 +02:00
Tacsipacsi 1b952bde29 Add "noprint" class
Add "noprint" class to the <aside> element containing the suggestions and the header.

Bug: T123551
Change-Id: Ie7de692208028fe788ffd3c901ee4649390203a7
2016-04-17 21:45:10 +02:00
jhobs 40dc624620 Temporary fix for blurry images
Request double the size until pithumbmode is implemented.

Bug: T123549
Change-Id: I773c5a1a68c73f1ed721b1acc729db3d51b8b661
2016-04-11 21:36:06 +00:00
Baha cfc73ff5c9 Remove the isElementInViewport function
Use mw.viewport.isElementInViewport instead.

Bug: T124317
Change-Id: I621aa4c21d673d8d431bb38ba094271b570ca93c
2016-04-07 12:23:38 -04:00