From 0a5369c7b4d57dc3c54a8025b7405f911b538c9c Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Jun 2016 18:04:58 +0200 Subject: [PATCH] Shows anonymous messages on focus whit tab --- app/assets/javascripts/votes.js.coffee | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee index e4223c644..030b9cf46 100644 --- a/app/assets/javascripts/votes.js.coffee +++ b/app/assets/javascripts/votes.js.coffee @@ -1,20 +1,22 @@ App.Votes = hoverize: (votes) -> - $(votes).hover -> - $("div.anonymous-votes", votes).show(); - $("div.organizations-votes", votes).show(); - $("div.not-logged", votes).show(); - $("div.no-supports-allowed", votes).show(); - $("div.logged", votes).hide(); - , -> - $("div.anonymous-votes", votes).hide(); - $("div.organizations-votes", votes).hide(); - $("div.not-logged", votes).hide(); - $("div.no-supports-allowed", votes).hide(); - $("div.logged", votes).show(); + $(document).on { + 'mouseenter focus': -> + $("div.anonymous-votes", this).show(); + $("div.organizations-votes", this).show(); + $("div.not-logged", this).show(); + $("div.no-supports-allowed", this).show(); + $("div.logged", this).hide(); + mouseleave: -> + $("div.anonymous-votes", this).hide(); + $("div.organizations-votes", this).hide(); + $("div.not-logged", this).hide(); + $("div.no-supports-allowed", this).hide(); + $("div.logged", this).show(); + }, votes initialize: -> - App.Votes.hoverize votes for votes in $("div.votes") - App.Votes.hoverize votes for votes in $("div.supports") + App.Votes.hoverize "div.votes" + App.Votes.hoverize "div.supports" false