Commit graph

1137 commits

Author SHA1 Message Date
Simon Legner 3c11f01c5f Make remaining functions in Config class static
Bug: T77349
Change-Id: I40d3ccd34df20943b33c3923fabbd0b59a94e5ae
2024-08-11 12:03:30 +02:00
Simon Legner 01437fd521 Replace wgMultimediaViewer with config.json packageFiles
Practically, the variable wgMultimediaViewer is not used inside user common.js, see https://global-search.toolforge.org/?q=wgMultimediaViewer

Ref: https://www.mediawiki.org/wiki/ResourceLoader/Package_files
Bug: T77349
Change-Id: Ib086c6184f76ca2dbeb701f79c3b18b336ff5433
2024-08-11 11:34:46 +02:00
Simon Legner d698b8b006 Use mw.storage.get/set/remove directly
Bug: T77349
Change-Id: I5b670ed617c8359f28029cf117cfda26b635e871
2024-08-11 09:56:43 +02:00
Simon Legner 8c4186962e Use mw.Api.prototype.saveOption directly
Bug: T77349
Change-Id: I531995fd2224705a612c0f1aef8cfc545c8b4228
2024-08-11 09:48:49 +02:00
Simon Legner 6309f26238 Use mw.config directly
Bug: T77349
Change-Id: I1dff714af371a8e605f35a2ac198f4eecad28cb8
2024-08-11 09:47:04 +02:00
Simon Legner 2602867d7c Use mw.user directly
Bug: T77349
Change-Id: Ib0901b88e9d85a7544bbce386a37a56b45955ec3
2024-08-11 09:28:38 +02:00
Simon Legner aa2951f436 Use mw.storage directly
Bug: T77349
Change-Id: I8a494f20b4d9f4930fa89681857990416c0e840c
2024-08-10 14:39:31 +02:00
jenkins-bot f27c355342 Merge "Make thumbnail bucket widths configurable using wgMediaViewerThumbnailBucketSizes" 2024-08-09 17:01:07 +00:00
Simon Legner 64e0cfeab5 Make thumbnail bucket widths configurable using wgMediaViewerThumbnailBucketSizes
Bug: T269987
Change-Id: Ib1b590c5c6fe353a86ac1527d19617975113ff8a
2024-08-09 15:56:48 +02:00
Simon Legner 85968f2022 Fix commons icon on commons
Regression of: Ia4388fe4d5e1d6112a992e826453cd5799a6a4b4

Bug: T77349
Change-Id: I5c987e3794eeb031f4a4019d5999bbc34fc19a6d
2024-08-09 12:30:20 +00:00
Timo Tijhof 70375cac12 tests: Change use of unrelated Map to mw.Map
This partially reverts commit 07ba0e43a9, which changed the test to
inject an ES6 Map rather than a mw.Map, which diminishes the value of
the test, including risk of false positive since that isn't what
the code actually accepts. See also T353076.

Change-Id: I4877d0d9820dfff42996ddbd4c9e26573d84d19c
2024-07-28 23:43:53 +01:00
jenkins-bot 4670e09260 Merge "Remove small piece of dead code from mmv.bootstrap.js" 2024-07-18 21:49:43 +00:00
jenkins-bot 4aeadfab12 Merge "Use much more precise original size for ratio calculations" 2024-07-18 21:49:42 +00:00
thiemowmde 4a37c70c95 Use much more precise original size for ratio calculations
Nowadays our HTML contains data-file-width="…" and data-file-height="…"
attributes. Previously this code was using <img width="…" height="…">
from the tiny thumbnail to calculate the aspect ratio. But this is
only a rough estimate and can be off by a significant amount of
pixels. Example:

Original image size: 4000 x 2100
Thumbnail in the article: 220 x 116
Available canvas height: 630
When using the thumbnail's size: 1195 x 630
When using the original size: 1200 x 630

I still use the old thumbnail size as a fallback just to be sure.
It's possible this is unreachable code by now. But it doesn't hurt
to keep it.

Change-Id: Iabd89762b09523249375bcbc7e4a573ef974e02e
2024-07-15 12:00:53 +02:00
thiemowmde ac2e3c4cbb Remove dead code from 2014 related to fullscreen pre-loading
This is disabled since 2014. See Ic145c8a for a longer explanation.

Bug: T66135
Change-Id: If0a1564676a25ba3ed2bcae099db77ec8fd3bae3
2024-07-15 11:59:20 +02:00
thiemowmde 92d400b9d6 Remove small piece of dead code from mmv.bootstrap.js
Calling .eq( 0 ) on a jQuery set that's known to contain only a
single element is pointless and doesn't do anything. .eq() is
documented to reduce the set to a single element.

Change-Id: I3f3a08d65a0490771e0282408e8c4711f3772c99
2024-07-15 11:45:10 +02:00
Ebrahim Byagowi 6fd605d4b2 Fix icons in RTL by using an element instead of ::after
Codex icons are auto-mirrored for RTL scripts but a pseudo-element
causes the auto-mirror selector to have incorrect order and that
builtin auto-mirror functionality of codex icons to not get trigged.

This change fixes it by adding a span to each icon so auto-mirror
can target an actual element instead of ::after pseudo-elements.

Bug: T369659
Change-Id: Ib5f9793a8ad10980d2742d1046c59306c943f960
2024-07-11 20:07:46 +03:30
Taavi Väänänen 1ea305b03b Fix dark mode issues with an extended 'Permission details' box
Fixes the shadows and borders that come with an extended 'Permission
details' box to use Codex tokens that support dark mode. To test this
out, view any image from Commons with a VRT permissions template (for
example [[File:Gordon_Highlander_steam_locomotive.jpg]]).

Bug: T369531
Change-Id: Ie2873b2ef2836c5b7ac2ded860dc2404f293f119
2024-07-08 16:16:15 +00:00
jenkins-bot afe1c08d2f Merge "ThumbnailInfo: support multi lingual SVG" 2024-07-04 19:30:11 +00:00
Simon Legner 4672f2eb57 ThumbnailInfo: support multi lingual SVG
Bug: T208564
Change-Id: Icf082ca0dc94bc4739fd31b795de76f8a0083b70
2024-07-01 22:49:10 +02:00
jenkins-bot dfc3818bdc Merge "Rename whitelist to allowlist" 2024-07-01 20:48:02 +00:00
Simon Legner f58526901f Remove obsolete MultimediaViewerBootstrap.statusInfoDialog
Bug: T77349
Change-Id: I4814dfe57d05c547c24f22e2516be795670c27bf
2024-07-01 19:51:42 +00:00
jenkins-bot 111916cf08 Merge "MMV: Set body background and theme-color" 2024-07-01 15:34:16 +00:00
Simon Legner c872e64988 Rename whitelist to allowlist
Bug: T277952
Change-Id: I67ce70df18d9f9c86579cedcb63aa63685156b09
2024-06-27 20:50:08 +00:00
Derk-Jan Hartman 1b12172bb0 MMV: Set body background and theme-color
When opening the viewer set the body background and the theme-color
to match the background of the viewer. This provides a better
experience for (esp. mobile) browsers.

theme-color has to be overriden, as it can be inferred from the top
of the browser window, but images can be all kinds of colors, so it
is better to be explicit.

Bug: T368659
Change-Id: I313745a31bf17eef612dd89630b1bbc4cb57fd45
2024-06-27 21:25:01 +02:00
Derk-Jan Hartman 1833ce7f14 Metadatapanel: Improve spacing between license links
The license links listed on the right are vertically pretty tight
next to eachother. Add some line-height to make them more readable.

Bug: T365192
Change-Id: Idd0e3d845188178656017ac3158b0a3451c24294
2024-06-27 21:09:20 +02:00
Derk-Jan Hartman 2a8b140ed3 MMV square buttons
- Use square cdx icon only buttons
- gray transparent brackground
- opaque background on hover, active, focus
- Some fixes to the positioning and offsets of buttons and dialogs
- Move the dialogs to be in the same container as the buttons
  This is better for accessibility but also fixes the z-index issue

Bug: T365192
Change-Id: Idbc2a309fbca15bd528aaed7ca9bed584487c4f3
2024-06-26 20:28:38 +02:00
jenkins-bot 3ac5c2e650 Merge "LightboxImage.originalWidth needs to be a property" 2024-06-21 00:39:00 +00:00
jenkins-bot 9fbea4233b Merge "Remove obsolete property LightboxImage.filePageLink" 2024-06-18 19:04:53 +00:00
jenkins-bot 33cb6e5ef2 Merge "Remove obsolete class IwTitle" 2024-06-14 20:40:09 +00:00
Simon Legner bc63438a16 Remove obsolete fields imageDisplayedCount and metadataDisplayedCount
Bug: T77349
Change-Id: Ie553107c33f24b26571ebd93e2458b4878c09f3b
2024-06-13 22:25:03 +02:00
Simon Legner a951a360d5 Remove obsolete property LightboxImage.filePageLink
Bug: T77349
Change-Id: I9c4fa491cb6bdc2668c6d21cc314c5290847bbc1
2024-06-13 22:17:00 +02:00
Simon Legner 8ecfc1aa7d LightboxImage.originalWidth needs to be a property
mmv.displayPlaceholderThumbnail overrides this value using ImageInfoProvider.

Bug: T64039
Follow-Up: Ic7c5889064492fc88dae33271b635c5327b091e1
Change-Id: I08d024f81336a76439f51b7684446f8725ddb905
2024-06-13 21:48:09 +02:00
Simon Legner 048c359806 Remove obsolete class IwTitle
Bug: T77349
Change-Id: Idc81f0d97ebfef725bcdb93ca50deac197d67590
2024-06-13 21:11:58 +02:00
Ed Sanders 39968fdb9a Update stylelint-config-wikimedia to 0.17.1
Change-Id: Icaa6d43338a747dbbf1d05d50646d6c7a0edda6d
2024-06-07 17:34:06 +01:00
Ed Sanders 27459e19dc Fix JSDoc complex return types
Change-Id: Ia50a9f086ebb0abcaf0409dac33f66178275cd30
2024-06-07 17:33:16 +01:00
Ed Sanders a74af878a4 Convert jQuery callbacks to arrow functions
Change-Id: I0a9ddd6931ac0f4f30b638491941d624582081ca
2024-06-07 17:33:16 +01:00
Ed Sanders fa18975543 build: Update eslint-config-wikimedia to 0.28.0 and autofix
Change-Id: Iff4b874580768b008427c0bea535ab08cea14a36
2024-06-07 17:33:12 +01:00
Simon Legner 0399ffff40 Api: remove obsolete getQueryField function
Obsolete since Ia4388fe4d5e1d6112a992e826453cd5799a6a4b4.

Bug: T77349
Change-Id: I13efa32786a2ba65edbaedde214057e9efe98145
2024-06-04 19:34:30 +02:00
jenkins-bot c754f877a6 Merge "Add loading bar while loading mmv module" 2024-05-31 20:10:23 +00:00
Derk-Jan Hartman c1a38cfe9e Add loading bar while loading mmv module
When opening the media viewer, we immediately display a black frame,
as we wait for the dependencies etc to load.

Add a codex indeterminate progress bar to this phase as we wait, so
the user has feedback that something is happening.

Bug: T77230
Change-Id: Ibba98150ac2e8034fbfcd586309632704cf0b606
2024-05-31 19:50:19 +00:00
Simon Legner 21438d2b22 Remove FileRepoInfo API and Repo model
Repo was only used in two locations:
1. StripeButtons.set for `isCommons` - can be replaced by `descriptionUrl.includes('//commons.wikimedia.org/')`
2. EmbedFileFormatter.getSiteLink (unused)

Furthermore:
- Simplify StripeButtons (we only have one button)
- Unwrap info objects consisting of `ImageModel` and `Repo`
- Remove unused EmbedFileFormatter.getSiteLink
- Inline EmbedFileFormatter.getCaption and EmbedFileFormatter.getLinkUrl
- Fix JSDoc type `ImageModel`

Reduces mmv bundle size from 28012 to 27246.

Bug: T77349
Change-Id: Ia4388fe4d5e1d6112a992e826453cd5799a6a4b4
2024-05-31 08:13:08 +02:00
Derk-Jan Hartman 82e36ddc61 Use CSS transitions for the progressbar.
Bug: T77349
Change-Id: Ib2e5367b913eaf1f4b8920ed7e78dbdecb01ca1d
2024-05-30 20:00:07 +00:00
jenkins-bot 167978ae5b Merge "Use mw.msg shortcut" 2024-05-29 21:53:16 +00:00
jenkins-bot da7401f983 Merge "Move dialog/reuse dialog code to mmv.ui.reuse module" 2024-05-29 20:23:47 +00:00
Simon Legner a8a5247c5e Use mw.msg shortcut
Change-Id: I5af9cc79d1c6108f643b690ded0dd9b876c3852b
2024-05-29 05:14:01 +00:00
Novem Linguae b02ba00fd0 JSDoc: convert @cfg to @param
Bug: T138401
Change-Id: Ib09d471a28821f54c6f8678e788ba85fbd426d35
2024-05-28 06:25:20 -07:00
Simon Legner 5bee6274e0 Move dialog/reuse dialog code to mmv.ui.reuse module
Initialise the corresponding dialogs upon first use by deferred loading of the mmv.ui.reuse module. Reduces code size of the main mmv module.

Bug: T77349
Change-Id: I672419e1a8af47d192843f7e7a4a038c0d8da2a3
2024-05-28 11:58:44 +02:00
Derk-Jan Hartman f8fe9c0af3 Remove the thumbnail blurring
This removes the thumbnail blurring.

The initial page thumbnail is still in place.
This too can be slightly improved as sizing up to the MMV frame is
done via JS right now, and causes a noticeable change. But we can
simply do this with CSS immediately i think.

Bug: T71609
Bug: T65504
Change-Id: If2a92689be9ee7ecd64561dc224991f31274d58a
2024-05-25 00:56:35 +00:00
Simon Legner 72ba58c134 Merge download/share/embed into mmv.ui.reuse module
Bug: T77349
Change-Id: I19f3444ac3e35d94ba3436e0c1387a1cb5b7e972
2024-05-24 18:27:03 +00:00