Oops, that didn't go to the multimedia list.
Juliusz Gonera wrote:
Gergo Tisza wrote:
* jquery.color - what for? can we use CSS transitions? * jquery.colorUtil - what for? can we use CSS transitions?
Dependencies for doing color transitions with jQuery.animate(). Probably can be replaced with CSS; I'll look into that when I have some free time. At any rate, .animate() still runs without those files (just doesn't produce any visible effect) so they can be omitted.
Thanks! In the worst case we could make them a soft dependency, but CSS-based transitions would be the best way to go for mobile.
* moment
Used for date localization. Moment is heavy (25K minified) but the browser's built in date formatting is very unreliable. Might be possible doing this on the server side, although it would be ugly from an API design point of view.
Where is it used? The only place I could spot it was "Created on [date]." I'm not sure if it pays off to serve 25KB more to a mobile user to format one date. Could this, theoretically, be made a soft dependency too?
Probably more preloading? We do a lot of that. You can set mw.mmv.mediaViewer.preloadDistance = 0 to disable. (This only works once you have opened some image already as mw.mmv.mediaViewer is created when the main JS lib is loaded; we don't have a lazy-loading compatible way to configure the viewer yet. Created #275 https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/275 about that.)
Also, we request every image twice to get certain performance metrics; this should not result in the image actually being downloaded twice (although we did not test that in mobile browsers), but might confuse the network stats in Chrome. Probably also something that we should make configurable :-)
Yep, that's the major cause of increased size. On my vagrant instance, for some reason, those second requests return HTTP 200 and it seems that they are fetched from the server again.
Another thing is that I counted 6 API requests. 3 of them are for imageinfo, 3 for other APIs. They are small, but as we know each request has an HTTP overhead. It would be great to combine them.
The big win in terms of size would be to make the UI modular and configurable, so you can request a MultimediaViewer instance which does not have most of the information on the metadata panel, for example, and the related files would not be loaded. We have some vague plans about that, but nothing specific yet.
Yes, that's definitely something we should look into when we start working on MMV on mobile.
-- Juliusz