Commit graph

22 commits

Author SHA1 Message Date
Fomafix ae99be730e Apply coding conventions for JavaScript
Change-Id: I57a8f188eb1152438a8e94235a6f6801e2617c28
2015-01-23 12:48:27 +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
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
Gilles Dubuc 0e01796a3c Track how long users are viewing images for
This is complete, but it would be better if the HEAD request
was actually aborted by Varnish when the viewDuration parameter is
present, or if the hit pointed to a script that does that.

Change-Id: I66cafd97427756411e967de1901324af2215e3ae
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/1001
2014-11-21 00:39:29 +01:00
Gergő Tisza 2c578e6dc3 Show popup when the user visits a file page the first time after disabling MMV
Change-Id: Id2b121c930115373a8a81dc1091c4124807db053
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/719
2014-10-21 14:28:20 +00:00
Gergő Tisza 4b6e44a2fc Make sure event handlers are set up even if onready handler is lost
Due to a jQuery bug, errors in local code (gadgets, user scripts)
can cause onready handlers to not be executed. For MMV this causes
catastrophic failure, with a black screen of death on exit.

This change makes sure that the setup code necessary for Media
Viewer to work is executed at latest when MV is invoked, even if some
onready handlers were skipped.

Opening MediaViewer via a hash-URL will still not work if the onready
handler fails, but that's hard to avoid and it is not a catastrophic
failure anymore. This change can be reverted when bug 70772 gets fixed.

Bug: 70756
Change-Id: Ida3b780791bc9dfec29303567d33e3aa4f44dd81
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/891
2014-09-12 23:49:43 +00:00
Mark Holmquist 35b6f70ef2 Use link title as fallback for caption
This works because the title doesn't exist if there's no caption and we
won't get to this logic branch if the thumbnail is an explicit |thumb|
with a caption already.

Refactored caption-fetching a bit.

Change-Id: If84c890e7b71880db640a0993f8e3d6cd59951b8
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/513
2014-09-03 12:13:21 +00:00
Gergő Tisza 81865ecf7c Fix failing loader tests
mw.notify calls mw.loader.using now, which we mock out in some
tests. This change adds an exception to the mock.

Change-Id: I68d7293a4d45f904e949ea4b56ec409456624cbd
2014-08-15 13:46:43 +00:00
jenkins-bot a4e2dc6962 Merge "Make MediaViewer ignore images which are in 'noviewer' class" 2014-06-13 23:34:23 +00:00
Gergő Tisza 92ea8edbc5 Make MediaViewer ignore images which are in 'noviewer' class
This includes images where the <img> element has that class
(achievable with [[File:Foo.png|class=noviewer]]) and also those
where some parent element has it.

Change-Id: I666be026828ea9ecb6e8c93d3f5ad1e3c190f81e
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/511
2014-06-13 23:32:32 +00:00
Gergő Tisza e8c7c537a2 Add functionality to check & set opt-in flag from code, also for anons
Adds anew mmv.Config class to centralize localStorage handling issues,
adds AJAX option setting, adds getting/setting opt-in flag from
localstorage.

Change-Id: I25762ccb8c9bccd694c30a6f1c5d3c8611a5ecbc
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/703
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/704
2014-06-11 01:11:12 +00:00
Gergő Tisza 6d301dcd12 Do not handle clicks if MediaViewer could not be loaded.
mmv.bootstrap will not try again to handle clicks if it failed
for the first time.

Change-Id: Idd55d7dc6c1388070895f8630bdcd51763a94d86
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/527
Bug: 63801
2014-04-29 16:04:17 -07:00
Gilles Dubuc 0d51b0128d Preload Media Viewer js/css when hovering thumbs
Change-Id: I6f56c9d3d908f1980d2a3b29bea857d828fdaf0e
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/430
2014-04-29 13:36:47 -07:00
Gergő Tisza 9b1e756c3b Replace current URL generation logic with routing classes
* deduplicates URL generating/parsing code
* gets rid of spaces in URLs
* fixes error for file names with / in them (in case they exist;
  current MediaWiki seems to disallow such names anyway)

Change-Id: I5aad43f6af1b99523c597c39befcc9db1ecab83a
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/371
2014-04-16 12:51:38 +02:00
Mark Holmquist 68bb702eaa Fix issues with file page link
TIL about setup/teardown in qunit

Change-Id: Ib283285bea401be251ec3f46a2dbd01623fe895e
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/452
2014-04-15 15:42:11 -07:00
Gilles Dubuc 09374fc9dd Restore article scroll after closing Media Viewer
There used to be a CSS trick with the order we added things to the
page and removed them from it, but it doesn't seem possible anymore
with the new order of execution, with the overlay appearing
immediately and being taken care of inside bootstrap.

The main cause of the bug, however, was the hash reset happening
after the interface was closed.

Doing the scroll restore with jQuery.scrollTo is more future-proof
and testable in QUnit.

Additions were also made to the cucumber E2E test because QUnit
alone wouldn't have caught the hash issue.

This also cleans up custom events a little and reintroduces
pushState on browsers that support the history API.

Change-Id: I63187383b632a2e8793f05380c18db2713856865
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/439
Bug: 63892
2014-04-14 18:04:30 +00:00
Mark Holmquist 1ae138c9e7 Open MMV on hash change on file pages, add link
Change-Id: I4aa53d50bcd4880f341dfb59b7a451e2d5bda2ad
2014-04-10 09:34:01 +02:00
Gilles Dubuc 685f42f05f Display black overlay while the viewer JS is loading
I went for this option because it was the fastest to implement.
I think we should wait until we make the change to core to expose
image dimensions before we consider switching to another strategy.

Change-Id: I61c9342a2d6d6fc24a24e0988b3cf7f9a06859a2
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/248
2014-03-30 09:53:20 +02:00
Gilles Dubuc 8beca0b106 Get rid of global viewer instance
- split event handler setup out of bootstrap and viewer creation
- simplify the tests setup/teardown

Change-Id: Icde1db81efd6191207ba35757192c800ea2d2e91
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/278
2014-03-05 02:33:06 +00:00
Gergő Tisza 109bbe6ac1 Namespacing MMV properly
Everything is under mw.mmv now.
(Also, I cut down on the number of direct global instance references a bit.)

Change-Id: I88bb3b62b82ce54126dd069b0aab4412d9404719
2014-02-25 13:16:22 +01:00
Gergő Tisza 53da285b07 Merge MultiLightbox into MultimediaViewer
* merges parent classes into child classes
* moves some files and tests to have a consistent directory structure

Change-Id: I360cc0805d8a561f5105fb063747457f67e1fccd
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/177
2014-02-25 02:00:13 +00:00
Renamed from tests/qunit/mmv.bootstrap.test.js (Browse further)