File tree 1 file changed +12
-2
lines changed 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 55
55
// @grant GM_addStyle
56
56
// @grant GM_setValue
57
57
// @grant GM_getValue
58
- // @require https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.11.1 /tocbot.min.js
58
+ // @require https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.18.2 /tocbot.min.js
59
59
// @icon https://raw.githubusercontent.com/hikerpig/toc-bar-userscript/master/toc-logo.svg
60
60
// @homepageURL https://github.com/hikerpig/toc-bar-userscript
61
61
// @downloadURL https://raw.githubusercontent.com/hikerpig/toc-bar-userscript/master/toc-bar.user.js
73
73
* @property {() => Boolean } shouldShow
74
74
* @property {(ele) => HTMLElement } findHeaderId
75
75
* @property {(e) => void } onClick
76
+ * @property {(tocBar: TocBar) => void } onInit
76
77
*/
77
78
78
79
/** @type {{[key: string]: Partial<SiteSetting>} } */
209
210
}
210
211
} ,
211
212
'developer.mozilla.org' : {
212
- contentSelector : '#content'
213
+ contentSelector : '#content' ,
214
+ onInit ( ) {
215
+ setTimeout ( ( ) => {
216
+ tocbot . refresh ( )
217
+ } , 2000 )
218
+ }
213
219
} ,
214
220
'learning.oreilly.com' : {
215
221
contentSelector : '#sbo-rt-content'
@@ -771,6 +777,7 @@ a.toc-link {
771
777
} ,
772
778
/**
773
779
* @method TocBar
780
+ * @param {SiteSetting } options
774
781
*/
775
782
initTocbot ( options ) {
776
783
const me = this
@@ -811,6 +818,9 @@ a.toc-link {
811
818
// console.log('tocbotOptions', tocbotOptions);
812
819
try {
813
820
tocbot . init ( tocbotOptions )
821
+ if ( options . onInit ) {
822
+ options . onInit ( this )
823
+ }
814
824
} catch ( error ) {
815
825
console . warn ( 'error in tocbot.init' , error )
816
826
}
You can’t perform that action at this time.
0 commit comments