diff --git a/js/ext.multimediaViewer.js b/js/ext.multimediaViewer.js index 72d1c4a2d..361da1ebf 100644 --- a/js/ext.multimediaViewer.js +++ b/js/ext.multimediaViewer.js @@ -238,6 +238,11 @@ this.$imageMetadata.show(); } } ); + + lightboxHooks.register( 'clearInterface', function () { + this.$imageDesc.empty(); + this.$title.empty(); + } ); } MultimediaViewer.prototype.fetchRepoInfo = function ( cb ) { diff --git a/js/multilightbox/hooks.txt b/js/multilightbox/hooks.txt index 4936725c7..11fa249fe 100644 --- a/js/multilightbox/hooks.txt +++ b/js/multilightbox/hooks.txt @@ -72,3 +72,8 @@ defullscreen Arguments: None ThisArg: LightboxInterface Called: From LightboxInterface fullscreen method when user is leaving fullscreen interface. + +clearInterface + Arguments: None + ThisArg: LightboxInterface + Called: From LightboxInterface empty method when the interface is being cleared. diff --git a/js/multilightbox/lightboxinterface.js b/js/multilightbox/lightboxinterface.js index eaa3e5bf7..91a7cb4d5 100644 --- a/js/multilightbox/lightboxinterface.js +++ b/js/multilightbox/lightboxinterface.js @@ -76,6 +76,12 @@ LIP = LightboxInterface.prototype; + LIP.empty = function () { + this.$imageDiv.empty(); + + lightboxHooks.callAll( 'clearInterface', this ); + }; + LIP.attach = function () { $( document.body ) .append( diff --git a/js/multilightbox/multilightbox.js b/js/multilightbox/multilightbox.js index 7f3bd0634..d70c68a8e 100644 --- a/js/multilightbox/multilightbox.js +++ b/js/multilightbox/multilightbox.js @@ -77,6 +77,7 @@ }; MLBP.open = function () { + this.iface.empty(); this.iface.attach(); this.iface.load( this.images[this.currentIndex] ); };