From 538f18c721778091431be68f8f4647fbd4521903 Mon Sep 17 00:00:00 2001 From: AI-Chef Date: Fri, 21 Jul 2023 07:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E9=95=BF=E6=8E=A8=E6=96=87,?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=97=E8=A1=A8=E8=BE=B9=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../site-adapters/followin/index.mjs | 25 ++++++++++++------- src/content-script/site-adapters/index.mjs | 2 +- src/content-script/styles.scss | 11 ++++++++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/content-script/site-adapters/followin/index.mjs b/src/content-script/site-adapters/followin/index.mjs index 733b96dc..619e5465 100644 --- a/src/content-script/site-adapters/followin/index.mjs +++ b/src/content-script/site-adapters/followin/index.mjs @@ -3,16 +3,23 @@ import { cropText } from '../../../utils' export default { inputQuery: async () => { try { - const title = document.querySelector('main article h1')?.textContent - const description = document.querySelector('#article-content')?.textContent - if (title && description) { - const author = document.querySelector('main article a > span')?.textContent - return await cropText( - `以下是一篇文章,标题是:"${title}",作者是:"${author}",内容是:\n"${description}".请以如下格式输出你的回答: - ====== - {文章摘要} + 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) diff --git a/src/content-script/site-adapters/index.mjs b/src/content-script/site-adapters/index.mjs index b2820b54..989b8713 100644 --- a/src/content-script/site-adapters/index.mjs +++ b/src/content-script/site-adapters/index.mjs @@ -190,6 +190,6 @@ export const config = { inputQuery: followin.inputQuery, sidebarContainerQuery: [], appendContainerQuery: [], - resultsContainerQuery: ['#article-content'], + resultsContainerQuery: ['#article-content', '#thead-gallery'], }, } diff --git a/src/content-script/styles.scss b/src/content-script/styles.scss index eb7d4887..dc716ba2 100644 --- a/src/content-script/styles.scss +++ b/src/content-script/styles.scss @@ -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; @@ -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; @@ -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); } @@ -133,6 +141,7 @@ li { counter-increment: item; + margin-bottom: 0px; &::marker { content: counter(item) '. '; @@ -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; }