|
26 | 26 | // @match *://www.smashingmagazine.com/*/*
|
27 | 27 | // @match *://distill.pub/*
|
28 | 28 | // @match *://github.com/*/*
|
| 29 | +// @match *://github.com/*/issues/* |
29 | 30 | // @match *://developer.mozilla.org/*/docs/*
|
30 | 31 | // @match *://learning.oreilly.com/library/view/*
|
31 | 32 | // @match *://developer.chrome.com/extensions/*
|
|
102 | 103 | 'github.com': {
|
103 | 104 | contentSelector() {
|
104 | 105 | const README_SEL = '#readme'
|
105 |
| - const WIKI_CONTENT_SEL = '.repository-content' |
106 |
| - const matchedSel = [README_SEL, WIKI_CONTENT_SEL].find((sel) => { |
107 |
| - return !!document.querySelector(README_SEL) |
| 106 | + const WIKI_CONTENT_SEL = '#wiki-body' |
| 107 | + const ISSUE_CONTENT_SEL = '.comment' |
| 108 | + const matchedSel = [README_SEL, ISSUE_CONTENT_SEL, WIKI_CONTENT_SEL].find((sel) => { |
| 109 | + return !!document.querySelector(sel) |
108 | 110 | })
|
109 | 111 |
|
110 | 112 | if (matchedSel) return matchedSel
|
111 | 113 |
|
112 | 114 | return false
|
113 | 115 | },
|
| 116 | + scrollSmoothOffset() { |
| 117 | + const isIssueDetail = /\/issues\//.test(location.pathname) |
| 118 | + if (isIssueDetail) return -60 |
| 119 | + return 0 |
| 120 | + }, |
114 | 121 | initialTop: 500,
|
115 | 122 | },
|
116 | 123 | 'developer.mozilla.org': {
|
|
161 | 168 | if (!contentSelector) return
|
162 | 169 | siteSetting = {...siteSetting, contentSelector}
|
163 | 170 | }
|
| 171 | + if (typeof siteSetting.scrollSmoothOffset === 'function') { |
| 172 | + siteSetting.scrollSmoothOffset = {...siteSetting, scrollSmoothOffset: siteSetting.scrollSmoothOffset()} |
| 173 | + } |
164 | 174 | console.log('[toc-bar] found site info for', siteInfo.siteName)
|
165 | 175 | return siteSetting
|
166 | 176 | }
|
|
0 commit comments