Commit graph

2849 commits

Author SHA1 Message Date
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
James D. Forrester 8d95d367a5 build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I833380e20616462633f2e0b84bfd9a823ad085e4
2023-08-19 13:54:25 +08:00
James D. Forrester c17cc34efe build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I4e07c2174c6f712d798ec3a5e4fbf9b22edb3b14
2023-08-19 13:54:20 +08:00
Translation updater bot c8fca24f43 Localisation updates from https://translatewiki.net.
Change-Id: I7cbf091a2db29fa9dc931277d83f2f8f3936119b
2023-08-15 08:26:15 +02:00
jenkins-bot 783fc61dcc Merge "Use HookHandlers for core hooks" 2023-08-15 02:28:36 +00:00
Umherirrender ad1f6a6ee0 Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T271019
Change-Id: I57dac8d590b5afa7524000d93c8477a10148c052
2023-08-14 20:47:02 +02:00
Umherirrender b4e7477150 Escape use of commons.wikimedia.org in regular expression
Dots needs escaping

resources\mmv\model\mmv.model.Repo.js
  129:11  warning  Unsafe Regular Expression
security/detect-unsafe-regex
  169:11  warning  Unsafe Regular Expression
security/detect-unsafe-regex

The plugin does not like the backtracking for "https?", but that does
not looks like a performance problem when given long strings here.

Change-Id: Iac4c88b591c2e8ebb2ce037bbd99b774319a261c
2023-08-10 00:30:27 +02:00
Translation updater bot 5ed21318bc Localisation updates from https://translatewiki.net.
Change-Id: Ic3b9a35f9ffb506a4b676063e825e289ecd9a3e8
2023-08-07 08:39:04 +02:00
jenkins-bot d8b4eaf524 Merge "QUnit: Use .toFixed() before compare .height() values" 2023-08-06 21:52:42 +00:00
jenkins-bot 0c25150766 Merge "Avoid errors in Special:JavaScriptTest with non-default settings" 2023-08-06 09:22:10 +00:00
Translation updater bot f30adcab3b Localisation updates from https://translatewiki.net.
Change-Id: I5cce81f5452e25b64b5df6ea48ab95509de16066
2023-07-31 08:59:25 +02:00
Fomafix d4c17edccd QUnit: Use .toFixed() before compare .height() values
https://api.jquery.com/height/ may return fractional in some cases on
zoom.

Change-Id: I446e7eccbb50da594cd1509a3cf1c3f31c716610
2023-07-28 09:57:33 +00:00
Fomafix f4858976ca Avoid errors in Special:JavaScriptTest with non-default settings
This change reverts b3ba9676e and solves it by a different way.

Change-Id: Ieefcbf9feb873233777c0f706c48620e308e1e93
2023-07-28 09:04:12 +00:00
Translation updater bot 96ae9d46a0 Localisation updates from https://translatewiki.net.
Change-Id: I08ce3376ce945d26e492982d52c6b63846c5da27
2023-07-26 10:27:18 +02:00
Translation updater bot d1a59a8a91 Localisation updates from https://translatewiki.net.
Change-Id: I5f3548d5608da3a85dc9ac189a569e40089b180d
2023-07-24 09:38:49 +02:00
Simon Legner de2349a509 Use Codex styles for buttons in mmv.bootstrap
Bug: T340258
Change-Id: I11fdbabae0ed996ed2e830259ccd3e02c3f035fc
2023-07-17 20:19:05 +00:00
Translation updater bot 0f9026a76e Localisation updates from https://translatewiki.net.
Change-Id: Ifea4992f7ec65e593006b35196daa23e5b2a7e12
2023-07-13 10:49:38 +02:00