summaryrefslogtreecommitdiffstats
path: root/public/ng
diff options
context:
space:
mode:
authorAlexey Makhov <makhov.alex@gmail.com>2015-02-19 00:52:22 +0300
committerAlexey Makhov <makhov.alex@gmail.com>2015-02-19 00:52:22 +0300
commit563e8b4ea98e57adf3992dcaef76b86d29c13cec (patch)
treec77d91a4b1cf6265d0bfce9490b23dfbae95ec40 /public/ng
parentbe19fe48d70cd7ce3ec0d49e2b6f47f83f33ad2f (diff)
downloadgitea-563e8b4ea98e57adf3992dcaef76b86d29c13cec.tar.gz
gitea-563e8b4ea98e57adf3992dcaef76b86d29c13cec.zip
gitlab-like hash naming
Diffstat (limited to 'public/ng')
-rw-r--r--public/ng/js/gogs.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js
index a6b9753e17..bd320b4403 100644
--- a/public/ng/js/gogs.js
+++ b/public/ng/js/gogs.js
@@ -209,14 +209,14 @@ var Gogs = {};
$list.parents('tr').removeClass('end-selected-line');
$list.parents('tr').find('td').removeClass('selected-line');
if ($from) {
- var expr = new RegExp(/diff-(\d+)L(\d+)/);
+ var expr = new RegExp(/diff-(\w+)([LR])(\d+)/);
var selectMatches = $select.attr('rel').match(expr)
var fromMatches = $from.attr('rel').match(expr)
- var a = parseInt(selectMatches[2]);
- var b = parseInt(fromMatches[2]);
+ var a = parseInt(selectMatches[3]);
+ var b = parseInt(fromMatches[3]);
var linesIntToStr = {};
- linesIntToStr[a] = selectMatches[2];
- linesIntToStr[b] = fromMatches[2];
+ linesIntToStr[a] = selectMatches[3];
+ linesIntToStr[b] = fromMatches[3];
var c;
if (a != b) {
@@ -225,11 +225,11 @@ var Gogs = {};
a = b;
b = c;
}
- $('[rel=diff-'+fromMatches[1]+'L' + linesIntToStr[b] + ']').parents('tr').next().addClass('end-selected-line');
- var $selectedLines = $('[rel=diff-'+fromMatches[1]+'L' + linesIntToStr[a] + ']').parents('tr').nextUntil('.end-selected-line').andSelf();
+ $('[rel=diff-'+fromMatches[1] + fromMatches[2] + linesIntToStr[b] + ']').parents('tr').next().addClass('end-selected-line');
+ var $selectedLines = $('[rel=diff-'+fromMatches[1]+selectMatches[2] + linesIntToStr[a] + ']').parents('tr').nextUntil('.end-selected-line').andSelf();
$selectedLines.find('td.lines-num > span').addClass('active')
$selectedLines.find('td').addClass('selected-line');
- $.changeHash('#diff-'+fromMatches[1]+'L' + linesIntToStr[a] + '-L' + linesIntToStr[b]);
+ $.changeHash('#diff-'+fromMatches[1]+fromMatches[2] + linesIntToStr[a] + '-' + selectMatches[2] + + linesIntToStr[b]);
return
}
}
@@ -262,7 +262,7 @@ var Gogs = {};
});
$(window).on('hashchange', function (e) {
- var m = window.location.hash.match(/^#diff-(\d+)(L\d+)\-(L\d+)$/);
+ var m = window.location.hash.match(/^#diff-(\w+)([LR]\d+)\-([LR]\d+)$/);
var $list = $('.code-diff td.lines-num > span');
var $first;
if (m) {
@@ -271,7 +271,7 @@ var Gogs = {};
$("html, body").scrollTop($first.offset().top - 200);
return;
}
- m = window.location.hash.match(/^#diff-(\d+)(L\d+)$/);
+ m = window.location.hash.match(/^#diff-(\w+)([LR]\d+)$/);
if (m) {
$first = $list.filter('[rel=diff-' + m[1] + m[2] + ']');
selectRange($list, $first);