Commit graph

1164 commits

Author SHA1 Message Date
jenkins-bot a0403ff80e Merge "Revert "mmv.js: Store comingFromHashChange as a class property"" 2024-11-13 23:17:05 +00:00
Jdlrobson 2e4bd06f6b Revert "mmv.js: Store comingFromHashChange as a class property"
This reverts commit b5ed0e6c04.

Reason for revert: Caused T379835

Bug: T379835
Change-Id: I5ad84928417588d777fc40bad04d8e693a1bc257
2024-11-13 23:12:03 +00:00
jenkins-bot b0c2cc5671 Merge "mmv.js: Store comingFromHashChange as a class property" 2024-11-07 19:50:26 +00:00
Simon Legner 7c89a3e18b It should be possible for editors via a gadget or Special:MyPage/common.css to hide the start and end arrows
Set mw-mmv-prev-image-loop, mw-mmv-next-image-loop classes.

Bug: T377791
Change-Id: If4c398274ef5b86f1220ef6ed8a8265ddebc0d6b
2024-11-01 19:19:54 +00:00
Simon Legner 8dab698605 MMV should have an affordance for which image is being viewed in the article (i18n)
Additional change:
* Bump bundle size for Codex module due to recent Codex update.

Follow-Up: I701632faa6890bd1577eb725ac4b25579fb510b8
Bug: T377791
Change-Id: I110335dabbec15c9290b771440d172c877351d5a
2024-11-01 18:03:16 +00:00
jenkins-bot c203a5bde6 Merge "Remove unused eslint rule" 2024-10-29 17:17:13 +00:00
Simon Legner 69e4e77044 MMV should have an affordance for which image is being viewed in the article
Bug: T377791
Change-Id: I701632faa6890bd1577eb725ac4b25579fb510b8
2024-10-28 20:56:16 +00:00
Ed Sanders b5ed0e6c04 mmv.js: Store comingFromHashChange as a class property
Code in mmv.bootstrap.js sets viewer.comingFromHashChange directly,
assuming it to be a class property, not a local variable.

Change-Id: I8b10243768118e84d916f50f1a48ff10463d1db4
2024-10-28 17:30:29 +00:00
jenkins-bot 850b558e9f Merge "Remove support for legacy route #/mediaviewer/File:" 2024-10-23 15:39:26 +00:00
Simon Legner dbe57993a4 Remove support for legacy route #/mediaviewer/File:
This route has been declared legacy in 2015 via I0936ada35141ddd85e0aa232b833d315e3246ce3.

On English Wikipedia for a given day there was no usage of this
route.

Change-Id: I41b33697669500670bea6506dc45c5c6a613c502
2024-10-23 15:34:41 +00:00
Ed Sanders 4a4997a8e5 Remove unused eslint rule
Change-Id: I702749b60aaaf5528af28ce44fb73f586f256105
2024-10-22 15:34:55 +01:00
Simon Legner 9eb3439d1b Hide next/prev buttons when there is only one image
In addition, prefer `this.ui` over passing `ui` as method argument.

In addition, hide the next/prev buttons while loading.

Bug: T77877
Change-Id: I316687f1a180605c6014e93d963ce9e5fd325850
2024-10-21 18:58:06 +02:00
Ebrahim Byagowi 81abf7ba8b Increase specificity to avoid rare white boxes
This increases specificity of the mw-mmv-button to make
sure it wins over '.cdx-button:enabled' and
'.cdx-button.cdx-button--fake-button--enabled' that right
now sometimes fail due to load order.

Bug: T374373
Change-Id: I402aa0761615eeb0e080bb6087e0de778b6f493a
2024-10-19 06:07:11 +00:00
Simon Legner fb4e80a1b1 Move HtmlUtils from mmv.bootstrap to mmv module
HtmlUtils is used for stripping HTML code. This is the responsibility of the individual UI components.

More specifically, MultimediaViewerBootstrap.processParsoidThumb no longer strips HTML code. Various UI components were already calling HtmlUtils.htmlToTextWithLinks. Only the error case in MultimediaViewer.loadImage newly needs HTML stripping applied.

Bug: T65504
Change-Id: If24b9c220a6ec43f35251a4ec6a716fd4ba03df6
2024-10-17 22:51:20 +00:00
Simon Legner fe5687b6ef MMV options dialog: remove leftover code
Follow-Up: I707ef2c0b6b8d4d13c05182078b82ddc99e32d12
Bug: T77349
Change-Id: I2693cd36ec390e0ca059030d264276492ed0a2fe
2024-10-17 09:31:51 -07:00
jenkins-bot d882ec8a93 Merge "Merge MultimediaViewer bootstrap modules" 2024-10-16 23:38:19 +00:00
jenkins-bot 525d333998 Merge "Back button doesn't close MediaViewer if the URL has a fragment with "/"" 2024-10-16 23:33:49 +00:00
Simon Legner 630a45a3ba Merge MultimediaViewer bootstrap modules
There is no need for them to live in separate modules and they bloat the size of our ResourceLoader startup module unnecessarily.

Bug: T77349
Change-Id: Ieb830486a280e607cad3be6418c46db9c6477491
2024-10-16 23:20:46 +00:00
jenkins-bot e49c6d8e58 Merge "Fix warning icons on dark mode" 2024-10-16 23:10:20 +00:00
Simon Legner 81c47fb174 Fix warning icons on dark mode
Use @background-color-warning-subtle, @border-color-warning for the warning box.
Use @color-base for the warning icon.

Bug: T374871
Change-Id: I9a90d2d3a1b58d92fac7aca67660c76bc117b249
2024-10-16 15:36:23 -07:00
jenkins-bot 029f84c5ec Merge "Use browser provided URL object instead of mw.Uri" 2024-10-14 15:53:36 +00:00
Simon Legner a12565e8aa Back button doesn't close MediaViewer if the URL has a fragment with "/"
Bug: T361612
Change-Id: I1a516dbe62bd3a8c621a148c3fb36111128a57ef
2024-10-13 14:12:58 +02:00
Simon Legner 161adf921d Drop "About Media Viewer" link
Bug: T376972
Change-Id: I85a308afe7c805a147bfcc5e9adf0293378859f1
2024-10-13 08:46:50 +02:00
Ebrahim Byagowi 32a575f739 Use browser provided URL object instead of mw.Uri
Bug: T374314
Change-Id: I7de5ac9ba2de70e5a3a84fca1608c64ea1cd1aaf
2024-10-11 17:22:40 +02:00
jenkins-bot fc75d3aabe Merge "Remove MMV options dialog in favour of Special:Preferences" 2024-10-11 00:23:53 +00:00
Simon Legner e3badef708 Remove MMV options dialog in favour of Special:Preferences
MMV options dialog only allows to disable/enable MVV. Rely on Special:Preferences instead. Strips more than 2kB off the bundlesize.

Bug: T77349
Change-Id: I707ef2c0b6b8d4d13c05182078b82ddc99e32d12
2024-10-08 20:56:04 +02:00
Simon Legner f3786ff249 Make next/prev buttons jump to first/last image when viewing last/first image
Bug: T77877
Change-Id: I10f4d1b51b909ac8683afbd21f9529254a25ff37
2024-10-08 20:35:52 +02:00
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