diff options
Diffstat (limited to 'extensions/BugModal/web')
-rw-r--r-- | extensions/BugModal/web/bug_modal.js | 31 | ||||
-rw-r--r-- | extensions/BugModal/web/common_bug_modal.js | 28 |
2 files changed, 29 insertions, 30 deletions
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index c1080cde8..c6abb5d7a 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -700,7 +700,7 @@ $(function() { $('#needinfo-scroll') .click(function(event) { event.preventDefault(); - $.scrollTo($('#needinfo_role'), function() { $('#needinfo_role').focus(); }); + $.scrollTo($('#needinfo_container'), function() { $('#needinfo_role').focus(); }); }); // knob @@ -830,13 +830,15 @@ $(function() { // remove embedded links to attachment details reply_text = reply_text.replace(/(attachment\s+\d+)(\s+\[[^\[\n]+\])+/gi, '$1'); - if ($('#comment').val() != reply_text) { - $('#comment').val($('#comment').val() + reply_text); - } - if (BUGZILLA.user.settings.autosize_comments) { - autosize.update($('#comment')); - } $.scrollTo($('#comment'), function() { + if ($('#comment').val() != reply_text) { + $('#comment').val($('#comment').val() + reply_text); + } + + if (BUGZILLA.user.settings.autosize_comments) { + autosize.update($('#comment')); + } + $('#comment').focus(); }); }); @@ -942,7 +944,7 @@ $(function() { $('#' + id + '-view').hide(); $('#' + id).show().focus().select(); }); - + // timetracking $('#work_time').change(function() { // subtracts time spent from remaining time @@ -1429,18 +1431,15 @@ $(function() { let $target; if (typeof target === 'string') { - $target = $('#' + target); + $target = document.getElementById(target); window.location.hash = target; } else { - $target = target; - } - - if ($target.length) { - $('main').scrollTop(Math.round($target.position().top) - 20); + // Use raw DOM node instead of jQuery + $target = target.get(0); } - if (complete) { - complete(); + if ($target) { + scroll_element_into_view($target, complete); } } diff --git a/extensions/BugModal/web/common_bug_modal.js b/extensions/BugModal/web/common_bug_modal.js index 160f922cc..dc91824f6 100644 --- a/extensions/BugModal/web/common_bug_modal.js +++ b/extensions/BugModal/web/common_bug_modal.js @@ -424,7 +424,7 @@ $(function() { var rbs = $("#readable-bug-status"); var rbs_text = bugzillaReadableStatus.readable(rbs.data('readable-bug-status')); rbs.text(rbs_text); - + if (BUGZILLA.user.id === 0) return; // @@ -700,7 +700,7 @@ $(function() { $('#needinfo-scroll') .click(function(event) { event.preventDefault(); - $.scrollTo($('#needinfo_role'), function() { $('#needinfo_role').focus(); }); + $.scrollTo($('#needinfo_container'), function() { $('#needinfo_role').focus(); }); }); // knob @@ -831,10 +831,13 @@ $(function() { // remove embedded links to attachment details reply_text = reply_text.replace(/(attachment\s+\d+)(\s+\[[^\[\n]+\])+/gi, '$1'); - if ($('#comment').val() != reply_text) { - $('#comment').val($('#comment').val() + reply_text); - } - $.scrollTo($('#comment'), function() { $('#comment').focus(); }); + $.scrollTo($('#comment'), function() { + if ($('#comment').val() != reply_text) { + $('#comment').val($('#comment').val() + reply_text); + } + + $('#comment').focus(); + }); }); // add comment --> private @@ -1356,18 +1359,15 @@ $(function() { let $target; if (typeof target === 'string') { - $target = $('#' + target); + $target = document.getElementById(target); window.location.hash = target; } else { - $target = target; - } - - if ($target.length) { - $('main').scrollTop(Math.round($target.position().top) - 20); + // Use raw DOM node instead of jQuery + $target = target.get(0); } - if (complete) { - complete(); + if ($target) { + scroll_element_into_view($target, complete); } } |