Merge branch 'main' of https://github.com/Mitrichius/hugo-theme-anubis into anubis
# Conflicts: # README.md # assets/css/main.css # layouts/partials/header.html
This commit is contained in:
commit
b2702eff55
19 changed files with 24 additions and 89 deletions
3
layouts/partials/fa-icons/halfcircle.svg
Normal file
3
layouts/partials/fa-icons/halfcircle.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 290 290">
|
||||
<path d="M142.959,0C64.131,0,0,64.132,0,142.96c0,78.828,64.131,142.959,142.959,142.959c78.828,0,142.96-64.131,142.96-142.959 C285.919,64.132,221.787,0,142.959,0z M142.959,260.919V142.96V25c65.043,0,117.96,52.917,117.96,117.96 C260.919,208.003,208.002,260.919,142.959,260.919z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 358 B |
|
@ -19,8 +19,6 @@
|
|||
{{ partial "footer-extra.html" . }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{ partial "theme-switcher.html" . }}
|
||||
</div>
|
||||
|
||||
{{ partial "h-card.html" . }}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
<div class="header-top noselect">
|
||||
{{ partial "site-title.html" . }}
|
||||
{{ partial "social.html" . }}
|
||||
<div class="header-top">
|
||||
<div class="header-top-left">
|
||||
{{ partial "site-title.html" . }}
|
||||
{{ partial "social.html" . }}
|
||||
</div>
|
||||
<div class="header-top-right">
|
||||
{{ partial "theme-switcher.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ if .Site.Menus.main }}
|
||||
<nav class="noselect">
|
||||
{{ $currentPage := . }}
|
||||
|
@ -15,4 +21,4 @@
|
|||
|
||||
{{ if .Site.Params.mathjax }}{{ partial "mathjax_support.html" . }}{{ end }}
|
||||
|
||||
{{ partial "header-extra.html" . }}
|
||||
{{ partial "header-extra.html" . }}
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
{{ if not (in (slice "light-without-switcher" "dark-without-switcher") $style) }}
|
||||
{{ if ne "auto-without-switcher" $style }}
|
||||
<button class="theme-switcher">
|
||||
{{ i18n "darkTheme" }}
|
||||
</button>
|
||||
<div class="theme-switcher">
|
||||
{{ partial "font-awesome.html" (dict "iconName" "halfcircle" "custom" false) }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<script>
|
||||
|
@ -21,7 +21,6 @@ let autoDefinedScheme = window.matchMedia('(prefers-color-scheme: dark)')
|
|||
const autoChangeScheme = e => {
|
||||
currentTheme = e.matches ? 'dark' : 'light'
|
||||
document.documentElement.setAttribute('data-theme', currentTheme)
|
||||
changeButtonText()
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
@ -36,7 +35,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
}
|
||||
|
||||
if (switchButton) {
|
||||
changeButtonText()
|
||||
switchButton.addEventListener('click', switchTheme, false)
|
||||
}
|
||||
|
||||
|
@ -59,13 +57,6 @@ function detectCurrentScheme() {
|
|||
return 'light'
|
||||
}
|
||||
|
||||
function changeButtonText()
|
||||
{
|
||||
if (switchButton) {
|
||||
switchButton.textContent = currentTheme == 'dark' ? {{ i18n "lightTheme" }} : {{ i18n "darkTheme" }}
|
||||
}
|
||||
}
|
||||
|
||||
function switchTheme(e) {
|
||||
if (currentTheme == 'dark') {
|
||||
if (localStorage !== null)
|
||||
|
@ -78,7 +69,6 @@ function switchTheme(e) {
|
|||
document.documentElement.setAttribute('data-theme', 'dark')
|
||||
currentTheme = 'dark'
|
||||
}
|
||||
changeButtonText()
|
||||
}
|
||||
|
||||
function showContent() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue