mirror of
https://github.com/027xiguapi/code-box.git
synced 2026-05-17 07:29:03 +00:00
增加获取微信封面
This commit is contained in:
@@ -183,4 +183,4 @@ https://www.code-box.fun/
|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
@@ -181,4 +181,4 @@ Directly download and install:
|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
@@ -1,3 +1,7 @@
|
||||
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
|
||||
|
||||
import { sendToContentScript } from "@plasmohq/messaging"
|
||||
|
||||
import CssCode from "~component/items/cssCode"
|
||||
import DownloadHtml from "~component/items/downloadHtml"
|
||||
import DownloadImages from "~component/items/downloadImages"
|
||||
@@ -8,6 +12,12 @@ import ShowTag from "~component/items/showTag"
|
||||
import { i18n } from "~tools"
|
||||
|
||||
export default function Weixin() {
|
||||
async function getThumbMedia() {
|
||||
sendToContentScript({
|
||||
name: `weixin-getThumbMedia`
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<fieldset>
|
||||
<legend>{i18n("weixinConfig")}</legend>
|
||||
@@ -18,6 +28,13 @@ export default function Weixin() {
|
||||
<DownloadHtml name="weixin" />
|
||||
<DownloadPdf name="weixin" />
|
||||
<DownloadImages name="weixin" />
|
||||
<div className="item download" onClick={getThumbMedia}>
|
||||
<span>
|
||||
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
|
||||
{i18n("getThumbMedia")}
|
||||
</span>
|
||||
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
|
||||
</div>
|
||||
</fieldset>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@ const PlasmoOverlay: FC<PlasmoCSUIProps> = ({ anchor }) => {
|
||||
if (req.name == "weixin-downloadImages") {
|
||||
await downloadImages(req.body?.onProgress)
|
||||
}
|
||||
if (req.name == "weixin-getThumbMedia") {
|
||||
const thumbMediaUrl = document.querySelector<HTMLMetaElement>(
|
||||
'meta[property="og:image"]'
|
||||
).content
|
||||
thumbMediaUrl && window.open(thumbMediaUrl)
|
||||
}
|
||||
})
|
||||
|
||||
async function downloadImages(
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Print } from "~utils/print"
|
||||
import Turndown from "~utils/turndown"
|
||||
|
||||
export const config: PlasmoCSConfig = {
|
||||
matches: ["https://*.zhihu.com/*"]
|
||||
matches: ["https://*.zhihu.com/p/*"]
|
||||
}
|
||||
|
||||
const turndownService = Turndown()
|
||||
|
||||
@@ -193,5 +193,8 @@
|
||||
},
|
||||
"fullPageScreenshot": {
|
||||
"message": "Full Page Screenshot"
|
||||
},
|
||||
"getThumbMedia": {
|
||||
"message": "get Thumb Media"
|
||||
}
|
||||
}
|
||||
@@ -196,5 +196,8 @@
|
||||
},
|
||||
"fullPageScreenshot": {
|
||||
"message": "全页面截图"
|
||||
},
|
||||
"getThumbMedia": {
|
||||
"message": "获取封面"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "code-box",
|
||||
"displayName": "__MSG_extensionName__",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.9",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"author": "027xiguapi. <458813868@qq.com>",
|
||||
"scripts": {
|
||||
|
||||
BIN
public/en/1400x560.jpg
Normal file
BIN
public/en/1400x560.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
public/en/440x280.jpg
Normal file
BIN
public/en/440x280.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -23,16 +23,22 @@
|
||||
width: 20%;
|
||||
}
|
||||
p {
|
||||
font-size: 4em;
|
||||
font-size: 2em;
|
||||
color: #000;
|
||||
font-family: fantasy;
|
||||
}
|
||||
div {
|
||||
font-size: 1em;
|
||||
color: #666;
|
||||
font-family: fantasy;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<img src="./128x128.png" alt="logo" />
|
||||
<p>codebox-一键复制代码/下载文章</p>
|
||||
<p>codebox</p>
|
||||
<div>One-click Code Copying/Downloading Articles</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user