aboutsummaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-20 16:16:32 -0500
committerUnknwon <u@gogs.io>2017-02-20 16:16:32 -0500
commit934734a85a1e4cb68d8c1aa68c518b511c7be190 (patch)
tree775db872acad5e2ff4ef9ed837870907d8864455 /public/js
parent491934784fd99c10a4d2cb37eabb94d3c4ef1903 (diff)
diff: able to highlight line with hashtag URL
Diffstat (limited to 'public/js')
-rw-r--r--public/js/gogs.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js
index b7770fde..2cd98d3b 100644
--- a/public/js/gogs.js
+++ b/public/js/gogs.js
@@ -542,6 +542,20 @@ function initRepository() {
$item.find(".bar .add").css("width", addPercent + "%");
});
}
+
+ $('.diff-file-box .lines-num').click(function () {
+ if ($(this).attr('id')) {
+ window.location.href = '#' + $(this).attr('id');
+ }
+ });
+
+ $(window).on('hashchange', function (e) {
+ $('.diff-file-box .lines-code.active').removeClass('active');
+ var m = window.location.hash.match(/^#diff-.+$/);
+ if (m) {
+ $(m[0]).siblings('.lines-code').addClass('active');
+ }
+ }).trigger('hashchange');
}
// Quick start and repository home