hikerpig / toc-bar-userscript

A user script that adds floating widget displaying table of content of current page

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] 需要刷新后才能生效

lihuacai168 opened this issue · comments

问题

我增加了对https://testerhome.com/这个网站的支持
从首页点击帖子(任意帖子都行),进入到帖子页面后,脚本没有生效
需要重新刷新,才会生效。
麻烦问一下是什么问题呢

default.mp4

代码改动

image

目前只是topics页面生效,articles木有生效,如果能帮忙支持,就太好啦

// @match             *://testerhome.com/topics/*
// @match             *://testerhome.com/articles/*


    'testerhome.com': {
        contentSelector: location.pathname.includes('articles') ? '.topic-detail .card' : '.col-lg-9',
    },

你可以提一个 PR 看看?
一般不生效可能是由于页面属于前端渲染的,在刚 load 完脚本的时候还没有对应元素 (不过不确定你这个 case 是不是)

你可以提一个 PR 看看? 一般不生效可能是由于页面属于前端渲染的,在刚 load 完脚本的时候还没有对应元素 (不过不确定你这个 case 是不是)

感谢回复,暂时不打算搞了,我找到另外一个项目,可以自动识别文章内容toc-auto,不用每个网站自定义。