mirror of
https://github.com/tomfran/typo.git
synced 2025-04-26 13:39:55 +03:00
Theme Update
This commit is contained in:
parent
16d9fb1710
commit
70a938a3a5
3 changed files with 32 additions and 1 deletions
|
@ -281,4 +281,13 @@ footer a {
|
|||
|
||||
.autonumber h4:before {
|
||||
content: counter(h2-counter) "." counter(h3-counter) "." counter(h4-counter) "\00a0\00a0";
|
||||
}
|
||||
|
||||
/* Dark mode */
|
||||
.dark .img-light {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.light .img-dark {
|
||||
display: none !important;
|
||||
}
|
|
@ -1 +1,14 @@
|
|||
console.log('This site was generated by Hugo.');
|
||||
const images = document.querySelectorAll('img');
|
||||
|
||||
images.forEach(img => {
|
||||
|
||||
if (img.src.endsWith('#dark-mode')) {
|
||||
|
||||
console.log('found');
|
||||
|
||||
img.onload = function () {
|
||||
console.log(`Image loaded: ${img.src}`);
|
||||
};
|
||||
|
||||
}
|
||||
});
|
9
layouts/_default/_markup/render-image.html
Normal file
9
layouts/_default/_markup/render-image.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{ $url := .Destination | safeURL }}
|
||||
|
||||
{{/* Append class to figures based on ending -> #dark or #light */}}
|
||||
|
||||
<figure {{ $file_name_array :=split $url "#" }} {{ $file_name_len :=len $file_name_array }} {{ if eq (index
|
||||
$file_name_array (sub $file_name_len 1)) "dark" }} class="img-dark" {{ else if eq (index $file_name_array (sub
|
||||
$file_name_len 1)) "light" }} class="img-light" {{end }}>
|
||||
<img src="{{ $url }}">
|
||||
</figure>
|
Loading…
Add table
Add a link
Reference in a new issue