Commit graph

71 commits

Author SHA1 Message Date
Gilles Dubuc 35690bb2f1 Get rid of lightboxHooks
Delete lightboxHooks, since most of them
haven't proven to be useful.
Replace the useful ones by jQuery events.

Change-Id: I28f99ba85666ca15979feb5c637924b98bba27a8
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/176
2014-02-13 17:47:30 -08:00
Gilles Dubuc 6e127b25e2 Preload prev/next images
When the lightbox is opened, or prev/next pressed, preloads the
previous/next N images.

Technical debt introduced:
* initialization is a mess, with the viewer and the interface
  randomly setting properties on each other in different phases of
  execution. That got in the way and I shuffled things around
  until they worked, which is obviously not the way to have a
  robust system, but hopefully it will get scrapped soon anyway
  in favor of a clean top-down dependency injection.

Change-Id: Idcb5c40de1ac0b3e482decd66e56c4de8ec71b6b
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/155
2014-02-13 10:52:40 +01:00
Gergő Tisza 9881f9e7ae Add TaskQueue class
A simple task queue which can be processed or cancelled.
Will be used to handle preloading in a more robust way.

Change-Id: Ib33f9b2d814a35538f9d4f3691fce5ba5cdc82c1
2014-02-12 01:55:39 +00:00
Mark Holmquist a62410616d Refactor button things into a separate class
https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/124

Change-Id: Ib4b54164bccbe17e42b223880179531e8d9e6123
2014-02-10 09:40:50 +01:00
Gergő Tisza 06cc6cca1a Refactor thumbnail size calculation
* moves generic logic into ThumbnailSizeCalculator class
* moves UI-specific logic into interface class
* fixes bug where non-bucketed sizes were served on devices with
  non-standard pixel density
* fixes bug where bucketed size was compared to css size instead of screen size
  for resizing

Change-Id: I8ba3380b74fcc8fb0a6ecc3f3140627411851ad0
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/196
2014-02-08 01:27:27 +00:00
Gilles Dubuc e74fc33e89 Track detailed content loading network performance
Leverages the W3C Navigation Timing API when available

Change-Id: Ief1d327d1bd8928bf5f2bf0bd4c7141a0a608a53
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/126
2014-02-07 19:37:22 +00:00
Gilles Dubuc 57434b5812 Refactor panel-related things into another class
mmv.lightboxinterface was getting way too clunky.

https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/124

Change-Id: Ie3a604b532ee853f9df673cc4d38c2c7594bdefa
2014-02-07 10:09:08 -08:00
Gergő Tisza e33f2d263c Add Thumbnail model
Also refactor size calculation a bit - I found target/requested
harder to remember.

Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/155
Change-Id: I4781cdd7004e9a8e36875c152e1d3a335a55b7d7
2014-02-07 01:46:26 +00:00
jenkins-bot d1e966e903 Merge "Hide the fullscren button when fullscreen is unavailable" 2014-02-06 22:19:17 +00:00
Gilles Dubuc 4e85f31b27 Hide the fullscren button when fullscreen is unavailable
Change-Id: I72cff940cee1ad83f6bacfffdcfb9fdd0f16abcc
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/152
2014-02-06 14:02:52 -08:00
Gergő Tisza b013ddbefe Userinfo provider
* userinfo api requests are cached now
* we use jsonp only if we have to (makes gender api calls measurable on WMF wikis)
* all API calls use providers now, provider.Api constructor can be used to
  wrap mw.Api with metrics

Does not return a proper model, and gender API calls are not preloaded together
with the rest of the calls. Maybe next time.

Change-Id: I9b3ea73c65eef57e160ac8636d9e45d349150884
2014-02-06 00:37:39 +00:00
Gilles Dubuc 3dd716a3f2 Hide the controls after some time when in fullscreen mode
Also removes side-effects from several tests

Change-Id: Ifdc978f56f8c4caafadc8b192756645a9378f58a
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/150
2014-02-05 10:27:10 +01:00
Gergő Tisza 1ff0ac60cd Fix merge problem with categories
Change-Id: I628bffeb4cac16cf50def6d5562fb9e2b9fa8933
2014-02-05 01:46:55 +00:00
jenkins-bot af1c2cbeee Merge "Add provider to for actual image loading" 2014-02-05 00:15:56 +00:00
jenkins-bot cba179e79a Merge "Replace old API code with providers + fix a few provider bugs" 2014-02-05 00:15:55 +00:00
jenkins-bot f1640171e3 Merge "Renaming things for consistency: DataProvider -> Provider" 2014-02-05 00:15:54 +00:00
jenkins-bot 97e29b9e00 Merge "Add imageinfo, thumbnail info, repoinfo provider" 2014-02-05 00:14:22 +00:00
Gergő Tisza 6068ffd58d Add provider to for actual image loading
Change-Id: I9ca9bce37c97648afa07db9f004138a791c74e65
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
2014-02-05 00:02:28 +00:00
Gergő Tisza 40d1a2508a Replace old API code with providers + fix a few provider bugs
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
Change-Id: Id7952f0a0eafa34d7c8691c63c2daccff2eea64a
2014-02-04 23:52:02 +00:00
Gergő Tisza 056651ed33 Renaming things for consistency: DataProvider -> Provider
Change-Id: Ia1f022baef02b477296c9664e7280c75b1c84515
2014-02-04 23:51:48 +00:00
Gergő Tisza 85a37d0e14 Add imageinfo, thumbnail info, repoinfo provider
Change-Id: I80ffec39ee6c9e0ea0b37be2fc48315063b5ff8a
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
2014-02-04 23:46:02 +00:00
Mark Holmquist 9d043e7ddc Fix categories empty method
+test

Change-Id: I16f19dde713709b0cf8631cb1bf0ceee6ca438a7
2014-02-04 10:10:53 -08:00
Gilles Dubuc d34fec4ff2 Add categories to the interface
Also move some things around a liiiittle bit. Not too much.

Change-Id: I7a5b8d900f5173fa20142d205e4992361b9e81a3
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/41
2014-02-03 15:09:42 +01:00
jenkins-bot 9f0641c214 Merge "Make mmv handle urlencoded hashes" 2014-02-03 10:44:42 +00:00
Gilles Dubuc 67fa053687 Make mmv handle urlencoded hashes
Change-Id: Id05806be4586a3d6f04b92ace2c8195b8de016bc
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/153
2014-02-03 09:32:38 +01:00
Gergő Tisza e0edec21b2 Move providers into their own subdirectory
Also refactor MultimediaViewer.php a bit to get rid of all the globals.

Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
Change-Id: Ieca4263ecc7652dc6bc36db63b99d3813c4653e4
2014-02-01 03:49:30 +00:00
Gilles Dubuc 5d47d1da3d Fix the "view all uses" link when there are both local and global results
The code was incorrectly adding the link to the first section
no matter what. This wasn't caught by the existing assertions,
so these are being improved as well.

Change-Id: I4dcbf44b504bd4cb875b4058fe5604f2a3c871b7
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/44
2014-01-31 09:30:26 +01:00
Gilles Dubuc 30563de71d Add file usage data to MMV metadata panel
Interface code is its own class which does not depend on the main
interface class it can be unit tested (and eventually moved into its
own file to make browsing the code easier). IMO we should aim to
eventually break up the interface into similar classes (with a simple
init/empty/set interface + custom events where it makes sense).

Also, sneak-introducing LESS!

API usage could be more effective (globalusage is a separate API call;
it needn't be), but we will have to rewrite that part soon anyway, so
it should pass for now.

Bug: 60087
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/44
Change-Id: Ibe5c323cdeab4a378316925f0c3efb3dc7ef5997
2014-01-30 13:03:28 +01:00
Aaron Arcos f7925a1a4f Refactor image load code, add unit tests.
The code to load and set the image was semi-duplicated and
scattered in various places. This was the source of defects
as this code is called asynchronously and was hard to debug.
This change attemps ot consolidate all the image load logic
in one place. It also adds sorely needed unit tests.

Change-Id: I92eb1c48e2ff0808134e56b4b150e22254eb2d6e
2014-01-30 08:51:15 +01:00
Gilles Dubuc 98e03d31c8 Test metadata visibility in fullscreen mode
Add metadata visibility logic to the test
Convert the code to CSS since writing the test made me
realise that the current JS was superfluous

Change-Id: I80c2f1860cc021e9bdf09345647b288de746f1e3
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/140
2014-01-30 08:39:55 +01:00
Gilles Dubuc 02897fda9c Chevron/metadata UI behavior improvements
When the multimedia panel is closed, the chevron
points upwards, otherwise it points downwards
Pressing the up and down arrows on the keyboard
opens and closes the metadata panel

Change-Id: I7dd31f3cc3d90f9342845faea2c6cfea3b40e232
2014-01-30 02:52:53 +00:00
jenkins-bot d246d7709a Merge "Simple test for enter/exiting fullscreen mode" 2014-01-28 10:21:14 +00:00
Aaron Arcos 7c87033235 Request maximum image resolution in the API call.
After checking all the code paths (phew !), it seems
this simple change takes care of the resolution issue
that surfaces mainly in iOS devices (see b/60388).

Bug: 60388
Change-Id: I867dd18f782126fb71eb52ec637a2b90b910050d
2014-01-27 17:17:32 -08:00
Gilles Dubuc 6803daf3a6 Simple test for enter/exiting fullscreen mode
While writing the test I spotted a bug and fixed it

Change-Id: I781c67752781960e4be88520f53163756fc11dab
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/140
2014-01-27 17:54:03 +01:00
Mark Holmquist 5e98e3bcd6 Fix bug that would cause the image to stay small
When opening the lightbox, the image might stay small
because of a race condition. This is fixed using a
deferred object.

Change-Id: I4e93c7d26da47e5177abeb1dac841bf6c25a9022
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/138
2014-01-27 10:21:38 +01:00
Mark Holmquist 5e4a544133 Moving things around for module renames
This is a big change, but should change nothing except the sizes of some
files and where they all are.

There are no more ext.multimediaViewer strings ANYWHERE, so let's keep
it that way. :)

Change-Id: Ic0892f5894700938bfa01f3f9bc8e5ab8276eb72
2014-01-24 09:21:16 -08:00
Aaron Arcos f643430373 Fix to streching image b/60173.
It seems the problem was iOS specific. In retina displays the devicePixelRatio
turns out to be 2. This was making the images twice as wide. This was introduced
as a way to fix the resolution problem with some Apple devices, I suppose? Since this is not
fixing the problem I am removing it for the moment. Fixing the resolution issue implies
more changes that will be addressed in another iteration.

Bug: 60173
Change-Id: Iaff2aa6ba13ae85f905ab6d1569572881d8b5990
2014-01-23 16:16:13 -08:00
jenkins-bot d245703241 Merge "A bunch of description fixes" 2014-01-22 23:51:50 +00:00
Mark Holmquist 22d2a69979 A bunch of description fixes
* Move description and caption to both be in the bottom left
* Make empty description grey and italic
* Fix problem where description was sometimes appended twice
* Move description UI stuff into a separate file, and make it more MVCy
* Tests for description UI stuff
* General framework, to an extent, for UI classes

Change-Id: Ibc8c576cd8a41c2e3cf7e13f1b9e093384fb4655
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/120
2014-01-22 14:46:39 -08:00
jenkins-bot 7f67c0934a Merge "Add 'Location:' to the location message" 2014-01-22 17:13:52 +00:00
Gergő Tisza fed238fcd6 Create model & providers for file usage information
Bug: 60087
Change-Id: I0e72c1e4590714e92a365f9741633221af5b0553
2014-01-21 18:04:51 -08:00
Mark Holmquist 47cad0e607 Add 'Location:' to the location message
Actually it's a totally new message, but still.

Change-Id: I5c02b9ec59bd0c8e455aae71936625a1bae48700
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/121
2014-01-21 17:35:02 -08:00
Mark Holmquist f59962e4a3 Add location information to metadata div
Adds location in a human readable format, plus a link to geohack because
that's how we roll.

See https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/42

+more tests

Change-Id: Ie8c9b8a0caf0f13ad5341a84173381ce49da97f6
2014-01-17 17:22:44 -08:00
Mark Holmquist 6363b90bd8 Add caption to the interface in place of description
Also include the description on the right side of the page, but the caption
generally is more relevant and so should have the place of honour.

+tests

Change-Id: I512b3dd99207878233d501135b4dda0d0bd9cdd6
2014-01-17 16:37:56 -08:00
Mark Holmquist 328728a3ff Add tests for EventLogging timing
Change-Id: Idb44fc2c0b4f38c0e4ae9c91459735fa547d0191
2014-01-17 18:44:28 +00:00
jenkins-bot b9dc9b1c2d Merge "Refactor animation, plus test" 2014-01-17 17:47:29 +00:00
Gilles Dubuc ddff7de9da Display the favicon of the foreign file repo when available
The foreign repo link in the details area will display the favicon
of the foreign repo when available.

Change-Id: Id946a80beeabcd526f16872efaedbdd291444d2d
Mingle: Multimedia card #107
2014-01-17 14:30:25 +01:00
Mark Holmquist 9b28edb1be Refactor animation, plus test
Change-Id: I688c573b7fbd136782177f0b690d3aab994c6d10
2014-01-16 17:33:15 -08:00
Gilles Dubuc cbf6bd7767 Make sure that the close button is always visible
Change-Id: Ib1bf72d898220442992c5a30d90a9a683d00d110
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/81
2014-01-14 16:42:52 +01:00
Mark Holmquist 89417163a9 Refactor to a data model
Image information and repo information are now both stored somewhere
else entirely, so we don't need to keep accessing weird API return
values to sort things out. fetchImageInfo now uses those classes to
an extent, and we now cache thumbnail URLs for different sizes.

Change-Id: Ife8293c86683ea914b1a5a60000584b501d92e55
2014-01-12 12:50:34 -08:00