Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dev]更了下dev,然后发现toc-wrapper没了,就是右侧那个根据本章内小标题生成的列表 #317

Closed
2 tasks done
ted423 opened this issue Sep 28, 2021 · 12 comments

Comments

@ted423
Copy link

ted423 commented Sep 28, 2021

「描述遇到的问题」或「发现的 bug」(Describe the problem or bug you encounter)
#316
因为这个issue升的
确认了下 toc确实是enable的
你是否已经阅读过以下内容,并确认你的行为是正确的,在 [ ] 中填入 x 选中(Ensure that you had consulted followings and confirm the validity of your operation, fill x in [ ] to select)

如何复现(To Reproduce)

存在问题或 bug 的已部署上线的页面地址(A deployed page link that with bug or problem)

如果可能是与 markdown 内容相关的问题或 bug,请粘贴对应的 markdown 内容(If the problem or bug that may be related to markdown, paste it here)

打开控制台,填写控制台中打印的主题的版本,如果脚本出错可直接提供控制台截图(Open the console and report the version of hexo-theme-archer. You can paste the screenshot on console directly if there is error with script)

信息 (please complete the following information):

  • 操作系统(OS): [e.g. iOS]
  • 浏览器(Browser) [e.g. chrome, safari]
  • 浏览器版本(Version)[e.g. 22][可选]

其他信息(Additional context)

@ted423 ted423 changed the title 更了下dev,然后发现toc-wrapper没了,就是右侧那个根据本章内小标题生成的列表 [Dev]更了下dev,然后发现toc-wrapper没了,就是右侧那个根据本章内小标题生成的列表 Sep 28, 2021
@ted423
Copy link
Author

ted423 commented Sep 28, 2021

还有这个报错
image

image
h是2级标题,只有两个,然后c到2的时候就报错退出了
看了下右边还是有东西,
只不过有个opacity: 0;
大概是脚本出错导致css没改

@LolipopJ
Copy link
Collaborator

我这边使用 dev 分支代码并没有出现渲染失败的问题……

或许尝试一下 Hexo 根目录执行 hexo clean 清除以前版本的缓存文件避免冲突?

@ted423
Copy link
Author

ted423 commented Sep 30, 2021

我这边使用 dev 分支代码并没有出现渲染失败的问题……

或许尝试一下 Hexo 根目录执行 hexo clean 清除以前版本的缓存文件避免冲突?

我这边尝试了hexo clean
也试了删除主题文件,重新解压也是一样

@ted423
Copy link
Author

ted423 commented Sep 30, 2021

又试了下,现在没有报错,主要是
&-loding {
opacity: 0;
}
这个的问题

@LolipopJ
Copy link
Collaborator

src/js/toc.js 执行的最后一步移除了其未就绪的等待状态:$('.toc-wrapper').removeClass('toc-wrapper-loding')。我这边能够正常移除:

image

也许还是您那边的脚本文件未能正确执行?是每一篇博客都出现了这个问题吗?

@ted423
Copy link
Author

ted423 commented Sep 30, 2021

我发现又开始报错了,每篇都有。报错是导致右边的二级标题无法展开

toc.js:142 Uncaught TypeError: Cannot set property 'onclick' of undefined
at i (toc.js:142)
at s (toc.js:125)
at L (toc.js:194)
at HTMLDocument. (init.js:45)

@ted423
Copy link
Author

ted423 commented Sep 30, 2021

https://ted423.github.io/Anime/Frozen/#/P2P
似乎是因为i超了上限,i是14,但二级标题只有11个

@ted423
Copy link
Author

ted423 commented Sep 30, 2021

只有1级标题的情况下,archorjsLinks length是0,但是仍然会读下,导致报错,我现在是吧loding 那个opacity注释掉了
https://ted423.github.io/Software/tools/#KeePassXC

@LolipopJ
Copy link
Collaborator

LolipopJ commented Sep 30, 2021

我想问题出在每个标题后的这个小链接图标:

image

它并没有在执行脚本前渲染出来,我想应该修改一下渲染顺序试试看。

我再加一个判断,如果不存在这个 archorjsLinks,就跳过:

if (archorjsLinks.length && archorjsLinks.length > i) {
  archorjsLinks[i].onclick = () => {
    tocOnclickFunction()
    return false
  }
}

已经推动修改到 dev 分支,现在再试试呢……

@LolipopJ
Copy link
Collaborator

目前 toc.js 存在一些问题,我计划后面将它重写一遍。

@ted423
Copy link
Author

ted423 commented Sep 30, 2021

了解,我不急哈

@LolipopJ
Copy link
Collaborator

Fixed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants