mirror of
https://github.com/suk-ws/ph-Bookshelf.git
synced 2024-12-05 09:26:52 +08:00
Eyre_S
4b5a33278f
- 添加插件 rolling-title 可以使网页标题有滚动向左的效果 - 默认关闭,使用 enhanced.web.web-title.rolling-title = true 打开 - PHP Markdown 添加 Heading_Permalink 插件 - 支持了自动为标题生成同名定位标 - 添加了一个 ⁕ 悬浮的 permalink 按钮 - 添加了插件 heading-permalink-highlights 使标题被定位时 permalink 按钮会产生闪烁效果
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);
|