git ssb

30+

cel / git-ssb-web



Commit 97ef971b5aaa29e8f2c7613f765d91b7f6f2d615

Use :target instead of hash highlight script

Charles Lehner committed on 4/10/2016, 4:31:19 PM
Parent: 85dd6e2c80b5aa7daef0a42e25cc6d5f77c1ff9d

Files changed

index.jschanged
static/styles.csschanged
index.jsView
@@ -406,22 +406,8 @@
406406 }
407407 }
408408 }.toString() + ')()'
409409
410-var hashHighlightScript = '<script>(' + function () {
411- var activeEl
412- function onHashChange() {
413- var el = document.getElementById(location.hash.substr(1))
414- if (activeEl)
415- activeEl.classList.remove('active-hash')
416- if (el)
417- el.classList.add('active-hash')
418- activeEl = el
419- }
420- onHashChange()
421- window.addEventListener('hashchange', onHashChange, false)
422-}.toString() + ')()</script>'
423-
424410 var msgTypes = {
425411 'git-repo': true,
426412 'git-update': true,
427413 'issue': true
@@ -739,9 +725,9 @@
739725 buf = buf.toString('utf8')
740726 if (err) return cb(err)
741727 cb(null, (ext == 'md' || ext == 'markdown')
742728 ? markdown(buf, repo)
743- : renderCodeTable(buf, ext) + hashHighlightScript)
729 + : renderCodeTable(buf, ext))
744730 })
745731 })
746732 }
747733
@@ -1415,9 +1401,9 @@
14151401 encodeLink([repo.id, 'blob', commitId].concat(item.path))))
14161402 })
14171403 }, 4)
14181404 ),
1419- pull.once('</section>' + hashHighlightScript),
1405 + pull.once('</section>'),
14201406 ])
14211407 }
14221408
14231409 function htmlLineDiff(filename, anchor, oldStr, newStr, blobHref, rawHref) {
static/styles.cssView
@@ -340,11 +340,11 @@
340340 .code td {
341341 padding: 0 1ex 0;
342342 }
343343
344-.active-hash,
344 +:target,
345345 .code tr:hover {
346- background-color: #fff8d2;
346 + background-color: #fff8d2 !important;
347347 }
348348
349349 .code-linenum {
350350 vertical-align: top;

Built with git-ssb-web