stagit-responsive

My mobile friendly fork of stagit
Log | Files | Refs | README | LICENSE

commit 3bef738a10f66467cd7f6f4bf4c1cf1a3dee4c63
parent 430b79e27a3c12e839e6ffab375279c63f7e4cec
Author: Yohanes Bandung <bandungpenting@gmail.com>
Date:   Sun, 17 May 2020 04:41:44 +0700

refactor: alignments

mobile friendly

style

nno

ail

alignment

Diffstat:
Mstagit.c | 18+++++++++---------
Mstyle.css | 15+++++++++++----

2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/stagit.c b/stagit.c
@@ -594,11 +594,11 @@ writelogline(FILE *fp, struct commitinfo *ci)
 	fputs("</td><td>", fp);
 	if (ci->author)
 		xmlencode(fp, ci->author->name, strlen(ci->author->name));
-	fputs("</td><td class=\"num\" align=\"right\">", fp);
+	fputs("</td><td class=\"num\">", fp);
 	fprintf(fp, "%zu", ci->filecount);
-	fputs("</td><td class=\"num\" align=\"right\">", fp);
+	fputs("</td><td class=\"num\">", fp);
 	fprintf(fp, "+%zu", ci->addcount);
-	fputs("</td><td class=\"num\" align=\"right\">", fp);
+	fputs("</td><td class=\"num\">", fp);
 	fprintf(fp, "-%zu", ci->delcount);
 	fputs("</td></tr>\n", fp);
 }
@@ -894,7 +894,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
 			xmlencode(fp, filepath, strlen(filepath));
 			fputs("\">", fp);
 			xmlencode(fp, entrypath, strlen(entrypath));
-			fputs("</a></td><td class=\"num\" align=\"right\">", fp);
+			fputs("</a></td><td class=\"num\">", fp);
 			if (lc > 0)
 				fprintf(fp, "%dL", lc);
 			else
@@ -906,7 +906,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
 				relpath);
 			xmlencode(fp, entrypath, strlen(entrypath));
 			git_submodule_free(module);
-			fputs("</a></td><td class=\"num\" align=\"right\"></td></tr>\n", fp);
+			fputs("</a></td><td class=\"num\"></td></tr>\n", fp);
 		}
 	}
 
@@ -922,7 +922,7 @@ writefiles(FILE *fp, const git_oid *id)
 
 	fputs("<div id=\"table-scroll\"><table id=\"files\"><thead>\n<tr>"
 	      "<th>Mode</th><th>Name</th>"
-	      "<th class=\"num\" align=\"right\">Size</th>"
+	      "<th class=\"num\">Size</th>"
 	      "</tr>\n</thead><tbody>\n", fp);
 
 	if (!git_commit_lookup(&commit, repo, id) &&
@@ -1191,9 +1191,9 @@ main(int argc, char *argv[])
 	writeheader(fp, "Log");
 	fputs("<div id=\"table-scroll\"><table id=\"log\"><thead>\n<tr><th>Date</th>"
 	      "<th>Commit message</th>"
-	      "<th>Author</th><td class=\"num\" align=\"right\"><b>Files</th>"
-	      "<td class=\"num\" align=\"right\"><b>+</th>"
-	      "<td class=\"num\" align=\"right\"><b>-</th></tr>\n</thead><tbody>\n", fp);
+	      "<th>Author</th><td class=\"num\"><b>Files</th>"
+	      "<td class=\"num\" id=\"plus\"><b>+</th>"
+	      "<td class=\"num\" id=\"min\"><b>-</th></tr>\n</thead><tbody>\n", fp);
 
 	if (cachefile && head) {
 		/* read from cache file (does not need to exist) */
diff --git a/style.css b/style.css
@@ -42,14 +42,21 @@ a.line {
 
 #blob a:hover {
 	color: #F9690E;
+	background-color: #303030;
 	text-decoration: none;
 }
 
-table thead td {
+table th {
 	font-weight: bold;
+	text-align: left;
+}
+@media screen and (min-width: 600px) {
+  table:not(#branches) th {
+    text-align: center;
+  }
 }
 
-table td {
+table td, table th {
 	padding: 0 0.4em;
 }
 
@@ -58,7 +65,7 @@ table td {
   padding-bottom: 3em;
 }
 
-#content table td {
+#content table td, #content table th {
 	vertical-align: top;
 	white-space: nowrap;
 }
@@ -78,7 +85,7 @@ table td {
 	white-space: normal;
 }
 
-td.num {
+th.num, td.num {
 	text-align: right;
 }