stagit-responsive

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

commit 6f71bd7f3d993ef4196000cc27f67500df945140
parent 467dfeb8f4bf2dd1ddb69e5c9592147acb425aab
Author: Yohanes Bandung <bandungpenting@gmail.com>
Date:   Thu, 14 May 2020 22:34:27 +0700

style: make mobile friendly

Diffstat:
Mstagit-index.c | 5+++--
Mstagit.c | 13+++++++------
Mstyle.css | 29+++++++++++++++++++++--------

3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/stagit-index.c b/stagit-index.c
@@ -65,6 +65,7 @@ writeheader(FILE *fp)
 {
 	fputs("<!DOCTYPE html>\n"
 		"<html>\n<head>\n"
+    "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
 		"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"
 		"<title>", fp);
 	xmlencode(fp, description, strlen(description));
@@ -76,7 +77,7 @@ writeheader(FILE *fp)
 	xmlencode(fp, description, strlen(description));
 	fputs("</span></td></tr><tr><td></td><td>\n"
 		"</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n"
-		"<table id=\"index\"><thead>\n"
+		"<div id=\"table-scroll\"><table id=\"index\"><thead>\n"
 		"<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>"
 		"<td><b>Last commit</b></td></tr>"
 		"</thead><tbody>\n", fp);
@@ -85,7 +86,7 @@ writeheader(FILE *fp)
 void
 writefooter(FILE *fp)
 {
-	fputs("</tbody>\n</table>\n</div>\n</body>\n</html>\n", fp);
+	fputs("</tbody>\n</table>\n</div>\n</div>\n</body>\n</html>\n", fp);
 }
 
 int
diff --git a/stagit.c b/stagit.c
@@ -343,6 +343,7 @@ writeheader(FILE *fp, const char *title)
 {
 	fputs("<!DOCTYPE html>\n"
 		"<html>\n<head>\n"
+    "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
 		"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"
 		"<title>", fp);
 	xmlencode(fp, title, strlen(title));
@@ -918,7 +919,7 @@ writefiles(FILE *fp, const git_oid *id)
 	git_commit *commit = NULL;
 	int ret = -1;
 
-	fputs("<table id=\"files\"><thead>\n<tr>"
+	fputs("<div id=\"table-scroll\"><table id=\"files\"><thead>\n<tr>"
 	      "<td><b>Mode</b></td><td><b>Name</b></td>"
 	      "<td class=\"num\" align=\"right\"><b>Size</b></td>"
 	      "</tr>\n</thead><tbody>\n", fp);
@@ -927,7 +928,7 @@ writefiles(FILE *fp, const git_oid *id)
 	    !git_commit_tree(&tree, commit))
 		ret = writefilestree(fp, tree, "");
 
-	fputs("</tbody></table>", fp);
+	fputs("</tbody></table></div>", fp);
 
 	git_commit_free(commit);
 	git_tree_free(tree);
@@ -1004,7 +1005,7 @@ writerefs(FILE *fp)
 
 			/* print header if it has an entry (first). */
 			if (++count == 1) {
-				fprintf(fp, "<h2>%s</h2><table id=\"%s\">"
+				fprintf(fp, "<h2>%s</h2><div id=\"table-scroll\"><table id=\"%s\">"
 			                "<thead>\n<tr><td><b>Name</b></td>"
 				        "<td><b>Last commit date</b></td>"
 				        "<td><b>Author</b></td>\n</tr>\n"
@@ -1035,7 +1036,7 @@ writerefs(FILE *fp)
 		}
 		/* table footer */
 		if (count)
-			fputs("</tbody></table><br/>", fp);
+			fputs("</tbody></table></div><br/>", fp);
 	}
 
 err:
@@ -1187,7 +1188,7 @@ main(int argc, char *argv[])
 	relpath = "";
 	mkdir("commit", S_IRWXU | S_IRWXG | S_IRWXO);
 	writeheader(fp, "Log");
-	fputs("<table id=\"log\"><thead>\n<tr><td><b>Date</b></td>"
+	fputs("<div id=\"table-scroll\"><table id=\"log\"><thead>\n<tr><td><b>Date</b></td>"
 	      "<td><b>Commit message</b></td>"
 	      "<td><b>Author</b></td><td class=\"num\" align=\"right\"><b>Files</b></td>"
 	      "<td class=\"num\" align=\"right\"><b>+</b></td>"
@@ -1231,7 +1232,7 @@ main(int argc, char *argv[])
 			writelog(fp, head);
 	}
 
-	fputs("</tbody></table>", fp);
+	fputs("</tbody></table></div>", fp);
 	writefooter(fp);
 	fclose(fp);
 
diff --git a/style.css b/style.css
@@ -1,6 +1,6 @@
 body {
-	color: #000;
-	background-color: #fff;
+	color: #E3E0D7;
+	background-color: #242424;
 	font-family: monospace;
 }
 
@@ -17,8 +17,16 @@ img {
 	border: 0;
 }
 
+a {
+  color: #8DBFFF;
+}
+
+a:hover {
+  color: #F9690E;
+}
+
 a:target {
-	background-color: #ccc;
+	background-color: #303030;
 }
 
 a.d,
@@ -33,7 +41,7 @@ a.line {
 }
 
 #blob a:hover {
-	color: blue;
+	color: #F9690E;
 	text-decoration: none;
 }
 
@@ -45,6 +53,11 @@ table td {
 	padding: 0 0.4em;
 }
 
+#blob, div#table-scroll {
+  overflow: scroll;
+  padding-bottom: 3em;
+}
+
 #content table td {
 	vertical-align: top;
 	white-space: nowrap;
@@ -55,7 +68,7 @@ table td {
 #index tr:hover td,
 #log tr:hover td,
 #files tr:hover td {
-	background-color: #eee;
+	background-color: #303030;
 }
 
 #index tr td:nth-child(2),
@@ -84,19 +97,19 @@ pre {
 }
 
 pre a.h {
-	color: #00a;
+	color: #8DBFFF;
 }
 
 .A,
 span.i,
 pre a.i {
-	color: #070;
+	color: #79D688;
 }
 
 .D,
 span.d,
 pre a.d {
-	color: #e00;
+	color: #F9690E;
 }
 
 pre a.h:hover,