From 1d34640b2aa29556327960edcd5afff14f12e73a Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 4 May 2024 12:58:53 +0200 Subject: merged with upstream changed from 1.2.3.r54.g00ecfaa --- cgit.css | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ cgit.js | 68 +++++++++++++++++++++++++++++++++ 2 files changed, 188 insertions(+), 11 deletions(-) create mode 100644 cgit.js diff --git a/cgit.css b/cgit.css index 7e02127..e1b1c07 100644 --- a/cgit.css +++ b/cgit.css @@ -10,6 +10,16 @@ body { background: white; } +div#cgit { + padding: 0em; + margin: 0em; + font-family: sans-serif; + font-size: 10pt; + color: #333; + background: white; + padding: 4px; +} + div#cgit a { color: blue; text-decoration: none; @@ -20,7 +30,7 @@ div#cgit a:hover { } div#cgit table { - border-collapse: collapse; + border-collapse: collapse; } div#cgit table#header { @@ -87,6 +97,12 @@ div#cgit table.tabs td a.active { background-color: #ccc; } +div#cgit table.tabs a[href^="http://"]:after, div#cgit table.tabs a[href^="https://"]:after { + content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgAhcJDQY+gm2TAAAAHWlUWHRDb21tZW50AAAAAABDcmVhdGVkIHdpdGggR0lNUGQuZQcAAABbSURBVAhbY2BABs4MU4CwhYHBh2Erww4wrGFQZHjI8B8IgUIscJWyDHcggltQhI4zGDCcRwhChPggHIggP1QoAVmQkSETrGoHsiAEsACtBYN0oDAMbgU6EBcAAL2eHUt4XUU4AAAAAElFTkSuQmCC); + opacity: 0.5; + margin: 0 0 0 5px; +} + div#cgit table.tabs td.form { text-align: right; } @@ -130,14 +146,34 @@ div#cgit table.list tr.logheader { background: #eee; } +div#cgit table.list tr:nth-child(even) { + background: #f7f7f7; +} + +div#cgit table.list tr:nth-child(odd) { + background: white; +} + div#cgit table.list tr:hover { background: #eee; } +div#cgit table.list tr.nohover { + background: white; +} + div#cgit table.list tr.nohover:hover { background: white; } +div#cgit table.list tr.nohover-highlight:hover:nth-child(even) { + background: #f7f7f7; +} + +div#cgit table.list tr.nohover-highlight:hover:nth-child(odd) { + background: white; +} + div#cgit table.list th { font-weight: bold; /* color: #888; @@ -256,7 +292,7 @@ div#cgit div.error { margin: 1em 2em; } -div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit a.ls-mod { +div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit .ls-mod { font-family: monospace; } @@ -276,6 +312,7 @@ div#cgit table.blob { border-top: solid 1px black; } +div#cgit table.blob td.hashes, div#cgit table.blob td.lines { margin: 0; padding: 0 0 0 0.5em; vertical-align: top; @@ -293,16 +330,55 @@ div#cgit table.blob pre { padding: 0; margin: 0; } -div#cgit table.blob a.no, div#cgit table.ssdiff a.no { +div#cgit table.blob td.linenumbers a, +div#cgit table.ssdiff td.lineno a { color: gray; text-align: right; text-decoration: none; } -div#cgit table.blob a.no a:hover { +div#cgit table.blob td.linenumbers a:hover, +div#cgit table.ssdiff td.lineno a:hover { color: black; } +div#cgit table.blame td.hashes, +div#cgit table.blame td.lines, +div#cgit table.blame td.linenumbers { + padding: 0; +} + +div#cgit table.blame td.hashes div.alt, +div#cgit table.blame td.lines div.alt { + padding: 0 0.5em 0 0.5em; +} + +div#cgit table.blame td.linenumbers div.alt { + padding: 0 0.5em 0 0; +} + +div#cgit table.blame div.alt:nth-child(even) { + background: #eee; +} + +div#cgit table.blame div.alt:nth-child(odd) { + background: white; +} + +div#cgit table.blame td.lines > div { + position: relative; +} + +div#cgit table.blame td.lines > div > pre { + padding: 0 0 0 0.5em; + position: absolute; + top: 0; +} + +div#cgit table.blame .oid { + font-size: 100%; +} + div#cgit table.bin-blob { margin-top: 0.5em; border: solid 1px black; @@ -501,7 +577,7 @@ div#cgit table.diff td div.del { color: red; } -div#cgit .sha1 { +div#cgit .oid { font-family: monospace; font-size: 90%; } @@ -512,9 +588,6 @@ div#cgit .left { div#cgit .right { text-align: right; - float: none !important; - width: auto !important; - padding: 0 !important; } div#cgit table.list td.reposection { @@ -588,6 +661,30 @@ div#cgit span.age-years { color: #bbb; } +div#cgit span.insertions { + color: #080; +} + +div#cgit span.deletions { + color: #800; +} + +div#cgit div.footer { + margin-top: 0.5em; + text-align: center; + font-size: 80%; + color: #ccc; +} + +div#cgit div.footer a { + color: #ccc; + text-decoration: none; +} + +div#cgit div.footer a:hover { + text-decoration: underline; +} + div#cgit a.branch-deco { color: #000; margin: 0px 0.5em; @@ -595,6 +692,7 @@ div#cgit a.branch-deco { background-color: #88ff88; border: solid 1px #007700; } + div#cgit a.tag-deco { color: #000; margin: 0px 0.5em; @@ -602,6 +700,15 @@ div#cgit a.tag-deco { background-color: #ffff88; border: solid 1px #777700; } + +div#cgit a.tag-annotated-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ffcc88; + border: solid 1px #777700; +} + div#cgit a.remote-deco { color: #000; margin: 0px 0.5em; @@ -609,6 +716,7 @@ div#cgit a.remote-deco { background-color: #ccccff; border: solid 1px #000077; } + div#cgit a.deco { color: #000; margin: 0px 0.5em; @@ -619,6 +727,7 @@ div#cgit a.deco { div#cgit div.commit-subject a.branch-deco, div#cgit div.commit-subject a.tag-deco, +div#cgit div.commit-subject a.tag-annotated-deco, div#cgit div.commit-subject a.remote-deco, div#cgit div.commit-subject a.deco { margin-left: 1em; @@ -788,9 +897,9 @@ div#cgit table.ssdiff td.head div.head { div#cgit table.ssdiff td.foot { border-top: solid 1px #aaa; - border-left: none; - border-right: none; - border-bottom: none; + border-left: none; + border-right: none; + border-bottom: none; } div#cgit table.ssdiff td.space { diff --git a/cgit.js b/cgit.js new file mode 100644 index 0000000..df3ad4e --- /dev/null +++ b/cgit.js @@ -0,0 +1,68 @@ +/* cgit.js: javacript functions for cgit + * + * Copyright (C) 2006-2018 cgit Development Team + * + * Licensed under GNU General Public License v2 + * (see COPYING for full license text) + */ + +(function () { + +/* This follows the logic and suffixes used in ui-shared.c */ + +var age_classes = [ "age-mins", "age-hours", "age-days", "age-weeks", "age-months", "age-years" ]; +var age_suffix = [ "min.", "hours", "days", "weeks", "months", "years", "years" ]; +var age_next = [ 60, 3600, 24 * 3600, 7 * 24 * 3600, 30 * 24 * 3600, 365 * 24 * 3600, 365 * 24 * 3600 ]; +var age_limit = [ 7200, 24 * 7200, 7 * 24 * 7200, 30 * 24 * 7200, 365 * 25 * 7200, 365 * 25 * 7200 ]; +var update_next = [ 10, 5 * 60, 1800, 24 * 3600, 24 * 3600, 24 * 3600, 24 * 3600 ]; + +function render_age(e, age) { + var t, n; + + for (n = 0; n < age_classes.length; n++) + if (age < age_limit[n]) + break; + + t = Math.round(age / age_next[n]) + " " + age_suffix[n]; + + if (e.textContent != t) { + e.textContent = t; + if (n == age_classes.length) + n--; + if (e.className != age_classes[n]) + e.className = age_classes[n]; + } +} + +function aging() { + var n, next = 24 * 3600, + now_ut = Math.round((new Date().getTime() / 1000)); + + for (n = 0; n < age_classes.length; n++) { + var m, elems = document.getElementsByClassName(age_classes[n]); + + if (elems.length && update_next[n] < next) + next = update_next[n]; + + for (m = 0; m < elems.length; m++) { + var age = now_ut - elems[m].getAttribute("data-ut"); + + render_age(elems[m], age); + } + } + + /* + * We only need to come back when the age might have changed. + * Eg, if everything is counted in hours already, once per + * 5 minutes is accurate enough. + */ + + window.setTimeout(aging, next * 1000); +} + +document.addEventListener("DOMContentLoaded", function() { + /* we can do the aging on DOM content load since no layout dependency */ + aging(); +}, false); + +})(); -- cgit v1.2.3-70-g09d2