summaryrefslogtreecommitdiffstats
path: root/js/comments.js
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-11-25 09:21:03 +0100
committerByron Jones <bjones@mozilla.com>2013-11-25 09:21:03 +0100
commitba0765bf4dc468815e4fa45509010c0cd675e5b2 (patch)
tree32d979d1172495770a326f87f294c6f10a1eaa68 /js/comments.js
parent0aade93cebf4192b240347e092a7e53a62436ea2 (diff)
downloadbugzilla-ba0765bf4dc468815e4fa45509010c0cd675e5b2.tar.gz
bugzilla-ba0765bf4dc468815e4fa45509010c0cd675e5b2.tar.xz
Bug 793963: add the ability to tag comments with arbitrary tags
r=dkl, a=glob
Diffstat (limited to 'js/comments.js')
-rw-r--r--js/comments.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/js/comments.js b/js/comments.js
index acf5dbf9b..8d314de15 100644
--- a/js/comments.js
+++ b/js/comments.js
@@ -25,9 +25,9 @@ function toggle_comment_display(link, comment_id) {
var comment = document.getElementById('comment_text_' + comment_id);
var re = new RegExp(/\bcollapsed\b/);
if (comment.className.match(re))
- expand_comment(link, comment);
+ expand_comment(link, comment, comment_id);
else
- collapse_comment(link, comment);
+ collapse_comment(link, comment, comment_id);
}
function toggle_all_comments(action) {
@@ -44,20 +44,22 @@ function toggle_all_comments(action) {
var id = comments[i].id.match(/\d*$/);
var link = document.getElementById('comment_link_' + id);
if (action == 'collapse')
- collapse_comment(link, comment);
+ collapse_comment(link, comment, id);
else
- expand_comment(link, comment);
+ expand_comment(link, comment, id);
}
}
-function collapse_comment(link, comment) {
+function collapse_comment(link, comment, comment_id) {
link.innerHTML = "[+]";
YAHOO.util.Dom.addClass(comment, 'collapsed');
+ YAHOO.util.Dom.addClass('comment_tag_' + comment_id, 'collapsed');
}
-function expand_comment(link, comment) {
+function expand_comment(link, comment, comment_id) {
link.innerHTML = "[&minus;]";
YAHOO.util.Dom.removeClass(comment, 'collapsed');
+ YAHOO.util.Dom.removeClass('comment_tag_' + comment_id, 'collapsed');
}
function wrapReplyText(text) {
@@ -110,11 +112,12 @@ function wrapReplyText(text) {
/* This way, we are sure that browsers which do not support JS
* won't display this link */
-function addCollapseLink(count, title) {
+function addCollapseLink(count, collapsed, title) {
document.write(' <a href="#" class="bz_collapse_comment"' +
' id="comment_link_' + count +
'" onclick="toggle_comment_display(this, ' + count +
- '); return false;" title="' + title + '">[&minus;]<\/a> ');
+ '); return false;" title="' + title + '">[' +
+ (collapsed ? '+' : '&minus;') + ']<\/a> ');
}
function goto_add_comments( anchor ){