From 4c9d8fd79d806391f68423f004d087035ba60e0a Mon Sep 17 00:00:00 2001 From: marijus Date: Thu, 5 Jun 2014 11:02:27 +0200 Subject: possible fix for 2nd comment collapsing --- view/theme/redbasic/js/redbasic.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'view/theme') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 58acc1b95..f7f4d3dc2 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -1,21 +1,33 @@ function commentOpenRedbasic(obj,id) { - $(document).click(function() { + + $(document).unbind( "click", handler ); + + var handler = function() { if(obj.value == aStr['comment']) { obj.value = ''; $("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty"); $("#comment-tools-" + id).show(); } - }); + }; + + $(document).bind( "click", handler ); + } function commentCloseRedbasic(obj,id) { - $(document).click(function() { + + $(document).unbind( "click", handler ); + + var handler = function() { if(obj.value == '') { obj.value = aStr['comment']; $("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty"); $("#comment-tools-" + id).hide(); } - }); + }; + + $(document).bind( "click", handler ); + } $(document).ready(function() { -- cgit v1.2.3 From 48f856e84cb117b6224ae7a1e0cac30070f1af24 Mon Sep 17 00:00:00 2001 From: marijus Date: Thu, 5 Jun 2014 11:21:02 +0200 Subject: we probably want a seperate namespace to not disable all click events in document --- view/theme/redbasic/js/redbasic.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'view/theme') diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index f7f4d3dc2..5a9d2f390 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -1,6 +1,6 @@ function commentOpenRedbasic(obj,id) { - $(document).unbind( "click", handler ); + $(document).unbind( "click.commentOpen", handler ); var handler = function() { if(obj.value == aStr['comment']) { @@ -10,13 +10,13 @@ function commentOpenRedbasic(obj,id) { } }; - $(document).bind( "click", handler ); + $(document).bind( "click.commentOpen", handler ); } function commentCloseRedbasic(obj,id) { - $(document).unbind( "click", handler ); + $(document).unbind( "click.commentClose", handler ); var handler = function() { if(obj.value == '') { @@ -26,7 +26,7 @@ function commentCloseRedbasic(obj,id) { } }; - $(document).bind( "click", handler ); + $(document).bind( "click.commentClose", handler ); } -- cgit v1.2.3