Commit graph

876 commits

Author SHA1 Message Date
James D. Forrester 90ada228cd eslint: Drop 'dot-notation' rule
Bug: T210552
Change-Id: I09660b9d49cfdc450efe0273736abd4730da5e77
2018-11-28 10:46:41 -08: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
Volker E a92bbbaa5f Update user avatar icon
Updating user avatar icon to overhauled standard WikimediaUI icon.
Also:
- Using new icon default size instead of `80 x 80 px`. Icon is
  resized by `background-size` in both applications anyways.
- Renaming 'user*' to 'user-avatar' for consistency across projects.

Bug: T123810
Change-Id: Ifb2027694af8f619663f00f4c50891772ee64746
2018-10-10 23:29:01 -07:00
Kunal Mehta c50794c3f2 Don't use deprecated jquery.hidpi module
Using window.devicePixelRatio directly means we won't be supporting Windows 8
and/or IE 10 & 11. But that seems intentional based on 828f6d6ac9db.

Bug: T206099
Change-Id: I53dbce0a8ddc69c4edfd4d10f98031aa4f7cd20a
2018-10-08 20:15:18 -07:00
jenkins-bot a0f3ccba4e Merge "Use improvements of jQuery 3.3" 2018-09-23 18:24:41 +00:00
jenkins-bot efa37ccd29 Merge "Use a for loop instead of Array.prototype.find" 2018-09-22 17:59:12 +00:00
Fomafix 170d10848b Use a for loop instead of Array.prototype.find
Array.prototype.find is part of ES6 and not supported by older browser.

This change is a follow-up of 965b496850.

Bug: T205162
Change-Id: I0954c42a37668b0eb46c3e864a2e13152a6dc68a
2018-09-22 14:41:56 +00:00
Fomafix 30bae884e6 Use improvements of jQuery 3.3
Replace
  .removeClass( classes.join( ' ' ) )
by
  .removeClass( classes )

Since jQuery 3.3 .addClass(), .removeClass() and .toggleClass()
supports arrays. [1]

[1] https://blog.jquery.com/2018/01/19/jquery-3-3-0-a-fragrant-bouquet-of-deprecations-and-is-that-a-new-feature/

Change-Id: Icd8eb2eb228c7612f028cc399d29826908e2ae39
2018-09-19 21:17:06 +02: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
Zoranzoki21 007e161a76 Fix "the the" typo in mmv.provider.GuessedThumbnailInfo.js file
Bug: T201491
Change-Id: I752c08b5ec625555b03e199a800a6d1fb0c0738b
2018-08-27 20:20:32 +00:00
Fomafix 4320ab4c8e Use wgUserLanguage instead of the first key from mw.language.data
Follows-up f59962e4a3.

wgUserLanguage contains the user interface language of the current
user. mw.language.data can contain several languages.

Also apply encodeURIComponent() to the parameter.

Change-Id: Ifaf5dc4be3fb8f87fbf1513866bcc68648c36ab1
2018-08-01 18:16:04 +00: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
jenkins-bot d07aad8b3e Merge "Avoid jQuery event aliases" 2018-05-11 22:05:26 +00:00
jenkins-bot 3787a275ed Merge "Remove jQuery.hashchange library" 2018-05-11 19:11:58 +00:00
Ed Sanders bc5870527a Remove jQuery.hashchange library
This library just provides fallbacks for browsers
that we no longer support.

Change-Id: If81df7b33b3106ab58744494a4f67583241861dc
2018-05-11 18:47:08 +00: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 6fe5419a03 Fix documentation of title argument
Change-Id: I49120797833e73d8be4523b4b778ad4570cb4c98
2018-04-24 15:28:02 +01:00
hunter 0db6e39991 Fix buttons in Multimedia Viewer to be semantic
Convert button-like interface elements in MMV from <a> and <div>
elements to <button> elements. Also add tabindex attribute in one
case for keyboard accessibility.

Bug: T161612
Change-Id: I37fb862f82099decd59ca7bb0beeb69b24584bb4
2018-04-17 00:58:04 +00:00
Volker E d101b0e095 Replace abandoned border-color with WikimediaUI palette one
Change-Id: I9ec58af9d5832485ee2e0e811027e0363a2fb4d5
2018-03-14 15:29:11 -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
jenkins-bot 1657e4241e Merge "Use saveOption from 'mediawiki.api.options'" 2018-02-09 00:18:05 +00:00
Volker E b81f6393aa Remove special color treatment of close icon on confirmation
Removing arbitrary close confirmation color treatment with green.
We don't feature such treatment anywhere else, nor are we planning
to do. Let's remove it.

Bug: T50067
Change-Id: Ia597a51cd9c5ca057720c720b1e3
2018-02-05 15:29:29 +05:30
Fomafix 61581fa905 Use saveOption from 'mediawiki.api.options'
Change-Id: I33a60cbaf10f5d53a4e49f335ce8f16d108f9dfb
2018-02-03 16:37:21 +01:00
jenkins-bot cfdd3cc79a Merge "Bring SVGO optimization to build step" 2018-01-25 01:49:53 +00:00
jenkins-bot 0d0b4cdf81 Merge "Unify SVG markup" 2018-01-25 01:35:12 +00:00
Volker E d1f416278a Bring SVGO optimization to build step
Enabling SVGO automation with conservative plugin set, among those:
- disable cleanupIDs, removeDesc, removeTitle, removeViewBox &
  removeXMLProcInst and
- don't use multipass,
- enable removeRasterImages and sortAttrs

Bug: T185596
Change-Id: Ic13afb6e1cbc4d26af7a100cb7a916619fb4158e
2018-01-24 00:27:53 -08:00
Volker E 268e1406d4 Unify SVG markup
Align SVG markup across Foundation products by:
- unifying XML declaration,
- removing unnecessary `standalone="no"` attribute as it's default,
- removing unnecessary `enable-background` attribute as it got removed
  from standard
- removing all SVG editor metadata
- adding `width` and `height` attributes where missing,
- removing all `g` group elements except where necessary for transforms,
- putting attributes on `path`,
- removing unnecessary ids and
- unifying whitespace.

Also
- changing 'expand' and 'gear' icon colors to resemble general button style,
- while at this renaming 'gear_gray' to 'gear' including CSS reference,
- slightly adapt remaining colors to WikimediaUI color palette and
- deleting unused, unreferenced icon files.

Saving up to 79% file size before gzipping.

Bug: T178867
Change-Id: I9e54a3a972903811f5205def05397383f3484d63
2018-01-23 23:59:28 -08:00
Volker E 8a8d8277af Use “OOUI” as unified name in code comments
Bug: T182360
Change-Id: I20e85bf4d5ef55797b5be59ae1772f791d504ade
2018-01-17 00:16:54 -08: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
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
Gergő Tisza eca337e62f Add functions to display/remove a warning in the dialogs
Adds setWarning(<element>,...) and clearWarning() to mw.mmv.ui.Dialog.
These functions can be used to display a warning ribbon with the given
text in the reuse dialogs, typically when the copyright status of the
file is problematic (e.g. non-free or tagged with {{wrong licence}}).

Bug: T76030
Bug: T71389
Bug: T71557
Change-Id: I7c477c810d391578ec64635357eda97a85ab2954
2017-09-28 12:45:17 +00: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
Volker E 692b2b2f15 Remove obsolete vendor prefixed at-rules
Opera 12.10 supported unprefixed animations, gradients, transforms &
transitions. See http://www.opera.com/docs/changelogs/unified/1210/
Removing support for Opera 12.0x versions.

Change-Id: Id0e0afef1ab6ebda373d63b9c91c7ee731dafb7b
Depends-on: Ie8edbcd7f85c713ea2156706ea3a3a7b423d8d9d
2017-07-31 21:48:24 +02:00
Prateek Saxena a66c36750c Replace TextInputWidget (multiline) with MultilineTextInputWidget
Bug: T170275
Change-Id: I88a4dabbd2894a9ddacc55e8fcdedb141480be2b
2017-07-12 13:58:35 +05:30
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
Ed Sanders 9514e3107a Code lint: Throw errors, no strings
Change-Id: I4bb4de96a5e61b67b7a4c8f16a22f67f53cb034f
2017-05-17 11:28:53 +01:00
Matthias Mullie 5bc3a2d90e Fix mmv.logging.PerformanceLogger qunit tests
Bug: T164473
Change-Id: I6ae5c0170bf12fb076ddc505299ceeb7b9c292e8
2017-05-16 16:54:43 +02:00
Matthias Mullie 93f1c9f79e Fix mmv qunit tests
This heavily relied on deferreds getting resolved synchroneously,
which (for .then) is no longer the case with jQuery 3.
There's also a difference in how chained .then's get resolved,
and $.when no longer propagates notify().

The changes in here are basically:
* fix use of $.when, manually passing along notify()
* use .then in some places, instead of .done, .fail, .progress
* fix progress bar hiding in setupProgressBar, which assumed sync
* fixed tests, mostly by using fake timers to give async stuff a
  chance to execute

Bug: T164473
Change-Id: Ib51ddd8bc6254a477861588fb16f57565353afe1
2017-05-16 16:51:52 +02:00
Matthias Mullie d204ecc99a Fix mmv.bootstrap qunit tests
This heavily relied on deferreds getting resolved synchroneously,
which (for .then) is no longer the case with jQuery 3.
There's also a difference in how chained .then's get resolved.

These tests did not wait for the deferreds to get resolved async,
so that had to change. Worse even: some functionality was tested
by assuming a handler would not be called (= the test in that
handler would not be called), which didn't make the test run,
because we never even waited for it to be called.

The changes in here are basically:
* make mmv.bootstrap.js correctly use .then instead of .done & fail
* let mmw.bootstrap.test.js tests wait for unresolved async promises
* check call counts instead of running tests inside of callbacks
* limit use of fake timer to the 1 test that needs it (it interferes
  with async, which otherwise don't get resolved)

Bug: T164473
Change-Id: I3ca4f786890ad1646f71fe336afdb61e5c3b01c7
2017-05-16 16:48:20 +02:00
Prateek Saxena 45110a7090 Use <button> instead of <div>
* Buttons are semantically better.
* Neither <div> nor <button> elements can have the 'alt' attribute
  so switching to 'title' instead.

Reverts parts of I6ea62124018b1a0ec5110bb500f690cb2368f102.

Bug: T58471
Change-Id: I991b40d3387f8d6dd7cdad8ccc5cc9660b9f139a
2017-03-22 12:06:15 +05:30
Volker E 7157729ae8 Align to WikimediaUI style guide and code cleanup
Aligning to WikimediaUI style guide by replacing colors with
standard color palette equivalents, merging close colors
(ex: `#E6E6E6` & `#eee` become `#eaecf0` ) and slightly increase
contrast on a few to meet WCAG 2.0 level AA criteria.
Also:
- following other code bases like MobileFrontend or OOjs UI in
using `border-radius` property instead of obsolete mixin
- removing non-existing browser vendor prefixes in mixins
- removing non-used Less variables
- bringing CSS/Less code closer to coding standards and
- simplifying Less code where applicable

Change-Id: Icb936e14ff613471ea1da6df6341ec1b0543cfaf
2017-03-02 15:55:01 -08:00