Skip to content

Commit 58e2823

Browse files
committed
create invisible text - mobile support
1 parent 0099de7 commit 58e2823

File tree

5 files changed

+75
-52
lines changed

5 files changed

+75
-52
lines changed

popup/tabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const tabs = [
3333
{
3434
...CATEGORY.search,
3535
scripts: [
36-
s._test,
36+
// s._test,
3737
// s._ufs_statistic,
3838
s.similarWeb,
3939
s.similarWeb_bypassLimit,

scripts/createInvisibleText.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Useful Scripts - Giải mã tin nhắn tàng hình</title>
8+
9+
<script src="../popup/libs/swal2.min.js"></script>
10+
</head>
11+
12+
<body>
13+
<script type="module" src="./createInvisibleText_main.js">
14+
</script>
15+
</body>
16+
17+
</html>

scripts/createInvisibleText.js

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,32 @@ export default {
1111
vi: "Tạo tin nhắn tàng hình, giúp ẩn đi thông tin quan trọng, người nhận cần dùng chức năng này để có thể giải mã.",
1212
},
1313
badges: [BADGES.new],
14+
infoLink: "/scripts/createInvisibleText.html",
1415
changeLogs: {
1516
"2025-05-26": "init",
1617
},
1718

1819
popupScript: {
1920
onClick: async () => {
2021
const { t } = await import("../popup/helpers/lang.js");
21-
Swal.fire({
22+
let result = await Swal.fire({
2223
icon: "info",
2324
title: t({ vi: "Tin nhắn tàng hình", en: "Invisible messages" }),
2425
text: t({ vi: "Vui lòng chọn", en: "Please choose" }),
2526
showDenyButton: true,
2627
showCancelButton: false,
2728
confirmButtonText: t({ vi: "Tạo tin nhắn", en: "Create message" }),
2829
denyButtonText: t({ vi: "Giải mã tin nhắn", en: "Decode message" }),
29-
}).then((result) => {
30-
if (result.isConfirmed) {
31-
doEncode();
32-
} else if (result.isDenied) {
33-
doDecode();
34-
}
3530
});
3631

37-
function doEncode() {
38-
Swal.fire({
32+
if (result.isConfirmed) {
33+
await doEncode();
34+
} else if (result.isDenied) {
35+
await doDecode();
36+
}
37+
38+
async function doEncode() {
39+
let result = await Swal.fire({
3940
icon: "question",
4041
title: t({ vi: "Nhập tin nhắn", en: "Enter message" }),
4142
html: t({
@@ -44,55 +45,53 @@ export default {
4445
}),
4546
input: "textarea",
4647
showCancelButton: true,
47-
}).then((result) => {
48-
if (result.isConfirmed) {
49-
let encoded = encode(result.value);
50-
Swal.fire({
51-
icon: "success",
52-
title: t({
53-
vi: "Tạo tin tàng hình thành công",
54-
en: "Create invisible message successfully",
55-
}),
56-
html:
57-
result.value +
58-
"<br/><br/>" +
59-
t({
60-
vi: " Bạn hãy copy và sử dụng nhé",
61-
en: " Please copy and use",
62-
}),
63-
input: "textarea",
64-
inputValue: encoded,
65-
});
66-
}
6748
});
49+
if (result.isConfirmed) {
50+
let encoded = encode(result.value);
51+
await Swal.fire({
52+
icon: "success",
53+
title: t({
54+
vi: "Tạo tin tàng hình thành công",
55+
en: "Create invisible message successfully",
56+
}),
57+
html:
58+
result.value +
59+
"<br/><br/>" +
60+
t({
61+
vi: " Bạn hãy copy và sử dụng nhé",
62+
en: " Please copy and use",
63+
}),
64+
input: "textarea",
65+
inputValue: encoded,
66+
});
67+
}
6868
}
6969

70-
function doDecode() {
71-
Swal.fire({
70+
async function doDecode() {
71+
let result = await Swal.fire({
7272
icon: "question",
7373
title: "Nhập tin nhắn cần giải mã",
7474
input: "textarea",
7575
showCancelButton: true,
76-
}).then((result) => {
77-
if (result.isConfirmed) {
78-
let decoded = decode(result.value);
79-
if (decoded != result.value) {
80-
Swal.fire({
81-
icon: "success",
82-
title: "Kết quả giải mã",
83-
text: result.value,
84-
input: "textarea",
85-
inputValue: decoded,
86-
});
87-
} else {
88-
Swal.fire({
89-
icon: "info",
90-
title: "Tin nhắn này không có nội dung tàng hình",
91-
text: result.value,
92-
});
93-
}
94-
}
9576
});
77+
if (result.isConfirmed) {
78+
let decoded = decode(result.value);
79+
if (decoded != result.value) {
80+
await Swal.fire({
81+
icon: "success",
82+
title: "Kết quả giải mã",
83+
text: result.value,
84+
input: "textarea",
85+
inputValue: decoded,
86+
});
87+
} else {
88+
await Swal.fire({
89+
icon: "info",
90+
title: "Tin nhắn này không có nội dung tàng hình",
91+
text: result.value,
92+
});
93+
}
94+
}
9695
}
9796
},
9897
},

scripts/createInvisibleText_main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import createInvisibleText from "./createInvisibleText.js";
2+
3+
(async () => {
4+
while (true) {
5+
await createInvisibleText.popupScript.onClick();
6+
}
7+
})();

scripts/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function runFunc(fnPath = "", params = [], global = {}) {
133133

134134
export async function trackEvent(scriptId) {
135135
console.log("trackEvent", scriptId, version);
136-
return;
136+
// return;
137137
try {
138138
let res = await fetch(
139139
// "http://localhost:3000/count",

0 commit comments

Comments
 (0)