aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authormrsdizzie <info@mrsdizzie.com>2020-09-15 16:43:05 -0400
committerGitHub <noreply@github.com>2020-09-15 16:43:05 -0400
commit88823f3e29385922cffab697d8d9f5a9a2ad3e42 (patch)
tree49542dda7c092cb2ea1ecfada9e2370e05ceef46 /web_src
parentd9085fe176d1df1e34f8702858e367dfcf4d90c4 (diff)
downloadgitea-88823f3e29385922cffab697d8d9f5a9a2ad3e42.tar.gz
gitea-88823f3e29385922cffab697d8d9f5a9a2ad3e42.zip
Fix line selection on blame view (#12857)
Blame and regular code view have diverge slightly so line highlighting wasn't working properly anymore. Make work again in lieu of a larger refactor of blame HTML to move it outside of source and into templates to match code view. Fixes #12836 Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/index.js14
-rw-r--r--web_src/less/_base.less2
2 files changed, 13 insertions, 3 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 98a1033955..3f714874ae 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -2005,14 +2005,24 @@ function initCodeView() {
if ($('.code-view .lines-num').length > 0) {
$(document).on('click', '.lines-num span', function (e) {
const $select = $(this);
- const $list = $('.code-view td.lines-code');
+ let $list;
+ if ($('div.blame').length) {
+ $list = $('.code-view td.lines-code li');
+ } else {
+ $list = $('.code-view td.lines-code');
+ }
selectRange($list, $list.filter(`[rel=${$select.attr('id')}]`), (e.shiftKey ? $list.filter('.active').eq(0) : null));
deSelect();
});
$(window).on('hashchange', () => {
let m = window.location.hash.match(/^#(L\d+)-(L\d+)$/);
- const $list = $('.code-view td.lines-code');
+ let $list;
+ if ($('div.blame').length) {
+ $list = $('.code-view td.lines-code li');
+ } else {
+ $list = $('.code-view td.lines-code');
+ }
let $first;
if (m) {
$first = $list.filter(`[rel=${m[1]}]`);
diff --git a/web_src/less/_base.less b/web_src/less/_base.less
index ddb65a7c26..82b403de6c 100644
--- a/web_src/less/_base.less
+++ b/web_src/less/_base.less
@@ -1122,7 +1122,7 @@ i.icon.centerlock {
width: 100%;
}
- .lines-code.active {
+ .active {
background: #fffbdd !important;
}