summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/cgit-extra.html37
-rw-r--r--web/git.css18
2 files changed, 32 insertions, 23 deletions
diff --git a/web/cgit-extra.html b/web/cgit-extra.html
index ed62938..3241e8c 100644
--- a/web/cgit-extra.html
+++ b/web/cgit-extra.html
@@ -285,23 +285,6 @@ async function getActivityData( days ) {
return { values: ret, highest };
}
-function getActivityClass( delta, highest ) {
- if( !highest )
- return "";
-
- const ratio = delta / highest;
- if( ratio < 0.0001 )
- return "";
- if( ratio < 0.25 )
- return "activity-low";
- else if( ratio < 0.5 )
- return "activity-medium";
- else if( ratio < 0.75 )
- return "activity-high";
- else
- return "activity-very-high";
-}
-
let spinnerFrame = 0;
const spinnerFrames = [
'/',
@@ -354,6 +337,19 @@ function createActivityContainer() {
content.appendChild( wrapper );
}
+function getActivityColor( commits, highest ) {
+ if( !commits ) return null;
+
+ let percent = commits / highest;
+ let color = [
+ 255 * (1.0 - percent),
+ 255 * percent,
+ 255
+ ];
+
+ return `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+}
+
async function createActivityGraph() {
const date = new Date();
let weekday = date.getDay();
@@ -371,10 +367,11 @@ async function createActivityGraph() {
for( let i = 0; i < 365 + weekday; ++i ) {
const day = 364 + weekday - i;
const commits = activity.values[day];
- const aclass = getActivityClass( commits, activity.highest );
+ const acol = getActivityColor( commits, activity.highest );
const cell = document.createElement( "td" );
cell.classList.add( "activity-cell-" + day );
- if( aclass ) cell.classList.add( aclass );
+ if( acol )
+ cell.style.backgroundColor = acol;
const popup = document.createElement( "div" );
popup.classList.add( "popup" );
@@ -394,6 +391,8 @@ async function createActivityGraph() {
const main = async () => {
if( isMainPage() ) {
+ if( document.querySelector( ".content" ) == null )
+ return setTimeout( main, 1 );
createActivityContainer();
return setTimeout( createActivityGraph );
}
diff --git a/web/git.css b/web/git.css
index a8b3435..dcd7b22 100644
--- a/web/git.css
+++ b/web/git.css
@@ -103,6 +103,14 @@ a:hover {
background-color: #7f7f7f;
}
+
+@media (max-width: 1280px) {
+ .activity-table td {
+ border: none;
+ }
+}
+
+
.activity-title {
margin-left: 5px;
margin-bottom: 1px;
@@ -119,9 +127,11 @@ a:hover {
}
.activity-table td:hover {
- border-left: 3px solid #888;
- border-right: 3px solid #888;
+ border-left: 2px solid #888 !important;
+ border-right: 2px solid #888 !important;
+ min-width: 4px;
}
+
td .popup {
display: none;
position: absolute;
@@ -156,7 +166,7 @@ hr {
div#cgit {
padding: 0em;
margin: 0em;
- font-size: 13px;
+ font-size: 13.5px;
color: #fff;
background: #888;
padding: 4px;
@@ -1032,7 +1042,7 @@ div#cgit table.ssdiff td.hunk {
div#cgit table.ssdiff td.head {
border-top: solid 1px #aaa;
border-bottom: solid 1px #aaa;
- font-size: 13px;
+ font-size: 13.5px;
font-weight: normal;
}