From c290f3ecabec75b741d375e6130af9060255c274 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 15 Jun 2015 12:49:59 +0800 Subject: Bug 1146774: treeherder/tbpl comments are not automatically collapsed --- extensions/BugModal/web/comments.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'extensions/BugModal/web/comments.js') diff --git a/extensions/BugModal/web/comments.js b/extensions/BugModal/web/comments.js index f9852cd0e..b18f7d3d1 100644 --- a/extensions/BugModal/web/comments.js +++ b/extensions/BugModal/web/comments.js @@ -72,7 +72,7 @@ $(function() { $('#c' + id).find('.comment-tags').hide(); $('#c' + id).find('.gravatar').css('width', '16px').css('height', '16px'); $('#cr-' + id).hide(); - spinner.text('+'); + realSpinner.text('+'); } else if (forced == 'show') { if (defaultCollapsed) { @@ -87,14 +87,14 @@ $(function() { $('#c' + id).find('.comment-tags').show(); $('#c' + id).find('.gravatar').css('width', '32px').css('height', '32px'); $('#cr-' + id).show(); - spinner.text('-'); + realSpinner.text('-'); } else { $('#ct-' + id).slideToggle('fast', function() { $('#c' + id).find(activitySelector).toggle(); - $('#c' + id).find('.comment-tags').toggle(); if ($('#ct-' + id + ':visible').length) { - spinner.text('-'); + $('#c' + id).find('.comment-tags').show(); + realSpinner.text('-'); $('#cr-' + id).show(); if (BUGZILLA.user.id !== 0) $('#ctag-' + id).show(); @@ -105,7 +105,8 @@ $(function() { } } else { - spinner.text('+'); + $('#c' + id).find('.comment-tags').hide(); + realSpinner.text('+'); $('#cr-' + id).hide(); if (BUGZILLA.user.id !== 0) $('#ctag-' + id).hide(); @@ -171,6 +172,23 @@ $(function() { } }); + $('#view-toggle-treeherder') + .click(function() { + var that = $(this); + console.log(that.data('userid')); + var item = $('.context-menu-item.hover'); + if (that.data('hidden') === '1') { + that.data('hidden', '0'); + item.text('Hide Treeherder Comments'); + $('.ca-' + that.data('userid')).show(); + } + else { + that.data('hidden', '1'); + item.text('Show Treeherder Comments'); + $('.ca-' + that.data('userid')).hide(); + } + }); + $.contextMenu({ selector: '#view-menu-btn', trigger: 'left', -- cgit v1.2.3-24-g4f1b