[PATCH] Highlight the link target line in Gitweb using CSS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is useful when a Gitweb link with a target (like #l100) refers to
a line in the last screenful of text.  Highlight the background in
yellow, and display a ⚓ character on the left.  Show the same
highlight when hovering the mouse over a line number.

Signed-off-by: Matthew Blissett <matt@xxxxxxxxxxxxxx>
---
The background-colour change is the 'main' (tiny) change.

Consider the ::before part a suggestion.  I think it helps show the
target line, but it does overlap the first character of any line >999.

I've tested this on the browsers I have access to, which excludes
Internet Explorer.  Since it's cosmetic it shouldn't matter if it doesn't
work.

Wikipedia use similar CSS for their citation links:
<http://en.wikipedia.org/wiki/Git_(software)#cite_note-1>

 gitweb/static/gitweb.css |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index cb86d2d..9f54311 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -546,6 +546,16 @@ a.linenr {
 	text-decoration: none
 }
 
+a.linenr:hover, a.linenr:target {
+	color: #444444;
+	background-color: #ff4;
+}
+
+a.linenr:hover::before, a.linenr:target::before {
+	content: '⚓';
+	position: absolute;
+}
+
 a.rss_logo {
 	float: right;
 	padding: 3px 0px;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]