Skip to content

Commit

Permalink
增加移除CSDN文章vip遮罩
Browse files Browse the repository at this point in the history
  • Loading branch information
027xiguapi committed Aug 5, 2024
1 parent 890e5c9 commit 4303832
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
15 changes: 15 additions & 0 deletions component/csdn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export default function Csdn() {
const [closeFollow, setCloseFollow] = useStorage("csdn-closeFollow", (v) =>
v === undefined ? true : v
)
const [closeVip, setCloseVip] = useStorage("csdn-closeVip", (v) =>
v === undefined ? true : v
)
const [autoOpenCode, setAutoOpenCode] = useStorage(
"csdn-autoOpenCode",
(v) => (v === undefined ? true : v)
Expand Down Expand Up @@ -63,6 +66,18 @@ export default function Csdn() {
/>
<label htmlFor="csdn-closeFollow" className="codebox-switch"></label>
</div>
<div className="item">
<span>VIP阅读全文</span>
<input
type="checkbox"
id="csdn-closeVip"
name="csdn-closeVip"
className="codebox-offscreen"
checked={closeVip}
onChange={(e) => setCloseVip(e.target.checked)}
/>
<label htmlFor="csdn-closeVip" className="codebox-switch"></label>
</div>
<div className="item">
<span>自动展开代码块</span>
<input
Expand Down
10 changes: 10 additions & 0 deletions contents/csdn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const csdn = () => {
const [closeAds] = useStorage<boolean>("csdn-closeAds")
const [copyCode] = useStorage<boolean>("csdn-copyCode")
const [closeFollow] = useStorage<boolean>("csdn-closeFollow")
const [closeVip] = useStorage<boolean>("csdn-closeVip")
const [autoOpenCode] = useStorage<boolean>("csdn-autoOpenCode")
const [closeLoginModal] = useStorage<boolean>("csdn-closeLoginModal")
const [closeRedirectModal] = useStorage<boolean>("csdn-closeLoginModal")
Expand All @@ -27,13 +28,15 @@ const csdn = () => {
copyCode,
autoOpenCode,
closeFollow,
closeVip,
closeLoginModal,
closeRedirectModal
})
closeAds && closeAdsFunc()
copyCode && copyCodeFunc()
autoOpenCode && autoOpenCodeFunc()
closeFollow && followFunc()
closeVip && closeVipFunc()
closeLoginModal && closeLoginModalFunc()
closeRedirectModal && closeRedirectModalFunc()
setIcon((closeAds || copyCode || autoOpenCode || closeFollow || closeLoginModal || closeRedirectModal))
Expand Down Expand Up @@ -177,6 +180,13 @@ const csdn = () => {
addCss(css)
}

function closeVipFunc() {
document.querySelectorAll(".vip-mask").forEach((vip) => {
const box = vip.closest(".hide-article-box")
box.remove()
})
}

return <div style={{ display: "none" }}></div>
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-box",
"displayName": "codebox-免登录一键复制代码(CSDN/知乎/脚本之家/博客园/51CTO博客)",
"version": "0.3.1",
"version": "0.3.2",
"description": "本浏览器插件可以用于CSDN/知乎/脚本之家/博客园/51CTO博客/php中文等网站,实现无需登录一键复制代码;支持选中代码;或者代码右上角按钮的一键复制;解除关注博主即可阅读全文提示;去除登录弹窗;去除跳转APP弹窗;页面自定义样式.",
"author": "027xiguapi. <458813868@qq.com>",
"scripts": {
Expand Down
Binary file added public/1400x560.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/440x280.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4303832

Please sign in to comment.