From fed8b6b5664bdebaf1389bbf6269fc42af1f3c50 Mon Sep 17 00:00:00 2001 From: marijus Date: Thu, 5 Jun 2014 17:53:06 +0200 Subject: move new comment open/close js functions to core so they can be used by other themes --- view/js/main.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'view/js') diff --git a/view/js/main.js b/view/js/main.js index 2f695c77e..871b683d5 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1,5 +1,38 @@ function confirmDelete() { return confirm(aStr['delitem']); } + + function commentOpenUI(obj,id) { + + $(document).unbind( "click.commentOpen", 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.commentOpen", handler ); + + } + + function commentCloseUI(obj,id) { + + $(document).unbind( "click.commentClose", 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.commentClose", handler ); + + } + function commentOpen(obj,id) { if(obj.value == aStr['comment']) { obj.value = ''; -- cgit v1.2.3