From 6b5cd42432a6cf5ac2d8a55b5bfebbe3be6dcc36 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 16 Nov 2014 21:40:21 -0600 Subject: [PATCH] * VRFS-2097 - move around hover hookups --- web/app/assets/javascripts/hoverBand.js | 2 +- web/app/assets/javascripts/hoverFan.js | 2 +- web/app/assets/javascripts/hoverMusician.js | 2 +- web/app/assets/javascripts/hoverRecording.js | 2 +- web/app/assets/javascripts/hoverSession.js | 2 +- web/app/assets/javascripts/utils.js | 27 ++++++++++++-------- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/web/app/assets/javascripts/hoverBand.js b/web/app/assets/javascripts/hoverBand.js index ccc8c4fe5..9eb5e8d5c 100644 --- a/web/app/assets/javascripts/hoverBand.js +++ b/web/app/assets/javascripts/hoverBand.js @@ -9,7 +9,7 @@ this.showBubble = function($hoverElement) { - rest.getBand(bandId) + return rest.getBand(bandId) .done(function(response) { $(hoverSelector).html(''); diff --git a/web/app/assets/javascripts/hoverFan.js b/web/app/assets/javascripts/hoverFan.js index 34c2400d2..6ca880df5 100644 --- a/web/app/assets/javascripts/hoverFan.js +++ b/web/app/assets/javascripts/hoverFan.js @@ -10,7 +10,7 @@ this.showBubble = function($hoverElement) { - rest.getUserDetail({id: userId}) + return rest.getUserDetail({id: userId}) .done(function(response) { $(hoverSelector).html(''); diff --git a/web/app/assets/javascripts/hoverMusician.js b/web/app/assets/javascripts/hoverMusician.js index 5e3b5777f..56042effd 100644 --- a/web/app/assets/javascripts/hoverMusician.js +++ b/web/app/assets/javascripts/hoverMusician.js @@ -13,7 +13,7 @@ this.showBubble = function($hoverElement) { $templateLatency = $("#template-account-session-latency"); - rest.getUserDetail({id: userId}) + return rest.getUserDetail({id: userId}) .done(function(response) { $(hoverSelector).html(''); diff --git a/web/app/assets/javascripts/hoverRecording.js b/web/app/assets/javascripts/hoverRecording.js index 9cadedf27..8ba1239c7 100644 --- a/web/app/assets/javascripts/hoverRecording.js +++ b/web/app/assets/javascripts/hoverRecording.js @@ -39,7 +39,7 @@ this.showBubble = function($hoverElement) { - rest.getClaimedRecording(recordingId) + return rest.getClaimedRecording(recordingId) .done(function(response) { var claimedRecording = response; var recording = response.recording; diff --git a/web/app/assets/javascripts/hoverSession.js b/web/app/assets/javascripts/hoverSession.js index 0d7577167..35a7baa5e 100644 --- a/web/app/assets/javascripts/hoverSession.js +++ b/web/app/assets/javascripts/hoverSession.js @@ -10,7 +10,7 @@ this.showBubble = function($hoverElement) { - rest.getSessionHistory(sessionId) + return rest.getSessionHistory(sessionId) .done(function(response) { $(hoverSelector).html(''); diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index f8f37d927..7e45b7c46 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -333,23 +333,26 @@ function showBubble(bubble, $hoverElement) { $hoverElement.attr("bubble-id", bubble.id); - bubble.showBubble($hoverElement); + bubble.showBubble($hoverElement) + .done(function() { + + $(bubble.id()).hover( + function () { + $(this).data('hovering', true) + // do nothing when entering the bubble + }, + function () { + $(this).data('hovering', false).fadeOut(100); + } + ); + + }) } function hideBubble($hoverElement) { var bubbleSelector = $hoverElement.attr("bubble-id"); - $(bubbleSelector).hover( - function () { - $(this).data('hovering', true) - // do nothing when entering the bubble - }, - function () { - $(this).data('hovering', false).fadeOut(fadeoutValue); - } - ); - // first check to see if the user isn't hovering over the hover bubble if (!$(bubbleSelector).data('hovering')) { $(bubbleSelector).fadeOut(fadeoutValue); @@ -360,8 +363,10 @@ $("[hoveraction='musician']", $parent).hoverIntent({ over: function(e) { var bubble = new JK.MusicianHoverBubble($(this).attr('user-id'), e.pageX, e.pageY); + showBubble(bubble, $(this)); + }, out: function () { // this registers for leaving the hoverable element hideBubble($(this));