Commit graph

2985 commits

Author SHA1 Message Date
Simon Legner 07ba0e43a9 Don't use mw.Map(), use a native Map() instead
Bug: T353076
Change-Id: I91a556becc1093e0db4c4b13e4685f2c0e084031
2024-02-08 20:21:20 +00:00
Simon Legner 1ab8d0d899 Public API to Check Wikimedia Media Viewer Extension Status
mw.mmv.isMediaViewerEnabledOnClick()

Bug: T348026
Change-Id: Ibc34e370e6bf631d9f861b9f6baa75d3f227123e
2024-02-07 20:38:01 +01:00
Simon Legner ef53ab0834 File with percentage sign in file name does not open
Invoking encodeURI on the imageFileTitle makes sure that a "%" character is properly URL-escaped.

Bug: T337540
Change-Id: I538b7f813b546134848e93cea4744de8f4da9e90
2024-02-07 20:13:35 +01:00
libraryupgrader 993936420c build: Updating npm dependencies
* grunt-eslint: 24.2.0 → 24.3.0
* grunt-stylelint: 0.18.0 → 0.19.0
* stylelint-config-wikimedia: 0.15.0 → 0.16.1

Change-Id: I2f770b102304643a78dea200d1e8bfabb6c5cf55
2024-02-07 19:00:44 +00:00
jenkins-bot fabeff0090 Merge "formatDate: handle year, handle <div>" 2024-02-05 22:16:55 +00:00
Simon Legner 254ec713cc formatDate: handle year, handle <div>
Bug: T58794
Change-Id: Ie05241c8db18773d0eb84421813db69b425e0784
2024-02-05 22:25:39 +01:00
libraryupgrader 23184825bd build: Updating npm dependencies
* eslint-plugin-compat: 4.1.4 → 4.2.0
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
* postcss: 8.4.21 → 8.4.33
  * https://github.com/advisories/GHSA-7fh5-64p2-3v2j
* semver: 7.3.8 → 7.5.4
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw

Change-Id: I44179fd3c9f072d7d4034d4211e5fa98ea84e34c
2024-02-04 05:22:41 +00:00
Translation updater bot d4f10cf2fb Localisation updates from https://translatewiki.net.
Change-Id: I2a45c7ddc020a42d63d8a1558c9504a9b594b880
2024-01-28 16:07:31 +01:00
Volker E cfcb8d4755 build: Update 'svgo' to latest v3.2.0 and re-crush SVGs
The latest update of 'svgo' dependency includes three optimizations on
converting path commands, which
- improves closing paths and how we determine if to use absolute or
  relative commands.
- round arc or convert to lines based on the geometric sagitta
- convert cubic Bézier curves to quadratic Bézier curves where possible
Also
- removing obsolete 'grayscale.svg' which was introduced in
  I0f2c2b24aece3b but seems to have not been in use. It itself is not
  reasonable, as an SVG filter needs an element to be applied to, which
  this SVG didn't feature.
- unifying npm command to qua standard notation `minify:svg` and add
  “parent” command `minify` as well.

Bug: T354875
Change-Id: Ie4d8ef85b9b9d28943a7216f0b5ed6392592a43e
2024-01-18 12:04:02 +01:00
Translation updater bot 4c7ad24845 Localisation updates from https://translatewiki.net.
Change-Id: I508cad9fda86afda2404e95a8db825b01fca9ace
2024-01-10 08:33:09 +01:00
jenkins-bot 7b344bfe61 Merge "Support conditional user defaults" 2024-01-09 04:43:16 +00:00
Translation updater bot 4ba6b0ee99 Localisation updates from https://translatewiki.net.
Change-Id: Ibbbc78ed157c62765bf1fbf289f331f823eb57d2
2024-01-08 09:15:58 +01:00
Martin Urbanec 81ce7b08bd Support conditional user defaults
Thanks to T321527, MediaWiki makes it possible for default
values of user properties to vary by user.

Depends-On: I1549c3137e66801c85e03e46427e27da333d68e2
Bug: T354329
Change-Id: Ib6717be54d4f898b8b0433ee44b57f1e3e960545
2024-01-04 13:07:24 +01:00
jenkins-bot d1c35338f0 Merge "tests: Avoid DB access in HooksTest" 2023-12-30 21:32:23 +00:00
Translation updater bot c91ca39e37 Localisation updates from https://translatewiki.net.
Change-Id: I9006418007a5aca44d0a9b20da919625c36864ac
2023-12-28 14:50:10 +01:00
Translation updater bot 4d1580f771 Localisation updates from https://translatewiki.net.
Change-Id: Iddd799a948cbe00ddf04bb714b85be21fc62801c
2023-12-22 17:46:25 +01:00
Translation updater bot 9b1d3ca24d Localisation updates from https://translatewiki.net.
Change-Id: Ieedc3d6da7ec32dacc524b309a41f4e8e19c8320
2023-12-18 18:18:12 +01:00
Umherirrender ba0af22fce tests: Avoid DB access in HooksTest
Force a content model on the title used by HooksTest, so that
calls to getPageLanguage() won't end up hitting the DB

Only happens when the Flow extension is enabled

Change-Id: Ie4769f972c26e48a216e4546a584893a8b47eb19
2023-12-16 00:40:12 +01:00
Jon Robson f3f86d6081 Fixes button sizes on file page and overlay
* The file page has a button that does not match the font size of
the page. This is also the case for the overlay.
* The icons are too big on the file page. This reduces their size.

Bug: T345749
Change-Id: I4f4edc0aa7adc0c72773a939c43108019bc4295b
2023-12-13 18:34:16 +00:00
jenkins-bot 96f66f06a0 Merge "mmv.bootstrap: Avoid code duplication" 2023-12-12 20:00:19 +00:00
Translation updater bot aa125754e3 Localisation updates from https://translatewiki.net.
Change-Id: Ia7b0e5e37d50169ba2672a75fe88692985fd6a1c
2023-12-11 10:43:37 +01:00
Timo Tijhof b619d47f79 mmv.bootstrap: Avoid code duplication
Follows-up a0ce33226d (ref T348275, T349448).

Change-Id: I18bebf524686cac9e00e5d250eddd0c73c950893
2023-11-30 15:51:05 -06:00
gerritbot 65cf8fc812 Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: If63fb03b90f797a38a07f0d88f663e25cac75770
2023-11-29 12:39:36 +00:00
Translation updater bot 5db5cc2470 Localisation updates from https://translatewiki.net.
Change-Id: I21a6ed123d13b747b77418bab2c75c3dfe269e03
2023-11-27 08:32:47 +01:00
jenkins-bot e0c48c1331 Merge "Skip thumbs from a.mw-file-description with typeof attribute" 2023-11-13 16:39:38 +00:00
Translation updater bot 817391d4c2 Localisation updates from https://translatewiki.net.
Change-Id: I10d25feb989a956f7b63e0ecaa4e1f4c6d190509
2023-11-13 08:41:29 +01:00
Fomafix 3481080251 Improve variable declarations in JavaScript
Use the eslint rule
	"no-var": "error"
in resources/.eslintrc.json and in .eslintrc.json
to require the use of `const` and `let` instead of `var`.

Bug: T337102
Change-Id: I3b3d6d426966a97c13f62494443f62bd5b790920
2023-11-06 23:11:23 +00:00
Translation updater bot db68366fe6 Localisation updates from https://translatewiki.net.
Change-Id: I2db55fabe4c4fe971adf49d7688c565323329fc3
2023-11-06 08:56:57 +01:00
Umherirrender a0ce33226d Skip thumbs from a.mw-file-description with typeof attribute
Skip thumbs found by the newly added selector (from 4d4e86ec) to skip
when also matched for the parsoid part of the multimedia viewer.

Bug: T348275
Bug: T349448
Follow-Up: I5ec67accab4e1cbfa90544087750016e1baab85d
Change-Id: I0c45b877565fd54b3e1cc766e4ee745a48cdea27
2023-11-03 20:53:05 +01:00
Translation updater bot 44d10b070e Localisation updates from https://translatewiki.net.
Change-Id: I1188528e304d759ee783f2ea1ba803ef9f774a5e
2023-11-03 08:59:20 +01:00
Translation updater bot 654f30d69f Localisation updates from https://translatewiki.net.
Change-Id: If277c53ad4989b4e5bcf602d28a5ccdf99b49cbd
2023-10-27 09:20:47 +02:00
Translation updater bot 1f48e682a3 Localisation updates from https://translatewiki.net.
Change-Id: I3b6c1417ac79c6c16dd2f90835be30e67d1021e6
2023-10-26 11:05:21 +02:00
Translation updater bot 4609f34069 Localisation updates from https://translatewiki.net.
Change-Id: I94df597f5f455345ca36085c05e674778195e0ea
2023-10-25 09:02:37 +02:00
Translation updater bot 743ab759af Localisation updates from https://translatewiki.net.
Change-Id: I911c21b76d21b7f825ae340c47f66b15891beadf
2023-10-24 09:38:07 +02:00
jenkins-bot c4855e2157 Merge "Improve variable declarations in JavaScript" 2023-10-23 21:19:46 +00:00
jenkins-bot a76823a721 Merge "Use namespaced classes" 2023-10-23 21:18:42 +00:00
jenkins-bot 6ce10b6597 Merge "Replace global variables by inject MainConfig" 2023-10-23 21:17:39 +00:00
jenkins-bot b28183caeb Merge "Use type hint UserOptionsLookup for private variable declaration" 2023-10-23 21:17:37 +00:00
Fomafix 4fd709678e Remove phpcs exclusion rule MediaWiki.Commenting.PropertyDocumentation.MissingVar
Fix code to pass phpcs.

Change-Id: I093b87804d6b2c66efa6ba039d6f1e4720f30209
2023-10-23 20:58:07 +00:00
Fomafix 622f44121f Replace global variables by inject MainConfig
Change-Id: I53322a15e53bfe4e0de6d12253aff74071c339c3
2023-10-23 20:42:49 +00:00
Fomafix 72745a5f28 Use type hint UserOptionsLookup for private variable declaration
Also use alphabetical order of the __constuct parameters.

Change-Id: I448103eabdb88372709eb529118f0f5d17baee8a
2023-10-23 20:15:46 +00:00
Fomafix 2f6a063b71 Use namespaced classes
Change-Id: I358d0544e2195fe5fd8a828bf8130a9b851544d3
2023-10-23 20:10:29 +00:00
Fomafix c37c64875b Improve variable declarations in JavaScript
Change-Id: Ibb3f99a98e019204b4def19af957511ef32e9dd4
2023-10-23 19:52:02 +00:00
Translation updater bot dee4a7e067 Localisation updates from https://translatewiki.net.
Change-Id: Ic2b7cdca3d5f0ab90695db553374178a5f3c3a48
2023-10-12 09:29:38 +02:00
jenkins-bot 8161b14ea0 Merge "Use a.mw-file-description to find thumbs" 2023-10-12 02:04:49 +00:00
Translation updater bot a6856ff464 Localisation updates from https://translatewiki.net.
Change-Id: Ia97d3d0d52c1fe9052f1a389ab88048c993869e8
2023-10-10 08:52:37 +02:00
Translation updater bot 00c6770ab9 Localisation updates from https://translatewiki.net.
Change-Id: If1ae636643c834c64fd39ef5fb0642c76f955b41
2023-10-09 08:56:35 +02:00
jenkins-bot df28c29433 Merge "tests: Remove pointless "Hash handling" test that leaves black overlay" 2023-10-06 18:18:18 +00:00
jenkins-bot 17c14d4c50 Merge "tests: Prevent native "Back" navigation in mmv.test.js" 2023-10-06 18:17:43 +00:00
Timo Tijhof 44b15a2c2c tests: Remove pointless "Hash handling" test that leaves black overlay
This test was leaving behind the black overlay, obscuring the test
results interface. Upon closer inspection, it appears not one part
of this test is doing anything that actually works.

* Assertion 1: `viewer.isOpen === false`
  This is the initial and default state. Not essential for the test,
  but so far so good.

* Prep for Assertion 2 & 3:

  We call loadImageByTitle. One might think that this will set isOpen
  to true, but, this isn't asserted. If one did, the test would fail,
  because loadImageByTitle returns early from its first branch
  in `!this.thumbs.length` and is thus a no-op, and adds nothing to
  the test.

  We set `location.hash = 'Foo'`.

* Assertion 2: `location.hash === '#Foo'`
  Assertion 3: `viewer.isOpen === false`

  Assertion 2 is meaningless because handling of hash changes appears
  to be asynchronous. Perhaps not always, but at least the indirection
  used in this codebase makes it async. Hence, the fact that it is
  correctly normalised to '#Foo' is meaningless as the popstate
  and hashchange event handler haven't been processed yet. If they
  were, it would still be meaningless since viewer.isOpen was never
  true in the first place and MMV's event handlers for popstate/hashchange
  are guarded by `isOpen`.

* Prep for Assertion 4: location.hash = Bar
* Assertion 4: `location.hash === '#Bar'`

  Idem.

* Prep for Assertion 5: Replace the viewer.loadImageByTitle function
  with a function that performs a nested assertion.

  This function is never called and its assertion never reached.
  This is a textbook example why assertions should never be
  nested. If you rewrite this in following with the advice from
  <https://api.qunitjs.com/assert/verifySteps/>, we find that
  the array is in fact empty by the end of the test() function.

  ```js
  var seen = [];
  viewer.loadImageByTitle = function ( title ) {
    // assert.strictEqual( … );
    seen.push( title.getPrefixedText() );
  };
  location.hash = …;
  location.hash = …;
  location.hash = …;
  location.hash = …;
  assert.deepEqual( seen, [ 'File:' + imageSrc' } );
  // Actual: []
  ```

== Misc notes ==

The test ends with "#/media/File:Foo bar.jpg" set on location.hash,
and the black overlay covering the page. It seems that the hashchange
are async, and that the first in a given event loop tick "wins", with
later ones being ignored. Observing this with debugger/breakpoints is
hard given that each pause results in the effect not being observable.
console.log(location.href) at the end of the test shows hash='#',
but placing a debugger at the end of the test results in the hash
being "#/media/…" instead.

Exprienced in Firefox 117 on macOS.

Change-Id: Ib37bec1b3e67fcab1da89d23381a3adbb6312827
2023-10-06 03:03:58 +00:00