Skip to content

Commit b37e29c

Browse files
committed
🐛 xiaohongshu style and jump fixed
1 parent d494fce commit b37e29c

File tree

4 files changed

+90
-96
lines changed

4 files changed

+90
-96
lines changed

apps.conf.json

Lines changed: 0 additions & 76 deletions
This file was deleted.

default_app_list.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[
2+
{
3+
"name": "programmusic",
4+
"title": "ProgramMusic",
5+
"name_zh": "ProgramMusic",
6+
"url": "https://musicforprogramming.net/"
7+
},
8+
{
9+
"name": "twitter",
10+
"title": "Twitter",
11+
"name_zh": "推特",
12+
"url": "https://twitter.com/"
13+
},
14+
{
15+
"name": "youtube",
16+
"title": "YouTube",
17+
"name_zh": "YouTube",
18+
"url": "https://www.youtube.com"
19+
},
20+
{
21+
"name": "coderunner",
22+
"title": "CodeRunner",
23+
"name_zh": "CodeRunner",
24+
"url": "https://riju.codes/"
25+
},
26+
{
27+
"name": "chatgpt",
28+
"title": "ChatGPT",
29+
"name_zh": "ChatGPT",
30+
"url": "https://chatgpt.com/"
31+
},
32+
{
33+
"name": "flomo",
34+
"title": "Flomo",
35+
"name_zh": "浮墨",
36+
"url": "https://v.flomoapp.com/mine"
37+
},
38+
{
39+
"name": "qwerty",
40+
"title": "Qwerty",
41+
"name_zh": "Qwerty",
42+
"url": "https://qwerty.kaiyi.cool/"
43+
},
44+
{
45+
"name": "lizhi",
46+
"title": "LiZhi",
47+
"name_zh": "李志",
48+
"url": "https://lizhi.turkyden.com/?from=pake"
49+
},
50+
{
51+
"name": "xiaohongshu",
52+
"title": "XiaoHongShu",
53+
"name_zh": "小红书",
54+
"url": "https://www.xiaohongshu.com/explore"
55+
},
56+
{
57+
"name": "poe",
58+
"title": "Poe",
59+
"name_zh": "Poe",
60+
"url": "https://poe.com/"
61+
},
62+
{
63+
"name": "youtubemusic",
64+
"title": "YouTubeMusic",
65+
"name_zh": "YouTubeMusic",
66+
"url": "https://music.youtube.com/"
67+
},
68+
{
69+
"name": "weread",
70+
"title": "WeRead",
71+
"name_zh": "微信阅读",
72+
"url": "https://weread.qq.com/"
73+
}
74+
]

src-tauri/src/inject/event.js

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ function isDownloadLink(url) {
5151
return downloadLinkPattern.test(url);
5252
}
5353

54-
// No need to go to the download link.
55-
function externalDownLoadLink() {
56-
return ['quickref.me'].indexOf(location.hostname) > -1;
57-
}
58-
5954
document.addEventListener('DOMContentLoaded', () => {
6055
const tauri = window.__TAURI__;
6156
const appWindow = tauri.window.getCurrentWindow();
@@ -192,35 +187,31 @@ document.addEventListener('DOMContentLoaded', () => {
192187
});
193188
};
194189

195-
const handleDownloadLink = (e, url, filename) => {
196-
e.preventDefault();
197-
invoke('download_file', { params: { url, filename } });
198-
};
199-
200190
const detectAnchorElementClick = e => {
201191
const anchorElement = e.target.closest('a');
202192

203193
if (anchorElement && anchorElement.href) {
204-
194+
const target = anchorElement.target;
205195
const hrefUrl = new URL(anchorElement.href);
206196
const absoluteUrl = hrefUrl.href;
207197
let filename = anchorElement.download || getFilenameFromUrl(absoluteUrl);
208198

209199
// Handling external link redirection, _blank will automatically open.
210-
if (isExternalLink(absoluteUrl) && (['_new'].includes(anchorElement.target))) {
211-
handleExternalLink(absoluteUrl);
200+
if (target === '_blank') {
201+
e.preventDefault();
212202
return;
213203
}
214204

215-
// Process download links for Rust to handle.
216-
if (isDownloadRequired(absoluteUrl, anchorElement, e) && !externalDownLoadLink() && !isSpecialDownload(absoluteUrl)) {
217-
handleDownloadLink(e, absoluteUrl, filename);
205+
if (target === '_new') {
206+
e.preventDefault();
207+
handleExternalLink(absoluteUrl);
218208
return;
219209
}
220210

221-
// App internal jump.
222-
if (!anchorElement.target) {
223-
location.href = anchorElement.href;
211+
// Process download links for Rust to handle.
212+
if (isDownloadRequired(absoluteUrl, anchorElement, e) && !isSpecialDownload(absoluteUrl)) {
213+
e.preventDefault();
214+
invoke('download_file', { params: { url: absoluteUrl, filename } });
224215
}
225216
}
226217
};

src-tauri/src/inject/style.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ window.addEventListener('DOMContentLoaded', _event => {
119119
display: none !important;
120120
}
121121
122-
#react-root [data-testid="DMDrawer"] {
122+
#react-root [data-testid="DMDrawer"],
123+
#root > main > footer.justify-center.ease-in {
123124
visibility: hidden !important;
124125
}
125126
@@ -386,6 +387,10 @@ window.addEventListener('DOMContentLoaded', _event => {
386387
.lark > .main-wrapper [data-testid="aside"] {
387388
top: 15px;
388389
}
390+
391+
#global > div.header-container > .mask-paper {
392+
padding-top: 20px;
393+
}
389394
390395
#background.ytd-masthead {
391396
height: 68px;

0 commit comments

Comments
 (0)