aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortenox <as@tenoware.com>2016-08-22 00:39:22 -0700
committertenox <as@tenoware.com>2016-08-22 00:39:22 -0700
commit7209125f0c6bc89bb9226df93cc00549608c2118 (patch)
tree954b05c4454252743f3b46bd29066b33380a6d5d
parent77fb204475e2a6920f9575686446f98f664b1fd4 (diff)
downloadwfm-7209125f0c6bc89bb9226df93cc00549608c2118.tar.gz
alternating colors for non-js browsers
-rw-r--r--dir.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/dir.c b/dir.c
index 7f2f1f8..7df7901 100644
--- a/dir.c
+++ b/dir.c
@@ -64,7 +64,7 @@ void dirlist(void) {
char *stime;
char sortby[64];
char *name, *icon, *linecolor;
- int nentr=0, e;
+ int nentr=0, e=0, n=1;
int editable;
time_t now;
@@ -404,13 +404,22 @@ void dirlist(void) {
else if(now-direntry[e].mtime < 365*24*3600) stime=M_YR;
else stime=M_OLD;
+
if(strcmp(highlight, name)==0) {
icon=NEWIMG;
linecolor=tHIGH_COLOR;
}
else {
icon=DIRIMG;
- linecolor=tNORMAL_COLOR;
+ if(js) {
+ linecolor=tNORMAL_COLOR;
+ }
+ else {
+ if(n % 2)
+ linecolor=tNORMAL_COLOR;
+ else
+ linecolor=tALTER_COLOR;
+ }
}
@@ -422,11 +431,11 @@ void dirlist(void) {
"<TR BGCOLOR=\"#%s\" ", linecolor);
if(js)
- fprintf(cgiOut, "onMouseOver=\"this.bgColor='#%s';\" onMouseOut=\"this.bgColor='#%s';\">\n",
+ fprintf(cgiOut, "onMouseOver=\"this.bgColor='#%s';\" onMouseOut=\"this.bgColor='#%s';\"",
HL_COLOR, linecolor);
fprintf(cgiOut,
- "><TD NOWRAP ALIGN=\"LEFT\">\n"
+ ">\n<TD NOWRAP ALIGN=\"LEFT\">\n"
"<INPUT TYPE=\"CHECKBOX\" NAME=\"multiselect_filename\" STYLE=\"border: none;\" VALUE=\"%s\">",
name);
@@ -463,6 +472,7 @@ void dirlist(void) {
cgiScriptName, virt_dirname, name, token, name, ICONSURL);
totalsize+=size;
+ n++;
}
@@ -507,7 +517,15 @@ void dirlist(void) {
linecolor=tHIGH_COLOR;
}
else {
- linecolor=tNORMAL_COLOR;
+ if(js) {
+ linecolor=tNORMAL_COLOR;
+ }
+ else {
+ if(n % 2)
+ linecolor=tNORMAL_COLOR;
+ else
+ linecolor=tALTER_COLOR;
+ }
}
// filename
@@ -518,11 +536,11 @@ void dirlist(void) {
"<TR BGCOLOR=\"#%s\" ", linecolor);
if(js)
- fprintf(cgiOut, "onMouseOver=\"this.bgColor='#%s';\" onMouseOut=\"this.bgColor='#%s';\">\n",
+ fprintf(cgiOut, "onMouseOver=\"this.bgColor='#%s';\" onMouseOut=\"this.bgColor='#%s';\"\n",
HL_COLOR, linecolor);
fprintf(cgiOut,
- "><TD NOWRAP ALIGN=\"LEFT\"><INPUT TYPE=\"CHECKBOX\" NAME=\"multiselect_filename\" STYLE=\"border: none;\" VALUE=\"%s\">"
+ ">\n<TD NOWRAP ALIGN=\"LEFT\"><INPUT TYPE=\"CHECKBOX\" NAME=\"multiselect_filename\" STYLE=\"border: none;\" VALUE=\"%s\">"
"<A HREF=\"%s?action=%s&amp;directory=%s&amp;filename=%s&amp;token=%s\" TITLE=\"Open '%s'\">%s %s</A></TD>\n",
name, cgiScriptName, (edit_by_default && editable) ? "edit" : "sendfile", virt_dirname, name, token, name, icon, name);
@@ -605,7 +623,7 @@ void dirlist(void) {
}
totalsize+=size;
-
+ n++;
}
tstop();