summaryrefslogtreecommitdiff
path: root/layouts/partials/head/headscript.html
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-31 15:41:22 +0800
committerEltrac <hi@guhub.cn>2025-03-31 15:41:22 +0800
commit0cab77ee79f81634e1c145cdb230a31d0a4e389b (patch)
treebaedb39ea7fc05a51b68922a9044421ac0e277a3 /layouts/partials/head/headscript.html
parente9d529d21e4de47ab12d12f33700473b64b65b40 (diff)
refactor: better encapsulation of heatmap and pagefind
move initializers of both components into its own file Former-commit-id: ed628a0a4983dd0b21030b365558b514d7ac6d1f
Diffstat (limited to 'layouts/partials/head/headscript.html')
-rw-r--r--layouts/partials/head/headscript.html41
1 files changed, 0 insertions, 41 deletions
diff --git a/layouts/partials/head/headscript.html b/layouts/partials/head/headscript.html
index 1dec4c13..ed68e4c8 100644
--- a/layouts/partials/head/headscript.html
+++ b/layouts/partials/head/headscript.html
@@ -11,42 +11,6 @@ if (window.location.hostname !== 'localhost') {
document.head.appendChild(script);
}
-/* === cal-heatmap Initializing Method */
-
-function initCalHeatmap() {
- // Initialize CalHeatmap
- const cal = new CalHeatmap();
-
- // Calculate the date 6 months ago
- const startDate = new Date();
- startDate.setMonth(startDate.getMonth() - 12);
-
- // Render the heatmap
- cal.paint({
- domain: {
- type: 'month',
- },
- subDomain: { type: 'day' },
- scale: {
- color: {
- range: ['#eee', 'black'],
- type: 'linear',
- domain: [0, 6000],
- },
- },
- date: {
- timezone: 'Asia/Shanghai',
- start: startDate,
- },
- data: {
- source: '/cal-heatmap.json', // 指定数据源
- x: d => new Date(d.date), // 提取日期字段并转换为 Date 对象
- y: d => d.value, // 提取数值字段
- defaultValue: 0, // 缺失数据的默认值
- },
- });
-}
-
/* === giscus === */
function loadGiscus() {
const giscusContainer = document.querySelector('.giscus'); // Make sure this matches your Giscus container class
@@ -72,9 +36,4 @@ function loadGiscus() {
document.body.appendChild(script);
}
}
-
-/* == Pagefind === */
-function initPagefind() {
- new PagefindUI({ element: "#search", showSubResults: true });
-}
</script>