Commit graph

176 commits

Author SHA1 Message Date
Jon Robson 11da8483f0 Remove targets definitions and limit page previews to ES6 browsers
I noticed that page previews is currently not working for ES5 users
as ext.maths.popups is an ES6 module which causes the
mw.loader call inside ext.popups/index.js to reject meaning the
feature never gets activated. This was broken in
Iefe98c1f0422dbf034e385b1a41a859d030a2cf4.

I talked to Olga about whether we should restore ES6
support for page previews, and given the recent trend away
from IE11, we decided it made sense to drop page previews
support for ES6 users.

Bug: T328497
Bug: T329901
Change-Id: Icbd683b12c47491eba4de6b5a14afce4465553b9
2023-02-16 13:43:27 -08:00
Fomafix 76e2339cec Inject service UserOptionsManager in Hooks
Change-Id: I690699210c041f950a076904b863bc014833e5ad
2022-12-15 22:13:23 +00:00
Jon Robson 0febc3f54d Extensible previews
Allow extensions to register new types of previews via
extension attributes.

Changes:

- The check for reference previews doesn't make sense
as $('a[ href*="#" ]' ) will match any elements with a hash
fragment, so the additional check to Title.getFragment
will not provide a different result. This was introduced in
I9ec57e0fbb0d21beaaa7b359c1c2bef64d2c14f5
- Links that point to themselves are marked with mw-selflink
in MediaWiki so this can use the not selector we already have.
- The new API is used internally and only available via extension
Attributes
- An example is provided in SkinJSON
(https://github.com/jdlrobson/mediawiki-skins-skinjson/pull/14)

Bug: T233099
Change-Id: Iefe98c1f0422dbf034e385b1a41a859d030a2cf4
2022-11-22 08:45:27 -08:00
jenkins-bot 723053f98a Merge "Revert "Use null for default user options value of beta features"" 2022-05-11 03:21:17 +00:00
Func 03ea5adb03 Revert "Use null for default user options value of beta features"
This reverts commit addb8a02d7.

Reason for revert: Not ready to be merged

Change-Id: Ia16b232e863c1aca490de44835b8790ce4516cc7
2022-05-10 12:32:14 +00:00
jenkins-bot 2eac3b36c0 Merge "Use null for default user options value of beta features" 2022-04-08 11:48:03 +00:00
Func addb8a02d7 Use null for default user options value of beta features
The new soft auto-enroll logic of BetaFeatures requires user options
default to null or no default values since it needs to save opt-out
values.
Unfortunately, BetaFeatures can't maintain default options itself, since
the GetBetaFeaturePreferences hook is coupled with User, can't be run
in the handler of UserGetDefaultOptions hook.
All the user options will be handled by BetaFeatures carefully, no
unnecessary values will be saved (no regression of T291748).

Needed by change I93af61153ec3c2cd3ec7686fe88067eed6766b5a, and they
should be merged in the same deploy train.

Bug: T260870
Change-Id: I1e9a91eed2e2eb22ce42f8d79b7183c505f1df7d
2022-02-01 11:53:03 +00:00
Fomafix cfa0f5419b Use HookHandlers and implement hook interfaces
This change requires MediaWiki 1.35+.

Bug: T263353
Change-Id: I4d3aa20c666799e6e693a6a4b7a3e835303e2fc5
2021-12-20 11:05:19 +00:00
Adam Wight 6bb27111e6 Update eventlogging schema
We've been dropping events for some time now.

Bug: T297523
Change-Id: I47567e227f69714dfdcf21f9c11d08067c4ca2e6
2021-12-15 14:45:14 +01:00
Umherirrender 9d7c3a9851 Add preference popups-reference-previews to DefaultUserOptions
Without the default the preference is never deleted from the database,
even it was disabled by the user.

Bug: T291748
Change-Id: I63ef1bad22acc4581e7c6aecb7dcc3d54422af18
2021-09-29 10:42:09 +02:00
Sam Smith 88edf5d999 virtualPageView: Log VirtualPageView events to Event Platform
We started logging VirtualPageView events to the Event Platform in
I645a81a4 but I640ab367c overwrote that change.

Change-Id: I3fcb9b79931da2ce0fa39ffc3be03e141d0d4152
2021-08-11 20:43:18 +01:00
Sam Smith 8f5000f346 Remove Popups instrumentation
Bug: T267211
Change-Id: I640ab367cd235ab8da7dd70dbef7ae9076712e84
2021-07-29 17:01:01 +00:00
Fomafix 197f7f557e Bump to requires MediaWiki >= 1.34.0
c7595e54f6 changed to
mw.util.escapeRegExp included in MediaWiki 1.34.

Change-Id: Ibef8f95b80d71d26dcd69572ce3b98f43f2cbfc0
2021-06-17 06:16:22 +00:00
Marcel Ruiz Forns cf1b674665 Set default VirtualPageView version to Event Platform schema URI
This schema has been fully migrated to Event Platform.  Setting
this as the default lets us remove the mediawiki-config override
of this that is currently being used.

Bug: T238138
Change-Id: I645a81a4a22130ed6a442c055d6bf4e78160705f
2021-05-24 20:33:45 +02:00
Thiemo Kreuz 275a67c730 Make checkboxes use upstream mediawiki.ui.… styles
This does not fully solve the ticket, as these are not the
actual OOUI styles. But it's already much better than the
unstyled checkboxes before.

Bug: T281227
Change-Id: I9a5023482774c09aa73845ca6dfd1c4926f088e1
2021-04-28 10:37:07 +02:00
Svantje Lilienthal 3b6d9ccc9d Renamed settings local from simple to page
We changed the handling of the popup settings. They now contain popup types (pages and references). 
To not get confused with the old setting options (simple, advanced and off), 
we would like to rename the local for the simple setting to page. 
It should already contain the correct string.

Bug: T277639
Change-Id: I8847b890e9e31602277a92d82a188fcdd3eea855
2021-04-23 14:35:06 +00:00
Svantje Lilienthal 09c2c52945 Added popup types handling
We added reference preview as a checkbox the the
anonymous user settings. To handle both popup types
(pages and references), we changed the usage of
preview.enabled. We pass on all types as a map
inside preview.enabled. The footer link to edit the
settings will appear for anonymous users if at least
one type is disabled.

Bug: T277639
Change-Id: I860a1b35ac7749d8d0884575f6acb7186ad8e4d0
2021-04-23 12:14:23 +02:00
Svantje Lilienthal cf9258b0c5 Changed radio button to checkbox in anonymous user settings window
Bug: T277639
Change-Id: Ifa84dda88a8a167fc8ed2cef17254c1b722ade2d
2021-04-21 14:13:47 +02:00
WMDE-Fisch 190962cc5b Remove dead code around cog wheel dialogue
An "advanced" option was first introduced in 2014 via patch I374805e
(originally named "monitor-or-edit", renamed via patch I7b4f6d2).

The isNavPopupsEnabled() function was added in 2016 via patch
Ic660f48.

The code that disables the extension entirely the moment the NavPopups
gadget is enabled was added in 2017 via patch Ia474b1b (T151058) and
patch Ia837816 (T160081).

As of now, the "advanced" option can only be seen in an extreme edge
case:
* Only for anonymous users.
* Only if NavPopups is enabled by default for anonymous users.
* Only if the $wgPopupsConflictingNavPopupsGadgetName setting is
  misconfigured.
* … or if NavPopups is not a gadget in the first place, but e.g.
  loaded via Common.js.

In this situation the settings dialog opens with all *3* options. This
is broken for several reasons:
* The "simple" option enables the extension, but doesn't disable
  NavPopups. Both trigger, resulting in both popups being displayed
  the same time.
* Since "simple" is the default, this bogus behavior is the default
  for anonymous users.
* The "off" option doesn't stick. Every time the settings dialog opens
  "advanced" is checked instead.
* "Off" can't work anyway. There is no code to disable the gadget.
* Only the "advanced" option "works", but more by accident.

It's unclear how to fix this:
* There is no code that does anything with the "advanced" option. It's
  not even stored. The behavior of the option is identical to "off".
* The code appears as if "advanced" was meant to be shown instead of
  "off". I.e. anonymous users can only choose one of the popups, but
  not disable both. But there is no code to hide the "off" option.
* The bug when both popups are displayed was fixed in 2017 via an
  entirely different mechanism. Re-introducing "advanced" does not
  only mean duplication, it's unclear how the 2 mechanisms are meant
  to work together.

It really, really feels like this was just forgotten.

Bug: T278949
Change-Id: Iab21f3a649a5b2f19ebb0d0dbb45ce1450c65678
2021-04-15 15:29:16 +02:00
Andrew Kostka 398565b1d6 Track anonymous enables/disables of reference previews
Bug: T277641
Change-Id: I89ee3ff280e79f560bf613a110a1c9e0b3ba6648
2021-04-15 14:21:32 +02:00
Clare Ming 4908f82c01 Add title attribute to settings gear icon
Add message, description, extension for title. Update createPagePreview, renderPagePreview methods to add title attribute to settings gear icon. Add test for title attribute. Increase maxSize, maxAssetSize, maxEntrypointSize. Add compiled js files.

Bug: T274887
Change-Id: Ibb29deb3418569d8283b954b4b22074423e78bda
2021-04-02 13:30:07 -06:00
Thiemo Kreuz 66b5e307e1 Minor tweaks to the wording of gadget-related messages
Bug: T276218
Change-Id: I6b9ebec33f39e938855c5ee9b2f9665ea92560d0
2021-03-04 09:53:41 +01:00
Andrew Kostka 82d54945e4 Combine page and reference preview preferences
Update copy and remove unnecessary reference preview preference
in favor of using the default preference. It seems there is no
stable method to link to the subsections on the preference page
for gadgets. So in all cases does the link just point to the
gadgets pref page.

These changes should only be visible when reference previews
are no longer marked as a beta feature.

Bug: T265709
Change-Id: I7b8ab91331092ada04b230315373548673b9272c
2021-02-25 10:21:16 +00:00
Adam Wight 8a857103f7 Finalize ReferencePreviewsPopups event platform migration
Bug: T275009
Change-Id: Ia8d54ea90b4e5fa8ad52a5c809948c90577c908d
2021-02-24 19:48:51 +00:00
Thiemo Kreuz ef4b032513 Add new reference type "note" without an icon
Bug: T274343
Change-Id: Ib9f3fe98baf1d194e686b007a9c535f2b49ac19d
2021-02-11 10:15:36 +01:00
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