mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-28 01:50:09 +00:00
Adds viewer state invalidation into wikipage.content
hook callback
When new content is added to a page ( like images LazyLoading ) the MultimediaViewer reacts mostly correctly, except that is does not rebuild images indexes for a viewer hence breaking next/prev order. The patch solves this by resetting the viewer state at MMVB.processThumbs() letting the viewer to be correctly re-initialized at later stages. Change-Id: Ib1e3ba05f5bc84d477302e365ad7984de1a84272
This commit is contained in:
parent
e3ae4e166c
commit
ca57e8eda0
|
@ -135,6 +135,15 @@
|
||||||
MMVB.processThumbs = function ( $content ) {
|
MMVB.processThumbs = function ( $content ) {
|
||||||
var bs = this;
|
var bs = this;
|
||||||
|
|
||||||
|
// MMVB.processThumbs() is a callback for `wikipage.content` hook (see constructor)
|
||||||
|
// which as state in the documentation can be fired when content is added to the DOM
|
||||||
|
// https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook
|
||||||
|
// The content being added can contain thumbnails that the MultimediaViewer may need to
|
||||||
|
// process correctly and add the the thumbs array, so it's necessary to invalidate the
|
||||||
|
// viewer initialization state if this happens to let the MMVB.loadViewer() to process
|
||||||
|
// new images correctly
|
||||||
|
bs.viewerInitialized = false;
|
||||||
|
|
||||||
this.$thumbs = $content.find(
|
this.$thumbs = $content.find(
|
||||||
'.gallery .image img, ' +
|
'.gallery .image img, ' +
|
||||||
'a.image img, ' +
|
'a.image img, ' +
|
||||||
|
|
Loading…
Reference in a new issue