Commit graph

440 commits

Author SHA1 Message Date
Ed Sanders a33f7e5c57 Update linters and fix issues
Change-Id: Ib562131bbb3a9940d56602e0c4dbbe810ce7358c
2023-06-28 19:12:48 +01:00
Simon Legner 9215d30471 Add shortcuts Home/End to jump to first/last image
Switch keydown handler to use KeyboardEvent.key
Ref: https://caniuse.com/?search=KeyboardEvent.key

Bug: T163976
Change-Id: Ia0d5b2b8d28324c89b0fa11916de9cdd6d16434a
2023-06-21 22:09:24 +00:00
Bartosz Dziewoński 900ce9d74c Update localStorage mocks for changes in mw.SafeStorage
Since MediaWiki change 6f9d4829b2fefc98a1969bb8f7ab3d04ef0268fe
mw.SafeStorage sometimes calls removeItem() before calling setItem(),
so we need to mock it as well.

Bug: T340069
Change-Id: Ife6c4cc032689bb75e572d7936ce33afa76cf396
2023-06-21 22:09:11 +00:00
Simon Legner 30fad6b8b8 Use ES6 features
* classes
* arrow functions
* const/let
* string templates
* Object.assign

Bug: T337102
Change-Id: I757b9993a2feeed707fb4ad213944001498f3f6a
2023-06-12 16:45:08 +00:00
Simon Legner 74a76718d7 Use packageFiles in mmv.test
Bug: T337030
Change-Id: Iaea2deec35003e306a8e1f12f890879c80cd8289
2023-05-21 06:41:31 +00:00
Simon Legner d0066039ac Deep-link to the license section of a file page
The necessary anchor link depends on the language used on Wikimedia Commons:

* https://commons.wikimedia.org/wiki/File:GATEWAY_(Moon_Space_Station).png?uselang=en#Licensing
* https://commons.wikimedia.org/wiki/File:GATEWAY_(Moon_Space_Station).png?uselang=de#Lizenz
* Ref: https://commons.wikimedia.org/wiki/Template:License-header

Remove jsduck due to lacking support for ES6 string templates.

Bug: T336708
Change-Id: Ib71e647682835baa71bd375ae3098966ae01f26c
2023-05-19 13:57:54 +00:00
Jon Robson 00b65d02cd Remove jquery.tipsy and use OO.ui instead
Bug: T77402
Change-Id: I63328cf86872019fc9832162b26ffa8075382acd
2023-05-05 16:32:00 +00:00
Bartosz Dziewoński c2e0cccbfe Remove some redundant tests
Follow-up to b1ade19388.

Change-Id: Iba4a2d7886798ba59b811dd6be4f51517e476b24
2023-05-02 15:50:53 +02:00
Jon Robson d556e73a00 Router handling code should be centralized into mmv.bootstrap
- mediawiki.router is available inside mmv.bootstrap so move
the handlers into the bootstrap file
- Remove direct loading of images from mmv.js instead modify
event handlers to modify the location which will trigger the loading of
the image
- Copy what we previously did in MobileFrontend (Bartosz's idea)
to allow page refreshing and escaping overlay on page load.
- Remove some no longer relevant tests

Bug: T236591
Change-Id: Ie5d33fca5174db58380a63f5cf97f44e5df10d42
2023-05-01 17:22:39 -07:00
jenkins-bot 9f77efa7ad Merge "Avoid errors in Special:JavaScriptTest on non 'en' content languages" 2023-04-29 16:46:07 +00:00
jenkins-bot 3a427c6e3d Merge "Use formatversion=2 in API requests" 2023-04-29 00:12:49 +00:00
Fomafix b3ba9676ec Avoid errors in Special:JavaScriptTest on non 'en' content languages
Change-Id: I5a2e265875d2a01314205796a5c652f9a4dda57b
2023-04-28 16:59:25 -07:00
Fomafix b5e3c3b8cd Fix qunit tests
The
	progressBar: {
		hide: this.sandbox.stub()
	}
fixes the following exception in the JavaScript console:

jQuery.Deferred exception: progressBar.hide is not a function MMVP.setupProgressBar

The
	router: {
		checkRoute: function () {}
	}
fixes the following exception in the JavaScript console:

jQuery.Deferred exception: viewer.router is undefined

Change-Id: Ia7658937ebdbb77a5889d6462f7706bb2fd4e08f
2023-04-25 09:46:04 +00:00
Fomafix 8013fde051 Use formatversion=2 in API requests
The response of prop=imageinfo is now an array instead of an object.
Therefor it is not needed to interate over the elements anymore.
The array contains exact one element if one title is used in the query.

The function getNormalizedTitle not needed anymore because the
requested title is always the first element of the array.

Change-Id: I7a226d3950615a2152c3f55127b218cac2d21fcc
2023-04-24 20:32:11 +00:00
Taavi Väänänen fb4ad597a0
Refresh Geohack URL
Change-Id: I86719937bca606f757f6f144bc287a0e61b09915
2023-04-10 17:58:25 +03:00
Umherirrender 8a7182b27a build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0

Change-Id: I8d3b6ca9d9e0d0c0b2019f0a165eb51618e829b8
2023-03-25 22:33:26 +01:00
Sam Smith 34e4968b2c Remove instrumentation
The MediaViewer and MultimediaViewer* instruments were disabled circa
October 2021 in Ie7dd8739efc.

This patch removes those instruments and any supporting code and data.
Notably, this patch does not remove the mw.mmv.logging.ViewLogger
instrument, which is responsible for logging image views.

Bug: T310890
Change-Id: I97d41be93849b2ae9d1adba6660546ea716657fd
2022-07-05 17:41:24 +00:00
Ed Sanders 70b4410e30 eslint: Fix qunit/no-loose-assertions
Change-Id: I61a1ade103e421aa1f447d441f3bb198258b50ad
2022-05-20 01:18:43 +01:00
Ed Sanders e131da48f9 build: Update eslint-config-wikimedia to 0.22.1
Change-Id: I275ecfa03b3df8554b30f2a0f6d94d4b66da8088
2022-05-20 00:05:49 +01:00
Timo Tijhof 0f092b6cb3 tests: Minor clean up of mmv.ui.metadataPanel.js and other tests
* Declare variables inline, as per the current code conventions.

* Use `assert.true()` or `assert.false()` in a few places.

* Clarify some test names and simplify some surrounding code.

Change-Id: Id0bca942e34564b9c011e89c0b2298cbb4f8a582
2022-05-13 22:13:01 +01:00
Timo Tijhof 5e1dece304 tests: Make mmv.ui.metadataPanel.js pass with non-English locale
My browser is configured with en-GB as its locale. This meant that
when qqx was passed down, it fell back to my browser's default locale
and thus made the tests fail, as the expected data was set against
lang=en.

Ironically, MMV actually prefers the en-GB date format, and outside
tests even replaces 'en' with 'en-GB' when formatting dates in the
user interface. It was only in the tests that it asserted the 'en'
format that would otherwise never be used by MMV.

Ironically, the reason my locale is affecting the test is because
we switched from hardcoded lang=en to hardcoded lang=qqx which is
meant to disable any influence from localisation. However, when
passed to browser-native Intl API, qqx is not valid and thus
caused us to not have a hardcoded 'en' but a completely variable
UI language based on the developer's browser settings.

Bug: T250045
Change-Id: I94ad25cc7060ac5e9db41c6b6767aa9fd687a0db
2022-05-13 21:49:51 +01:00
Timo Tijhof c8eae3585a tests: Remove use of QUnit 1.x setup()/teardown()
Bug: T250045
Change-Id: I22641fa8ca8231ef3fcac6075a604e1478fa1145
2022-05-13 21:41:15 +01:00
Ed Sanders b03af20581 eslint: Lint Gruntile.js using server rules
Change-Id: I6f6f7391668412b2bb572a8d77da8e137fa169bb
2022-02-07 16:38:38 +00:00
Iniquity 5803ea79eb Remove discussion and help links from footer
Bug: T133899
Change-Id: Ide631cd8bd98ff5084a8c406515c53b8a0cb033a
2022-02-06 01:15:02 +00:00
James D. Forrester 7dbee90cce Avoid ableist language in comments and test names
Change-Id: I55047f95da7c05f631f4009cbe25d8515dd937f1
2021-12-09 19:48:17 -05:00
Ostrzyciel c38a65410a Link to local description page if present
Currently for files from foreign repositories, the "More details"
button always points to the foreign description page, regardless of
whether a local description page exists. That is a bit unintuitive,
as the local description page often contains additional info (like
categories) that may be useful for the user.

This patch changes the behavior of the button to link to a local
description page if available.

Change-Id: I7db609a4dda42f28ef913ad6d4256fb5adabeb89
2021-06-20 07:24:00 +00:00
libraryupgrader 54647ec198 build: Updating eslint-config-wikimedia to 0.20.0
Change-Id: Iacb383954abfddb4636eb92650f9ebcbaef88ac0
2021-04-17 04:37:38 +00:00
AronDemian 72636057d8 [cleanup] Fix eslint (new version) warnings
Bug: T245930
Change-Id: I7a62e5a0a90ce0f4e4385afdae1e57722bc9ac82
2020-11-02 02:58:31 +01:00
Ed Sanders bfdcd8dbf1 eslint: Update eslint-config-wikimedia to 0.16.2
Change-Id: I0c35ed9b5ab00952124cb0e5c6c48fbc0d734f60
2020-06-26 12:14:27 +01:00
Matthias Mullie 6a85e6c111 Fix tests
Tests are now run with qqx language.

Bug: T252543
Change-Id: Ibe87b3ee64d5607bee12faf453cbb9fec64c5d2b
2020-06-12 10:27:09 +02:00
Umherirrender 6a6d17b999 build: Remove unneeded exclude from .eslintrc.json
This reverts parts of commit bb26bc47b4.

Change-Id: I108e2f39713fb95f4b00dabd495e27f4bd5af90a
2020-01-08 19:51:42 +00:00
Ed Sanders 18a154b989 build: Update devDependencies
Change-Id: I46f5317976ef9f818e30b0c81018e83800535389
2019-07-31 22:59:13 +01:00
Fomafix f89d7dc878 Remove "window." for location and setTimeout
The JavaScript in core also don't use "window." for these browser
properties and methods.

Change-Id: I344573fd7ef0e73c252779b4e59a53168d16574f
2019-06-10 12:46:58 +02:00
jenkins-bot 0d4d5096b1 Merge "Replace moment.js with Date.toLocaleString" 2019-05-31 21:14:00 +00:00
Simon Legner 682873dd2d Replace moment.js with Date.toLocaleString
Bug: T224626
Change-Id: Ib312821d2c72c2570cec29153557fd44e4db2bf7
2019-05-31 21:56:45 +02:00
jenkins-bot c7e33d0f5e Merge "Download sizes: 480p, 720p, 1080p, 2160p" 2019-05-31 16:54:00 +00:00
jenkins-bot a4e63f623c Merge "Adopt mediawiki.router" 2019-05-28 15:14:50 +00:00
Simon Legner b1ade19388 Adopt mediawiki.router
Bug: T77258
Change-Id: Id4df92b0ebed3fb4f4b9269862c952f3968bf957
2019-05-26 19:46:38 +02:00
Simon Legner 2fbf2c06a9 Download sizes: 480p, 720p, 1080p, 2160p
Bug: T77642
Change-Id: I41b7d59d14342345fc060085b755ce28f3e9cf98
2019-05-26 19:15:09 +02:00
Ed Sanders 394b893c7d Use upstream CopyTextLayout in share/embed/download panels
Results in small UI changes, but allows us to delete a lot
of code duplication.

Depends-On: I9049f5a1c0d88680fc4a174e390dd08e27c0eee2
Change-Id: Iebe7bdc8a026b929a35e823d8107d90e7bb62b82
2019-05-23 20:01:36 +01:00
jenkins-bot fb40e5b09f Merge "Do not clone CSS class names as well" 2019-05-19 13:12:18 +00:00
Thiemo Kreuz 26fbcd6095 Do not clone CSS class names as well
What MultiMediaViewer does is re-using the small thumbnail <img> that
is already present on the page, cloning it, blowing the size up, and
using it as a "placeholder thumbnail". The moment the bigger image
finished loading, it replaces the placeholder.

The issue here is that the cloning includes class names like the
<img class="thumbimage"> on every [[File:…|thumb]] image. This shows a
gray border. The cloned DOM node in MultiMediaViewer shows this gray
border around the placeholder for a short time. This can be distracting.

Change-Id: Ie83427fab478b6568731b9a0b1f7dbbcc6d5b0fb
2019-05-19 10:44:21 +00:00
Simon Legner e1caa0f65e Fix typos in code/comments
No functional change.

Change-Id: I6447aefe8fdd39642d613f55ad0a5537f64dcb9d
2019-05-19 10:17:44 +00:00
Dan Andreescu 51b31545ab Remove mentions of schema.* ResourceLoader modules
These modules are deprecated and will be removed, see parent task for
details and deprecation information.

Bug: T223284
Change-Id: I2532e20659a59cdd036a7d8ad5a040ae136848f5
2019-05-14 21:22:28 -04:00
Thiemo Kreuz f733d8bbd1 Fix typos in JSDocs type hint
Change-Id: Id590ba6a587dbe5b38bd998d93f07221cfcfeae2
2019-05-10 15:42:20 +00:00
James D. Forrester 23b2f78642 Remove the BetaFeatures integration
Not used in years. Sadly $wgMediaViewerEnableByDefault has to remain
for now.

Change-Id: If2d90627de230b9b36e7b24abe0d4bdee8a2ef35
2019-05-08 11:22:35 -07:00
James D. Forrester c6008c7844 build: Be more aggressive in fixing old bad JS code style
Change-Id: I7f734f1440a4a3216e774d2bddbc39b34f4125d2
2019-02-20 19:28:25 +00:00
James D. Forrester 1b21470703 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: I66788a2c1fa59b617abd13b7c8e8fb59ad74130c
2019-02-20 19:22:21 +00:00
Ed Sanders 92157f6b05 build: Update eslint-config-wikimedia to 0.10.1
Change-Id: Icd89819ef38142e55c0bd4cc8dbb73745123f9f6
2019-02-06 01:56:53 +00:00
Eric Gardner bbaf7a38b4 Get Rid of EmbedFileInfo
* Deletes the mmv.model.EmbedFileInfo class file and its test file
* Updates the extension.json and MultimediaViewerHooks.php files to reflect
  these deletions (by removing entries from dependency lists)
* Refactors all instances of `new mmv.model.EmbedFileInfo()` to instead use a
  POJO with appropriate properties. Conditional assignment is used for the
  caption and alt properties if there is any chance they won't be available, to
  keep from adding props with falsy values.
* Refactors JSDoc method annotations so that `@param` tags expecting an
  EmbedFileInfo instance now expect an object; relevant properties of this
  object and their types have been added to the method annotations as well.

Bug: T77320
Change-Id: Ie9f5f24136f4b73000259685474ce4d765a3ccd3
2019-02-05 15:31:49 -08:00