From 22fa78eea3183e9c41520d84fbd9eb096f1d409d Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Fri, 27 Jun 2014 15:45:45 -0400 Subject: [PATCH] Close tipsies when closing interface This could probably be aggregated and done more cleanly, but for now this will do. Change-Id: I1918a61a29f753f7249d9c5afbe0658f4faf4d23 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/740 --- resources/mmv/mmv.lightboxinterface.js | 2 ++ resources/mmv/ui/mmv.ui.canvasButtons.js | 9 +++++++++ resources/mmv/ui/mmv.ui.metadataPanel.js | 5 +++++ resources/mmv/ui/mmv.ui.stripeButtons.js | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/resources/mmv/mmv.lightboxinterface.js b/resources/mmv/mmv.lightboxinterface.js index ddcfd5e01..3d34ba2ff 100644 --- a/resources/mmv/mmv.lightboxinterface.js +++ b/resources/mmv/mmv.lightboxinterface.js @@ -202,6 +202,8 @@ this.canvas.unattach(); + this.buttons.unattach(); + this.panel.fileReuse.closeDialog(); this.clearEvents(); diff --git a/resources/mmv/ui/mmv.ui.canvasButtons.js b/resources/mmv/ui/mmv.ui.canvasButtons.js index 8750fd7d5..48769eeaf 100644 --- a/resources/mmv/ui/mmv.ui.canvasButtons.js +++ b/resources/mmv/ui/mmv.ui.canvasButtons.js @@ -192,5 +192,14 @@ } }; + /** + * Removes all UI things from the DOM, or hides them + */ + CBP.unattach = function () { + this.$viewFile.tipsy( 'hide' ); + this.$close.tipsy( 'hide' ); + this.$fullscreen.tipsy( 'hide' ); + }; + mw.mmv.ui.CanvasButtons = CanvasButtons; }( mediaWiki, jQuery, OO ) ); diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js b/resources/mmv/ui/mmv.ui.metadataPanel.js index f2ce95fd4..b04cbdfcb 100644 --- a/resources/mmv/ui/mmv.ui.metadataPanel.js +++ b/resources/mmv/ui/mmv.ui.metadataPanel.js @@ -60,6 +60,11 @@ }; MPP.unattach = function() { + this.$title.tipsy( 'hide' ); + this.$mmvOptOutLink.tipsy( 'hide' ); + this.$titleAndCredit.find( '.mw-mmv-author' ).tipsy( 'hide' ); + this.$titleAndCredit.find( '.mw-mmv-source' ).tipsy( 'hide' ); + this.scroller.unattach(); this.buttons.unattach(); this.fileReuse.unattach(); diff --git a/resources/mmv/ui/mmv.ui.stripeButtons.js b/resources/mmv/ui/mmv.ui.stripeButtons.js index f0ad23b54..7bd51c806 100644 --- a/resources/mmv/ui/mmv.ui.stripeButtons.js +++ b/resources/mmv/ui/mmv.ui.stripeButtons.js @@ -417,6 +417,10 @@ this.buttons.$reuse.off( 'click.mmv-stripeButtons' ); this.clearTimer( 'feedbackTooltip.show' ); + + $.each( this.buttons, function ( name, $button ) { + $button.tipsy( 'hide' ); + } ); }; mw.mmv.ui.StripeButtons = StripeButtons;