diff options
author | Florian Pritz <bluewind@xinu.at> | 2011-09-30 17:02:19 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2011-09-30 17:02:19 +0200 |
commit | da4df73ad770c30b2e6c5d2606e11ed7dc291cd0 (patch) | |
tree | 573fc9f5a8dbbbd8939592e6ba55fe009a0056e3 | |
parent | f8d5e386ca303c14881d32b43807dafdc685909f (diff) |
highlight complete line; not only line number
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | application/views/file/html_header.php | 29 | ||||
-rw-r--r-- | data/paste.css | 9 |
2 files changed, 38 insertions, 0 deletions
diff --git a/application/views/file/html_header.php b/application/views/file/html_header.php index 52ffab007..f57884643 100644 --- a/application/views/file/html_header.php +++ b/application/views/file/html_header.php @@ -17,5 +17,34 @@ <a class="raw_link no" href="<?php echo $rmd_link; ?>">Render Markdown</a> </div> </div> + <script type="text/javascript"> + /* <![CDATA[ */ +function update_anchor_highlight() { + var anchor = window.location.hash.substr(1); + var element = document.getElementById("highlight_line"); + if (element) { + element.parentNode.removeChild(element); + } + + anchor = document.getElementById(anchor); + if (!anchor) { + return; + } + var newElement = document.createElement("div"); + newElement.setAttribute("id", "highlight_line"); + newElement.textContent=" "; + anchor.parentNode.insertBefore(newElement, anchor.nextSibling); +} + +if ("onhashchange" in window) { + window.onload = function () { + update_anchor_highlight(); + } + window.onhashchange = function () { + update_anchor_highlight(); + } +} + /* ]]> */ + </script> <table class="content"> <tr> diff --git a/data/paste.css b/data/paste.css index 2a5ce55f7..f511c54fe 100644 --- a/data/paste.css +++ b/data/paste.css @@ -14,6 +14,15 @@ body { .numbers a:target { background: yellow; } +div#highlight_line { + background: yellow; + display: inline; + position: absolute; + z-index: -1; + left: 0; + width: 100%; + +} .content { padding-left:3px; |