pake-cli 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -42
- package/dist/cli.js +4 -4
- package/package.json +1 -1
- package/src-tauri/icons/gpt.icns +0 -0
- package/src-tauri/icons/myshell.icns +0 -0
- package/src-tauri/png/gpt_256.ico +0 -0
- package/src-tauri/png/gpt_32.ico +0 -0
- package/src-tauri/png/gpt_512.png +0 -0
- package/src-tauri/png/myshell_256.ico +0 -0
- package/src-tauri/png/myshell_32.ico +0 -0
- package/src-tauri/png/myshell_512.png +0 -0
- package/src-tauri/src/app/window.rs +1 -0
- package/src-tauri/src/inject/event.js +177 -157
- package/src-tauri/src/inject/style.js +26 -5
package/README.md
CHANGED
|
@@ -58,9 +58,25 @@
|
|
|
58
58
|
</td>
|
|
59
59
|
</tr>
|
|
60
60
|
<tr>
|
|
61
|
-
<td><img src=https://cdn.fliggy.com/upic/
|
|
61
|
+
<td><img src=https://cdn.fliggy.com/upic/rdeeLu.jpg width=600/></td>
|
|
62
62
|
<td><img src=https://cdn.fliggy.com/upic/7QUfi3.png width=600/></td>
|
|
63
63
|
</tr>
|
|
64
|
+
<tr>
|
|
65
|
+
<td>YouTube Music
|
|
66
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTubeMusic.dmg">Mac</a>
|
|
67
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTubeMusic_x64.msi">Windows</a>
|
|
68
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTubeMusic_x86_64.deb">Linux</a>
|
|
69
|
+
</td>
|
|
70
|
+
<td>YouTube
|
|
71
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube.dmg">Mac</a>
|
|
72
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_x64.msi">Windows</a>
|
|
73
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_x86_64.deb">Linux</a>
|
|
74
|
+
</td>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<td><img src=https://cdn.fliggy.com/upic/iz3mtQ.png width=600/></td>
|
|
78
|
+
<td><img src=https://cdn.fliggy.com/upic/s4ZLNC.jpg width=600/></td>
|
|
79
|
+
</tr>
|
|
64
80
|
<tr>
|
|
65
81
|
<td>LiZhi
|
|
66
82
|
<a href="https://github.com/tw93/Pake/releases/latest/download/LiZhi.dmg">Mac</a>
|
|
@@ -78,52 +94,36 @@
|
|
|
78
94
|
<td><img src=https://cdn.fliggy.com/upic/0C9lju.jpg width=600/></td>
|
|
79
95
|
</tr>
|
|
80
96
|
<tr>
|
|
81
|
-
|
|
82
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
83
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
84
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
97
|
+
<td>Qwerty
|
|
98
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty.dmg">Mac</a>
|
|
99
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_x64.msi">Windows</a>
|
|
100
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_x86_64.deb">Linux</a>
|
|
85
101
|
</td>
|
|
86
|
-
|
|
87
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
88
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
89
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
102
|
+
<td>CodeRunner
|
|
103
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/CodeRunner.dmg">Mac</a>
|
|
104
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/CodeRunner_x64.msi">Windows</a>
|
|
105
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/CodeRunner_x86_64.deb">Linux</a>
|
|
90
106
|
</td>
|
|
91
107
|
</tr>
|
|
92
108
|
<tr>
|
|
93
|
-
<td><img src=https://cdn.fliggy.com/upic/
|
|
94
|
-
<td><img src=https://cdn.fliggy.com/upic/
|
|
109
|
+
<td><img src=https://cdn.fliggy.com/upic/i2eg6G.png width=600/></td>
|
|
110
|
+
<td><img src=https://cdn.fliggy.com/upic/fS1lVi.jpg width=600/></td>
|
|
95
111
|
</tr>
|
|
96
|
-
|
|
112
|
+
<tr>
|
|
97
113
|
<td>Flomo
|
|
98
114
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Mac</a>
|
|
99
115
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_x64.msi">Windows</a>
|
|
100
116
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_x86_64.deb">Linux</a>
|
|
101
117
|
</td>
|
|
102
|
-
<td>
|
|
103
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
104
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
105
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
118
|
+
<td>XiaoHongShu
|
|
119
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/XiaoHongShu.dmg">Mac</a>
|
|
120
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/XiaoHongShu_x64.msi">Windows</a>
|
|
121
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/XiaoHongShu_x86_64.deb">Linux</a>
|
|
106
122
|
</td>
|
|
107
123
|
</tr>
|
|
108
124
|
<tr>
|
|
109
125
|
<td><img src=https://gw.alipayobjects.com/zos/k/30/RoUSUf.png width=600/></td>
|
|
110
|
-
<td><img src=https://cdn.fliggy.com/upic/
|
|
111
|
-
</tr>
|
|
112
|
-
<tr>
|
|
113
|
-
<td>Reference
|
|
114
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Mac</a>
|
|
115
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_x64.msi">Windows</a>
|
|
116
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_x86_64.deb">Linux</a>
|
|
117
|
-
</td>
|
|
118
|
-
<td>CodeRunner
|
|
119
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/CodeRunner.dmg">Mac</a>
|
|
120
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/CodeRunner_x64.msi">Windows</a>
|
|
121
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/CodeRunner_x86_64.deb">Linux</a>
|
|
122
|
-
</td>
|
|
123
|
-
</tr>
|
|
124
|
-
<tr>
|
|
125
|
-
<td><img src=https://cdn.fliggy.com/upic/SPGMRY.png width=600/></td>
|
|
126
|
-
<td><img src=https://cdn.fliggy.com/upic/fS1lVi.jpg width=600/></td>
|
|
126
|
+
<td><img src=https://cdn.fliggy.com/upic/yJVwyi.png width=600/></td>
|
|
127
127
|
</tr>
|
|
128
128
|
</table>
|
|
129
129
|
|
|
@@ -248,25 +248,25 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
248
248
|
</a>
|
|
249
249
|
</td>
|
|
250
250
|
<td align="center">
|
|
251
|
-
<a href="https://github.com/
|
|
252
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
251
|
+
<a href="https://github.com/AielloChan">
|
|
252
|
+
<img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
|
|
253
253
|
<br />
|
|
254
|
-
<sub><b>
|
|
254
|
+
<sub><b>Aiello</b></sub>
|
|
255
255
|
</a>
|
|
256
256
|
</td></tr>
|
|
257
257
|
<tr>
|
|
258
258
|
<td align="center">
|
|
259
|
-
<a href="https://github.com/
|
|
260
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
259
|
+
<a href="https://github.com/m1911star">
|
|
260
|
+
<img src="https://avatars.githubusercontent.com/u/4948120?v=4" width="90;" alt="m1911star"/>
|
|
261
261
|
<br />
|
|
262
|
-
<sub><b>
|
|
262
|
+
<sub><b>Horus</b></sub>
|
|
263
263
|
</a>
|
|
264
264
|
</td>
|
|
265
265
|
<td align="center">
|
|
266
|
-
<a href="https://github.com/
|
|
267
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
266
|
+
<a href="https://github.com/Pake-Actions">
|
|
267
|
+
<img src="https://avatars.githubusercontent.com/u/126550811?v=4" width="90;" alt="Pake-Actions"/>
|
|
268
268
|
<br />
|
|
269
|
-
<sub><b>
|
|
269
|
+
<sub><b>Pake Actions</b></sub>
|
|
270
270
|
</a>
|
|
271
271
|
</td>
|
|
272
272
|
<td align="center">
|
|
@@ -333,6 +333,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
|
|
333
333
|
<sub><b>Hyzhao</b></sub>
|
|
334
334
|
</a>
|
|
335
335
|
</td>
|
|
336
|
+
<td align="center">
|
|
337
|
+
<a href="https://github.com/lakca">
|
|
338
|
+
<img src="https://avatars.githubusercontent.com/u/16255922?v=4" width="90;" alt="lakca"/>
|
|
339
|
+
<br />
|
|
340
|
+
<sub><b>Null</b></sub>
|
|
341
|
+
</a>
|
|
342
|
+
</td>
|
|
336
343
|
<td align="center">
|
|
337
344
|
<a href="https://github.com/liusishan">
|
|
338
345
|
<img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
|
package/dist/cli.js
CHANGED
|
@@ -1695,9 +1695,9 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|
|
1695
1695
|
const cli_path = path.join(new_dir, "cli.js");
|
|
1696
1696
|
const cli_path_target = path.join(old_dir, "cli.js");
|
|
1697
1697
|
const about_pake_path = path.join(new_dir, "about_pake.html");
|
|
1698
|
-
const
|
|
1698
|
+
const about_pake_path_target = path.join(old_dir, "about_pake.html");
|
|
1699
1699
|
fs$1.copyFile(cli_path, cli_path_target);
|
|
1700
|
-
fs$1.copyFile(about_pake_path,
|
|
1700
|
+
fs$1.copyFile(about_pake_path, about_pake_path_target);
|
|
1701
1701
|
}
|
|
1702
1702
|
tauriConf.pake.windows[0].url = file_name;
|
|
1703
1703
|
tauriConf.pake.windows[0].url_type = "local";
|
|
@@ -1837,7 +1837,7 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|
|
1837
1837
|
if (icon_exists) {
|
|
1838
1838
|
// 需要判断图标格式,默认只支持ico和png两种
|
|
1839
1839
|
let iconExt = path.extname(systemTrayIcon).toLowerCase();
|
|
1840
|
-
if (iconExt == ".png" || iconExt == ".
|
|
1840
|
+
if (iconExt == ".png" || iconExt == ".ico") {
|
|
1841
1841
|
useDefaultIcon = false;
|
|
1842
1842
|
const trayIcoPath = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}${iconExt}`);
|
|
1843
1843
|
tauriConf.tauri.systemTray.iconPath = `png/${name.toLowerCase()}${iconExt}`;
|
|
@@ -2523,7 +2523,7 @@ class BuilderFactory {
|
|
|
2523
2523
|
}
|
|
2524
2524
|
|
|
2525
2525
|
var name = "pake-cli";
|
|
2526
|
-
var version = "2.0.
|
|
2526
|
+
var version = "2.0.6";
|
|
2527
2527
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。";
|
|
2528
2528
|
var engines = {
|
|
2529
2529
|
node: ">=16.0.0"
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -26,6 +26,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
|
|
|
26
26
|
.resizable(window_config.resizable)
|
|
27
27
|
.fullscreen(window_config.fullscreen)
|
|
28
28
|
.inner_size(window_config.width, window_config.height)
|
|
29
|
+
.disable_file_drop_handler() //Very annoying, otherwise dragging files to the window will not work.
|
|
29
30
|
.initialization_script(include_str!("../inject/style.js"))
|
|
30
31
|
.initialization_script(include_str!("../inject/event.js"))
|
|
31
32
|
.initialization_script(include_str!("../inject/component.js"));
|
|
@@ -1,204 +1,224 @@
|
|
|
1
1
|
const shortcuts = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
ArrowUp: () => scrollTo(0, 0),
|
|
3
|
+
ArrowDown: () => scrollTo(0, document.body.scrollHeight),
|
|
4
|
+
// Don't use command + ArrowLeft or command + ArrowRight
|
|
5
|
+
// When editing text in page, it causes unintended page navigation.
|
|
6
|
+
// ArrowLeft: () => window.history.back(),
|
|
7
|
+
// ArrowRight: () => window.history.forward(),
|
|
8
|
+
'[': () => window.history.back(),
|
|
9
|
+
']': () => window.history.forward(),
|
|
10
|
+
r: () => window.location.reload(),
|
|
11
|
+
'-': () => zoomOut(),
|
|
12
|
+
'=': () => zoomIn(),
|
|
13
|
+
'+': () => zoomIn(),
|
|
14
|
+
0: () => setZoom('100%'),
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
function setZoom(zoom) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const html = document.getElementsByTagName('html')[0];
|
|
19
|
+
html.style.zoom = zoom;
|
|
20
|
+
window.localStorage.setItem('htmlZoom', zoom);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
function zoomCommon(zoomChange) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const currentZoom = window.localStorage.getItem('htmlZoom') || '100%';
|
|
25
|
+
setZoom(zoomChange(currentZoom));
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
function zoomIn() {
|
|
27
|
-
|
|
29
|
+
zoomCommon((currentZoom) => `${Math.min(parseInt(currentZoom) + 10, 200)}%`);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
function zoomOut() {
|
|
31
|
-
|
|
33
|
+
zoomCommon((currentZoom) => `${Math.max(parseInt(currentZoom) - 10, 30)}%`);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
function handleShortcut(event) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
if (shortcuts[event.key]) {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
shortcuts[event.key]();
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
//这里参考 ChatGPT 的代码
|
|
42
44
|
const uid = () => window.crypto.getRandomValues(new Uint32Array(1))[0];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
|
|
46
|
+
function transformCallback(callback = () => {
|
|
47
|
+
}, once = false) {
|
|
48
|
+
const identifier = uid();
|
|
49
|
+
const prop = `_${identifier}`;
|
|
50
|
+
Object.defineProperty(window, prop, {
|
|
51
|
+
value: (result) => {
|
|
52
|
+
if (once) {
|
|
53
|
+
Reflect.deleteProperty(window, prop);
|
|
54
|
+
}
|
|
55
|
+
return callback(result);
|
|
56
|
+
},
|
|
57
|
+
writable: false,
|
|
58
|
+
configurable: true,
|
|
59
|
+
});
|
|
60
|
+
return identifier;
|
|
57
61
|
}
|
|
62
|
+
|
|
58
63
|
async function invoke(cmd, args) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
if (!window.__TAURI_POST_MESSAGE__)
|
|
66
|
+
reject('__TAURI_POST_MESSAGE__ does not exist~');
|
|
67
|
+
const callback = transformCallback((e) => {
|
|
68
|
+
resolve(e);
|
|
69
|
+
Reflect.deleteProperty(window, `_${error}`);
|
|
70
|
+
}, true);
|
|
71
|
+
const error = transformCallback((e) => {
|
|
72
|
+
reject(e);
|
|
73
|
+
Reflect.deleteProperty(window, `_${callback}`);
|
|
74
|
+
}, true);
|
|
75
|
+
window.__TAURI_POST_MESSAGE__({
|
|
76
|
+
cmd,
|
|
77
|
+
callback,
|
|
78
|
+
error,
|
|
79
|
+
...args,
|
|
80
|
+
});
|
|
75
81
|
});
|
|
76
|
-
});
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
84
|
+
// Judgment of file download.
|
|
85
|
+
function isDownloadLink(url) {
|
|
86
|
+
const fileExtensions = [
|
|
87
|
+
'3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip',
|
|
88
|
+
'ico', 'iso', 'indd', 'jar', 'jpeg', 'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg',
|
|
89
|
+
'mpeg', 'msi', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss', 'svg',
|
|
90
|
+
'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip'
|
|
91
|
+
];
|
|
92
|
+
const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i');
|
|
93
|
+
return downloadLinkPattern.test(url);
|
|
94
|
+
}
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
// No need to go to the download link.
|
|
97
|
+
function externalDownLoadLink() {
|
|
98
|
+
return ['quickref.me'].indexOf(location.hostname) > -1;
|
|
99
|
+
}
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
102
|
+
const topDom = document.createElement('div');
|
|
103
|
+
topDom.id = 'pack-top-dom';
|
|
104
|
+
document.body.appendChild(topDom);
|
|
105
|
+
const domEl = document.getElementById('pack-top-dom');
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) {
|
|
102
|
-
handleShortcut(event);
|
|
103
|
-
}
|
|
104
|
-
if (/macintosh|mac os x/i.test(navigator.userAgent) && event.metaKey) {
|
|
105
|
-
handleShortcut(event);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
document.addEventListener('click', (e) => {
|
|
110
|
-
const anchorElement = e.target.closest('a');
|
|
111
|
-
|
|
112
|
-
if (anchorElement && anchorElement.href) {
|
|
113
|
-
const target = anchorElement.target;
|
|
114
|
-
anchorElement.target = '_self';
|
|
115
|
-
const hrefUrl = new URL(anchorElement.href);
|
|
116
|
-
const absoluteUrl = hrefUrl.href;
|
|
117
|
-
|
|
118
|
-
// Handling external link redirection.
|
|
119
|
-
if (
|
|
120
|
-
window.location.host !== hrefUrl.host &&
|
|
121
|
-
(target === '_blank' || target === '_new')
|
|
122
|
-
) {
|
|
107
|
+
domEl.addEventListener('mousedown', (e) => {
|
|
123
108
|
e.preventDefault();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
invoke('
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
109
|
+
if (e.buttons === 1 && e.detail !== 2) {
|
|
110
|
+
invoke('drag_window');
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
domEl.addEventListener('touchstart', () => {
|
|
115
|
+
invoke('drag_window');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
domEl.addEventListener('dblclick', () => {
|
|
119
|
+
invoke('fullscreen');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
document.addEventListener('keyup', (event) => {
|
|
123
|
+
if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) {
|
|
124
|
+
handleShortcut(event);
|
|
125
|
+
}
|
|
126
|
+
if (/macintosh|mac os x/i.test(navigator.userAgent) && event.metaKey) {
|
|
127
|
+
handleShortcut(event);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Prevent some special websites from executing in advance, before the click event is triggered.
|
|
132
|
+
document.addEventListener('mousedown', (e) => {
|
|
133
|
+
const anchorElement = e.target.closest('a');
|
|
134
|
+
|
|
135
|
+
if (anchorElement && anchorElement.href) {
|
|
136
|
+
const target = anchorElement.target;
|
|
137
|
+
anchorElement.target = '_self';
|
|
138
|
+
const hrefUrl = new URL(anchorElement.href);
|
|
139
|
+
const absoluteUrl = hrefUrl.href;
|
|
140
|
+
|
|
141
|
+
// Handling external link redirection.
|
|
142
|
+
if (
|
|
143
|
+
window.location.host !== hrefUrl.host &&
|
|
144
|
+
(target === '_blank' || target === '_new')
|
|
145
|
+
) {
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
invoke('open_browser', {url: absoluteUrl});
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let filename = anchorElement.download ? anchorElement.download : getFilenameFromUrl(absoluteUrl)
|
|
152
|
+
// Process download links for Rust to handle.
|
|
153
|
+
// If the download attribute is set, the download attribute is used as the file name.
|
|
154
|
+
if ((anchorElement.download || e.metaKey || e.ctrlKey || isDownloadLink(absoluteUrl))
|
|
155
|
+
&& !externalDownLoadLink()
|
|
156
|
+
) {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
invoke('download_file', {
|
|
159
|
+
params: {
|
|
160
|
+
url: absoluteUrl,
|
|
161
|
+
filename,
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Rewrite the window.open function.
|
|
169
|
+
const originalWindowOpen = window.open;
|
|
170
|
+
window.open = function (url, name, specs) {
|
|
171
|
+
// Apple login and google login
|
|
172
|
+
if (name === 'AppleAuthentication') {
|
|
173
|
+
//do nothing
|
|
174
|
+
} else if (specs.includes('height=') || specs.includes('width=')) {
|
|
175
|
+
location.href = url;
|
|
176
|
+
} else {
|
|
177
|
+
const baseUrl = window.location.origin + window.location.pathname;
|
|
178
|
+
const hrefUrl = new URL(url, baseUrl);
|
|
179
|
+
invoke('open_browser', {url: hrefUrl.href});
|
|
180
|
+
}
|
|
181
|
+
// Call the original window.open function to maintain its normal functionality.
|
|
182
|
+
return originalWindowOpen.call(window, url, name, specs);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Set the default zoom, There are problems with Loop without using try-catch.
|
|
186
|
+
try {
|
|
187
|
+
setDefaultZoom();
|
|
188
|
+
} catch (e) {
|
|
189
|
+
console.log(e);
|
|
156
190
|
}
|
|
157
|
-
// Call the original window.open function to maintain its normal functionality.
|
|
158
|
-
return originalWindowOpen.call(window, url, name, specs);
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
// Set the default zoom, There are problems with Loop without using try-catch.
|
|
162
|
-
try {
|
|
163
|
-
setDefaultZoom();
|
|
164
|
-
} catch (e) {
|
|
165
|
-
console.log(e);
|
|
166
|
-
}
|
|
167
191
|
});
|
|
168
192
|
|
|
169
193
|
function setDefaultZoom() {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
194
|
+
const htmlZoom = window.localStorage.getItem('htmlZoom');
|
|
195
|
+
if (htmlZoom) {
|
|
196
|
+
setZoom(htmlZoom);
|
|
197
|
+
}
|
|
174
198
|
}
|
|
175
199
|
|
|
176
200
|
function getFilenameFromUrl(url) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
201
|
+
const urlPath = new URL(url).pathname;
|
|
202
|
+
const filename = urlPath.substring(urlPath.lastIndexOf('/') + 1);
|
|
203
|
+
return filename;
|
|
180
204
|
}
|
|
181
205
|
|
|
182
206
|
function removeUrlParameters(url) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
207
|
+
const parsedUrl = new URL(url);
|
|
208
|
+
parsedUrl.search = '';
|
|
209
|
+
return parsedUrl.toString();
|
|
186
210
|
}
|
|
187
211
|
|
|
188
|
-
// No need to go to the download link.
|
|
189
|
-
function externalDownLoadLink() {
|
|
190
|
-
return ['quickref.me'].indexOf(location.hostname) > -1;
|
|
191
|
-
}
|
|
192
212
|
|
|
193
213
|
// Toggle video playback when the window is hidden.
|
|
194
214
|
function toggleVideoPlayback(pause) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
215
|
+
const videos = document.getElementsByTagName('video');
|
|
216
|
+
for (const video of videos) {
|
|
217
|
+
if (pause) {
|
|
218
|
+
video.pause();
|
|
219
|
+
} else {
|
|
220
|
+
video.play();
|
|
221
|
+
}
|
|
201
222
|
}
|
|
202
|
-
}
|
|
203
223
|
}
|
|
204
224
|
|
|
@@ -57,6 +57,11 @@ window.addEventListener('DOMContentLoaded', (_event) => {
|
|
|
57
57
|
min-width: 260px;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
#__next > div.overflow-hidden.w-full.h-full.relative.flex.z-0 > div.relative.flex.h-full.max-w-full.flex-1.overflow-hidden > div > main > div.absolute.left-2.top-2.z-10.hidden.md\\:inline-block{
|
|
61
|
+
margin-top:20px;
|
|
62
|
+
margin-left: 10px;
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
.chakra-ui-light #app .chakra-heading,
|
|
61
66
|
.chakra-ui-dark #app .chakra-heading,
|
|
62
67
|
.chakra-ui-light #app .chakra-stack,
|
|
@@ -71,18 +76,32 @@ window.addEventListener('DOMContentLoaded', (_event) => {
|
|
|
71
76
|
display: none;
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
#__next .overflow-hidden>.
|
|
75
|
-
padding-top:
|
|
79
|
+
#__next .overflow-hidden>.overflow-x-hidden .scrollbar-trigger > nav {
|
|
80
|
+
padding-top: 30px;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
#__next .absolute .px-3.pt-2.pb-3.text-center {
|
|
79
84
|
visibility: hidden;
|
|
85
|
+
padding-bottom: 4px;
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
#__next > div.overflow-hidden.w-full.h-full.relative.flex > div.dark.hidden.flex-shrink-0.bg-gray-900.md\\:flex.md\\:w-\\[260px\\].md\\:flex-col > div > div > nav {
|
|
83
89
|
width: 100%;
|
|
84
90
|
}
|
|
85
91
|
|
|
92
|
+
#tabs-sidebar--tabpanel-0 > div.tw-flex.tw-items-center.tw-mb-\\[12px\\].tw-mt-\\[14px\\].tw-px-4 {
|
|
93
|
+
padding-top: 15px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
#tabs-sidebar--tabpanel-1 > div > div.tw-p-\\[16px\\].tw-flex.tw-flex-col.tw-gap-1\\.5{
|
|
97
|
+
padding-top: 30px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#tabs-sidebar--tabpanel-2 > div > h2 {
|
|
101
|
+
padding-top: 20px;
|
|
102
|
+
height: 70px;
|
|
103
|
+
}
|
|
104
|
+
|
|
86
105
|
.lark > .dashboard-sidebar, .lark > .dashboard-sidebar > .sidebar-user-info , .lark > .dashboard-sidebar .index-module_wrapper_F-Wbq{
|
|
87
106
|
padding-top:15px;
|
|
88
107
|
}
|
|
@@ -134,10 +153,12 @@ window.addEventListener('DOMContentLoaded', (_event) => {
|
|
|
134
153
|
margin-top:24px;
|
|
135
154
|
}
|
|
136
155
|
|
|
156
|
+
|
|
137
157
|
#react-root [data-testid="placementTracking"] article,
|
|
138
158
|
#react-root a[href*="quick_promote_web"],
|
|
139
159
|
#react-root [data-testid="AppTabBar_Explore_Link"],
|
|
140
160
|
#react-root a[href*="/lists"][role="link"][aria-label],
|
|
161
|
+
#react-root a[href*="/i/communitynotes"][role="link"][aria-label],
|
|
141
162
|
#react-root a[href*="/i/verified-orgs-signup"][role="link"][aria-label] {
|
|
142
163
|
display: none !important;
|
|
143
164
|
}
|
|
@@ -294,9 +315,9 @@ window.addEventListener('DOMContentLoaded', (_event) => {
|
|
|
294
315
|
}
|
|
295
316
|
}
|
|
296
317
|
|
|
297
|
-
@media (
|
|
298
|
-
#__next .sticky.top-0{
|
|
299
|
-
padding-top:
|
|
318
|
+
@media (max-width:767px){
|
|
319
|
+
#__next .overflow-hidden.w-full .max-w-full>.sticky.top-0 {
|
|
320
|
+
padding-top: 20px;
|
|
300
321
|
}
|
|
301
322
|
}
|
|
302
323
|
|