Commit graph

545 commits

Author SHA1 Message Date
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
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
Cormac Parle 6bb1cbaddb IP masking update
Use localstorage to store MMV preference for anon and temp users,
use regular user preference for non-temp accounts only

For embed default to wikitext for temp and regular users, html
for anon users

Bug: T340534
Change-Id: Ic19e8a6b6fbdeb2c86be14a33a306dd0f3088b1b
2023-07-04 11:52:40 +01:00
Ed Sanders 67188f8c31 eslint: Enforce max-statements-per-line
Change-Id: I416d0c951d18f2fb3b477695ab0913f75fb60a68
2023-06-28 19:12:48 +01:00
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
James D. Forrester 8b31f8395b tests: Drop all Ruby selenium testing
This framework has been legacy / unsupported for four years now. It's
time to admit defeat. Someone keen can re-use these tests from git in
an effort to write into JavaScript in the future

Test running removed from CI in 690d5a909.

Bug: T180226
Change-Id: Id952fe14f608d0b185ed1170b990192b0de575d3
2021-04-24 10:46:40 -07: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
Željko Filipin d4b61852cc Selenium: do not run selenium-MultimediaViewer Jenkins job on macOS
The job has been failing for months for macOS. Tests are not providing
any value.

Ruby Selenium framework has been deprecated since 2017. We are removing
support for it from CI.

Bug: T214389
Bug: T220035
Change-Id: I4fef826a7ac1e7b2d260b1bf8f5d42e3f214b07d
2019-07-11 15:14:03 +02:00
jenkins-bot 989af50dcf Merge "Make the download/share buttons actual links for right/middle click" 2019-06-15 22:09:38 +00: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
Thiemo Mättig 8b647c09e7 Make the download/share buttons actual links for right/middle click
Bug: T71469
Change-Id: Ib9dca98a70a056e93e252ba1d08479be509e7a18
2019-05-20 09:05:10 +00:00
jenkins-bot fb40e5b09f Merge "Do not clone CSS class names as well" 2019-05-19 13:12:18 +00:00