From: Darren Date: Sun, 18 Aug 2013 01:16:45 +0000 (+0100) Subject: Media message toggling #355 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=975f970567740df24d72e984092a34136d82c5e6;p=KiwiIRC.git Media message toggling #355 --- diff --git a/client/assets/src/views/mediamessage.js b/client/assets/src/views/mediamessage.js index de24eb4..369c1dd 100644 --- a/client/assets/src/views/mediamessage.js +++ b/client/assets/src/views/mediamessage.js @@ -8,6 +8,14 @@ _kiwi.view.MediaMessage = Backbone.View.extend({ this.url = this.$el.data('url'); }, + toggle: function () { + if (!this.$content || !this.$content.is(':visible')) { + this.open(); + } else { + this.close(); + } + }, + // Close the media content and remove it from display close: function () { var that = this; diff --git a/client/assets/src/views/panel.js b/client/assets/src/views/panel.js index 7cec509..fefde49 100644 --- a/client/assets/src/views/panel.js +++ b/client/assets/src/views/panel.js @@ -199,7 +199,7 @@ _kiwi.view.Panel = Backbone.View.extend({ $media.data('media', media_message); } - media_message.open(); + media_message.toggle(); }, // Cursor hovers over a message