mirror of
https://github.com/SqrtMinusOne/sqrtminusone.github.io.git
synced 2025-12-11 16:13:03 +03:00
fix: images & resize TOC
This commit is contained in:
parent
e0886d64a5
commit
92ca9a8341
2 changed files with 23 additions and 4 deletions
|
|
@ -55,7 +55,11 @@
|
||||||
file))
|
file))
|
||||||
file 'overwrite))
|
file 'overwrite))
|
||||||
|
|
||||||
;; (copy-directory (expand-file-name "~/dot-stats/img") "dot-stats/img" t t)
|
(copy-directory
|
||||||
|
(expand-file-name
|
||||||
|
(format "%s/repos/dotfiles/dot-imgs/"
|
||||||
|
(vc-find-root default-directory ".git")))
|
||||||
|
"dot-imgs" t t)
|
||||||
|
|
||||||
(dolist (file my/config-files)
|
(dolist (file my/config-files)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ let currentActiveLinkId = null;
|
||||||
let elemsToHide = [];
|
let elemsToHide = [];
|
||||||
let linksById = {};
|
let linksById = {};
|
||||||
|
|
||||||
let headerObserver;
|
let headerObserver = null;
|
||||||
|
|
||||||
function observeHeadings() {
|
function observeHeadings() {
|
||||||
const links = document.querySelectorAll(`#${tocId} a`);
|
const links = document.querySelectorAll(`#${tocId} a`);
|
||||||
|
|
@ -94,10 +94,25 @@ function showHeadings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setUpObserver() {
|
||||||
|
if (document.documentElement.clientWidth >= (750 + 350 + 25)) {
|
||||||
|
if (headerObserver === null) {
|
||||||
|
observeHeadings();
|
||||||
|
observeButtons();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (headerObserver !== null) {
|
||||||
|
headerObserver.disconnect();
|
||||||
|
headerObserver = null;
|
||||||
|
showHeadings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.addEventListener("load", (event) => {
|
window.addEventListener("load", (event) => {
|
||||||
if ("IntersectionObserver" in window) {
|
if ("IntersectionObserver" in window) {
|
||||||
observeHeadings();
|
setUpObserver();
|
||||||
observeButtons();
|
window.addEventListener("resize", setUpObserver);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue