diff options
author | a1012112796 <1012112796@qq.com> | 2021-05-07 19:59:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 13:59:01 +0200 |
commit | c25813182c7b98f0fce32d6b955a6629c805fea5 (patch) | |
tree | 5d04914671224bb957204bb26b45b946f53a383c /web_src | |
parent | bdc169772980285a89480a93c78731b6f45ee2ff (diff) | |
download | gitea-c25813182c7b98f0fce32d6b955a6629c805fea5.tar.gz gitea-c25813182c7b98f0fce32d6b955a6629c805fea5.zip |
not show `ref-in-new-issue` pop when issue was disabled (#15761)
fix #15718
Signed-off-by: a1012112796 <1012112796@qq.com>
Diffstat (limited to 'web_src')
-rw-r--r-- | web_src/js/index.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js index 53843a6d22..2d9f7f4caf 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2208,6 +2208,10 @@ function searchRepositories() { } function showCodeViewMenu() { + if ($('.code-view-menu-list').length === 0) { + return; + } + // Get clicked tr const $code_tr = $('.code-view td.lines-code.active').parent(); @@ -2873,6 +2877,11 @@ function selectRange($list, $select, $from) { // add hashchange to permalink const $issue = $('a.ref-in-new-issue'); + + if ($issue.length === 0) { + return; + } + const matched = $issue.attr('href').match(/%23L\d+$|%23L\d+-L\d+$/); if (matched) { $issue.attr('href', $issue.attr('href').replace($issue.attr('href').substr(matched.index), `%23L${a}-L${b}`)); @@ -2888,6 +2897,11 @@ function selectRange($list, $select, $from) { // add hashchange to permalink const $issue = $('a.ref-in-new-issue'); + + if ($issue.length === 0) { + return; + } + const matched = $issue.attr('href').match(/%23L\d+$|%23L\d+-L\d+$/); if (matched) { $issue.attr('href', $issue.attr('href').replace($issue.attr('href').substr(matched.index), `%23${$select.attr('rel')}`)); |