summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlpha <ngcoder@live.com>2016-08-05 16:59:14 -0400
committerAlpha <ngcoder@live.com>2016-08-05 16:59:14 -0400
commite03f72ace0344414ae93927b7efc9dc358f99cfa (patch)
tree98d0b77d217ebaa10082f0494173ee7de9909233
parent6afa1f16bdc16fcfbc14617d772c4611221124f9 (diff)
downloadwebgrind-e03f72ace0344414ae93927b7efc9dc358f99cfa.zip
webgrind-e03f72ace0344414ae93927b7efc9dc358f99cfa.tar.gz
webgrind-e03f72ace0344414ae93927b7efc9dc358f99cfa.tar.bz2
Fileviewer: force scroll to line numbers on open
Helps when opening documents with very long lines.
-rw-r--r--templates/fileviewer.phtml5
1 files changed, 4 insertions, 1 deletions
diff --git a/templates/fileviewer.phtml b/templates/fileviewer.phtml
index 27220f8..6272b09 100644
--- a/templates/fileviewer.phtml
+++ b/templates/fileviewer.phtml
@@ -12,12 +12,15 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#'+location.hash.substr(1)).addClass('emph');
+ window.scrollBy(-100, 0);
if (typeof window.addEventListener == "function") {
window.addEventListener("hashchange", function(e) {
$("code").removeClass('emph');
- if (window.location.hash.length > 2)
+ if (window.location.hash.length > 2) {
$('#'+location.hash.substr(1)).addClass('emph');
+ window.scrollBy(-100, 0);
+ }
});
}
});