Commit Graph

818 Commits

Author SHA1 Message Date
Ed Sanders
02e17c5242 build: Update eslint-config-wikimedia to 0.22.1
Change-Id: I02692eeabb23c5b99997faa7a17d42f019148ed1
2022-03-08 09:41:49 +00:00
Abijeet
03cf7863ec Stop propagating first click handler when loading languagesettings
The languagesettings dialog does not open when clicking the
uls.trigger for the first time. This issue occurs when the user is
not logged in, ULSPosition is personal, and ULSAnonCanChangeLanguage
is false.

Without this change, the following happens:
* uls.languagesettings is loaded via uls.interface
* uls.languagesettings::hide is called via uls.languagesettings::init
* click method is triggered immediately via script in uls.interface
* uls.languagesettings::show is called
* uls.languagesettings::hide is called - triggered via ::show
  method - $( document.documentElement ).trigger( 'click' ); but
  dialog is not visible yet, so this does nothing
* uls.languagesettings::show displays the uls.languagesettings
* hide method called again via click handler for documentElement

With this change in place the hide method is not called again due to
e.stopPropagation();

Additionally add a parameter autoOpen that can be set to open the dialog
automatically.

Bug: T301882
Change-Id: I54e8172ae017c4a9c6ab5b841d9328b2f24f97a8
2022-03-08 09:39:43 +00:00
Santhosh Thottingal
5bd64b167c Improve the loading time of ULS language selector by fetching modules early
Start fetching them on mouseover without waiting for click.

Bug: T299202
Change-Id: I1ba3b8516bd01ad1bf8bb4c57d72d10ca59e06ca
2022-01-27 14:31:07 +00:00
Clare Ming
f539619b1c Simplify function to check for standalone language button.
Change-Id: I4d4afa0e5098736e40e49924e87f471b3d09257a
2022-01-14 05:58:42 +00:00
Santhosh Thottingal
cc1a255081 Update GentiumPlus font
Update to version 6.001
Upstream font file names were changes. So updated it here too.
Added Bold and Bold Italic since they are present in upstream.

Bug: T298613
Change-Id: I1c0429f6c5abac66471df0fa96738a10a7b28d04
2022-01-10 07:38:58 +00:00
jdlrobson
26aa8d450c Hide sticky header language button with preference disabled
Adds a class to body when the ULS dialog is disabled.

Bug: T297579
Change-Id: I791c65c6a7ac5221dcf24e5db01c22c3e2e9f81a
2022-01-06 05:13:45 +00:00
bwang
c95e8e70c5 Handle "Enter" keyboard event for checkbox hack selectors
"Enter" key support for Vector ULS button was previously handled by the core checkbox hack. With the upcoming changes to the checkbox hack implementation, it needs to be handled separately.
Context: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/747877/10/resources/src/mediawiki.page.ready/checkboxHack.js#b275

Change-Id: Id74a80cda6cf460cc2b579269b8d5b2ce81c8ca5
2021-12-21 22:17:34 +00:00
Jan Drewniak
2d9279a1f1 Accommodate Vector sticky header in menu positioning
Adds special logic to accommodate the ULS trigger being placed inside
modern Vector's sticky header, which has a fixed position and requires
the ULS menu to remain pinned to the page when scrolling.

Bug: T295391
Change-Id: Ic531dd2ae213f8221157386f79edb95bc61a8119
2021-11-29 17:26:28 +00:00
Reedy
c3bdd26c7a Add Awami Nastaliq font
Bug: T290510
Change-Id: I37403b6ff61af63f54e4277acbb436bf2d93db6d
2021-11-29 14:02:36 +00:00
Fomafix
6ee366a2c8 Reuse userCanChangeLanguage()
Change-Id: I52893ca8e2579520d21579bd7fdcb9af858a52b9
2021-11-21 19:39:25 +00:00
Fomafix
10e15cf0f8 Use .parseDom() instead of .parse()
Use

  $( ... ).append( mw.message( ... ).parseDom() )

instead of

  $( ... ).html( mw.message( ... ).parse() )

Add dependency on 'mediawiki.jqueryMsg' to 'ext.uls.setlang'.

Change-Id: I23897ab16a84a1732286921a8153b9a5e57c9462
2021-11-09 21:12:01 +00:00
Reedy
7617fda424 Update OpenDyslexic
Change-Id: I148f31b71b28c954e788719f321c11e463d5d724
2021-11-09 11:35:37 +00:00
DannyS712
e17f5c0b39 Merge jquery.webfonts into ext.uls.webfonts.repository
The two modules are always loaded together and don't need
separate entry points.

Additionally, this makes the ext.uls.webfonts.fonts
just depend on the ext.uls.webfonts.repository module
and not do anything else, so remove it in favor of
referencing ext.uls.webfonts.repository directly where
needed.

Bug: T292042
Change-Id: I067b9eda923fcb0d5da0ed80030356f1f747259b
2021-10-19 09:07:11 +00:00
jdlrobson
869c721e91 Language button should prevent default click behavior
In Vector the language button is a checkbox. It uses the checkbox
hack to provide non-JS dropdown behaviour.

When the JS upgrades such a button, the checkbox behavior continues
to work. An unsatisfying hack in Vector workarounds this problem.

This provides a neater way to disable that behavior
in Vector once the button is clicked by adding support for the
well documented checkbox hack.

Bug: T283757
Change-Id: I97a69c30b27cb1ded06451389e086229561c3589
2021-09-13 07:04:33 +00:00
bwang
9e952f28af Add support for multiple ULS buttons
- Update document click handler for loading ULS
- Use data attributes to ensure ULS isnt loaded multiple times for an element

Bug: T289815
Change-Id: Iba6cbbd6c6e48a1abfda342421822e3ff2715362
2021-09-07 15:21:26 -05:00
Niklas Laxström
03d099eddc Fix regressions in ULS entry point setup
* Link in preferences is again opening ULS
* "personal" entry point now works even with compact languages
  preference disabled

I added lots of comments and refactored this code to give things
better names to make this code easier to understand and maintain
and hopefully reduce the amount of bugs in the future.

Bug: T282956
Bug: T286574
Change-Id: I9cd6776ea6664e33fd63c49dfa77c5f004fba799
2021-07-16 19:23:34 +00:00
Sam Smith
3b9134f8ac launchULS: Add context to interface.language.change hook
Now that the interface.language.change hook is fired when the user
switches language using the Compact Language Switcher, we should provide
additional context to the UniversalLanguageSelector instrument.

Bug: T280770
Change-Id: I6c4ddf9738e527ac42581c9fb4924ed1d12748b4
2021-06-21 21:25:31 +00:00
jdlrobson
09a2b33bd6 Restore compact languages button user preference
The compact languages button user preference will be applied to
any compact language button provided by the skin, this allows users
to opt out of the feature as before.

This will be used immediately in Vector in
I436554d9d51470d277d59c2c71e08124735e12fd

Bug: T282149
Change-Id: I726c61d4c6895a28b999781752535e0ddc961744
2021-06-14 15:24:53 +00:00
Sam Smith
bc14f8fa40 Fire language change hook
As of Id345e933, we fire the language change hook when the user switches
language by clicking on a link in the languages list. In order to
compare the user switching language in the scenario above with the user
switching language via the CLS and/or Vector's language switcher, ensure
that we fire language change hook in all treatments.

Bug: T280770
Change-Id: I4a74254612557c287b16f4f086077a2637de9a2e
2021-06-10 11:11:37 +00:00
Sam Smith
49924e9ec5 Pass context to compact_language_links.open hook
Following on from I6fa966c2, fire the mw.uls.compact_language_links.open
hook with the $trigger parameter as context for clients to be able to
able to distinguish which treatment is visible to the user.

Supporting changes:

- Note that the hook is unstable next to its callsite

Bug: T280770
Change-Id: Ie4bbfea4dc5e36401df587550f466aeae5c8fdcc
2021-06-01 18:11:30 +00:00
Timo Tijhof
977e6c68c2 ext.uls.interface: remove some needless uses of jQuery
* $(node).prop(foo) -> node.foo

* For objects only expected to represent a single element,
  use native querySelector() and its natural null return
  fallback, instead of `$(), $.length, $()` etc.

* Fix a few minor non-voting eslint warnings that were in the CI
  output about line length and unknown type "bool".

* Remove presumed outdated comment about Vector splitting,
  per T234907.

* Rename ulsPosition to configPosition to be more clearly
  different from ulsPopupPosition.

* Remove various 'uls' prefixes of local variables,
  since this is ULS code in the ULS repository.

Change-Id: I1c617bf48283f47dc948550111c515faf173d1eb
2021-05-20 18:57:09 +00:00
Santhosh Thottingal
7b2338cef5 Replace BabelStoneTibetan with its variant with suitable type metrics
Due to the nature of the script, Tiben usually has high ascent and descent
values. Use a variant of BabelStoneTibetan to have lesser ascent, descent
values for modern, frequently used Tibetan

Bug: T283122
Change-Id: I902af894b0e4d6f375981f13548be49405fb3602
2021-05-19 14:35:33 +05:30
Santhosh Thottingal
96ec65ac8e Replace Jomolhari with BabelStone for Tibetan
Jomolhari is inactive upstream for years and BabelStone is an active
fork with improvement for better script support.

Bug: T197596
Change-Id: I5c3c1ce5ad2a80c78e93304d4023342a66382942
2021-05-17 13:39:09 +00:00
Sam Smith
8e85f0d611 Fire hook when compact language links are opened
Following on from Icc64044d, we fire the
mw.uls.compact_language_links.open hook whenever that treatment is
opened (and not only the first time that the triggering element is
clicked).

Bug: T281928
Change-Id: I6fa966c22c738ca12bcbeb0225c03f3f8394ecee
2021-05-11 12:48:10 +01:00
Sam Smith
c914a7d0ab Fire hook when user clicks language button
This allows us to correctly instrument (via the
UniversalLanguageSelector instrument) this action so interaction rates
between treatments can be compared.

Bug: T273232
Bug: T273928
Change-Id: Icc64044d51c567482d4f286637366cefb7beeb3e
2021-05-10 20:46:37 +00:00
jdlrobson
5278a672fe Restore suggested languages to compact languages button
The filterForCommonLanguagesForUser method checks if commonInterlanguageList
is null, but it can never be null unless it is first initialized that
way.

Bug: T282037
Change-Id: I70c3a60349693473509d9b329764dc5138930506
2021-05-10 07:14:04 +00:00
jdlrobson
ec8edeb8ec Use ev.currentTarget not ev.target
In modern Vector, the ULS trigger button has a child node which is
a span. When clicks are received on the span, they will result
in positioning relating to the span rather than the button.

The ev.currentTarget should be read outside the asynchronous function
to avoid bubbling.

Bug: T276248
Change-Id: I6e138c88e29b335b8e0bc22cf0aa07c289a5eb74
2021-04-26 16:59:47 +00:00
Inductiveload
a2a218cce1 Update Junicode to 1.002
Bug: T173573
Change-Id: I0d8d650ea63e5391a405926ff769981a4c094403
2021-04-21 13:47:21 +00:00
Niklas Laxström
2a044e1e0a Small cleanups and typo fixes
Change-Id: I4faeb4673fd5e903d2931d6071262a893d4009f5
2021-04-21 11:48:15 +00:00
Niklas Laxström
929e707c49 Simplify undo tooltip positioning
OOUI is smart enough to handle this automatically:
https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.PopupWidget-cfg-position
https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.PopupWidget-cfg-autoFlip

Change-Id: Ib8e4ea0e900b3ea0904b34d82c874227462e342e
2021-04-21 11:48:13 +00:00
Timo Tijhof
a6e0c10c54 ext.uls.interface: remove unused "ulsPopup remove" code
The ulsPopup variable is local to the showUndoTooltip() function.
If it is called multiple times, then a previous assignment of an
OO.ui.PopupWidget object would not be found here in subsequent calls.

This check can only ever be false since it is the first statement in
the function (after variable and function declarations, which don't
do anything other than call `$()`).

Change-Id: I7020c103428d01b5e48c65be695471401f588fc4
2021-04-15 07:01:13 +00:00
Niklas Laxström
50b345c83d Avoid JavaScript errors for tipsy if no entry point on the page
Bug: T278313
Change-Id: I48011eec9f7d876b914550012cc76e2209fc783c
2021-04-14 23:41:54 +00:00
libraryupgrader
e2ab4bb1c3 build: Updating dependencies
composer:
* mediawiki/minus-x: 1.1.0 → 1.1.1

npm:
* eslint-config-wikimedia: 0.17.0 → 0.19.0
  The following rules are failing and were disabled:
  * compat/compat

Additional changes:
* Added the "composer phan" command to conveniently run phan.
* eslint: Renamed `wikimedia/client` profile to `client-es5` (T277085).

Change-Id: Ib31cbcd8c615d2e6abf9ee30f0f4d7b7baa54e2e
2021-04-07 11:10:07 +00:00
Niklas Laxström
3af22f60d4 Fix ULS dialog positioning in some cases
In development environment, ev.currentTarget is the button.
In Beta Cluster, however, once ext.uls.mediawiki is loaded,
it is now the document (the event has bubbled up). I do not
know what causes the difference, but we can use the target.

Bug: T276255
Change-Id: Ie4c425510293a6f2ce81e4bf4a353f2c8d86d412
2021-03-24 10:32:08 +01:00
Niklas Laxström
e8747a022d Avoid content language selector dialog resize shortly after opening
Small dialogs were resizing after loading when display and input
setting buttons were added to it. Now delay showing the dialog until
they are loaded.

Bug: T276248
Change-Id: I7033903737afedbd4be908c84d07656c468ce801
2021-03-22 18:21:16 +00:00
Niklas Laxström
8c835588f2 Fix positioning of input/display settings for new language selector
Unrelated behavior change: ULS language selection dialog is hidden while
display or input settings is open.

Also simplified dead code in addDisplaySettings.

Bug: T276248
Change-Id: Ia91a2b83e7ad4072016649230e2376b0793cbbff
2021-03-22 12:11:39 +00:00
Niklas Laxström
d3a3ac082b ULS: Avoid JS error for undo tooltip with new language button
Change-Id: Ib571152ff14754e186a3e7dd9e1c08bc22239032
2021-03-18 08:43:06 +00:00
Niklas Laxström
03547c68e3 Improve positioning for content language selector on narrow screens
Reported in
https://github.com/wikimedia/jquery.uls/pull/383#pullrequestreview-613761459

Instead of checking the left edge of the trigger, check the midpoint.
This is more reliable and does not cause the dialog to incorrectly
swap sides in narrow screens in LTR direction,

This patch does not touch the compact language links variant.

Bug: T276248
Change-Id: Ic734abb7b350852f8c5c10ced8456bf146df62d8
2021-03-17 10:29:18 +01:00
Niklas Laxström
dd8842517e Change ULS content language selector positioning
New Vector introduced a new content language selector trigger. This
code was hardcoding a behavior that works for compact language links
but is not so appropriate for other uses in the skin, which are out
of our control.

This patch aims to be a minimal change to allow other kinds of
behavior without changing the amount of tech debt. This changes
the default ULS dialog behavior to match the requirements shown
in the task. Compact language links specific behavior is retained but
only enabled for the compact language links trigger. The behavior
is chosen depending on the value of isUsingStandaloneLanguageButton().

For future changes, I propose that mw-interlanguage-selector class will
not have any styles attached to it. Whoever creates the trigger would
be in charge of styling it. Ideally that code would also define the
positioning and other behavior, but it is less clear how that can be
abstracted in a nice and decoupled way.

Bug: T276248
Change-Id: I52da6c2f5a1f25d64f322a3c8f6105da3b244b66
2021-03-16 22:36:18 +00:00
Niklas Laxström
95b1137a57 ext.uls.interface: clarify code
Changes to comments, naming and code to increase clarity of the code
and explain better what it does and why. No change in behavior.

Change-Id: I998fcfd620c2ee737618c3ab8f41fb6dfdd2c99a
2021-03-16 22:36:16 +00:00
Niklas Laxström
099f1f37c8 Add mw.uls.setLanguage
Translate's pagetranslation.uls module needs to override the action
that happens after language code is set. Currently it uses setlang
url parameter, which (no longer) works with Special:MyLanguage.

After this patch, it can use mw.uls.setLanguage and does not need
to reimplement it's functionality.

Turned mw.uls.changeLanguage into simple utility that calls
location.reload when the promise is resolved.

Change-Id: I9a648b146188dd252c239085bbe276165dc5f393
2021-03-16 10:16:06 +00:00
Sam Smith
852d72e66d Remove UniversalLanguageSelector instrument
Per T275894, Readers Web intend to increase the scope of the
UniversalLanguageSelector instrument to help them understand how
users are interacting with the Languages list in sidebar.

In order to keep the UniversalLanguageSelector extension focussed and
not overly Wikimedia-specific, it was agreed that the instrument would
be migrated to the WikimediaEvents extension, where other such
instruments are located.

Therefore, remove all code related to the UniversalLanguageSelector
instrument.

Bug: T275894
Depends-On: I2acee8ba8dc59c497dc6ba42cd5bd88dfd985c8b
Change-Id: I72b1d0ff35488521b3499e9606efee26baff8c00
2021-03-04 13:58:19 +00:00
jdlrobson
96656c5f41 Allow access to display and input settings in new vector
Light refactor of existing code into reusable method to support
this.

Use Extension attributes to allow skins to provide ULS
additional configuration.

Bug: T274396
Change-Id: I7dcd49f05fae83fbc0c15768bee8ca93eab17bcc
2021-02-22 11:02:10 +00:00
Niklas Laxström
2172c8c1b2 CompactLinks: Update performance summary
Change-Id: I310fea3dbdd8cd232a0204ffd17e3a02c6723c8a
2021-02-11 08:00:48 +00:00
Niklas Laxström
8b6d8f6898 Remove CompactInterlanguageList.prototype.getInterlanguageList
Unused since e3569d32a7

Change-Id: I2a0f74972b8f566d6462fa261231dbafe9a66665
2021-02-11 07:51:26 +00:00
Niklas Laxström
b385d58aca Remove CompactInterlanguageList.prototype.getCommonLanguages
Unused since fcfa36ac77.

Change-Id: Ifae139d989fb6cb21fc3e19006306ed597d058e6
2021-02-10 14:39:25 +01:00
jdlrobson
64aeedfb17 Modern Vector should be compatible with ULS
Without the following changes the language button shows the
wrong label and opens a dialog with zero languages.

* Don't apply heading change to modern Vector
* Look for the element .mw-portlet-lang as well as #p-lang

Bug: T273232
Bug: T273928
Change-Id: Ic201b1983a17cc37fd1ff7c507aab656ea25f370
2021-02-09 18:07:11 +00:00
Nikerabbit
3ac9853220 Simplify ext.uls.preferences module
This is updated version of 61f1a9863a
which was reverted due to compatability issues which are no longer
present.

Change-Id: I05333ddc288171b6d867dce8a1d3efc1e1450e0a
2021-01-21 08:08:15 +00:00
Niklas Laxström
4fc7bc9200 Handle corrupted values in input preferences
Bug: T246370
Change-Id: I13c730a6d584ad2f73807e11d5ceadfcb16a6040
2021-01-19 08:45:05 +00:00
Amir Aharoni
7a0d559dc0 Add the Boyo Gagrai for the Ho language in the Warang Citi script
Bug: T233301
Change-Id: Iad328485531b97428f795b154f8181e71947a5fd
2020-11-30 15:31:31 +00:00