git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
emoji: white image backgrounds in dark style
[sheet.git]
/
common.inc.plp
diff --git
a/common.inc.plp
b/common.inc.plp
index a9d5875920da8565c8b6c6ce9c0ce46119f2b16d..6d6a532ed348afa6021bb3c4dd674db1fbea6c76 100644
(file)
--- a/
common.inc.plp
+++ b/
common.inc.plp
@@
-72,12
+72,10
@@
sub stylesheet {
} or warn "Unable to create style cookie: $@";
}
} or warn "Unable to create style cookie: $@";
}
- $style ||= exists $cookie{style} && $styles{ $cookie{style} } || $avail[0];
-
- return map { sprintf(
- '<link rel="%s" type="text/css" media="all" href="%s" title="%s">',
- $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.19", $_
- ) } @avail;
+ $style ||= $styles{$_} for $cookie{style} || ();
+ my $setstyle = $style;
+ $style ||= $avail[0];
+ return $setstyle;
}
sub checkmodified {
}
sub checkmodified {
@@
-141,11
+139,11
@@
sub Html {
$header{content_type} = "text/html; charset=$meta->{charset}"
unless $PLP::sentheaders;
exit if $ENV{REQUEST_METHOD} eq 'HEAD';
$header{content_type} = "text/html; charset=$meta->{charset}"
unless $PLP::sentheaders;
exit if $ENV{REQUEST_METHOD} eq 'HEAD';
- unshift @{ $meta->{raw} }, stylesheet($meta->{stylesheet});
-
push
@{ $meta->{raw} }, (
- '<link rel="stylesheet" type="text/css" media="
monochrome" href="/mono.css?1.11" title="light
">',
+
unshift
@{ $meta->{raw} }, (
+ '<link rel="stylesheet" type="text/css" media="
all" href="/light.css?1.20
">',
);
);
+ $meta->{stylesheet} = stylesheet($meta->{stylesheet});
if (my $img = $meta->{image}) {
my $proto = sprintf('http%s://', !!$ENV{HTTPS} && 's');
if (my $img = $meta->{image}) {
my $proto = sprintf('http%s://', !!$ENV{HTTPS} && 's');
@@
-166,7
+164,9
@@
sub Html {
PLP_START {
# leading output
say '<!DOCTYPE html>';
PLP_START {
# leading output
say '<!DOCTYPE html>';
- say qq(<html lang="$meta->{lang}">);
+ my $rootattr = '';
+ $rootattr .= qq( class="s-$_") for $meta->{stylesheet} || ();
+ say qq(<html lang="$meta->{lang}"$rootattr>);
say '';
say '<head>';
say sprintf '<meta http-equiv="content-type" content="%s">', $_
say '';
say '<head>';
say sprintf '<meta http-equiv="content-type" content="%s">', $_
@@
-180,6
+180,10
@@
sub Html {
say '<link rel="icon" type="image/png" href="/clip.png">';
say for map { @{$_} } $meta->{raw} || ();
say '<meta name="robots" content="noindex">' if $Dev;
say '<link rel="icon" type="image/png" href="/clip.png">';
say for map { @{$_} } $meta->{raw} || ();
say '<meta name="robots" content="noindex">' if $Dev;
+ say "<script>$_</script>" for join($/,
+ "if (m = window.matchMedia('(monochrome)'))",
+ "(m.onchange = e => document.documentElement.classList.toggle('s-mono', e.matches))(m);",
+ );
say '</head>';
say '';
say sprintf '<body id="%s">', $file;
say '</head>';
say '';
say sprintf '<body id="%s">', $file;