Commit graph

745 commits

Author SHA1 Message Date
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
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
Phantom42 3f855b5785 Fix displaying images with uppercase extension.
Bug: T154862
Change-Id: Ib74066340a869a49036215a6ea1df39daa17890c
2017-01-25 01:20:09 +02:00
Phantom42 3a0ed7b4a0 Fix displaying of transparent background
Fix checker background is not showed after resizing browser window.

Bug: T155913
Change-Id: Icc9236474d595c19566e294967a156865a3a1d31
2017-01-22 02:54:13 +02:00
Prateek Saxena f285a576b7 bootstrap: isAllowedThumb: Don't allow slideshow gallery thumbnails
Bug: T140595
Change-Id: Ia0e230c7649c399d0a43acacf55ff72db9bc0e8e
2017-01-19 14:49:54 +05:30
Ed Sanders d7ea64137c build: Replace jshint/jscs with eslint
Change-Id: I423add157245353031e36b7e44fee7ace7c753c7
2017-01-10 10:24:39 -08:00
Fomafix 8869af6eed Replace $( document ).ready(...) by $(...)
In jQuery 3 $(document).ready(...) is deprecated.
https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function

Change-Id: Iddec938b358388db11203b4b604928ecdcb3abe2
2017-01-06 16:04:56 +01:00
Geoffrey Mon fc84b8e125 Copy button for attribution text in download dialog
In addition:
* .mw-mmv-reuse-copy => .mw-mmv-dialog-copy because it's not just a
  reuse dialog thing anymore
* Adjust margin between attribution textbox and attribution option
  widget to stay consistent with reuse dialog UI

Bug: T77295
Change-Id: I79abdc1a3c10f0a8c3ecb6f4d444a601595a903f
2016-12-28 11:35:02 -05:00
jenkins-bot 569598cf6a Merge "Add button to select and copy share/embed text to clipboard" 2016-12-26 08:25:38 +00:00
Geoffrey Mon a907339f89 Add button to select and copy share/embed text to clipboard
Clipboard icon adapted from modules/tools/images/pasting.svg from the
ContentTranslation extension.

Also adjusts some margins to better separate embed code box from embed
options

Bug: T77295
Change-Id: Ic7a11eab6ecc767ad4d80b94a7b62578d535d047
2016-12-25 23:59:47 -05:00
Geoffrey Mon aa0b9d81c6 Add alt text attributes to all of the lightbox buttons
* Re-adds next/prev i18n msgs (removed in 532819)
* Adds alt attributes to close, fullscreen, options, next, prev,
  download, and reuse buttons

Bug: T58471
Change-Id: I6ea62124018b1a0ec5110bb500f690cb2368f102
2016-12-13 17:32:16 +00:00
jenkins-bot 1d323eac3f Merge "Replace colors with overhauled WCAG 2.0 compliant palette" 2016-11-21 21:38:55 +00:00
jenkins-bot b82ff2df77 Merge "Make performance statsv call sampled" 2016-11-21 10:38:36 +00:00
Gilles Dubuc a149b63b05 Make performance statsv call sampled
Bug: T149168
Change-Id: I5614d1eec1834c1d694a5bf71d5ca05ec29ad354
2016-11-19 03:31:20 +00:00
Volker E 9291a0d6e2 Replace colors with overhauled WCAG 2.0 compliant palette
Replacing colors with ones from current WCAG 2.0 level AA compliant
color palette. Also improving SVG files by svgo optimization where
easily applicable and cleaning up some minor Less shortcomings.

Bug: T149769
Change-Id: I3d46c95a61112ba808c6ec664a95c94e9cb42c5e
2016-11-19 03:31:16 +00:00
Fomafix 84b260587e Remove double spaces
Change-Id: I00d5cdf7aec91ec56117d395866c464e385f6dd9
2016-11-19 03:31:06 +00:00