From 4ab51600ef74f9fa90150864985a5724078661bf Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Wed, 5 Jun 2013 15:57:09 -0700 Subject: [PATCH] Only create multi categorize bubble for subscribe buttons upon hover. This prevents creating a ton of bubble views on pages with lots of subscribe buttons like /reddits/mine. --- r2/r2/public/static/js/multi.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/r2/r2/public/static/js/multi.js b/r2/r2/public/static/js/multi.js index a2a2b1f7b..dcac5e085 100644 --- a/r2/r2/public/static/js/multi.js +++ b/r2/r2/public/static/js/multi.js @@ -366,12 +366,21 @@ r.multi.MultiAddNoticeBubble = r.ui.Bubble.extend({ }) r.multi.SubscribeButton = Backbone.View.extend({ - initialize: function() { + events: { + 'mouseenter': 'createBubble' + }, + + createBubble: function() { + if (this.bubble) { + return + } + this.bubble = new r.multi.MultiSubscribeBubble({ parent: this.$el, group: this.options.bubbleGroup, srName: String(this.$el.data('sr_name')) }) + this.bubble.queueShow() } })