diff options
Diffstat (limited to 'extensions/BMO/template')
-rw-r--r-- | extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl | 31 | ||||
-rw-r--r-- | extensions/BMO/template/en/default/hook/bug/comments-end.html.tmpl | 20 |
2 files changed, 29 insertions, 22 deletions
diff --git a/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl b/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl index d8dc5bba0..65bf77967 100644 --- a/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl +++ b/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl @@ -9,17 +9,21 @@ [% IF has_tbpl_comment %] [% expand_caption = 'Expand TinderboxPushlog Comments' %] [% collapse_caption = 'Collapse TinderboxPushlog Comments' %] + [% show_caption = 'Show TinderboxPushlog Comments' %] + [% hide_caption = 'Hide TinderboxPushlog Comments' %] <script> YAHOO.util.Event.onDOMReady(function () { var ul = document.getElementsByClassName('bz_collapse_expand_comments'); if (ul.length == 0) - return; + return; + var li = document.createElement('li'); var a = document.createElement('a'); Dom.setAttribute(a, 'href', 'javascript:void(0)'); - Dom.setAttribute(a, 'id', 'toggle_tbplbot_comments'); + Dom.setAttribute(a, 'id', 'tbpl_toggle_collapse'); a.innerHTML = '[% expand_caption FILTER js %]'; YAHOO.util.Event.on(a, 'click', function() { + var a = document.getElementById('tbpl_toggle_collapse'); var do_expand = a.innerHTML == '[% expand_caption FILTER js %]'; for (var i = 0, n = tbpl_comment_ids.length; i < n; i++) { var id = tbpl_comment_ids[i]; @@ -37,6 +41,29 @@ }); li.appendChild(a); ul[0].appendChild(li); + + li = document.createElement('li'); + a = document.createElement('a'); + Dom.setAttribute(a, 'href', 'javascript:void(0)'); + Dom.setAttribute(a, 'id', 'tbpl_toggle_visible'); + a.innerHTML = '[% hide_caption FILTER js %]'; + YAHOO.util.Event.on(a, 'click', function() { + var a = document.getElementById('tbpl_toggle_visible'); + var do_show = a.innerHTML == '[% show_caption FILTER js %]'; + for (var i = 0, n = tbpl_comment_ids.length; i < n; i++) { + var id = tbpl_comment_ids[i]; + if (do_show) { + Dom.removeClass('c' + id, 'bz_default_hidden'); + } else { + Dom.addClass('c' + id, 'bz_default_hidden'); + } + } + a.innerHTML = do_show + ? '[% hide_caption FILTER js %]' + : '[% show_caption FILTER js %]'; + }); + li.appendChild(a); + ul[0].appendChild(li); }); </script> [% END %] diff --git a/extensions/BMO/template/en/default/hook/bug/comments-end.html.tmpl b/extensions/BMO/template/en/default/hook/bug/comments-end.html.tmpl deleted file mode 100644 index 3bf18a515..000000000 --- a/extensions/BMO/template/en/default/hook/bug/comments-end.html.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -[%# This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - # - # This Source Code Form is "Incompatible With Secondary Licenses", as - # defined by the Mozilla Public License, v. 2.0. - #%] - -[% IF user.id && comment.author.login_name == 'tbplbot@gmail.com' %] - [% has_tbpl_comment = 1 %] - <script> - var id = [% count FILTER none %]; - tbpl_comment_ids.push(id); - YAHOO.util.Dom.addClass(comment, 'collapsed'); - collapse_comment( - document.getElementById('comment_link_' + id), - document.getElementById('comment_text_' + id) - ); - </script> -[% END %] |