Skip to content

Commit

Permalink
add new adapter: followin (#467)
Browse files Browse the repository at this point in the history
* 加了一个ReadButton, 把GPT输出的文本转换为语音朗读出来

* add new adapter: followin

* 适配长推文,调整列表边距

---------

Co-authored-by: Petaflops <[email protected]>
  • Loading branch information
AI-Chef and Petaflops authored Jul 21, 2023
1 parent 5963049 commit 8f5306a
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/content-script/site-adapters/followin/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { cropText } from '../../../utils'

export default {
inputQuery: async () => {
try {
const author = document.querySelector('main article a > span')?.textContent
const description =
document.querySelector('#article-content')?.textContent ||
document.querySelector('#thead-gallery')?.textContent
if (author && description) {
const title = document.querySelector('main article h1')?.textContent
if (title) {
return await cropText(
`以下是一篇文章,请给出文章的结论和3到5个要点.标题是:"${title}",作者是:"${author}",内容是:\n"${description}".
`,
)
} else {
return await cropText(
`以下是一篇长推文,请给出文章的结论和3到5个要点.作者是:"${author}",内容是:\n"${description}".
`,
)
}
}
} catch (e) {
console.log(e)
}
},
}
7 changes: 7 additions & 0 deletions src/content-script/site-adapters/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import quora from './quora'
import stackoverflow from './stackoverflow'
import juejin from './juejin'
import weixin from './weixin'
import followin from './followin'

/**
* @typedef {object} SiteConfigAction
Expand Down Expand Up @@ -185,4 +186,10 @@ export const config = {
appendContainerQuery: [],
resultsContainerQuery: ['#js_content'],
},
followin: {
inputQuery: followin.inputQuery,
sidebarContainerQuery: [],
appendContainerQuery: [],
resultsContainerQuery: ['#article-content', '#thead-gallery'],
},
}
11 changes: 11 additions & 0 deletions src/content-script/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[data-theme='auto'] {
@import 'github-markdown-css/github-markdown.css';

@media screen and (prefers-color-scheme: dark) {
@import 'highlight.js/scss/github-dark.scss';
--font-color: #c9d1d9;
Expand All @@ -13,6 +14,7 @@
--color-neutral-muted: rgba(110, 118, 129, 0.4);
--code-background-color: rgb(13, 17, 23);
}

@media screen and (prefers-color-scheme: light) {
@import 'highlight.js/scss/github.scss';
--font-color: #24292f;
Expand Down Expand Up @@ -98,26 +100,32 @@
background-color: var(--theme-color);
width: 9px;
}

::-webkit-scrollbar-thumb {
background-color: var(--theme-border-color);
border-radius: 20px;
border: transparent;
}

::-webkit-scrollbar-corner {
background: transparent;
}

&::-webkit-scrollbar {
background-color: var(--theme-color);
width: 9px;
}

&::-webkit-scrollbar-thumb {
background-color: var(--theme-border-color);
border-radius: 20px;
border: transparent;
}

&::-webkit-scrollbar-corner {
background: transparent;
}

p {
color: var(--font-color);
}
Expand All @@ -133,6 +141,7 @@

li {
counter-increment: item;
margin-bottom: 0px;

&::marker {
content: counter(item) '. ';
Expand Down Expand Up @@ -288,11 +297,13 @@
background-color: var(--theme-color);
width: 9px;
}

&::-webkit-scrollbar-thumb {
background-color: var(--theme-border-color);
border-radius: 20px;
border: transparent;
}

&::-webkit-scrollbar-corner {
background: transparent;
}
Expand Down

0 comments on commit 8f5306a

Please sign in to comment.