Commit graph

151 commits

Author SHA1 Message Date
Vedmaka ff2ba9ebf5 Adds "$wgPopupsTextExtractsIntroOnly" option to control "intro" parameters for TextExtracts API request
Change-Id: I84f91ab0752bbd4a5b1ee159b7cbe1388f942f24
2020-12-07 15:00:29 -08:00
Svantje Lilienthal 0b6c859a2b hide reference previews when reference tooltip gadget is active
Change-Id: I5f43270bfeba944c05dc09adf771ed07057237c7
2020-11-16 18:36:04 +01:00
jdlrobson 140b1e5828 Settings cog should come from icon pack
To avoid continuously updating this cog, use the icon pack directly.
Use mw-ui-icon-small to control the size rather than custom CSS - this
reduces the amount of CSS overrides that are needed.
Also use `opacity` instead of icon SVG fill for coloring the icon. This
enables simple transition in interaction states.

Storybook: The settings cog will now be tied to the production icon.
Note for now this will not appear at all, as this code must first
have ridden the train. For local testing feel free to point to
localhost to verify this change.

Bug: T256504
Change-Id: I2a28666dbd644bb599146fabb84d148ff0167ed3
2020-11-12 05:57:57 -08:00
Adam Wight 789cedc168 Remove reference preview "Jump to reference" link
Now that the footnote label links to the references section, we don't
need this additional link.

Bug: T265482
Change-Id: Ib9b2939eb49e7b826c7699a5b7fa0e8255fa9da1
2020-10-30 11:33:24 +00:00
Thiemo Kreuz f4d696e6bf Add (i) info icon to collapsible replacement message
This avoids pulling in the entirety of OOjs, with the disadvantage
that we have to copy a little bit of CSS. I copied parts of this
patch from I2a28666.

There might be a better way to do this, with less code. E.g. is
there a better way to construct these HTML elements?

Bug: T220208
Change-Id: I024155f3ff0f57de1d68bbaf37bfb9e81e692bd0
2020-10-30 10:53:30 +01:00
Thiemo Kreuz 1cf721e2a2 Handle collapsible & sortable elements in reference popups
Elements that are marked as collapsible (often tables, but can
actually be anything) are most certainly marked as such because
they are big and don't fit in a popup.

Another plugin makes tables sortable.

In both cases non-functional UI elements appear in the popup.
We decided:
* Hide collapsible elements (no matter if currently collapsed
  or not), and show a placeholder text instead.
* Remove sortable arrows.

This is a baseline patch that solves everything, except the
(i) icon is missing. This will be added in the next patch.

Bug: T220208
Change-Id: I58f3036bf4988d0ebe5716b0a54506446fca10c3
2020-10-28 17:23:12 +01:00
Ammar Abdulhamid 5e405eb2f2 Popups: Rename new config variable
In this patch we introduce a new config variable and update its default
to be the same as the production value of $wgPopupsPageBlacklist.

When this code is deployed everywhere, we will remove wgPopupsPageBlacklist
from mediawiki config and defer to the Popups extension as the source of
truth from now on.

Bug: T254676
Change-Id: Ifebdcf8f5eec854a2b947dc390eaf47704a5c5eb
2020-07-07 09:47:59 -07:00
Thiemo Kreuz 092e2a4959 Talk about "exclusions" instead of "blacklists"
AVoid the term if possible, in all internal code. The only remaining
use of the word is in the public $wgPopupsPageBlacklist config
variable.

Change-Id: Ib238731270f473ad44fcff13df617a70433f2452
2020-06-09 08:56:06 +02:00
jdlrobson c597522b7d Enable Popups module in mobile, use feature detection to enable
This means that users of the mobile site on a desktop browser will
now benefit from Popups.

Targets is not necessary for `ext.popups.images` as these modules are
enabled on mobile by default.

Bug: T236097
Change-Id: I401fbb522ec97fdc81259702c8283c95386531af
2020-04-02 18:23:31 +00:00
Piotr Miazga 0ab39f88e7 Enable by default
Popups is enabled on the Wikipedias but disabled by default, which makes
it more difficult to enable on third-party wikis.

Things should be enabled by default, and them WMF configs should disable
features when they are not used/available.

Supporting changes:

- Rename PopupsContextTest#testAnonUserHasDisabledPagePreviews and
  remove the associated data provider, which provided only one datum

- Set $wgPopupsReferencePreviews to false in
  PopupsContextTest#testShouldSendModuleToUser in order to isolate the
  code under test

Change-Id: Ib8cc7041d792bed0a19d18e14506627099a69bef
2020-01-29 15:40:23 +00:00
Stephen Niedzielski 36935fe1f3 [hygiene] move ServiceWirings.php to ServiceWiring.php
Remove pluralization from the service wiring filename for consistency
with similar files in other Web repos. There are multiple services in
this file but the point of distinction doesn't seem worthwhile.

Change-Id: I6ff4f9caf66a6156f6aa6a8b808f51c356df3414
2020-01-14 08:49:11 -07:00
Umherirrender dd076b7542 Require MediaWiki 1.31 in extension.json for AutoloadNamespaces
AutoloadNamespaces is a new feature in 1.31

Change-Id: Ice5e01cf780aae12653916c6dc893557354eecfe
2019-12-28 13:44:09 +01:00
Thiemo Kreuz 3051067029 Update extension.json to make use of PSR-4
As far as I can see this codebase is already PSR-4 compatible. Let's
make use of it then.

Change-Id: I45a8492ce52d96acaf27e73d20e06e68de892686
2019-11-27 10:12:03 +01:00
Ammar Abdulhamid 5fd286d1ee Update extension.json to use manifest_version 2
Bug: T234114
Change-Id: I6a49f371fb69578e251bb5a0ecb6d9c0efe059d6
2019-11-27 09:08:49 +00:00
Adam Wight b7331a6e66 Record pageviews where Reference Previews is enabled
We want to know the side of this population in pageviews, in order to
produce proportional metrics later.

Bug: T214493
Change-Id: I940872870754e85d19688f3855d6857e65b982b1
2019-10-24 23:34:56 +02:00
Thiemo Kreuz c7595e54f6 Replace deprecated mw.RegExp.escape() with mw.util.escapeRegExp()
The signature mw.RegExp.escape() is deprecated since MediaWiki 1.34.

By the way, this is the 4th or even 5th time in my short career this
tiny, single line (!) helper function is moved around and I need to
update all my code. This felt already ridiculous when it happened the
2nd time.

Change-Id: I4d05a49120aff64ebc316d0af7736c62385d9307
2019-10-21 15:00:36 -07:00
Adam Wight 76a34618c3 Tracking for Reference Previews interactions
Logs events to the ReferencePreviewsPopups EventLogging schema, in
order to understand whether Reference Previews is helpful for
end-users.

This will be removed along with the older tracking, as soon as our analysis
phase is finished.

Incidentally disables a lint rule for the generated JS, it's about
readability so irrelevant to the minified code.

Bug: T214493
Change-Id: I2638611ba67b785338f7e98a1c4b08a5e829812d
2019-10-07 11:22:00 +02:00
Adam Wight 375d27bbf7 Update to a newer Schema:Popups
When ?debug=1, we send eventlogging with previewType=reference.  This
is only supported by a newer schema than we had specified.

Change-Id: Ic7558820df5945ccf287ca2211311b2bf0bf5219
2019-09-23 16:18:08 +02:00
Ed Sanders 78cbb02191 Update OOUI icons to latest versions
* web.svg was deprecated in favour of browser.svg.
* Update sad-face.svg based on OOUI speechBubble-ltr/rtl
* Apply preview-generic/disambiguation grey colour using CSS.

Change-Id: I8feea1b526ff85c4ffdee21ef42c616e72881e76
2019-04-17 12:11:08 +01:00
Thiemo Kreuz 1d2becc25a Consistently talk about "Reference" instead of "Footnote"
During story time on 2019-03-12 it was decided to consistently talk
about "References" in all messages. Main motivation is that this is
the term the community is most familiar with, and it is also the term
that is used in reference section headings most of the time.

Bug: T215063
Change-Id: Iaab8d2c0da1546a3c9d27bc8e2e1c784050ed135
2019-03-13 09:29:26 +01:00
Andrew Kostka f91c160214 Add a beta feature switch for reference previews
Bug: T215896
Change-Id: I6a4cc2103d594dc11f62da247891d3f190619899
2019-02-25 20:38:12 +01:00
Thiemo Kreuz d81415a040 Add all reference type icons and messages
These icons are currently unused because the gateway does not deliver
the necessary information. This will be used starting with I6223cbb.
This patch aims to introduce all resources needed by the later.

Bug: T214908
Change-Id: Ie0c3c059222700169f2605c3123554c74d974256
2019-02-20 09:32:11 +01:00
Johannes Kroll d4d8cefac4 Rename link in footer to "Jump to footnote"
Bug: T215063
Change-Id: I18201bdeee65418ef147203a845f34447c24e163
2019-02-13 16:01:24 +01:00
Thiemo Kreuz 0c889c4cd4 Add default OOUI reference icon to all reference popups
I tried hard to keep the CSS as small and robust as possible. The
icon will be align with the text by adding a negativ margin. With
that we also decided against using RTL and LTR specific icons that
are positioned at the edge of the canvas for now.

Bug: T213907
Change-Id: I98888114e1c50e249cf31e71749323bd4f69da3f
2019-01-29 17:06:40 +01:00
WMDE-Fisch abc070a5e0 Enable reference popups by default
It is more convinient to have the feature enabled by default and set
it to false on the production servers. This makes it easier to use and
test by CI.

Depends-On: I36b4fb7615de5ff6670b70345abf7436538a6828
Change-Id: Iad3bc723e1dd5f79e770c9a2f66190ebcd7c8b9d
2019-01-24 10:27:41 +01:00
Thiemo Kreuz 671c39ef4a Add reference preview type
This adds support for preview popups on reference/footnotes from
the Cite extension. For that a new preview type was introduced and
integrated into the existing structures.

The essential starting points were this code comes into action are
added behind the feature flag introduced in the previous patches.

Bug: T213415
Change-Id: Ie0ccb03117bd654373d0f458b62cc52018361c67
2019-01-23 12:12:36 +01:00
Thiemo Kreuz 485acf1488 Add feature flag to disable reference previews by default
This is a prerequisit for the later patch Ie0ccb03.

Any JavaScript code can check this feature flag via
mw.config.get( 'wgPopupsReferencePreviews' )

Bug: T213415
Change-Id: I17687c62cc8d738a4eb41738c9ce6662a5ec68d8
2019-01-21 11:24:33 +01:00
Nicholas Ray 6a25f70ad5 Use window.devicePixelRatio instead of deprecated jQuery.hidpi
jQuery.hidpi was deprecated by T127328
(https://gerrit.wikimedia.org/r/441614). This repo used the
"bracketedDevicePixelRatio" function from that plugin. Since browser
compatibility is good now for window.devicePixelRatio, this commit adds
a function which relies on that instead.

Bug: T198579
Change-Id: I56c234048d7741f12f35bfff5f7319c6e085c29f
2018-08-10 10:00:28 -06:00
Piotr Miazga a492d5f609 Change the PopupsVisibility state to visible to match anon experience
PagePreviews are visible to anonymous users, we would like to match
the same experience, when user creates a new account. On account
creation we mark PagePreviews settings to ON or OFF (configurable
via PopupsOptInStateForNewAccounts settings). With that approach
we can provide the best experience for new users, and keep existing
users happy (not enabling feature by default for everyone).

Bug: T191888
Change-Id: I39f42aa7268ce59c51f038048025ccf1bdf16481
2018-05-10 00:57:44 +02:00
jenkins-bot 44684b760b Merge "Remove A/B testing code" 2018-05-08 14:39:43 +00:00
jdlrobson 912402e840 Remove A/B testing code
No longer needed. We can't turn something off again for people
now they expect it to exist.

Clarified usage instructions of PopupsEventLogging to make sure
it's more scary given the implications

Bug: T173952
Change-Id: I7be005b79da498d8e7b7df8f18b60c1327636a2c
2018-05-07 12:37:41 -07:00
jdlrobson ad74a37f0b Update extension authors
Change-Id: Iee16b902247396ed9fc849d433f0a0d6fb2f85e7
2018-05-04 16:32:51 -07:00
jdlrobson f6524d9315 Remove remaining references to beta
Bug: T193053
Change-Id: I2e2d722bb99f1ec044749ef74122b4b7bdf119e2
2018-05-02 13:31:43 -07:00
jdlrobson 4e3282e5ff Remove BetaFeature code
Popups is out of beta feature and this code is no longer needed.
Removing code is the happiest activity a developer can do.

Other changes:
* Remove redundant type field on extension.json
(If not set, the extension will default to the "other" section.)
* Repurpose `name` with `namemsg` and make use of existing i18n
messages

Bug: T193053
Change-Id: Iea832cd1f37b0e7df6ff95efd66e4a1ff2a9004e
2018-04-26 15:51:48 -07:00
Stephen Niedzielski 007efbef05 Hygiene: remove unused strings
Remove popups-redirects and popups-send-feedback, which are unused. They
appear to be remnants of the code before the rewrite:

- popups-redirects was removed in I42fb9cc1a8b26eaf6807243e4e7bdbf0b56dc35c
- send-feedback was removed in If545873bb97b1da8ea5001dce575b1ef512903fb

Also, add detail to prefs-reading qqq string.

Change-Id: I072d416b2805a2a05e76aa28f083db730e0a523a
2018-04-11 22:47:54 +00:00
jenkins-bot 563cc05fa7 Merge "Bump VirtualPageView schema to 17780078" 2018-04-05 13:26:05 +00:00
Stephen Niedzielski c61513f0ea Hygiene: split LESS into components
Bug: T165036
Change-Id: I916f27138b5abe6b9fe23719cffb10f20e604b89
2018-04-03 16:37:05 -07:00
jdlrobson 663218d974 All images are served by ResourceLoaderImageModule
This moves the footer icon into the ResourceLoaderImage module
providing us a consistent way of serving image assets.

This means we no longer need to provide PNGs for icons

However, given mw-ui-icon-large is not large enough for the given
use case we do have to wrestle with icon styles and override them
to get the desired result. I think this is a small price to pay given
icons are now discoverable

Change-Id: I38b62c01fd930dcbfb73b95e6128885cb483f86e
2018-04-03 16:34:49 -07:00
jdlrobson 5bbfe9c4e5 Bump VirtualPageView schema to 17780078
This should be a noop since edits only relate
to documentation changes but is done to avoid
confusion

Change-Id: I9b4a4924a301e0cdec617d89b9b7d817941a95ef
2018-03-29 14:55:04 -07:00
jdlrobson 1acd15adb1 Standardise disambiguation icon
All icons should be 20 by 20 by standard.
(Previously it was 24 by 24)

Bug: T190558
Change-Id: I0956c9c31f1606f0a77b4be29bde5a56b5c5ebb8
2018-03-23 13:54:31 -07:00
jdlrobson 90b787ed9c Abandon use of skinStyles for settings dialog
We already use pixels to define font sizes in the pixels so rather
fight Vector's styles explicitly declare the font size in the header
(which it controls) instead for more readable code.

Also copy across several rules that are implied by Vector but needed
for the settings dialog so that this renders nicely in Monobook and
Minerva.

Change-Id: I196b8af23fe6ebcdb472c059cf1536d251a5b978
2018-03-23 11:13:00 -07:00
Stephen Niedzielski c4b50b04ac Hygiene: remove unused resources
In I7395e3438836149becdd576942bdaf6f21b4163f the settings templates
were rewritten so that they no longer displayed an image.

descriptionText and images were dropped from the template but not from
the template provider. These are artifacts from relating to that patch
and are no longer used.

Change-Id: I1be7ef288d37f338e83dab3cf041e628a06608d2
2018-03-21 17:07:18 -05:00
Stephen Niedzielski 42816702eb Hygiene: replace Mustache templates w/ ES6 strings
Replace Mustache.js templates with template literals. An effort was made
to minimize additional refactoring, so feel free to ask for more but it
ain't coming in this PS.

Bug: T165036
Change-Id: I4a6a1d93a2922c3a9ef3ae93c47da17a35c644f0
2018-03-20 08:06:02 -05:00
Jan Drewniak 1e946a379d Custom page preview for disambiguation pages
Creating a different page preview for disambiguation pages.

This patch:
- modifies the Preview model to accept a new 'type' property
- modifies the Restbase Gateway to pass the 'type' prop to the Preview model
- creates a new template to accept both generic/disambig previews
- modifies the renderer to render the new template
- generates icons for new template through resource loader
- adds new i18n strings
- modifies event-logging "preview seen" event to send new "disambiguation" previewType
- updates event logging schema version
- adds tests for Preview model and renderer for new preview type
- does way too much? yes, yes it does.

Bug: T168392
Change-Id: Idc936cc3eabbdd99a3d98f43c66b4cdbb7d24917
2018-03-14 11:24:26 -07:00
jdlrobson deaaf0961b Remove popups from critical rendering path
Instead load it via mw.loader.using

We retain the module name ext.popups as this will be present
in cached HTML, however now it will load the bulk of the code
inside ext.popups.main

Bug: T176211
Change-Id: Ibe212721807d3698dc45ef46b2dbde15ca9d2f70
2018-03-13 08:44:31 -07:00
jdlrobson f5f21a8d09 RESTBase url is configurable
Allow developers to use different endpoints for summaries
= developer happiness

This is useful for the following use cases:
* A developer wants to test against a production endpoint via
CORS
* A developer has setup an API where REST is hosted elsewhere
e.g. http://localhost:6927/en.wikipedia.org/v1/
* A user wants to create their own REST summary compatible
endpoint
* A wiki e.g. wikidata wants to use a different endpoint which is compatible
with the summary endpoint.

We are unlikely to use it ourselves on Wikimedia wikis (the
default should suffice) but this will be a powerful tool for

When not configured this will continue to work as per normal

Change-Id: I8a7e12fbc43cddbac678e0d7b81d1e877b747b22
2018-03-09 16:15:19 +00:00
Kunal Mehta e351fd1550 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: If21be3dd6d81dbeb30911bbe3be29e20b55bf6da
2018-03-02 15:33:58 -08:00
jdlrobson 535149c16c Upgrade schema and log the required fields
This change updates the schema and begins to log
additional information such as source_namespace, id
and title. This information is provided inside the
boot action.

Additional changes:
* Allow camel case in bundle artifact

Bug: T184793
Bug: T186728
Change-Id: I425ffecc018bef2958d0dfe957a40a065e3e6c56
2018-02-26 10:25:30 -08:00
Sam Smith 35daa2a689 Hygiene: Page view -> Pageview
Pageview is consistent with verbiage used by Research and Analytics
Engineering in their reports and documentation, e.g.
https://wikitech.wikimedia.org/wiki/Analytics/Pageviews.

Bug: T184793
Change-Id: I8ae085b4af85aa72f234f3db27f0cac2c4d014e5
2018-02-21 18:51:49 +00:00
jdlrobson a702c0f499 Capture page view-like interactions
* New action added PREVIEW_SEEN
* The action will be used to signal that a page view needs
to be recorded.
* PREVIEW_SEEN is a delayed action which is triggered
as a side-effect of the previewShow action. It is only dispatched
if the user is still previewing the same card and the page
related to the card has preview type `page`
* The pageview changelistener is added when
$wgPopupsVirtualPageViews is set to true.
* The page view changelistener listens for page views and logs
them using EventLogging when needed using
https://meta.wikimedia.org/wiki/Schema:VirtualPageView

Note:
* Currently if a user has enabled the DNT header, the
event will not be logged. There is ongoing discussion on the
ticket and fixing this will be addressed separately.
* Only title and referrer are logged in the initial version.
The task demands that "namespace" is logged but this information
is not provided by the summary endpoints we use so will need
to be added later (if indeed needed) either via a change to that
endpoint of by using JavaScript to parse the URL.

Bug: T184793
Change-Id: Id1fe34e4bdada3a41f0d888a753af366d4756590
2018-02-16 23:03:33 +00:00