Skip to content

Commit f2f5f21

Browse files
committed
update
1 parent 2f01588 commit f2f5f21

File tree

9 files changed

+1041
-433
lines changed

9 files changed

+1041
-433
lines changed

pages/viewScriptSource/main.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
window.onload = async () => {
22
try {
3-
let scriptId = localStorage.viewScriptSource_sharedData;
4-
let source = await getScriptSource(scriptId);
3+
let id = localStorage.viewScriptSource_sharedData;
4+
let source = await getScriptSource(id);
55

66
if (source) {
7-
let fileName = scriptId + ".js";
8-
let comment = "// " + fileName;
7+
let fileName = id + ".js";
8+
let comment = "// File: " + fileName;
99

1010
document.querySelector("#copy-btn").onclick = () => copy(source);
1111
document.querySelector("code").innerHTML =
@@ -26,11 +26,15 @@ function copy(text) {
2626

2727
// https://stackoverflow.com/a/26276924/11898496
2828
async function getScriptSource(scriptId) {
29-
let fileName = scriptId + ".js";
30-
let path = "/scripts/" + fileName;
31-
let res = await fetch(path);
32-
let source = await res.text();
33-
return source;
29+
try {
30+
let fileName = scriptId + ".js";
31+
let path = "/scripts/" + fileName;
32+
let res = await fetch(path);
33+
let source = await res.text();
34+
return source;
35+
} catch (e) {
36+
return "// Không lấy được source code\n// Cannot load source code";
37+
}
3438
}
3539

3640
// https://stackoverflow.com/a/6234804/11898496

popup/tabs.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,16 @@ const recommendTab = {
297297
onClick: () =>
298298
window.open("https://github.com/HoangTran0410/FBMediaDownloader"),
299299
},
300+
{ name: { en: "--- Web ---", vi: "--- Web hay ---" } },
301+
{
302+
icon: "https://you.com/favicon/apple-touch-icon-72x72.png",
303+
name: { en: "You.com", vi: "You.com" },
304+
description: {
305+
en: "The AI Search Engine You Control",
306+
vi: "Trình tìm kiếm sử dụng trí tuệ nhân tạo",
307+
},
308+
onClick: () => window.open("https://you.com/"),
309+
},
300310
{ name: { en: "--- Extensions ---", vi: "--- Extensions hay ---" } },
301311
{
302312
icon: "https://lh3.googleusercontent.com/2GdtpZt9NWFkfrfLZnWL2gM2UdCOsgpQhhdxSx4wPw5Iz10NcT433g3iHyAAZ8J-ZCyz3gwLKR1kJQC0PidRVKKJ1Ws=w128-h128-e365-rj-sc0x00ffffff",

0 commit comments

Comments
 (0)