Commit graph

2815 commits

Author SHA1 Message Date
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
Timo Tijhof 1260d98c78 tests: Prevent native "Back" navigation in mmv.test.js
This makes the test report inaccessible in the browser. I'm adding
it at the module level given that nearly all test cases in this
file trigger it:

* "Progress"
* "Progress when switching images"
* "New image loaded while another one is loading"
* "Events are not trapped after the viewer is closed"
* "document.title"

```
-   QUnit.module( 'mmv', QUnit.newMwEnvironment() );
+   QUnit.module( 'mmv', QUnit.newMwEnvironment( {
+       beforeEach: function () {
+           this.sandbox.stub( require( 'mediawiki.router' ), 'back', function () {
+               console.log( QUnit.config.current.testName );
+               console.trace();
+           } );
+       }
+   } ) );
```

Change-Id: I0cb7ed6c76d5547bcef9c183c9305b6fd08ec9eb
2023-10-06 03:03:48 +00:00
Timo Tijhof 1a25711033 mmv.lightboxinterface: remove 'isFullscreened' data
This was used internally by `jquery.fullscreen` but now that we
have all the logic inside this file, we don't need to store this
information two places with a copy in `this.$main.data()`. We can
use this.isFullscreen directly as they are always the same.

Change-Id: Ie15729a038bc9c1f6278c0b068c0706620d95e93
2023-10-06 03:03:00 +00:00
jenkins-bot 01652054b3 Merge "Remove unused core JavaScript modules that ship with MediaWiki core" 2023-10-05 23:58:00 +00:00
Hannah Okwelum c9eed0a3b5 Remove unused core JavaScript modules that ship with MediaWiki core
Bug: T335723
Change-Id: I89e389b532cd80af488255ebe88e403a10ae3a38
2023-10-05 16:53:45 -07:00
Umherirrender 4d4e86ecb2 Use a.mw-file-description to find thumbs
a.thumb is no longer outputted when $wgParserEnableLegacyMediaDOM is
false (fdd8f864 ), use the new class from 350721cc

Bug: T348275
Change-Id: I5ec67accab4e1cbfa90544087750016e1baab85d
2023-10-05 21:16:50 +02:00
jenkins-bot e804f87b89 Merge "Add mw-no-invert class to MMV overlay" 2023-10-05 14:38:49 +00:00
Translation updater bot 728a7de9b4 Localisation updates from https://translatewiki.net.
Change-Id: Ie7663f7d5f47536f45767c069c9171803e238d1b
2023-10-04 09:08:48 +02:00
Translation updater bot 855fba12c4 Localisation updates from https://translatewiki.net.
Change-Id: I96aaecb438bcdcd8e00afb2bdf6b55b3342f395a
2023-10-03 09:32:59 +02:00
Translation updater bot cbeb4e1f35 Localisation updates from https://translatewiki.net.
Change-Id: Ia2fdb58ecb62d1af616c88658e9144179f59400b
2023-10-02 10:57:50 +02:00
Simon Legner 6ee3f05104 Use Codex styles for buttons in mmv.ui.download.pane
Bug: T340258
Change-Id: I30a7ab4a6732fd87a68c67593d322be2347b2ff8
2023-09-28 10:02:57 -07:00
Umherirrender fb1de7786c Improve special page handling in onBeforePageDisplay
Avoid creating of Title object to get the "fixed special name" (which is
the localized name) and compare that against the local name of the
current page, just use the SpecialPageFactory to get the canonical name
(which is the english internal name, not the english visible name) and
compare against the list of canonical allowed pages (adjust the existing
list to the canonical names, that are "old" names in different cases)

Change-Id: Ia6f6574bf6e65c75f8977ff016feda6ecdca3776
2023-09-23 00:03:01 +02:00
Ed Sanders 2212255fe2 Add mw-no-invert class to MMV overlay
Bug: T345281
Change-Id: I2f2659809ef8e4fc2e1c752d8fd0eb3533c3cb78
2023-09-12 14:02:36 +01:00
Translation updater bot ed07de63f7 Localisation updates from https://translatewiki.net.
Change-Id: I2288d2314809b44d97e52ff1beb63dab6e6587e9
2023-09-11 09:04:24 +02:00
Translation updater bot 9bb5f5d628 Localisation updates from https://translatewiki.net.
Change-Id: I40eb5c5e37598074258834bbc7753a8d8b71a7c7
2023-09-07 11:12:07 +02:00
Translation updater bot 7bf796e93d Localisation updates from https://translatewiki.net.
Change-Id: Ie572ce9adc7da7fe57e0459f0d1fa4e67e397ee3
2023-09-06 08:42:42 +02:00
Translation updater bot cc189fc45a Localisation updates from https://translatewiki.net.
Change-Id: Ifcc7f4a02529356a400f52b3c857af6556c9f4f9
2023-08-28 09:30:30 +02:00
jenkins-bot ee93b4875b Merge "build: Update MediaWiki requirement to 1.41" 2023-08-24 03:33:46 +00:00
James D. Forrester 886a7e722c build: Upgrade jsdoc-wmf-theme from ^v0.0.5 to v0.0.8
Change-Id: I93c4a73d229b47f11027923a5b5c5065a9987ed1
2023-08-23 09:56:07 -04:00
jenkins-bot 231c28eb6a Merge "Replace some moved Title class uses, now MediaWiki\Title\Title" 2023-08-19 18:35:17 +00:00
gerritbot 2c25dcfe59 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I61ad6f6178ca7cd4f6f52a303d10d47e8ba4476e
2023-08-19 13:08:12 +00:00