From 9bbc0d19ce19d63bac9cc931cbf8c7c7c19c5249 Mon Sep 17 00:00:00 2001 From: Rober Torkuhl Date: Sat, 9 Mar 2013 21:39:01 +0100 Subject: [PATCH 1/3] show edit buttons only on mouse over --- pinry/static/js/pinry.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pinry/static/js/pinry.js b/pinry/static/js/pinry.js index 953bc70..f985795 100644 --- a/pinry/static/js/pinry.js +++ b/pinry/static/js/pinry.js @@ -64,6 +64,16 @@ $(window).load(function() { }); }); + // Show edit-buttons only on mouse over + $('.pin').each(function(){ + var thisPin = $(this); + thisPin.find('.editable').hide(); + thisPin.unbind('hover'); + thisPin.hover(function() { + thisPin.find('.editable').toggle(); + }); + }); + $('.spinner').css('display', 'none'); blockContainer.css('height', colHeights.sort().slice(-1)[0]); } From 0a5ed2b04990041919ed48e2b7c87458b2e7d5ed Mon Sep 17 00:00:00 2001 From: Rober Torkuhl Date: Sat, 9 Mar 2013 21:39:40 +0100 Subject: [PATCH 2/3] remove doubled event listeners --- pinry/static/js/pinry.js | 1 + 1 file changed, 1 insertion(+) diff --git a/pinry/static/js/pinry.js b/pinry/static/js/pinry.js index f985795..db3a02e 100644 --- a/pinry/static/js/pinry.js +++ b/pinry/static/js/pinry.js @@ -51,6 +51,7 @@ $(window).load(function() { // Delete pin if trash icon clicked $('.icon-trash').each(function() { var thisPin = $(this); + $(this).unbind('click'); $(this).click(function() { $(this).off('click'); var promise = deletePinData($(this).data('id')); From 812358e31b95079d71eec7a1706d1dcfc8585a69 Mon Sep 17 00:00:00 2001 From: Rober Torkuhl Date: Sat, 9 Mar 2013 21:59:39 +0100 Subject: [PATCH 3/3] use jQuery.off() instead od deprecated .unbind() function --- pinry/static/js/pinry.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pinry/static/js/pinry.js b/pinry/static/js/pinry.js index db3a02e..3c0cb52 100644 --- a/pinry/static/js/pinry.js +++ b/pinry/static/js/pinry.js @@ -51,7 +51,7 @@ $(window).load(function() { // Delete pin if trash icon clicked $('.icon-trash').each(function() { var thisPin = $(this); - $(this).unbind('click'); + $(this).off('click'); $(this).click(function() { $(this).off('click'); var promise = deletePinData($(this).data('id')); @@ -69,7 +69,7 @@ $(window).load(function() { $('.pin').each(function(){ var thisPin = $(this); thisPin.find('.editable').hide(); - thisPin.unbind('hover'); + thisPin.off('hover'); thisPin.hover(function() { thisPin.find('.editable').toggle(); });