git ssb

30+

cel / git-ssb-web



Commit 12f054e8b00dd52e785740807429a28d8ed8200f

Hyperlink diff line nums

%Nsj+VIqIWreIbjKEyFjb9yRLAPG1ryjERHDww2TEnIk=.sha256
Charles Lehner committed on 4/2/2016, 1:47:47 AM
Parent: 359143dca22db78c06f6326af639aa0d02e028da

Files changed

index.jschanged
static/styles.csschanged
index.jsView
@@ -1346,11 +1346,16 @@
13461346 var s = line[0]
13471347 if (s == '\\') return
13481348 var html = escapeHTML(line)
13491349 var trClass = s == '+' ? 'diff-new' : s == '-' ? 'diff-old' : ''
1350- return '<tr' + (trClass ? ' class="' + trClass + '"' : '') + '>' +
1351- '<td class="diff-linenum">' + (s == '+' ? '' : oldLine++) + '</td>' +
1352- '<td class="diff-linenum">' + (s == '-' ? '' : newLine++) + '</td>' +
1350+ var lineNums = [s == '+' ? '' : oldLine++, s == '-' ? '' : newLine++]
1351+ var id = [filename].concat(lineNums).join('-')
1352+ return '<tr id="' + escapeHTML(id) + '" class="' + trClass + '">' +
1353+ lineNums.map(function (num) {
1354+ return '<td class="diff-linenum">' +
1355+ (num ? '<a href="#' + encodeURIComponent(id) + '">' +
1356+ num + '</a>' : '') + '</td>'
1357+ }).join('') +
13531358 '<td class="diff-text">' + html + '</td></tr>'
13541359 }))
13551360 })
13561361 return '<pre><table class="diff">' +
static/styles.cssView
@@ -350,8 +350,16 @@
350350 color: grey;
351351 border-right: 1px solid rgba(0, 0, 0, 0.06);
352352 }
353353
354+.diff-linenum a {
355+ color: inherit;
356+}
357+
358+.diff-linenum a:hover {
359+ color: #9f9999;
360+}
361+
354362 .diff-text {
355363 white-space: pre-wrap;
356364 width: 100%;
357365 }

Built with git-ssb-web