Commit graph

15 commits

Author SHA1 Message Date
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)