Skip to content

Commit 68a5cb3

Browse files
committed
feat: 重新实现智能链接跳转功能
1 parent 4ba4e5c commit 68a5cb3

6 files changed

Lines changed: 117 additions & 70 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
- style: 调整 popup 页面已读功能及样式修改
2-
- feat: 兼容 idcflare.com 网站(90% 功能已经可以兼容使用,少量功能暂无法适配,如:图片生成分享图)
1+
- feat: 重新实现智能链接跳转功能

README_EN.md

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<p>
2020
<a href="https://discord.gg/3wDmhCsVeU">Discord</a>
2121
·
22-
<a href="https://linuxdo-scripts.zishu.me">Documentation</a>
22+
<a href="https://linuxdo-scripts.zishu.me">Usage Documentation</a>
2323
·
24-
<a href="https://github.com/anghunk/linuxdo-scripts/issues/new/choose">Report an Issue</a>
24+
<a href="https://github.com/anghunk/linuxdo-scripts/issues/new/choose">Feedback</a>
2525
·
2626
<a href="https://github.com/anghunk/linuxdo-scripts/releases/latest">Latest Release</a>
2727
</p>
@@ -36,24 +36,28 @@
3636

3737
## 📖 I. Project Introduction
3838

39-
LinuxDo Scripts is a feature-rich browser extension designed to enhance your experience on the LinuxDo forum. It integrates a wide range of practical functionalities, from basic interface optimization to advanced AI assistance, making your forum browsing and interaction smoother and more efficient.
39+
LinuxDo Scripts is a feature-rich browser extension designed to enhance the user experience on the LinuxDo forum. It integrates a variety of practical features, from basic interface optimization to advanced AI assistance, making your forum browsing and interaction smoother and more efficient.
4040

41-
Forum Discussion Thread: [linuxdo enhanced plugin, continuously updated, feedback welcome (browser extension, Tampermonkey is invalid and no longer updated) - LINUX DO](https://linux.do/t/topic/170951)
41+
> [!note]
42+
> Forum discussion thread: [linuxdo enhanced plugin, continuous updates welcome feedback - LINUX DO](https://linux.do/t/topic/170951)
43+
44+
> [!note]
45+
> Compatibility has also been synchronized with the [idcflare.com](https://idcflare.com) website. (90% of features are compatible, with a few exceptions, such as: image generation for sharing.)
4246
4347
### 1. Core Highlights
4448
- 🎨 **Interface Beautification** - Multiple theme skins, personalized customization
4549
- 🤖 **AI Intelligence** - Topic summarization, intelligent reply generation
4650
- 📚 **Content Management** - Favorites, user tags, content filtering
47-
-**Experience Optimization** - Quick operations, automation features
51+
-**Experience Optimization** - Quick operations, automated functions
4852
- 🔧 **Highly Customizable** - Supports custom CSS, quick replies, etc.
4953

5054
![Main Image](https://github.com/user-attachments/assets/1b0039de-3f3e-420b-9a91-6bc651e8c8e5)
5155

5256
<details>
53-
<summary>More Screenshots</summary>
57+
<summary>More Screenshot Demonstrations</summary>
5458

55-
![Usage](https://github.com/user-attachments/assets/514b92b7-deb3-4eee-80cd-c2203f4661b8)
56-
![Favorites Enhancement](https://github.com/user-attachments/assets/0523929c-c825-40b8-817e-1f9ea06a01ea)
59+
![How to Use](https://github.com/user-attachments/assets/514b92b7-deb3-4eee-80cd-c2203f4661b8)
60+
![Favorite Enhancement](https://github.com/user-attachments/assets/0523929c-c825-40b8-817e-1f9ea06a01ea)
5761
![Share Post](https://github.com/user-attachments/assets/07728ccc-4032-431d-bf70-e32b7a8e2289)
5862

5963
</details>
@@ -62,11 +66,11 @@ Forum Discussion Thread: [linuxdo enhanced plugin, continuously updated, feedbac
6266

6367
### 1. Supported Browsers
6468

65-
| Browser | Installation Link | Notes |
66-
| ------------------------------- | --------------------------------------------------------------------------------------------- | ------------- |
67-
| **Chrome / Edge / Arc / Brave** | [Chrome Web Store](https://chromewebstore.google.com/detail/fbgblmjbeebanackldpbmpacppflgmlj) | Recommended |
68-
| **Firefox** | [Firefox Addons](https://addons.mozilla.org/zh-CN/firefox/addon/linux_do-scripts/) | Full Support |
69-
| **Domestic Users** | [Crx Store](https://www.crxsoso.com/webstore/detail/fbgblmjbeebanackldpbmpacppflgmlj) | No VPN Needed |
69+
| Browser | Installation Link | Remarks |
70+
| -------------------------------- | --------------------------------------------------------------------------------------------- | -------- |
71+
| **Chrome / Edge / Arc / Brave** | [Chrome Web Store](https://chromewebstore.google.com/detail/fbgblmjbeebanackldpbmpacppflgmlj) | Recommended |
72+
| **Firefox** | [Firefox Addons](https://addons.mozilla.org/zh-CN/firefox/addon/linux_do-scripts/) | Full Support |
73+
| **Users in China** | [Crx Store](https://www.crxsoso.com/webstore/detail/fbgblmjbeebanackldpbmpacppflgmlj) | No VPN required |
7074

7175
### 2. Installation Steps
7276
1. Click the installation link for your browser above.
@@ -77,72 +81,72 @@ Forum Discussion Thread: [linuxdo enhanced plugin, continuously updated, feedbac
7781
## ✨ III. Features
7882

7983
<details>
80-
<summary>🔍 Browse Experience Optimization</summary>
84+
<summary>🔍 Browsing Experience Optimization</summary>
8185

82-
- ⏰ Display creation time in the topic list
83-
- 🏢 Show floor count and original poster identifier
84-
- 🆕 Open topics in a new tab
85-
- 👀 Directly preview details and comments in the topic list
86-
- 📝 Optimize display of mixed Chinese and English text
87-
- 🖼️ Optimize signature image display to prevent corruption
88-
- 🌙 Automatically switch to dark mode
89-
- 📱 Optimize for ultra-wide displays
86+
- ⏰ Display creation time in topic list.
87+
- 🏢 Show floor number and author identifier.
88+
- 🆕 Open topics in a new tab.
89+
- 👀 Directly preview topic details and comments in the topic list.
90+
- 📝 Optimize display of mixed Chinese and English text.
91+
- 🖼️ Optimize signature image display to prevent corruption.
92+
- 🌙 Automatically switch to dark mode.
93+
- 📱 Optimize for ultra-wide displays.
9094

9195
</details>
9296

9397
<details>
9498
<summary>📚 Content Management</summary>
9599

96-
- ⭐ Comprehensive favorites functionality
97-
- 🏷️ User tagging system
98-
- 🚫 Force block topics from specified users
99-
- 👑 Toggle "Show Original Poster Only"
100-
- 🔍 Keyword and tag filtering
101-
- 📅 Block old posts by time
100+
- ⭐ Comprehensive favorites functionality.
101+
- 🏷️ User tagging system.
102+
- 🚫 Force-block topics from specified users.
103+
- 👑 Toggle to view only the original poster's posts.
104+
- 🔍 Keyword and tag filtering.
105+
- 📅 Block old posts by time.
102106

103107
</details>
104108

105109
<details>
106110
<summary>💬 Interaction Enhancement</summary>
107111

108-
- ⚡ Quick topic replies (supports custom templates)
109-
- 😊 Optimize reply box emojis
110-
- 📊 Query user level information
111-
- 👍 Quick like button
112-
- 🔄 Automatically expand replies
112+
- ⚡ Quick replies to topics (supports custom templates).
113+
- 😊 Optimized comment box emoticons.
114+
- 📊 Query user level information.
115+
- 👍 Quick "like" button.
116+
- 🔄 Automatically expand replies.
113117

114118
</details>
115119

116120
<details>
117-
<summary>🤖 AI Smart Assistant</summary>
121+
<summary>🤖 AI Intelligent Assistant</summary>
118122

119-
- 📋 AI topic summarization
120-
- 💡 Intelligent reply generation
121-
- 🤝 AI-assisted posting
122-
- 🎯 Intelligent content analysis
123+
- 📋 AI topic summarization.
124+
- 💡 Intelligent reply generation.
125+
- 🤝 AI-assisted replying.
126+
- 🎯 Intelligent content analysis.
123127

124128
</details>
125129

126130
<details>
127131
<summary>🎨 Personalization</summary>
128132

129-
- 🎭 Multiple forum theme skins
130-
- 😀 Switch forum emoji styles
131-
- 🎨 Support for custom CSS styles
132-
- ☁️ Cloud synchronization of settings
133-
- 🖼️ Customize forum Logo
134-
- 📑 Customize tab icons and titles
133+
- 🎭 Multiple forum theme skins.
134+
- 😀 Forum emoticon style switching.
135+
- 🎨 Support for custom CSS styles.
136+
- ☁️ Cloud synchronization of settings.
137+
- 🖼️ Customize forum logo.
138+
- 📑 Customize tab icon and title.
135139

136140
</details>
137141

138142
<details>
139143
<summary>🔧 Utility Tools</summary>
140144

141-
- 📸 Convert topics to image shares
142-
- 📄 Export forum articles
143-
- ⬆️ Scroll to top / Jump to first post
144-
- 🔕 Quickly mute posts
145-
- 🎯 View your own reply floor
145+
- 📸 Convert topics to image for sharing.
146+
- 📄 Export forum articles.
147+
- ⬆️ Return to top / Go directly to the first floor.
148+
- 🔕 Quickly mute posts.
149+
- 🎯 View your own reply floor.
146150

147151
</details>
148152

@@ -167,17 +171,17 @@ npm run dev
167171
```
168172

169173
### 3. Loading the Extension
170-
1. Open the browser's extension management page:
174+
1. Open your browser's extension management page:
171175
- Chrome: `chrome://extensions/`
172176
- Firefox: `about:addons`
173177
2. Enable "Developer mode".
174178
3. Click "Load unpacked extension".
175-
4. Select the `.output/chrome-mv3` folder in the project's root directory.
179+
4. Select the `.output/chrome-mv3` folder at the root of the project.
176180

177-
### 4. Development Guidelines
178-
- 🧩 **Component-based Development**: Each feature as an independent component to avoid conflicts.
179-
- 🔄 **Commit Process**: PR → Code Review → Merge
180-
- 📚 **Documentation Update**: New features require synchronized documentation updates.
181+
### 4. Development Conventions
182+
- 🧩 **Component-based development**: Each feature is an independent component to avoid conflicts.
183+
- 🔄 **Submission process**: PR → Code review → Merge.
184+
- 📚 **Documentation update**: New features must be synchronized with documentation updates.
181185

182186
## 🤝 V. Contributing
183187

@@ -192,7 +196,7 @@ npm run dev
192196

193197
### 3. Reference Projects
194198

195-
- https://linux.do/t/topic/850824 - Shi Huang Jiang's emoji pack feature
199+
- https://linux.do/t/topic/850824 - Shi Huang Jiang's emoticon pack feature
196200

197201
## 📄 VI. Other Information
198202

@@ -207,18 +211,18 @@ This project is licensed under the [Apache License 2.0](https://github.com/anghu
207211
**You are free to:**
208212
- ✅ Use, copy, modify, and distribute this software.
209213
- ✅ Use for commercial purposes.
210-
- ✅ Re-license under the terms of the license.
214+
- ✅ Re-license under the terms of the agreement.
211215

212-
**However, you must:**
216+
**But you must:**
213217
- 📋 Retain the original copyright notice.
214-
- 📋 Indicate any modifications made to the original code.
218+
- 📋 Indicate modifications made to the original code.
215219

216220
### 3. Disclaimer
217221

218-
- This project is **free and open-source**. It does not guarantee absolute perfection or error-freeness.
219-
- Please assess risks yourself before use and comply with relevant laws and regulations.
220-
- Any form of misuse is strictly prohibited.
221-
- For any infringement issues, please contact [@anghunk](https://github.com/anghunk) for prompt resolution.
222+
- This project is a **free and open-source** project and does not guarantee absolute perfection or error-freeness.
223+
- Please assess the risks yourself before use and comply with relevant laws and regulations.
224+
- Any form of abuse is strictly prohibited.
225+
- For any infringement issues, please contact [@anghunk](https://github.com/anghunk) for timely resolution.
222226

223227
---
224228

@@ -227,4 +231,4 @@ This project is licensed under the [Apache License 2.0](https://github.com/anghu
227231
<div align="center">
228232
<p>If this project has been helpful to you, please consider giving us a ⭐ Star!</p>
229233
<p>Made with ❤️ by <a href="https://github.com/anghunk">@anghunk</a> and <a href="https://github.com/anghunk/linuxdo-scripts/graphs/contributors">contributors</a></p>
230-
</div>
234+
</div>

entrypoints/DialogComponents/components/HotPosts.vue

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="news-content">
55
<a
66
:href="'https://linux.do/t/topic/' + item.id"
7-
target="_blank"
7+
@click="handleLinkClick($event, item.id)"
88
class="news-link"
99
>
1010
{{ item.title }}
@@ -23,6 +23,46 @@ export default {
2323
data() {
2424
return {};
2525
},
26-
methods: {},
26+
methods: {
27+
async handleLinkClick(event, itemId) {
28+
// 阻止默认的链接行为
29+
event.preventDefault();
30+
31+
// 构建目标 URL
32+
const targetUrl = `https://linux.do/t/topic/${itemId}`;
33+
34+
try {
35+
const browserAPI = typeof browser !== "undefined" ? browser : chrome;
36+
37+
// 查询当前活动的标签页
38+
const tabs = await new Promise((resolve) => {
39+
browserAPI.tabs.query({ active: true, currentWindow: true }, resolve);
40+
});
41+
42+
if (tabs.length > 0) {
43+
const currentTab = tabs[0];
44+
45+
// 检查当前活动标签页是否为 linux.do
46+
if (currentTab.url && currentTab.url.includes("linux.do")) {
47+
// 如果当前标签页是 linux.do,直接在当前标签页跳转
48+
browserAPI.tabs.update(currentTab.id, { url: targetUrl });
49+
} else {
50+
// 如果不是 linux.do,创建新标签页
51+
browserAPI.tabs.create({ url: targetUrl });
52+
}
53+
} else {
54+
// 如果无法获取标签页信息,默认创建新标签页
55+
browserAPI.tabs.create({ url: targetUrl });
56+
}
57+
} catch (error) {
58+
console.error("处理链接跳转失败:", error);
59+
// 出错时回退到新标签页打开
60+
window.open(targetUrl, "_blank");
61+
}
62+
63+
// 向父组件发送移除事件
64+
this.$emit("remove-item", itemId);
65+
},
66+
},
2767
};
2868
</script>

entrypoints/DialogComponents/components/NewsPosts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default {
4747
// 阻止默认的链接行为
4848
event.preventDefault();
4949
50-
// 构建目标URL
50+
// 构建目标 URL
5151
const targetUrl = `https://linux.do/t/topic/${itemId}`;
5252
5353
try {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "linuxdo-scripts",
33
"description": "manifest.json description",
44
"private": true,
5-
"version": "1.5.0",
5+
"version": "1.5.1",
66
"type": "module",
77
"scripts": {
88
"dev": "wxt",

version-log.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.5.1
2+
3+
- feat: 重新实现智能链接跳转功能
4+
15
## 1.5.0
26

37
- style: 调整 popup 页面已读功能及样式修改

0 commit comments

Comments
 (0)