Commit graph

958 commits

Author SHA1 Message Date
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
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
Andrew H 0c3b0a5056 Shorten clickable link text in HTML credit lines
Previously, the clickable text in the generated HTML credit lines
was the entire link to the article. This is shortened to a localized
version of "Link".

Bug: T119686
Change-Id: I708f65a85bfa26c264cdd06a265096027266240c
2016-09-26 17:07:09 -07:00
jenkins-bot 0716876c6d Merge "Make embed text short URL into a link in HTML mode" 2016-08-11 19:19:19 +00:00
Gergő Tisza 4518f8f27d Speed up caption collection
* don't do the slow lookup for closest caption unless there are
  multiple captions
* don't clone when there is no need to change the caption

Might give wrong result when selecting a thumbnail which is in a
multi-image template and has no caption but some other image
in the same template has; that seems hard to avoid.

Bug: T141714
Change-Id: Iacebd44ab9dd469d0c95b94e90faa90d579caaa3
2016-08-01 17:00:08 -07:00
Gergő Tisza 8b8dfe4633 Make embed text short URL into a link in HTML mode
Bug: T138142
Change-Id: Ide6d9b164cdcbafacf08631536cadb04a45ce3dd
2016-08-01 15:17:25 -07:00
jenkins-bot 7c559a7250 Merge "build: Introduce stylelint and make pass" 2016-07-19 21:02:27 +00:00
jenkins-bot b5f0de95b7 Merge "build: Introduce jshint & jscs and make a pass" 2016-07-19 21:02:24 +00:00
Ed Sanders e7ff2ba8b6 build: Introduce stylelint and make pass
Change-Id: I6f97359c6f34f2e5687ce91ab9926c493e613bf5
2016-07-19 13:51:05 -07:00
Ed Sanders b46529d1b2 build: Introduce jshint & jscs and make a pass
These replace the hard-coded jshint task in CI.

Change-Id: Id14eec1ecba4ceae735ffd10f9114233a580302f
2016-07-19 13:48:06 -07:00
jenkins-bot d8984a6ab8 Merge "Limit image search to content firing event" 2016-07-19 14:44:39 +00:00
Ed Sanders db6c74a232 Limit image search to content firing event
Bug: T140574
Change-Id: I3c504c09b2b382e094ab2be1fa388efa7ec827b1
2016-07-19 11:33:53 +01:00
jenkins-bot 4bdf893422 Merge "Make Parsoid HTML selectors more specific" 2016-07-18 15:56:45 +00:00
Ed Sanders 8c7a33429c Make Parsoid HTML selectors more specific
'figure img' matches images in captions.

Follow-up to d3131db19e.

Bug: T140574
Change-Id: I1ee50846191c9de19ca35d9bd40eb2d3001cf7f5
2016-07-18 15:53:42 +00:00
Ed Sanders 14d9297eb1 Check Title.newFromImg produced a valid title with an extension
Bug: T140574
Change-Id: Ia818cebd47b3bce03befc547e5e435cb8b1f2996
2016-07-18 13:34:24 +01:00
jenkins-bot b66336ade0 Merge "Filter HTML from some attributes" 2016-07-12 20:52:27 +00:00
jenkins-bot 9fbbabfe3e Merge "Add HtmlUtils.makeLinkText utility function" 2016-07-12 20:52:25 +00:00
jenkins-bot c4da4c7ca1 Merge "Remove IE8 JS compatibility hacks/workarounds" 2016-07-12 20:42:11 +00:00
Ed Sanders d3131db19e Fix selectors to match Parsoid DOM-spec images
Bug: T62014
Change-Id: I03ee3912aab8aad5ae1e2db3be1a6d3a25d03fef
2016-07-09 17:49:35 +01:00
Michael Holloway 94476eb918 Remove IE8 JS compatibility hacks/workarounds
No longer needed as MediaWiki is no longer serving JavaScript to IE8
users.

I noticed some possible candidates for removal in the less files as well
but left those alone as this task seems specific to JavaScript.

Bug: T123443
Change-Id: Ibf6d551798ff03a227b46dcb55bcf31899dad974
2016-06-29 00:02:46 -04:00
Gergő Tisza 3c71b85c84 Filter HTML from some attributes
Bug: T138142
Change-Id: Ie5048b38ed397ce852d3f9145a63fe4f52930da9
2016-06-19 15:23:45 +00:00
Gergő Tisza dba273ac31 Add HtmlUtils.makeLinkText utility function
Change-Id: I2697c2d865dc8dd23883a59ca0c38229c2e7b6e9
2016-06-19 17:22:52 +02:00
Volker E d947539f37 Fix obsolete constructive color on download button dropdown
Remove `constructive` extension of button and remove it with more
generalized `.mw-ui-progressive` class and rely on progressive color.
Also make use of central mediawiki.UI's variable.less file.

Bug: T136209
Change-Id: I22f365419c41dd888824dbfeb4b3c995713ac5a5
2016-05-25 13:33:28 -07:00
Gilles Dubuc 53a3d9a379 Make Media Viewer pluggable for the 3D extension
Some of the code encountered accessed mw.config directly,
I cleaned that up by migrating to mmv.Config, which is an
abstraction added to avoid peeking at mw.config directly.

Bug: T132064
Change-Id: I2a95ba703e6c7f46296f8e435bceec769dceebf9
2016-04-15 16:43:45 +02:00
Ramunas Geciauskas 454b279140 Trigger fullscreen-change event when closing lightbox interface
When exit button is clicked in the full screen mode, the lightboxinterface
detaches itself but the "jq-fullscreen-change.lip" even is never fired.
This leads to issues as described in T74843 and similar.

Bug: T74843
Change-Id: Id3a68844fd2405fcf289741d54b0602c8e337a3d
2016-03-01 19:47:35 -05:00
Bartosz Dziewoński 7ef5471846 Fix height of buttons on file description page
Bug: T127052
Change-Id: I69738387f685a9f88c62c1cc820bc0e8270b6fed
2016-02-16 13:05:30 +01:00
Alex Monk 195bc0aea7 Import Checker-16x16.png into repository, instead of loading from upload.wikimedia.org
Too simple to be copyrighted - PD.

Change-Id: I2547bd8708408425fcce08bce0019239c0cac572
2016-01-23 02:58:45 +00:00
Andrew H 1b2866df0d Shorten MediaViewer credit lines
Drop the title and site name. Use a shortened URL
created using the pageID for the curid query parameter.

Add pageID property to mmv.model.Image, using value already
fetched from an existing API request.

Bug: T119686
Depends-On: I0f00b986e6095bdb9b8d6af6fbc5b01995227e02
Change-Id: I9189f00bfbf7639974d66cf1921773855a77a865
2016-01-10 23:44:23 +00:00
mhutti1 f937b1f20d Fixed viewer only displaying every nth image after reopening
Added code to detach emit calls when the interface is closed.

Bug: T122785
Change-Id: Ifd97aebe7aa01a152817100f301a80a9b6ac83a3
2016-01-07 22:50:19 +00:00
Andrew H 6005b068bf Cache imageinfo query in MultimediaViewer
Bug: T117750
Change-Id: I5560e14b13968113e768bacce9972169f270e7bc
2016-01-06 04:37:53 +00:00
Julius Alphonso a9758d21e0 Remove uploader's name from MediaViewer
Only last uploader's name is shows, this turns out to be
more confusing than useful.

Bug: T59308
Change-Id: I7d06b72c581fe8738bffc64b5e36be9983b01ccf
2015-12-29 10:56:08 +05:30
Tisza Gergő 6dddb2f7db Do not set up the overlay on irrelevant hash changes
On not-MMV -> not-MMV hash changes the bootstrap class has set
up and immediately torn down the overlay. Besides slowing things
down, this broke TOC navigation on Chrome in an ugly way.

Add a special case to skip the overlay loading when the new hash
does not contain #/media. This is a quick-and-dirty fix; the whole
loading and hash handling could use a rewrite.

Bug: T119854
Change-Id: I5494903dfe778e533773ff142fdf756475c2df32
2015-12-06 08:00:22 +00:00
Ori Livneh 20a23ff4a4 Optimize SVGs
Done using svgo version 0.5.2, invoked with '--multipass' and
'--disable=removeXMLProcInst'.

Change-Id: I1abc7a798ef793536dc9262e40f164b2e77e4ea8
2015-11-23 21:13:45 -08:00
jenkins-bot 99c8b89fac Merge "Add some error details to bug report" 2015-10-27 23:03:32 +00:00
Gergő Tisza 77bfbf61aa Add some error details to bug report
Bug: T111112
Change-Id: I1c3a31ddaefdfec0d86b80891671316741e53b0c
2015-10-26 17:12:34 -07:00
Gergő Tisza 056e339ac4 Ignore case in file extension checks
Bug: T115563
Change-Id: I27efb1a1c6510edc88357b69b1631cf55ca11539
2015-10-25 22:31:07 -07:00
Gilles Dubuc be1ba4622f Turn mmv-next/mmv-prev into OO events
More of those events sent to the document can be converted, but it's a start...

Bug: T77253
Change-Id: I6100ce303346ab9fa94332e91f5d730dc83f4e65
2015-09-29 13:11:22 +02:00
Thiemo Mättig 17084aa2c1 Add explicit word-wrap: break-word to textareas
These text fields contain file names and license informations that tend
to contain very loooooooooong words. These make the field hard to use
and hard to read, especially when the browser decides to add a horizontal
scroll bar to the already pretty short text field. Some browsers do a
proper word wrap by default, others may not. I suggest to add this
explicitely.

Bug: T69835
Change-Id: I3f32270c1c0310e83288b5f4e260feb474006297
2015-09-24 00:39:36 +00:00
Gilles Dubuc dc9a2d43d2 Fix IE9 CSS hack
According to http://mynthon.net/howto/-/webdev/CSS-big-list-of-css-hacks.txt
the /IE9 part isn't required. Its presence causes an exception in less.php
which we want to switch to.

Bug: T112035
Change-Id: I103dbdf626d0f0d5e3622fa42ccf7b8c663c3942
2015-09-18 13:18:41 +02:00
Gilles Dubuc 90e956e080 Remove CSS readiness workaround
RL's support for this should be bug-free now

Bug: T63852
Change-Id: Iaa6355648dcc1eb1780a7b1ee7e461d4213e3017
2015-09-04 13:04:58 +02:00
Geoffrey Mon 33908e64c6 Improve Personality Rights restriction icon
Make it more gender-neutral and better-looking:
- No necktie
- A frame around the icon similar to the frame of a photograph

Change-Id: I05ec5a5a546b19f08ac9a6ab1470b769025e076b
2015-09-03 21:38:55 -04:00
Gergő Tisza 2e6ffeff96 Use wikipage.content hook for updating thumbnail list
This makes sure that MediaViewer works correctly when content
is changed via frontend code (such as a VisualEditor edit or
an AJAX preview).

Bug: T97010
Bug: T110493
Change-Id: I9c57af281ed7f416521d80512f95a79150ce13a2
2015-09-01 02:47:00 +00:00
Ori Livneh 1a0ee6d2a1 Work even when cookies are disabled
When cookies are disabled in Firefox, merely referencing window.localStorage is
enough to cause Firefox to throw a SecurityError exception. (See the referenced
bug for reproduction instructions.) This causes MMV to fail to start.

Bug: T109110
Change-Id: I28399cf8b63328ee34316b785f2d091f6f052224
2015-08-14 11:18:09 -07:00
Florian 7b50d14a8e Re-add event listeners to images after a finished VE edit
Currently, if VisualEditor saved an edit, it replaces the current content
with the new content, which removes all already added event listeners, e.g.
on thumbs, added by MMV.

Add a new hook handler to the postEdit JavaScript hook to re-add all event
handlers to the thumb images to cover this case and enable MMV on a page
after a finished VE edit.

Bug: T97010
Change-Id: Ic1ee0b52265363978640358510cab89db4de2bb8
2015-08-13 17:19:40 -07:00
Gilles Dubuc 04be1d5fcc Add most common non-bucket size to statsv performance tracking
Bug: T105681
Change-Id: I11e971141455d41e935543e3a06f587ebcd070ef
2015-08-05 11:01:14 +02:00
Gilles Dubuc 66d510dddc Track image load time with statsv
Bug: T105681
Change-Id: Ic25edf7852d4b87d2b35fabf6494d88dbfdb922e
2015-07-30 14:01:55 +02:00
Geoffrey Mon a7f11a7c45 Moar restriction icons!
Icons for all important non-copyright restriction types.
Also, some tweaks made in CSS e.g. add 1 px margin to top of mw-mmv-labels
Finally, new test to check if default restriction is placed last.

Example files:
copydesign: https://commons.wikimedia.org/wiki/File:Peugeot_404_dsc01875.jpg
trademark: https://commons.wikimedia.org/wiki/File:Logo_NIKE.svg
trademark+insignia: https://commons.wikimedia.org/wiki/File:Flag_of_UNESCO.svg
personality: https://commons.wikimedia.org/wiki/File:Vice_President_Megawati_Sukarnoputri_-_Indonesia.jpg
communist+insignia: https://commons.wikimedia.org/wiki/File:Flag_of_Georgian_SSR.svg
nazi: https://commons.wikimedia.org/wiki/File:PropagandaNaziJapaneseMonster.gif
costume: https://commons.wikimedia.org/wiki/File:Shrek_%26_Fiona.jpg
fan-art: https://commons.wikimedia.org/wiki/File:Magic_wand.gif
(I think that's enough)

Bug: T102693
Change-Id: I907396c59752511448145a4ac5d29096166f841f
2015-07-16 01:06:39 +00:00
jenkins-bot 2642ebd7d8 Merge "Reduce number of RL modules in MultimediaViewer" 2015-07-15 23:24:27 +00:00
Brion Vibber 849a6d9f16 Revert no-longer-needed fix for MS Edge browser
Bug with history.pushState in Edge fixed in Win10 build 10240;
Dave Storey is asking us to remove the workaround to keep our
code pure and them honest ;)

Reverts I6ea4d367

Bug: T104381
Change-Id: I5f53416dda7c31662330dc5ec67e1bbea55dace7
2015-07-15 17:54:53 -05:00
Gilles Dubuc 95dcc971b0 Reduce number of RL modules in MultimediaViewer
Having many modules makes the startup module in the head
unnecessarily longer. Things should only be in their own
module if they're going to be loaded on demand on their
own or are a shared dependency of separate modules that
are.

This change brings down the amount of modules declared by
Media Viewer from 53 to 8. The ones that remain are
mostly things loaded on demand.

Bug: T103706
Change-Id: I5b0d29209599285b93217e96def818e641646c73
2015-07-10 00:07:14 +02:00
Gergő Tisza 742a3473a6 Replace webkitMovementX with movementX
Bug: T104758
Bug: T77869
Change-Id: Ied88588a3db3a773b02799568da71ecd6c66a2fd
2015-07-06 10:44:16 -07:00
Brion Vibber e77df57615 Workaround apparent bug in Edge's history.pushState
When attempting to clear the hash state via history.pushState(),
MS Edge in Windows 10 build 10159 errors out with the helpful
"Unspecified Error".

Catching the exception and trying again with a "#" works around
the error and doesn't look any worse than the non-pushState code
path -- and should have no side effects when the bug is fixed.

Bug: T104381
Change-Id: I6ea4d367af64f85018b06b859ce688053a1caf0f
2015-07-03 13:43:17 -07:00
Gergő Tisza 0e9cfb5de0 Fix clipping of text when metadata panel is closed
The first item (license) of the list on the right side of the
metadata panel wasn't large enough (due to some recent global style
change that I couldn't track down) and the top of the next item was
visible. Added fixed height to prevent that. Also centered the
credit/license text which looked sloppy.

Bug: T101391
Change-Id: I848917ebb9c378c3210646486a87a6497d31a168
2015-06-19 00:42:35 +00:00
Gilles Dubuc ecc5b58cfa Remove the 640 bucket
It decreases the likelihood of Varnish hits and is only 11% smaller on
average in file weight than the 800 bucket.

Bug: T102870
Change-Id: I8611791a192fa7b0e638ccfc886733b75bf30aed
2015-06-18 10:18:00 +02:00
jenkins-bot 767b736dc1 Merge "Avoid not caching meta=filerepoinfo calls for logged in users" 2015-05-28 00:00:41 +00:00
Kunal Mehta e3a6c0baa3 Avoid not caching meta=filerepoinfo calls for logged in users
Change-Id: I6a1010cb4a0374ec57ccdede2f0788b914165324
2015-05-27 16:51:54 -07:00
Smriti.Singh 531947e802 mmv.mixins.less: Remove '-ms-linear-gradient'
No stable versions of IE have an '-ms-linear-gradient'. Any lines using
the same have been removed.

Bug: T100285
Change-Id: I9fccb3f2208433d2759949a39b86b46d5b71eac1
2015-05-27 15:26:09 +00:00
Gilles Dubuc 5bd02e8cc1 Catch exceptions thrown by localStorage.getItem
Bug: T94695
Change-Id: I7fd7c4776a55de24d702babb291faf3208c8d0af
2015-04-02 14:15:24 +02:00
Gilles Dubuc 96d4e6a4f2 Differentiate placeholder and final image
Should fix intermittent issues happening with the browser tests,
which can't currently tell the difference between the placeholder
and the final image.

Bug: T90589
Change-Id: Ibfdff4721ce5f37831863110ad1a2f9650b24d5e
2015-03-18 09:41:48 +01:00
jenkins-bot 0464c2b9e7 Merge "Record virtual image views" 2015-03-12 09:04:54 +00:00
Gilles Dubuc 40c7284911 Make media viewer use the same prefix as mobile
Keep responding to the legacy prefix, since many links on the web
are referencing it.

Bug: T87769
Change-Id: I0936ada35141ddd85e0aa232b833d315e3246ce3
2015-02-25 21:22:05 +01:00
jenkins-bot 3c11306293 Merge "Fix IE crop/stretch problems" 2015-02-23 10:50:31 +00:00
jenkins-bot a6bc9e181f Merge "Make logging less noisy in debug mode" 2015-02-23 10:47:19 +00:00
jenkins-bot fcd2317bf4 Merge "Remove delay when logging link clicks" 2015-02-23 10:46:35 +00:00
jenkins-bot e10efb56ed Merge "Adjust Media Viewer download menu colors" 2015-02-23 10:30:09 +00:00
Gergő Tisza 274249a435 Fix IE crop/stretch problems
It seems that IE11 sometimes does not keep the aspect ratio when
the width DOM property is set but height is not.

Also attempt to clarify what the two similar canvas setters are
good for, to the extent I could figure it out.

Bug: T89679
Change-Id: I9c87e2146e3d99d1ee00d7c00142b2ae1c3d7951
2015-02-20 01:20:21 +00:00
Gergő Tisza c3c549f1b4 Make logging less noisy in debug mode
Suppress logger console output if the logger is disabled.

Change-Id: I5f45bb7fc68f33880f8a4d1737f0055335fe5071
2015-02-19 23:50:04 +00:00
Gergő Tisza 1d79a5c483 Remove delay when logging link clicks
EventLogging uses sendBeacon now so there is no danger of losing
clicks because the browser navigates away. (On modern browsers,
anyway; but we can live with being a little imprecise on older
browsers. We don't use link click stats much, anyway.)

Bug: T89533
Change-Id: Id83f60585d11f06610d8514c211f0116c60ea936
2015-02-19 23:36:53 +00:00
Gergő Tisza 3bb2b8185a Fix canvas height calculation
Canvas height is calculated as viewport height minus above-the-fold
height but the latter did not take into account the padding. This
was probably broken last autumn when the above-the-fold contents
were rearranged, but the max-height rule on the image masked the
error so we did not notice until that rule was dropped.

Bug: T89631
Change-Id: Id53cd9c176528da33b393e5ed807d6f2e0886413
2015-02-19 07:20:15 +00:00
Gilles Dubuc 2b1c1b2260 Record virtual image views
Soft-depends on Ie20ed8fc7041e89510a6558d9e2647c67a0a4bbf

Bug: T89088
Change-Id: If1459bd9acde8b6e5040afbd89e2ceafc61dedc9
2015-02-16 18:06:08 +01:00
Gergő Tisza 194876ba58 Fix share tabs
The share/embed tab bar used some hacks to disable MenuSelectWidget's
normal behavior of disappearing once a selection has been made; after
the last OOUI update this doesn't work anymore.

This commit makes some small changes to make it work again:
* replace .show() with .toggle() as the widget uses a custom
  show/hide mechanism now
* reorder some calls - .toggle() has no effect as long as the menu has
  no options
* disable autoHide which would hide the menu when the user clicks
  outside (didn't test if it is really needed but seemed reasonable)

Also undoes some CSS changes that came with the update.

Bug: T89531
Change-Id: I3688ec21250bf2eb8dbfd67e306e857028d71fc7
2015-02-15 06:08:45 +00:00
Gergő Tisza 0fb10961ba Adjust Media Viewer download menu colors
Bug: T89520
Change-Id: I0c736868026fa1b241675058c9f7f1771d5689c5
2015-02-14 01:42:29 +00:00
Gilles Dubuc 1409475187 Adapt to OOUI change in dropdown widget
Bug: T89444
Change-Id: Ie65ad811296b5bce6c43f6c37a00f8d899418f8a
2015-02-13 15:20:59 -06:00
Pau Giner 361315b8af Icon updates
License icons have been updated for consistency with mobile media viewer.
File icon has been changed to match the former ones in color.

Change-Id: I8bc102755829b65ebace9608ca47a3bc2201da4a
2015-02-05 14:53:55 -08:00
Gilles Dubuc d638d9906c Record performance log hits regardless of ResourceTiming data contents
Bug: T87877
Change-Id: Ia196ef82004413144a9a256b73bd35aec8135760
2015-01-29 11:23:11 -08:00
Namit 7d22677ffd "View in browser" link limited to the text
Only the image and the text("View in browser") is now clickable.

Bug: T87427
Change-Id: I6650cf5a7b7cf2b8200087c7687495cdeaf0a3e1
2015-01-29 19:27:23 +05:30
jenkins-bot a588751d6f Merge "Collect thumbnail width in the performance log" 2015-01-23 23:04:20 +00:00
Gilles Dubuc 8309d7ea88 Collect thumbnail width in the performance log
Bug: T86609
Change-Id: Ia0934cf76c323b9bcb2ee7b0ee8ee6ca2aefc600
2015-01-23 14:57:36 -08:00
Divya adbf42280e Match size of preview and real image
Bug: T87295
Change-Id: I04746dcb80e571a624366b86fd5c5f4cbc31185b
2015-01-23 15:22:39 -05:00
Fomafix ae99be730e Apply coding conventions for JavaScript
Change-Id: I57a8f188eb1152438a8e94235a6f6801e2617c28
2015-01-23 12:48:27 +00:00
Divya 94b84fcd28 Removed the second scrollbar appeared while loading images
Bug: T77889
Change-Id: If2786401101b95caba52603389ec530cf48d6818
2015-01-20 01:43:26 -05:00
gladoscc 84a8df8808 Show (tm) symbol if applicable
ImageData will now parse for restrictions (this part has not been
implemented in CommonsMetadata yet), and an orange trademark label
will be displayed next to the license label if there is a 'trademarked'
restriction.

Bug: T77717
Change-Id: Ib03f9708d1e4ff0b5befddc2688b274e2c7ce1f7
2015-01-15 18:21:30 +11:00
m4tx 9a6039b580 Improve error messages UI for Media Viewer
Bug: T77272
Change-Id: I97ffa70903da32c66697c52969cfec2df03c1d57
2015-01-14 08:24:27 +01:00
gladoscc 40738c832a Display the file name in metadata panel
This patch adds the file name to the metadata panel, after the license
item. The namespace prefix is included and set to a static 'File:'.

The Title class already converts underscore to spaces.

The icon is from @Pginer-WMF.

PS: This has been a frequent annoyance for me, I'm glad to be working
on this patch!

Bug: T76680
Change-Id: I7d1f4ce67a6776ac017f8afe49cb3102b267af5c
2015-01-13 19:45:43 +11:00
m4tx b2aaae4b19 Fix download panel not showing on rclick after pressing esc
Bug: T86389
Change-Id: Ic158c579c4a7a6e48bcbd9cdfb724712b1e2fece
2015-01-13 01:06:59 +01:00
Namit d66509e2de Open the download panel when an image is right clicked
Many users right-click on images as a way to download them.Due to this,
they may get a scaled-down version which is used for display purposes and
also not given guidance on how to attribute.

Bug: T75999
Change-Id: I30655a0dda4430b494a393f1fa708fce6ca6fafe
2015-01-07 22:48:00 +05:30
gladoscc 7f4ce833d4 Log right-clicks on the image
Record how many users right-click on the image in MediaViewer, with the
assumption being they're intending to download the image. However, that
image has been resized and is not the original.

The event is logged even if the metadata panel is open, as the user probably
still intended to download.

Bug: T75962
Change-Id: I223ed957bcc60646adf9c9a00d2d9ca18ad128e6
2015-01-01 13:24:32 +11:00
Geoffrey Mon cf67495467 Allow bold and italic text
Added mmv.HtmlUtils.htmlToTextWithTags()
  which is similar to htmlToTextWithLinks()
  but allows <b> and <i>
Added test for mmv.HtmlUtils.htmlToTextWithTags()
Most text fields now use htmlToTextWithTags()
  except Permission field which is not supposed to
  have HTML

Bug: T69887
Change-Id: I16833f218e2f64586aa13925356fa2b8b7ec3100
2014-12-31 01:01:50 +00:00
jenkins-bot f65d846b81 Merge "Add mw.mmv.viewer shortcut for current MediaViewer instance" 2014-12-31 01:01:00 +00:00
jenkins-bot ac7bfa9274 Merge "Show alt-text in export dialog and for lightbox image" 2014-12-30 21:00:09 +00:00
Geoffrey Mon 8ba4ff03c8 Show alt-text in export dialog and for lightbox image
Pass alt parameter from mmv.bootstrap.js to mmv.js and
set it as a parameter on the displayed lightbox image.
Include the alt text in the embed text.

Bug: T66519
Bug: T75923
Change-Id: I29503eb582ac2bc8cf89f737a3bcb787b660d918
2014-12-30 15:47:25 -05:00
jenkins-bot 9119af8534 Merge "More accurate looking for image caption" 2014-12-30 08:56:22 +00:00
m4tx eb7d6ef537 More accurate looking for image caption
MediaViewer now handles Template:Multiple_image. Instead of looking
for caption in whole thumbnail container, it tries to find the
closest one to the image.

Bug: T85354
Change-Id: I18d982a4bf245c4925213d83a3410274d499845e
2014-12-30 09:50:18 +01:00
gladoscc c0c50a8d35 Add mw.mmv.viewer shortcut for current MediaViewer instance
Bug: T76923
Change-Id: I38142b541d58e66fcef6e6e589507dcf30b1b3be
2014-12-30 18:23:48 +11:00
jenkins-bot dc8c2bc545 Merge "Change "view terms" to "hide terms" once clicked" 2014-12-29 22:37:53 +00:00
m4tx dac77cafc4 Change "view terms" to "hide terms" once clicked
metadataPanel overrides the grow() and shrink() methods in Permission
class instance, so the text is changed also when user clicks the
"view more" link inside the box.

Bug: T71233
Change-Id: I66fe57980c6f469d86e3d52b67d01e06a3a14270
2014-12-29 23:23:07 +01:00
jenkins-bot af4f85a326 Merge "Show custom Attribution line instead of Author/Credit when available" 2014-12-29 21:15:33 +00:00
Sn1per e4b8e860c8 Show custom Attribution line instead of Author/Credit when available
- Adds attribution variable to Image model
  - In mmv.ui.metadataPanel and mmv.EmbedFileFormatter, display
      attribution line instead of author and credit when it is set
  - Update junit tests for mmv.model.Image and mmv.EmbedFileFormatter

Bug: T67445
Change-Id: Idfe542a1542d28cf8d27c1720ab0bd54324b2f37
2014-12-29 15:56:05 -05:00
gladoscc db01284c6e Ignore events with modifier keys
I've combed through the entire codebase for keydown, keyup, keypress
and .which and I've only found one case where modifier keys are not
ignored for keyboard shortcuts.

Bug: T68329
Change-Id: I10ca2b89b9eb5addd7c706cf796331b5206d6bef
2014-12-29 17:52:44 +11:00
Namit 36ad534988 Ignore generated captions on special file related pages
Most special pages which list images generate a caption using
various information and MediaViewer displays this caption.It should
fall back to the file description instead.

Bug: T85234
Change-Id: I5448e5de7d6f8de9852a2a845400299b6b51b8ef
2014-12-24 23:19:01 +05:30
jenkins-bot ba5acde550 Merge "Make "and X more" message more flexible for translators" 2014-12-18 09:00:14 +00:00
Gilles Dubuc b3e281237c Log Last-Modified header in performance logger
Bug: T78767
Change-Id: If747453b32cbe1db7e307193609af9eaa2bdcc7d
2014-12-17 11:31:45 +01:00
jenkins-bot 5c869aa9ec Merge "Rough logging of metadata panel scrolling" 2014-12-09 09:53:50 +00:00
Gergő Tisza 361464a55e Remove superfluous write of ensureEventHandlersAreSetUp flag
Change-Id: Ie28f58ea7d7b92f9eced46d94490bde9df69daa5
2014-12-08 21:58:20 +00:00
Gergő Tisza fdbefc27fc Rough logging of metadata panel scrolling
Logs metadata panel open/close by scroll. When the panel is opened
via keyboard or the "view terms" button, both a normal and a scroll
opening event is logged (same for closing). When the panel is opened
in fullscreen mode, neither event is logged.

Change-Id: I09092b8b6c20e6fea03b4fe59c811d7b441ca224
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/559
2014-12-08 21:56:51 +00:00
Gergő Tisza 07f7b837fa Close panel on canvas click + fullscreen mouseleave
Also remove the unused mmv-image-click event and fix a bug
where links got right-aligned when the panel was opened in
fullscreen mode.

Change-Id: If538ac420da4aae3908ac96978491f89c5b53493
Bug: T76029
2014-12-08 14:52:52 +01:00