@@ -11,31 +11,32 @@ export default {
11
11
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ã." ,
12
12
} ,
13
13
badges : [ BADGES . new ] ,
14
+ infoLink : "/scripts/createInvisibleText.html" ,
14
15
changeLogs : {
15
16
"2025-05-26" : "init" ,
16
17
} ,
17
18
18
19
popupScript : {
19
20
onClick : async ( ) => {
20
21
const { t } = await import ( "../popup/helpers/lang.js" ) ;
21
- Swal . fire ( {
22
+ let result = await Swal . fire ( {
22
23
icon : "info" ,
23
24
title : t ( { vi : "Tin nhắn tàng hình" , en : "Invisible messages" } ) ,
24
25
text : t ( { vi : "Vui lòng chọn" , en : "Please choose" } ) ,
25
26
showDenyButton : true ,
26
27
showCancelButton : false ,
27
28
confirmButtonText : t ( { vi : "Tạo tin nhắn" , en : "Create message" } ) ,
28
29
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
- }
35
30
} ) ;
36
31
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 ( {
39
40
icon : "question" ,
40
41
title : t ( { vi : "Nhập tin nhắn" , en : "Enter message" } ) ,
41
42
html : t ( {
@@ -44,55 +45,53 @@ export default {
44
45
} ) ,
45
46
input : "textarea" ,
46
47
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
- }
67
48
} ) ;
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
+ }
68
68
}
69
69
70
- function doDecode ( ) {
71
- Swal . fire ( {
70
+ async function doDecode ( ) {
71
+ let result = await Swal . fire ( {
72
72
icon : "question" ,
73
73
title : "Nhập tin nhắn cần giải mã" ,
74
74
input : "textarea" ,
75
75
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
- }
95
76
} ) ;
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
+ }
96
95
}
97
96
} ,
98
97
} ,
0 commit comments