Skip to content

Commit 71fa72d

Browse files
committed
okay
1 parent 9c8938c commit 71fa72d

2 files changed

Lines changed: 145 additions & 8 deletions

File tree

config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,10 @@ menu:
1212
name: Home
1313
url: /
1414
weight: 10
15-
- identifier: application
16-
name: App
17-
url: /application
18-
weight: 11
1915
- identifier: blog
2016
name: NET
2117
url: /blog
2218
weight: 12
23-
- identifier: games
24-
name: Game
25-
url: /games
26-
weight: 13
2719
- identifier: search
2820
name: Search
2921
url: /search

layouts/_partials/footer.html

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{{- if not (.Param "hideFooter") }}
2+
<footer class="footer">
3+
{{- if not site.Params.footer.hideCopyright }}
4+
{{- if site.Copyright }}
5+
<span>{{ site.Copyright | markdownify }}</span>
6+
{{- else }}
7+
<span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ site.Title }}</a></span>
8+
{{- end }}
9+
{{- if site.Params.footer.text }}
10+
{{- print " · "}}
11+
{{- end }}
12+
{{- end }}
13+
14+
{{- with site.Params.footer.text }}
15+
{{ . | markdownify }}
16+
{{- end }}
17+
</footer>
18+
{{- end }}
19+
20+
{{- if (not site.Params.disableScrollToTop) }}
21+
<a href="#top" id="top-link" class="top-link hidden" aria-label="go to top" title="Go to Top (Alt + G)" accesskey="g">
22+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
23+
stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevrons-up">
24+
<polyline points="17 11 12 6 7 11"></polyline>
25+
<polyline points="17 18 12 13 7 18"></polyline>
26+
</svg>
27+
</a>
28+
{{- end }}
29+
30+
{{- partial "extend_footer.html" . }}
31+
32+
<script>
33+
let menu = document.getElementById('menu');
34+
if (menu) {
35+
const scrollPosition = localStorage.getItem("menu-scroll-position");
36+
if (scrollPosition) {
37+
menu.scrollLeft = parseInt(scrollPosition, 10);
38+
}
39+
40+
menu.onscroll = function () {
41+
localStorage.setItem("menu-scroll-position", menu.scrollLeft);
42+
}
43+
}
44+
45+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
46+
anchor.addEventListener("click", function (e) {
47+
e.preventDefault();
48+
var id = this.getAttribute("href").substr(1);
49+
if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
50+
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({
51+
behavior: "smooth"
52+
});
53+
} else {
54+
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView();
55+
}
56+
if (id === "top") {
57+
history.replaceState(null, null, " ");
58+
} else {
59+
history.pushState(null, null, `#${id}`);
60+
}
61+
});
62+
});
63+
64+
</script>
65+
66+
{{- if (not site.Params.disableScrollToTop) }}
67+
<script>
68+
var toplink = document.getElementById("top-link");
69+
window.onscroll = function () {
70+
const scrollThreshold = window.innerHeight;
71+
if (document.body.scrollTop > scrollThreshold || document.documentElement.scrollTop > scrollThreshold) {
72+
toplink.classList.remove("hidden");
73+
} else {
74+
toplink.classList.add("hidden");
75+
}
76+
};
77+
78+
</script>
79+
{{- end }}
80+
81+
{{- if (not site.Params.disableThemeToggle) }}
82+
<script>
83+
document.getElementById("theme-toggle").addEventListener("click", () => {
84+
const html = document.querySelector("html");
85+
if (html.dataset.theme === "dark") {
86+
html.dataset.theme = 'light';
87+
localStorage.setItem("pref-theme", 'light');
88+
} else {
89+
html.dataset.theme = 'dark';
90+
localStorage.setItem("pref-theme", 'dark');
91+
}
92+
})
93+
94+
</script>
95+
{{- end }}
96+
97+
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }}
98+
<script>
99+
document.querySelectorAll('pre > code').forEach((codeblock) => {
100+
const container = codeblock.parentNode.parentNode;
101+
102+
const copybutton = document.createElement('button');
103+
copybutton.classList.add('copy-code');
104+
copybutton.innerHTML = '{{- i18n "code_copy" | default "copy" }}';
105+
106+
function copyingDone() {
107+
copybutton.innerHTML = '{{- i18n "code_copied" | default "copied!" }}';
108+
setTimeout(() => {
109+
copybutton.innerHTML = '{{- i18n "code_copy" | default "copy" }}';
110+
}, 2000);
111+
}
112+
113+
copybutton.addEventListener('click', (cb) => {
114+
if ('clipboard' in navigator) {
115+
navigator.clipboard.writeText(codeblock.textContent);
116+
copyingDone();
117+
return;
118+
}
119+
120+
const range = document.createRange();
121+
range.selectNodeContents(codeblock);
122+
const selection = window.getSelection();
123+
selection.removeAllRanges();
124+
selection.addRange(range);
125+
try {
126+
document.execCommand('copy');
127+
copyingDone();
128+
} catch (e) { };
129+
selection.removeRange(range);
130+
});
131+
132+
if (container.classList.contains("highlight")) {
133+
container.appendChild(copybutton);
134+
} else if (container.parentNode.firstChild == container) {
135+
// td containing LineNos
136+
} else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") {
137+
// table containing LineNos and code
138+
codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton);
139+
} else {
140+
// code blocks not having highlight as parent class
141+
codeblock.parentNode.appendChild(copybutton);
142+
}
143+
});
144+
</script>
145+
{{- end }}

0 commit comments

Comments
 (0)