Fixed js bug on visited function

parent 7b1d5bd5
/*** Autoscroll ***/
let autoscroll = () => {
container = document.querySelector("#site");
cell = document.querySelector(".cell.selected");
container = document.querySelector("#site");
cell = document.querySelector(".cell.selected");
dy = (container.clientHeight - cell.clientHeight) / 2;
dy = (container.clientHeight - cell.clientHeight) / 2;
if (dy < 0) dy = 0;
if (dy < 0) dy = 0;
container.scrollTop = cell.offsetTop - dy;
container.scrollTop = cell.offsetTop - dy;
};
$([IPython.events]).on("select.Cell", autoscroll);
$([IPython.events]).on("output_appended.OutputArea", function () {
setTimeout(autoscroll, 10);
setTimeout(autoscroll, 10);
});
/*** Auto reveal ***/
/*** visited cell marker ***/
(() => {
let style = document.createElement('style');
let style = document.createElement('style');
document.head.appendChild(style);
document.head.appendChild(style);
style.type = 'text/css';
style.innerText = ".unselected { visibility: hidden;}";
style.type = 'text/css';
style.innerText = ".cell { visibility: hidden;}";
setTimeout(() => {
document.querySelector(".cell.selected").classList.add("visited");
document.querySelectorAll(".cell.unselected").forEach(e => {
e.classList.add("unvisited");
});
document.querySelectorAll(".cell:not(:first-of-type)").forEach(e => {
e.classList.add("unselected");
});
$([IPython.events]).on("select.Cell", () => {
document.querySelector(".cell.selected").classList.remove("unselected");
});
style.innerText = ".cell.unvisited { visibility: hidden;}";
$([IPython.events]).on("select.Cell", () => {
document.querySelector(".cell.selected").classList.add("visited");
document.querySelector(".cell.selected").classList.remove("unvisited");
});
}, 200);
})();
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment