1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

perf: replace jQuery with Vanilla JS (#1681)

Also replaced `magnific-popup` with `GLightbox`
This commit is contained in:
Cotes Chung
2024-04-17 06:10:01 +08:00
committed by GitHub
parent c85e9e2394
commit fe7afa379f
22 changed files with 274 additions and 305 deletions

View File

@@ -28,7 +28,7 @@
{ threshold: [0] }
);
disqus_observer.observe(document.querySelector('#disqus_thread'));
disqus_observer.observe(document.getElementById('disqus_thread'));
/* Auto switch theme */
function reloadDisqus() {
@@ -44,7 +44,7 @@
}
}
if (document.querySelector('.mode-toggle')) {
if (document.getElementById('mode-toggle')) {
window.addEventListener('message', reloadDisqus);
}
</script>

View File

@@ -2,7 +2,6 @@
<script type="text/javascript">
(function () {
const origin = 'https://giscus.app';
const iframe = 'iframe.giscus-frame';
const lightTheme = 'light';
const darkTheme = 'dark_dimmed';
@@ -58,7 +57,7 @@
}
};
const giscus = document.querySelector(iframe).contentWindow;
const giscus = document.getElementsByClassName('giscus-frame')[0].contentWindow;
giscus.postMessage({ giscus: message }, origin);
}
});

View File

@@ -10,7 +10,6 @@
<script type="text/javascript">
(function () {
const origin = 'https://utteranc.es';
const iframe = 'iframe.utterances-frame';
const lightTheme = 'github-light';
const darkTheme = 'github-dark';
let initTheme = lightTheme;
@@ -43,7 +42,7 @@
theme: theme
};
const utterances = document.querySelector(iframe).contentWindow;
const utterances = document.getElementsByClassName('utterances-frame')[0].contentWindow;
utterances.postMessage(message, origin);
});
})();