Skip to content

Commit 8f5306a

Browse files
AI-ChefPetaflops
andauthored
add new adapter: followin (#467)
* 加了一个ReadButton, 把GPT输出的文本转换为语音朗读出来 * add new adapter: followin * 适配长推文,调整列表边距 --------- Co-authored-by: Petaflops <[email protected]>
1 parent 5963049 commit 8f5306a

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { cropText } from '../../../utils'
2+
3+
export default {
4+
inputQuery: async () => {
5+
try {
6+
const author = document.querySelector('main article a > span')?.textContent
7+
const description =
8+
document.querySelector('#article-content')?.textContent ||
9+
document.querySelector('#thead-gallery')?.textContent
10+
if (author && description) {
11+
const title = document.querySelector('main article h1')?.textContent
12+
if (title) {
13+
return await cropText(
14+
`以下是一篇文章,请给出文章的结论和3到5个要点.标题是:"${title}",作者是:"${author}",内容是:\n"${description}".
15+
`,
16+
)
17+
} else {
18+
return await cropText(
19+
`以下是一篇长推文,请给出文章的结论和3到5个要点.作者是:"${author}",内容是:\n"${description}".
20+
`,
21+
)
22+
}
23+
}
24+
} catch (e) {
25+
console.log(e)
26+
}
27+
},
28+
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import quora from './quora'
99
import stackoverflow from './stackoverflow'
1010
import juejin from './juejin'
1111
import weixin from './weixin'
12+
import followin from './followin'
1213

1314
/**
1415
* @typedef {object} SiteConfigAction
@@ -185,4 +186,10 @@ export const config = {
185186
appendContainerQuery: [],
186187
resultsContainerQuery: ['#js_content'],
187188
},
189+
followin: {
190+
inputQuery: followin.inputQuery,
191+
sidebarContainerQuery: [],
192+
appendContainerQuery: [],
193+
resultsContainerQuery: ['#article-content', '#thead-gallery'],
194+
},
188195
}

src/content-script/styles.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
[data-theme='auto'] {
55
@import 'github-markdown-css/github-markdown.css';
6+
67
@media screen and (prefers-color-scheme: dark) {
78
@import 'highlight.js/scss/github-dark.scss';
89
--font-color: #c9d1d9;
@@ -13,6 +14,7 @@
1314
--color-neutral-muted: rgba(110, 118, 129, 0.4);
1415
--code-background-color: rgb(13, 17, 23);
1516
}
17+
1618
@media screen and (prefers-color-scheme: light) {
1719
@import 'highlight.js/scss/github.scss';
1820
--font-color: #24292f;
@@ -98,26 +100,32 @@
98100
background-color: var(--theme-color);
99101
width: 9px;
100102
}
103+
101104
::-webkit-scrollbar-thumb {
102105
background-color: var(--theme-border-color);
103106
border-radius: 20px;
104107
border: transparent;
105108
}
109+
106110
::-webkit-scrollbar-corner {
107111
background: transparent;
108112
}
113+
109114
&::-webkit-scrollbar {
110115
background-color: var(--theme-color);
111116
width: 9px;
112117
}
118+
113119
&::-webkit-scrollbar-thumb {
114120
background-color: var(--theme-border-color);
115121
border-radius: 20px;
116122
border: transparent;
117123
}
124+
118125
&::-webkit-scrollbar-corner {
119126
background: transparent;
120127
}
128+
121129
p {
122130
color: var(--font-color);
123131
}
@@ -133,6 +141,7 @@
133141

134142
li {
135143
counter-increment: item;
144+
margin-bottom: 0px;
136145

137146
&::marker {
138147
content: counter(item) '. ';
@@ -288,11 +297,13 @@
288297
background-color: var(--theme-color);
289298
width: 9px;
290299
}
300+
291301
&::-webkit-scrollbar-thumb {
292302
background-color: var(--theme-border-color);
293303
border-radius: 20px;
294304
border: transparent;
295305
}
306+
296307
&::-webkit-scrollbar-corner {
297308
background: transparent;
298309
}

0 commit comments

Comments
 (0)