mirror of
https://github.com/suk-ws/ph-Bookshelf.git
synced 2025-01-31 21:13:00 +08:00
36 lines
1.7 KiB
JavaScript
36 lines
1.7 KiB
JavaScript
/******************************************************************************
|
||
##############################################################################
|
||
##### #####
|
||
##### JavaScript of ph-Bookshelf of ui design BreadCard #####
|
||
##### enhanced extension #####
|
||
##### for ! Permalink Highlight ! #####
|
||
##### for ¶[Heading Permalink](#heading-permalink) #####
|
||
##### #####
|
||
##### @author: Sukazyo Workshop #####
|
||
##### @version: 1.0 #####
|
||
##### #####
|
||
##############################################################################
|
||
******************************************************************************/
|
||
|
||
const headingPermalink_animaTimeoutMs = 150;
|
||
|
||
function headingPermalink_onScrollFocused (event) {
|
||
const node = event.target;
|
||
node.classList.add("highlighting");
|
||
sleep(headingPermalink_animaTimeoutMs).then(() => {
|
||
node.classList.remove("highlighting");
|
||
sleep(headingPermalink_animaTimeoutMs).then(() => {
|
||
node.classList.add("highlighting");
|
||
sleep(headingPermalink_animaTimeoutMs).then(() => {
|
||
node.classList.remove("highlighting");
|
||
});
|
||
});
|
||
});
|
||
}
|
||
|
||
for (const node of document.getElementsByClassName("heading-permalink")) {
|
||
node.addEventListener("focus", headingPermalink_onScrollFocused);
|
||
}
|
||
|
||
// document.getElementById("main").addEventListener("scrollend", onHeadingPermalinkScrollFocused);
|