summaryrefslogtreecommitdiffstats
path: root/template/en/default
diff options
context:
space:
mode:
authorEdmund Wong <ewong@pw-wspx.org>2010-05-17 17:02:53 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2010-05-17 17:02:53 +0200
commitf7dde138a05e914d4ee10586fcbbbbade0e5ab8f (patch)
treef1e5fa5a860a8e3e8aafa73514c60c87cfb87ecd /template/en/default
parent2cdcaa08031424c393878bed91f81fc92e4328a4 (diff)
downloadbugzilla-f7dde138a05e914d4ee10586fcbbbbade0e5ab8f.tar.gz
bugzilla-f7dde138a05e914d4ee10586fcbbbbade0e5ab8f.tar.xz
Bug 460799: Move JS code out of bug/comments.html.tmpl
r/a=LpSolit
Diffstat (limited to 'template/en/default')
-rw-r--r--template/en/default/bug/comments.html.tmpl76
1 files changed, 4 insertions, 72 deletions
diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl
index 93b954e87..2f42bbcb7 100644
--- a/template/en/default/bug/comments.html.tmpl
+++ b/template/en/default/bug/comments.html.tmpl
@@ -22,76 +22,8 @@
[% PROCESS bug/time.html.tmpl %]
- <script type="text/javascript">
- <!--
- function updateCommentPrivacy(checkbox, id) {
- var comment_elem = document.getElementById('comment_text_'+id).parentNode;
- if (checkbox.checked) {
- if (!comment_elem.className.match('bz_private')) {
- comment_elem.className = comment_elem.className.concat(' bz_private');
- }
- }
- else {
- comment_elem.className =
- comment_elem.className.replace(/(\s*|^)bz_private(\s*|$)/, '$2');
- }
- }
-
- /* The functions below expand and collapse comments */
-
- 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);
- else
- collapse_comment(link, comment);
- }
-
- function toggle_all_comments(action) {
- var num_comments = [% comments.size FILTER html %];
-
- // If for some given ID the comment doesn't exist, this doesn't mean
- // there are no more comments, but that the comment is private and
- // the user is not allowed to view it.
-
- for (var id = 0; id < num_comments; id++) {
- var comment = document.getElementById('comment_text_' + id);
- if (!comment)
- continue;
-
- var link = document.getElementById('comment_link_' + id);
- if (action == 'collapse')
- collapse_comment(link, comment);
- else
- expand_comment(link, comment);
- }
- }
-
- function collapse_comment(link, comment) {
- link.innerHTML = "[+]";
- link.title = "Expand the comment.";
- YAHOO.util.Dom.addClass(comment, 'collapsed');
- }
-
- function expand_comment(link, comment) {
- link.innerHTML = "[-]";
- link.title = "Collapse the comment";
- YAHOO.util.Dom.removeClass(comment, 'collapsed');
- }
-
- /* This way, we are sure that browsers which do not support JS
- * won't display this link */
-
- function addCollapseLink(count) {
- document.write(' <a href="#" class="bz_collapse_comment"' +
- ' id="comment_link_' + count +
- '" onclick="toggle_comment_display(this, ' + count +
- '); return false;" title="Collapse the comment.">[-]<\/a> ');
- }
- //-->
- </script>
-
+<script src="js/comments.js" type="text/javascript">
+</script>
[% DEFAULT start_at = 0 mode = "show" %]
[% sort_order = user.settings.comment_sort_order.value %]
@@ -142,9 +74,9 @@
<td>
[% IF mode == "edit" %]
<ul class="bz_collapse_expand_comments">
- <li><a href="#" onclick="toggle_all_comments('collapse');
+ <li><a href="#" onclick="toggle_all_comments('collapse', [% comments.size %]);
return false;">Collapse All Comments</a></li>
- <li><a href="#" onclick="toggle_all_comments('expand');
+ <li><a href="#" onclick="toggle_all_comments('expand', [% comments.size %]);
return false;">Expand All Comments</a></li>
</ul>
[% END %]