diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2020-04-07 21:25:16 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2020-04-07 21:32:28 +0100 |
commit | 15342b5f5bc741565a848fbc0abb351dd8dd02a5 (patch) | |
tree | 79734ee10307aaa4e7d8dbf58273f9596d2acb89 | |
parent | aa1513ed92deb690d65009549da0ac2c1a1a2683 (diff) | |
download | netsurf-15342b5f5bc741565a848fbc0abb351dd8dd02a5.tar.gz netsurf-15342b5f5bc741565a848fbc0abb351dd8dd02a5.tar.bz2 |
About pages: Update presentation using nscolour.
-rw-r--r-- | content/fetchers/about.c | 195 | ||||
-rw-r--r-- | resources/internal.css | 74 |
2 files changed, 115 insertions, 154 deletions
diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 02eb79d3e..249d372f0 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -282,6 +282,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) unsigned int cent_loop = 0; int elen = 0; /* entry length */ nserror res; + bool even = false; /* content is going to return ok */ fetch_set_http_code(ctx->fetchh, code); @@ -293,16 +294,12 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) /* page head */ res = ssenddataf(ctx, "<html>\n<head>\n" - "<title>NetSurf Browser Image Cache Status</title>\n" + "<title>Image Cache Status</title>\n" "<link rel=\"stylesheet\" type=\"text/css\" " "href=\"resource:internal.css\">\n" "</head>\n" - "<body id =\"cachelist\">\n" - "<p class=\"banner\">" - "<a href=\"http://www.netsurf-browser.org/\">" - "<img src=\"resource:netsurf.png\" alt=\"NetSurf\"></a>" - "</p>\n" - "<h1>NetSurf Browser Image Cache Status</h1>\n"); + "<body id =\"cachelist\" class=\"ns-even-bg ns-even-fg ns-border\">\n" + "<h1 class=\"ns-border\">Image Cache Status</h1>\n"); if (res != NSERROR_OK) { goto fetch_about_imagecache_handler_aborted; } @@ -324,7 +321,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) "(from %v images converted more than once)" "</p>\n" "<p>Bitmap of size %w had most (%x) conversions</p>\n" - "<h2>Current image cache contents</h2>\n"); + "<h2 class=\"ns-border\">Current contents</h2>\n"); if (slen >= (int) (sizeof(buffer))) { goto fetch_about_imagecache_handler_aborted; /* overflow */ } @@ -355,19 +352,35 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) slen = 0; do { - elen = image_cache_snentryf(buffer + slen, - sizeof buffer - slen, - cent_loop, - "<a href=\"%U\">" - "<span>%e</span>" - "<span>%k</span>" - "<span>%r</span>" - "<span>%c</span>" - "<span>%a</span>" - "<span>%g</span>" - "<span>%s</span>" - "<span>%o</span>" - "</a>\n"); + if (even) { + elen = image_cache_snentryf(buffer + slen, + sizeof buffer - slen, + cent_loop, + "<a href=\"%U\">" + "<span class=\"ns-border\">%e</span>" + "<span class=\"ns-border\">%k</span>" + "<span class=\"ns-border\">%r</span>" + "<span class=\"ns-border\">%c</span>" + "<span class=\"ns-border\">%a</span>" + "<span class=\"ns-border\">%g</span>" + "<span class=\"ns-border\">%s</span>" + "<span class=\"ns-border\">%o</span>" + "</a>\n"); + } else { + elen = image_cache_snentryf(buffer + slen, + sizeof buffer - slen, + cent_loop, + "<a class=\"ns-odd-bg\" href=\"%U\">" + "<span class=\"ns-border\">%e</span>" + "<span class=\"ns-border\">%k</span>" + "<span class=\"ns-border\">%r</span>" + "<span class=\"ns-border\">%c</span>" + "<span class=\"ns-border\">%a</span>" + "<span class=\"ns-border\">%g</span>" + "<span class=\"ns-border\">%s</span>" + "<span class=\"ns-border\">%o</span>" + "</a>\n"); + } if (elen <= 0) break; /* last option */ @@ -381,6 +394,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) /* normal addition */ slen += elen; cent_loop++; + even = !even; } } while (elen > 0); @@ -582,29 +596,6 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) nserror res; struct cert_chain *chain = NULL; - colour bg; - colour fg; - colour border; - colour outside; - - res = ns_system_colour_char("Window", &bg); - if (res != NSERROR_OK) { - return false; - } - - res = ns_system_colour_char("WindowText", &fg); - if (res != NSERROR_OK) { - return false; - } - - outside = mix_colour(fg, bg, 0x0c); - border = mix_colour(fg, bg, 0x40); - - bg = colour_rb_swap(bg); - fg = colour_rb_swap(fg); - border = colour_rb_swap(border); - outside = colour_rb_swap(outside); - /* content is going to return ok */ fetch_set_http_code(ctx->fetchh, code); @@ -618,23 +609,9 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) "<title>NetSurf Browser Certificate Viewer</title>\n" "<link rel=\"stylesheet\" type=\"text/css\" " "href=\"resource:internal.css\">\n" - "<style>\n" - "html {\n" - "\tbackground-color: #%06x;\n" - "}\n" - "body {\n" - "\tcolor: #%06x;\n" - "\tbackground-color: #%06x;\n" - "\tborder-color: #%06x;\n" - "}\n" - "h2 {\n" - "\tborder-color: #%06x;\n" - "}\n" - "</style>\n" "</head>\n" - "<body id =\"certificate\">\n" - "<h1>Certificate</h1>\n", - outside, fg, bg, border, border); + "<body class=\"ns-even-bg ns-even-fg ns-border\">\n" + "<h1 class=\"ns-border\">Certificate</h1>\n"); if (res != NSERROR_OK) { goto fetch_about_certificate_handler_aborted; } @@ -652,14 +629,14 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) size_t depth; for (depth = 0; depth < chain->depth; depth++) { res = ssenddataf(ctx, - "<h2>Certificate: %d</h2>\n" + "<h2 class=\"ns-border\">Certificate: %d</h2>\n" "<p>Subject: %s</p>" "<p>Serial Number: %s</p>" "<p>Type: %i</p>" "<p>Version: %ld</p>" "<p>Issuer: %s</p>" "<p>Valid From: %s</p>" - "<p>Valid Untill: %s</p>", + "<p>Valid Until: %s</p>", depth, cert_info[depth].subject, cert_info[depth].serialnum, @@ -716,6 +693,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) unsigned int opt_loop = 0; int elen = 0; /* entry length */ nserror res; + bool even = false; /* content is going to return ok */ fetch_set_http_code(ctx->fetchh, 200); @@ -726,23 +704,21 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) } res = ssenddataf(ctx, - "<html>\n<head>\n" - "<title>NetSurf Browser Config</title>\n" - "<link rel=\"stylesheet\" type=\"text/css\" " - "href=\"resource:internal.css\">\n" - "</head>\n" - "<body id =\"configlist\">\n" - "<p class=\"banner\">" - "<a href=\"http://www.netsurf-browser.org/\">" - "<img src=\"resource:netsurf.png\"" - " alt=\"NetSurf\"></a>" - "</p>\n" - "<h1>NetSurf Browser Config</h1>\n" - "<table class=\"config\">\n" - "<tr><th>Option</th>" - "<th>Type</th>" - "<th>Provenance</th>" - "<th>Setting</th></tr>\n"); + "<html>\n<head>\n" + "<title>NetSurf Browser Config</title>\n" + "<link rel=\"stylesheet\" type=\"text/css\" " + "href=\"resource:internal.css\">\n" + "</head>\n" + "<body " + "id =\"configlist\" " + "class=\"ns-even-bg ns-even-fg ns-border\" " + "style=\"overflow: hidden;\">\n" + "<h1 class=\"ns-border\">NetSurf Browser Config</h1>\n" + "<table class=\"config\">\n" + "<tr><th>Option</th>" + "<th>Type</th>" + "<th>Provenance</th>" + "<th>Setting</th></tr>\n"); if (res != NSERROR_OK) { goto fetch_about_config_handler_aborted; } @@ -751,10 +727,27 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) msg.data.header_or_data.buf = (const uint8_t *) buffer; do { - elen = nsoption_snoptionf(buffer + slen, - sizeof buffer - slen, - opt_loop, - "<tr><th>%k</th><td>%t</td><td>%p</td><td>%V</td></tr>\n"); + if (even) { + elen = nsoption_snoptionf(buffer + slen, + sizeof buffer - slen, + opt_loop, + "<tr>" + "<th class=\"ns-border\">%k</th>" + "<td class=\"ns-border\">%t</td>" + "<td class=\"ns-border\">%p</td>" + "<td class=\"ns-border\">%V</td>" + "</tr>\n"); + } else { + elen = nsoption_snoptionf(buffer + slen, + sizeof buffer - slen, + opt_loop, + "<tr class=\"ns-odd-bg\">" + "<th class=\"ns-border\">%k</th>" + "<td class=\"ns-border\">%t</td>" + "<td class=\"ns-border\">%p</td>" + "<td class=\"ns-border\">%V</td>" + "</tr>\n"); + } if (elen <= 0) break; /* last option */ @@ -768,6 +761,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) /* normal addition */ slen += elen; opt_loop++; + even = !even; } } while (elen > 0); @@ -1162,17 +1156,15 @@ static bool fetch_about_query_auth_handler(struct fetch_about_context *ctx) goto fetch_about_query_auth_handler_aborted; } - title = messages_get("LoginTitle"); - res = ssenddataf(ctx, "<html>\n<head>\n" "<title>%s</title>\n" "<link rel=\"stylesheet\" type=\"text/css\" " "href=\"resource:internal.css\">\n" "</head>\n" - "<body id =\"authentication\">\n" - "<h1>%s</h1>\n", + "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"authentication\">\n" + "<h1 class=\"ns-border\">%s</h1>\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_auth_handler_aborted; @@ -1331,8 +1323,8 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx) "<link rel=\"stylesheet\" type=\"text/css\" " "href=\"resource:internal.css\">\n" "</head>\n" - "<body id =\"privacy\">\n" - "<h1>%s</h1>\n", + "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"privacy\">\n" + "<h1 class=\"ns-border ns-odd-fg-bad\">%s</h1>\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_ssl_handler_aborted; @@ -1453,8 +1445,8 @@ static bool fetch_about_query_timeout_handler(struct fetch_about_context *ctx) "<link rel=\"stylesheet\" type=\"text/css\" " "href=\"resource:internal.css\">\n" "</head>\n" - "<body id =\"timeout\">\n" - "<h1>%s</h1>\n", + "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"timeout\">\n" + "<h1 class=\"ns-border ns-odd-fg-bad\">%s</h1>\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_timeout_handler_aborted; @@ -1576,8 +1568,8 @@ fetch_about_query_fetcherror_handler(struct fetch_about_context *ctx) "<link rel=\"stylesheet\" type=\"text/css\" " "href=\"resource:internal.css\">\n" "</head>\n" - "<body id =\"fetcherror\">\n" - "<h1>%s</h1>\n", + "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"fetcherror\">\n" + "<h1 class=\"ns-border ns-odd-fg-bad\">%s</h1>\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_fetcherror_handler_aborted; @@ -1712,6 +1704,13 @@ struct about_handlers about_handler_list[] = { true }, { + "nscolours.css", + SLEN("nscolours.css"), + NULL, + fetch_about_nscolours_handler, + true + }, + { "logo", SLEN("logo"), NULL, @@ -1795,16 +1794,12 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx) res = ssenddataf(ctx, "<html>\n<head>\n" - "<title>NetSurf List of About pages</title>\n" + "<title>List of NetSurf pages</title>\n" "<link rel=\"stylesheet\" type=\"text/css\" " "href=\"resource:internal.css\">\n" "</head>\n" - "<body id =\"aboutlist\">\n" - "<p class=\"banner\">" - "<a href=\"http://www.netsurf-browser.org/\">" - "<img src=\"resource:netsurf.png\" alt=\"NetSurf\"></a>" - "</p>\n" - "<h1>NetSurf List of About pages</h1>\n" + "<body class=\"ns-even-bg ns-even-fg ns-border\">\n" + "<h1 class =\"ns-border\">List of NetSurf pages</h1>\n" "<ul>\n"); if (res != NSERROR_OK) { goto fetch_about_config_handler_aborted; diff --git a/resources/internal.css b/resources/internal.css index 6a0949923..5b0bd4fcd 100644 --- a/resources/internal.css +++ b/resources/internal.css @@ -110,7 +110,8 @@ dd > ul { .footer p { margin-top: 1.5em; padding-top: 0.4em; - border-top: 2px solid #94adff; } + border-top-width: 2px; + border-top-style: solid; } input.default-action { color: white; @@ -196,7 +197,11 @@ body#dirlist span.size + span.size { */ body#configlist table.config { - border-spacing: 0; } + border-spacing: 0; + font-size: 85%; + margin: 1.3em 0; + width: 100%; + box-sizing: border-box } body#configlist table.config tr:nth-child(2n-1) { background: #eee; } @@ -204,14 +209,19 @@ body#configlist table.config tr:nth-child(2n-1) { body#configlist table.config tr:first-child th { text-align: left; font-weight: bold; - font-family: sans-serif; - background: #ddd; } + font-family: sans-serif; } body#configlist table.config tr th { text-align: left; font-weight: normal; font-family: monospace; } +body#configlist table.config tr+tr th, +body#configlist table.config tr+tr td { + border-top-width: 1px; + border-top-style: solid; +} + body#configlist table.config td, body#configlist table.config th { padding-left: 1em; } @@ -224,7 +234,7 @@ body#configlist table.config tr *:nth-child(4) { padding-right: 1em; } body#configlist .null-content { - font-style: italic; } + font-style: italic; } /* @@ -238,24 +248,20 @@ p.imagecachelist { display: table; } -p.imagecachelist a:nth-child(2n+3) { - background: #e8edff; -} - p.imagecachelist strong, p.imagecachelist a { display: table-row; } -p.imagecachelist strong span { - background: #c8d5ff; -} - p.imagecachelist span { - border-top: 1px solid #bcf; padding: 2px 0.5em; display: table-cell; } +p.imagecachelist a+a span { + border-top-width: 1px; + border-top-style: solid; +} + /* * authentication query styling */ @@ -264,21 +270,11 @@ body#authentication { max-width: 45em; } -body#authentication h1 { - padding: 0.8em 0.4em 0.5em 0.4em; - border-bottom: 0.1em solid #444; - margin: 0 0 1.3em 0; - background: #777; - color: white; -} - body#authentication form { /* Just to center the form on the page */ margin: 0 auto; /* To see the outline of the form */ padding: 1em; - border: 1px solid #CCC; - border-radius: 1em; } body#authentication table { @@ -328,21 +324,11 @@ body#privacy { max-width: 45em; } -body#privacy h1 { - padding: 0.8em 0.4em 0.5em 0.4em; - border-bottom: 0.1em solid #444; - margin: 0 0 1.3em 0; - background: #c55; - color: white; -} - body#privacy form { /* Just to center the form on the page */ margin: 0 auto; /* To see the outline of the form */ padding: 1em; - border: 1px solid #CCC; - border-radius: 1em; } body#privacy form div + div { @@ -366,21 +352,11 @@ body#timeout { max-width: 45em; } -body#timeout h1 { - padding: 0.8em 0.4em 0.5em 0.4em; - border-bottom: 0.1em solid #444; - margin: 0 0 1.3em 0; - background: #c55; - color: white; -} - body#timeout form { /* Just to center the form on the page */ margin: 0 auto; /* To see the outline of the form */ padding: 1em; - border: 1px solid #CCC; - border-radius: 1em; } body#timeout form div + div { @@ -404,21 +380,11 @@ body#fetcherror { max-width: 45em; } -body#fetcherror h1 { - padding: 0.8em 0.4em 0.5em 0.4em; - border-bottom: 0.1em solid #444; - margin: 0 0 1.3em 0; - background: #c55; - color: white; -} - body#fetcherror form { /* Just to center the form on the page */ margin: 0 auto; /* To see the outline of the form */ padding: 1em; - border: 1px solid #CCC; - border-radius: 1em; } body#fetcherror form div + div { |