From d5d10c940549d16f22ea19d99ecba2287d692c8f Mon Sep 17 00:00:00 2001 From: llj Date: Thu, 20 Sep 2012 11:55:19 +0800 Subject: [PATCH] [file-comment]click area outside file-comment and hide it --- templates/repo_view_file.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/repo_view_file.html b/templates/repo_view_file.html index 8cc1449f2c..662e12f0b6 100644 --- a/templates/repo_view_file.html +++ b/templates/repo_view_file.html @@ -279,6 +279,12 @@ $('#comment').click(function() { $('#file-comment, #comment-caret').addClass('hide'); } }); +$(document).click(function(e) { + var target = e.target || event.srcElement; + if (target != $('#comment')[0] && target != $('#file-comment')[0] && target != $('#comment-caret')[0] && !($('#file-comment, #comment-caret').find('*').is(target))) { + $('#file-comment, #comment-caret').addClass('hide'); + } +}); var comment_input_pre_text = $('#comment-input').val(); $('#comment-input').css('color', '#999').click(function() {