Commit graph

604 commits

Author SHA1 Message Date
Simon Legner 254ec713cc formatDate: handle year, handle <div>
Bug: T58794
Change-Id: Ie05241c8db18773d0eb84421813db69b425e0784
2024-02-05 22:25:39 +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
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
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
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
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 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
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
jenkins-bot a6e1a69a69 Merge "Fix browser test failures" 2019-05-08 22:27:35 +00:00
Mark Holmquist 93d948b21c Fix browser test failures
Sauce labs removed support for OSX 10.9, so we've seen failures in the
browser tests for a while apparently.

The generic "macos" should just work, and is sufficient for our testing
needs.

Bug: T214389
Change-Id: I01c1e9e03dc5b658aa3e2b3ee6a7b5f503488f97
2019-05-08 14:40:17 -07: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
Kunal Mehta 60d08ba00b Upgrade to newer phan
Bug: T216928
Change-Id: I2b812745176550616c8d37859f2ad29cdf8fd4c3
2019-03-17 16:14:02 -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
Ed Sanders a518cb03a5 build: Update eslint-config-wikimedia to 0.9.0
Change-Id: I92ed1f7093cfaed47f0372f9cb063fe4e65b4f55
2019-01-03 13:47:16 +00:00
Gergő Tisza 9901520ae5 Ignore TemplateStyle-generated content when textifying HTML
Not tested.

Bug: T211444
Change-Id: Id6fcd20d1d7d3b811623e6267cb9f74be9569b1b
2018-12-07 22:02:14 +00:00
flutters 2fad4daa43 SVG files display at max resolution
When an svg file is requested, returns the 1024px file and displays at
max possible size

Bug: T71237
Change-Id: I797794d1f9b1aa66cbb9bd9fec57274554292fb1
2018-11-26 20:37:34 +00:00
Ed Sanders 1ded292f83 Remove obsolete aliases from closures
Bug: T208951
Change-Id: Ice695dfb489974faa23ba19d74cf17b06e3f6075
2018-11-12 16:33:24 +00:00
Ed Sanders 053d1a9d8b build: Update linters
Change-Id: Ie6e85abdc0714adf4d89e515967bf2ab4c393215
2018-09-13 22:13:56 +01:00
Fomafix 965b496850 Replace jQuery by native JavaScript
Change-Id: I8ae88f9f569be61902e19f89c687b0188a7c099c
2018-09-11 21:15:07 +02:00
Timo Tijhof 5c9faa580e Move files to their own directory per module
Bug: T193826
Change-Id: I925b1c7be2dbbb50994ed9f1ef12b5978ba175ff
2018-07-30 15:15:25 +02:00
Matthias Mullie 4627adb9b1 Fix mw.storage typehint
Change-Id: I758ca9375c479098edae98a78c1ee9170df7afc2
2018-07-28 17:14:32 +00:00
Ed Sanders dec9c6321c build: Enable more qunit lint rules
Where appropriate, convert assert.ok to assert.strictEqual.

Change-Id: I098ade9928958e8c2d36de221361d89b5c70ec35
2018-06-06 12:18:24 -07:00
Ed Sanders 2c3213485d build: Introduce eslint-plugin-qunit and enforce
Change-Id: I16c00628a0f8a4f505fc0c78991bd7d9394c18d9
2018-06-06 12:17:23 -07:00
Ed Sanders 9ad112910c Avoid jQuery event aliases
Use #on for event binding and #trigger for event firing.

Change-Id: I75ca1cfac8419204399e27941c9f424664b56113
2018-05-11 18:46:50 +00:00
Ed Sanders 9987491fdf Pass mw.Title to #click in tests
Change-Id: I616d13bf11ce38ac9bd400a568ab791a07cf0392
2018-05-11 18:46:42 +00:00
James D. Forrester 2078fbfb53 tests: Comment out failing tests
Bug: T192932
Change-Id: Iba81676ebb13407679bd99b0e08d29e225a7ebde
2018-05-11 09:50:31 -07:00
Kunal Mehta b24f75a2ef Add phan configuration
Change-Id: I5d1c03978d6d018ea3e6fc0927598b5a2c931b85
2018-04-14 01:05:33 -07:00
Kunal Mehta fc165aa5a0 Use explicit HTTPS in help URLs
Change-Id: I2c387f6d10e31607b6c864cf39dfaa6503181a30
2018-04-14 01:05:07 -07:00
Prateek Saxena b6136712a4 Use findSelectedItem instead of getSelectedItem
Bug: T76630
Depends-on: I0f1d9c1f31efcc10d3647103548770d2101050d9
Change-Id: Id81bbe7b0daf104484272e05730e16f495cfd0e1
2018-02-27 15:34:10 +00:00
Derk-Jan Hartman 340e7680a1 MMV: Allow <sub> and <sup> in captions
As we already allow visual markup in captions, I see no reason to not
whitelist sup and sub. These elements are even allowed in the
displaytitle whitelist for articles, so seems appropriate to have them
for media captions as well.

Bug: T186844
Change-Id: I4339ee85d139301770a4e15650c9dc0d64c136cd
2018-02-09 10:34:53 +01:00
Fomafix 61581fa905 Use saveOption from 'mediawiki.api.options'
Change-Id: I33a60cbaf10f5d53a4e49f335ce8f16d108f9dfb
2018-02-03 16:37:21 +01:00
Gergő Tisza db3975fb1a Fix title detection on file pages
Media Viewer tries to detect the file name from the thumbnail name.
That can break for the main image of a file page, which is normally
a preview (ie. a normal thumbnail) but for unhandled types it can
be some asset (such as a PDF icon).

Bug: T137477
Change-Id: Ie6b23d7ef213087971b320460129910f2efd248e
2017-11-27 14:23:51 +01:00
Ed Sanders 42b577bae9 build: Update linters
Change-Id: I7262fb369df0428c39adaf55128b83f019afb4c0
2017-10-31 18:42:04 +00:00
Umherirrender 590c6cdf32 Allow https in test regex
Test failure from jenkins:
https://integration.wikimedia.org/ci/job/mwext-mw-selenium-jessie/6608/console
   Background:                             # features/mmv.download.feature:4
     Given I am viewing an image using MMV # features/step_definitions/mmv_steps.rb:21
       expected "https://creativecommons.org/licenses/by-sa/3.0" to match /^http:\/\/creativecommons.org\/licenses\/by-sa\/3.0$/
       Diff:
       @@ -1,2 +1,2 @@
       -/^http:\/\/creativecommons.org\/licenses\/by-sa\/3.0$/
       +"https://creativecommons.org/licenses/by-sa/3.0"
        (RSpec::Expectations::ExpectationNotMetError)
       ./features/step_definitions/mmv_steps.rb:126:in `check_elements_in_viewer_for_image2'
       ./features/step_definitions/mmv_steps.rb:73:in `block (2 levels) in <top (required)>'
       ./features/step_definitions/mmv_steps.rb:70:in `/^the image metadata and the image itself should be there$/'
       ./features/step_definitions/mmv_steps.rb:25:in `/^I am viewing an image using MMV$/'
       features/mmv.download.feature:5:in `Given I am viewing an image using MMV'
 
   Scenario: Download menu can be opened   # features/mmv.download.feature:7
     When I click the download icon        # features/step_definitions/mmv_download_steps.rb:8
     Then the download menu should appear  # features/step_definitions/mmv_download_steps.rb:54

Change-Id: I6feda65ca8ff2bc8f790eaaac8f63e1feafcbdfd
2017-10-07 20:17:55 +00:00
Gergő Tisza bbe174bca8 Display warning for licence/attribution problems
Bug: T76030
Bug: T71389
Bug: T71557
Change-Id: I38c1548a0de6cfd3a48db7efd7502a99f168d4a5
2017-09-28 15:34:30 +02:00
Ed Sanders 2156f3f485 Remove jquery.scrollTo library
This is an old library that is broken in Chrome 61.
Rather than updating it we can just use $(window).scrollTop/Left
which works in all the browsers we currently support.

Fix MPSP.toggle to return a promise, instead of a deferred
(although this return value is not used yet).

Bug: T173618
Change-Id: Iaec56debbb808bd95cf65c1ebfe22bdf0116da68
2017-09-14 12:45:46 +01:00
Timo Tijhof 7ae8401c22 Avoid use of deprecated QUnit.asyncTest and QUnit.start/stop
Change-Id: I9cc132f71df072c724b6cff6f1d935abbe092596
2017-07-25 17:59:27 -07:00
Timo Tijhof 5bf1466e7f Remove use of QUnit.test(, testCount, )
* Removed deprecated testCount, which is no longer supported in this way.
  It's only useful when wanting to explicitly expect 0 assertions (normally
  considered an error).
* Replaced use of testCount = 0, with assert.expect( 0 ).

Change-Id: I8fe82032d3af2a1ad2ed7febdb90a95d56dd3fc4
2017-07-26 00:12:06 +00:00
jenkins-bot 17485a4989 Merge "Replace all direct localStorage interaction by mw.storage" 2017-07-05 14:11:00 +00:00
Matthias Mullie 31c93b79fa Fix buttons fadeOut when coming back from fullscreen
Bug: T164410
Change-Id: I4275c15733b10cff68a20b19e5fb195a88fafebf
2017-06-07 17:09:01 +02:00
Matthias Mullie 3e5ad4c83a Replace all direct localStorage interaction by mw.storage
Meanwhile I also updated a few places where a non-string was
passed to/expected from localStorage - this could’ve led to
inconsistencies because localStorage stringifies everything.

And I also removed CP.canSetMediaViewerEnabledOnClick, which
was no longer used anywhere except for a test case.

Bug: T137777
Change-Id: I21ad4ba15ca751bb03e5e2c523d09a45c0444ccf
2017-06-02 11:52:34 +02:00
Ed Sanders 2264e5fdec build: Update eslint to 0.4.0 and make a pass
Change-Id: I444cfd511121a0547901ed87c9aedd410e7920bd
2017-05-17 11:30:45 +01:00