Skip to content

Commit fb2a065

Browse files
committed
show donate
1 parent c18848e commit fb2a065

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

README-en.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- [Useful scripts - Chrome extension](#useful-scripts---chrome-extension)
88
- [Overview](#overview)
9+
- [Demo](#demo)
910
- [Change logs](#change-logs)
1011
- [ScreenShots](#screenshots)
1112
- [Install](#install)
@@ -21,19 +22,22 @@ An extension includes a lot of small extensions. Make your life easier.
2122

2223
- Please join [FACEBOOK GROUP](https://www.facebook.com/groups/1154059318582088) of this extension
2324

24-
- View list all scripts [HERE](./md/LIST_SCRIPTS_EN.md)
25+
## Demo
26+
27+
Try online [Here](https://hoangtran0410.github.io/useful-script/popup/popup.html)
2528

2629
## Change logs
2730

2831
[Full change logs](/md/CHANGELOGS.md)
2932

3033
Current Versions:
3134

32-
- **v1.69**: small update (14/07/2024)
35+
- **v1.7**: tiktok update 28/07/2024
3336

3437
<details>
3538
<summary>Old versions</summary>
3639

40+
- <del>v1.69: small update (14/07/2024)</del>
3741
- <del>v1.68: big facebook update (01/07/2024)</del>
3842
- <del>v1.67 - huge update (29/05/2024)</del>
3943
- <del>v1.66 - big update (27/04/2024)</del>

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- [Useful scripts - Chrome extension](#useful-scripts---chrome-extension)
88
- [Giới thiệu](#giới-thiệu)
9+
- [Demo](#demo)
910
- [Phiên bản](#phiên-bản)
1011
- [Ảnh chụp màn hình](#ảnh-chụp-màn-hình)
1112
- [Cài đặt](#cài-đặt)
@@ -21,19 +22,22 @@ Donate? Muốn hỗ trợ mình 1 ly cafe <3 [Donate tại đây](https://github
2122

2223
- Hãy tham gia ngay [GROUP FACEBOOK](https://www.facebook.com/groups/1154059318582088) của tiện ích
2324

24-
- Xem tất cả chức năng [TẠI ĐÂY](./md/LIST_SCRIPTS_VI.md)
25+
## Demo
26+
27+
Dùng thử online [Tại đây](https://hoangtran0410.github.io/useful-script/popup/popup.html)
2528

2629
## Phiên bản
2730

2831
Xem [Lịch sử cập nhật](/md/CHANGELOGS.md)
2932

3033
Phiên bản hiện tại:
3134

32-
- **v1.69**: small update (14/07/2024)
35+
- **v1.7**: tiktok update 28/07/2024
3336

3437
<details>
3538
<summary>Xem phiên bản cũ hơn</summary>
3639

40+
- <del>v1.69: small update (14/07/2024)</del>
3741
- <del>v1.68: bản cập nhật facebook lớn (01/07/2024)</del>
3842
- <del>v1.67 - bản cập nhật siêu lớn (29/05/2024)</del>
3943
- <del>v1.66 - bản cập nhật lớn (27/04/2024)</del>

popup/index.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,43 @@ function initScrollToTop() {
10131013
// });
10141014
}
10151015

1016+
async function initShowDonate() {
1017+
const clickedDonate = await Storage.get("clickedDonate");
1018+
let count = (await Storage.get("openPopupCount")) || 0;
1019+
count++;
1020+
Storage.set("openPopupCount", count);
1021+
if (!clickedDonate && count > 0 && count % 10 === 0) {
1022+
const res = await Swal.fire({
1023+
icon: "info",
1024+
title: t({
1025+
vi: "Cảm ơn bạn tin dùng",
1026+
en: "Thanks for using Useful-scripts",
1027+
}),
1028+
text: t({
1029+
vi: "Useful-scripts là miễn phí. Nhưng nếu bạn thích nó, bạn có thể hỗ trợ mình 1 ly cà phê. Một đồng cũng đáng quý 💓",
1030+
en: "It's free. But you can support me if you like. I'll appreciate if you give me some love 💓",
1031+
}),
1032+
confirmButtonText: "Donate",
1033+
showCancelButton: true,
1034+
cancelButtonText: t({ vi: "Để sau", en: "Later" }),
1035+
showDenyButton: true,
1036+
denyButtonText: t({ vi: "Tặng sao", en: "Star github" }),
1037+
reverseButtons: true,
1038+
focusConfirm: true,
1039+
});
1040+
if (res.isConfirmed) {
1041+
Storage.set("clickedDonate", true);
1042+
window.open(
1043+
"https://hoangtran0410.github.io/HoangTran0410/DONATE",
1044+
"_blank"
1045+
);
1046+
}
1047+
if (res.isDenied) {
1048+
window.open("https://github.com/HoangTran0410/useful-script", "_blank");
1049+
}
1050+
}
1051+
}
1052+
10161053
function saveScroll() {
10171054
const scrollY = window.scrollY;
10181055
Storage.set("popupScrollY", scrollY);
@@ -1056,4 +1093,5 @@ window.addEventListener("scroll", onScrollEnd);
10561093
});
10571094

10581095
checkForUpdate();
1096+
initShowDonate();
10591097
})();

0 commit comments

Comments
 (0)