[PATCH 2/5] httpd_indexcgi.c: use CSS for odd/even rows

Denys Vlasenko vda.linux at googlemail.com
Fri Jul 31 16:16:04 UTC 2020


This only works for me when in this order:

"tr:nth-child(odd) { background-color:#ffffff }"       \
"tr.hdr { background-color:#eee5de }"                  \
"tr.foot { background-color:#eee5de }"                 \

Modified and applied, thanks!

On Fri, Jul 10, 2020 at 9:50 PM Sergey Ponomarev <stokito at gmail.com> wrote:
>
> Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
> ---
>  networking/httpd_indexcgi.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/networking/httpd_indexcgi.c b/networking/httpd_indexcgi.c
> index f5f18959d..a94d4983e 100644
> --- a/networking/httpd_indexcgi.c
> +++ b/networking/httpd_indexcgi.c
> @@ -77,8 +77,7 @@ httpd_indexcgi.c -o index.cgi
>    "white-space:nowrap"                                 \
>  "}"                                                    \
>  "tr.hdr { background-color:#eee5de }"                  \
> -"tr.o { background-color:#ffffff }"                    \
> -/* tr.e { ... } - for even rows (currently none) */    \
> +"tr:nth-child(odd) { background-color:#ffffff }"       \
>  "tr.foot { background-color:#eee5de }"                 \
>  "th.cnt { text-align:left }"                           \
>  "th.sz { text-align:right }"                           \
> @@ -220,7 +219,6 @@ int main(int argc, char *argv[])
>         unsigned count_dirs;
>         unsigned count_files;
>         unsigned long long size_total;
> -       int odd;
>         DIR *dirp;
>         char *location;
>
> @@ -291,7 +289,6 @@ int main(int argc, char *argv[])
>                 "<col class=nm><col class=sz><col class=dt>" "\n"
>                 "<tr class=hdr><th class=cnt>Name<th class=sz>Size<th class=dt>Last modified" "\n");
>
> -       odd = 0;
>         count_dirs = 0;
>         count_files = 0;
>         size_total = 0;
> @@ -307,9 +304,7 @@ int main(int argc, char *argv[])
>                 } else
>                         goto next;
>
> -               fmt_str("<tr class=");
> -               *dst++ = (odd ? 'o' : 'e');
> -               fmt_str("><td class=nm><a href='");
> +               fmt_str("<tr><td class=nm><a href='");
>                 fmt_url(cdir->dl_name); /* %20 etc */
>                 if (S_ISDIR(cdir->dl_mode))
>                         *dst++ = '/';
> @@ -330,7 +325,6 @@ int main(int argc, char *argv[])
>                 fmt_02u(ptm->tm_sec);
>                 *dst++ = '\n';
>
> -               odd = 1 - odd;
>   next:
>                 cdir++;
>         }
> --
> 2.25.1
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list