@@ -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 } ,
0 commit comments