Skip to content

Commit 0fa19da

Browse files
committed
update adaption for reddit and gitlab
1 parent 53e94fd commit 0fa19da

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/content-script/site-adapters/index.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ export const config = {
145145
},
146146
gitlab: {
147147
inputQuery: gitlab.inputQuery,
148-
sidebarContainerQuery: ['.js-commit-box-info'],
148+
sidebarContainerQuery: ['.info-well', '.js-commit-box-info'],
149149
appendContainerQuery: [],
150-
resultsContainerQuery: ['.js-commit-box-info'],
150+
resultsContainerQuery: ['.info-well', '.js-commit-box-info'],
151151
},
152152
zhihu: {
153153
inputQuery: zhihu.inputQuery,
@@ -157,9 +157,9 @@ export const config = {
157157
},
158158
reddit: {
159159
inputQuery: reddit.inputQuery,
160-
sidebarContainerQuery: ['.side div:nth-child(2)'],
160+
sidebarContainerQuery: ['#pdp-right-rail-topics div'],
161161
appendContainerQuery: [],
162-
resultsContainerQuery: ['.side div:nth-child(2)'],
162+
resultsContainerQuery: ['#pdp-right-rail-topics div'],
163163
},
164164
quora: {
165165
inputQuery: quora.inputQuery,

src/content-script/site-adapters/reddit/index.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { cropText } from '../../../utils'
33
export default {
44
inputQuery: async () => {
55
try {
6-
const title = document.querySelector('.entry .title').textContent
7-
const texts = document.querySelectorAll('.entry .usertext-body')
8-
let description
9-
if (texts.length > 0) description = texts[0].textContent
6+
const title = document.querySelector('.main shreddit-post div:nth-child(4)').textContent
7+
const description = document.querySelector(
8+
'.main shreddit-post div:nth-child(6) div',
9+
).textContent
10+
const texts = document.querySelectorAll('shreddit-comment div:nth-child(2)')
1011
let answers = ''
11-
if (texts.length > 1)
12-
for (let i = 1; i < texts.length; i++) {
13-
answers += `answer${i}:${texts[i].textContent}|`
14-
}
12+
for (let i = 0; i < texts.length; i++) {
13+
answers += `answer${i}:${texts[i].textContent}|`
14+
}
1515

1616
return cropText(
1717
`Below is the content from a social forum,giving the corresponding summary and your opinion on it.` +

0 commit comments

Comments
 (0)