2022-02-06 12:51:54 +00:00
|
|
|
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
|
|
|
|
<link href="{{"css/nucleus.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
|
|
|
<link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
|
|
|
<link href="{{"css/featherlight.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
|
|
|
<link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
|
|
|
<link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
|
|
|
<link href="{{"css/theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
2022-02-13 00:53:23 +00:00
|
|
|
{{- $themevariants := slice | append .Site.Params.themeVariant }}
|
|
|
|
{{- with index $themevariants 0 }}
|
|
|
|
<link id="variant-style" href="{{(printf "css/theme-%s.css" .) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
2022-02-06 12:51:54 +00:00
|
|
|
<link href="{{"css/variant.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
|
|
|
{{- end }}
|
2022-02-17 07:49:17 +00:00
|
|
|
<link href="{{"css/theme-relearn-light.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print">
|
2022-02-06 12:51:54 +00:00
|
|
|
<link href="{{"css/print.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print">
|
|
|
|
{{- range .Site.Params.custom_css }}
|
|
|
|
<link href="{{(printf "%s" .) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
|
|
|
{{- end }}
|
2022-02-13 11:49:45 +00:00
|
|
|
<style>
|
|
|
|
{{- if .Site.Params.disableInlineCopyToClipBoard }}
|
2022-02-17 18:21:20 +00:00
|
|
|
:not(pre) > code.copy-to-clipboard-code + span.copy-to-clipboard-button {
|
2022-02-13 11:49:45 +00:00
|
|
|
display: none;
|
|
|
|
}
|
2022-02-17 18:21:20 +00:00
|
|
|
:not(pre) > code.copy-to-clipboard-code {
|
2022-02-13 11:49:45 +00:00
|
|
|
border-bottom-right-radius: 2px;
|
|
|
|
border-top-right-radius: 2px;
|
|
|
|
border-right-width: 1px;
|
|
|
|
}
|
|
|
|
{{- end }}
|
|
|
|
</style>
|
2022-02-13 01:11:27 +00:00
|
|
|
<script>
|
2022-02-15 00:37:48 +00:00
|
|
|
{{ "// we need to define this script in the head to avoid flickering" | safeJS }}
|
|
|
|
{{ "// on page load if the user has selected a non default variant" | safeJS }}
|
2022-02-13 01:11:27 +00:00
|
|
|
var theme = window.localStorage.getItem( 'theme' );
|
2022-02-13 01:30:05 +00:00
|
|
|
changeTheme( theme );
|
2022-02-18 23:46:34 +00:00
|
|
|
function parseTheme( s ){
|
|
|
|
if( !s || !s.match ){
|
|
|
|
return '';
|
|
|
|
}
|
2022-02-19 13:21:16 +00:00
|
|
|
var matches = s.match(/^.*\/?theme-(.*?)\.css.*$/);
|
2022-02-18 23:46:34 +00:00
|
|
|
var theme = matches && matches.length == 2 ? matches[ 1 ] : '';
|
|
|
|
return theme;
|
|
|
|
}
|
2022-02-13 01:30:05 +00:00
|
|
|
function getTheme(){
|
|
|
|
var link = document.querySelector( '#variant-style' );
|
2022-02-13 08:32:52 +00:00
|
|
|
if( !link ){
|
|
|
|
return;
|
|
|
|
}
|
2022-02-13 01:30:05 +00:00
|
|
|
var path = link.getAttribute( 'href' );
|
2022-02-18 23:46:34 +00:00
|
|
|
var theme = parseTheme( path );
|
2022-02-13 01:30:05 +00:00
|
|
|
return theme;
|
|
|
|
}
|
|
|
|
function markTheme( theme ){
|
|
|
|
var select = document.querySelector( '#select-theme' );
|
2022-02-13 08:32:52 +00:00
|
|
|
if( !select ){
|
|
|
|
return;
|
2022-02-13 01:32:52 +00:00
|
|
|
}
|
2022-02-13 08:32:52 +00:00
|
|
|
select.value = theme;
|
2022-02-13 01:30:05 +00:00
|
|
|
}
|
2022-02-13 11:48:38 +00:00
|
|
|
function changeTheme( theme ){
|
|
|
|
{{- $quotedthemevariants := slice }}
|
|
|
|
{{- range $themevariants }}
|
|
|
|
{{- $quotedthemevariants = $quotedthemevariants | append (printf "\"%s\"" .) }}
|
|
|
|
{{- end }}
|
|
|
|
var themes = [ {{ delimit $quotedthemevariants ", " | safeJS }} ];
|
2022-02-15 00:37:48 +00:00
|
|
|
if( themes.indexOf( theme ) < 0 ){
|
2022-02-13 11:48:38 +00:00
|
|
|
theme = themes.length ? themes[ 0 ] : null;
|
|
|
|
}
|
2022-02-13 01:11:27 +00:00
|
|
|
if( !theme ){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var link = document.querySelector( '#variant-style' );
|
2022-02-13 08:32:52 +00:00
|
|
|
if( !link ){
|
|
|
|
return;
|
|
|
|
}
|
2022-02-13 01:11:27 +00:00
|
|
|
var old_path = link.getAttribute( 'href' );
|
|
|
|
var new_path = old_path.replace( /^(.*\/theme-).*?(\.css.*)$/, '$1' + theme + '$2' );
|
|
|
|
if( old_path != new_path ){
|
|
|
|
window.localStorage.setItem( 'theme', theme );
|
|
|
|
link.setAttribute( 'href', new_path );
|
2022-02-13 01:30:05 +00:00
|
|
|
markTheme( theme );
|
2022-02-15 00:37:48 +00:00
|
|
|
{{ "// remove selection, because if some uses an arrow navigation" | safeJS }}
|
|
|
|
{{ "// by pressing the left or right cursor key, we will automatically" | safeJS }}
|
|
|
|
{{ "// select a different style" | safeJS }}
|
2022-02-13 01:11:27 +00:00
|
|
|
if( document.activeElement ){
|
|
|
|
document.activeElement.blur();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2022-02-06 12:51:54 +00:00
|
|
|
<script src="{{"js/jquery.min.js"| relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
|