Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Fix Donation Notification
Browse files Browse the repository at this point in the history
We created the function to show donation notification when pass the limit
  • Loading branch information
HamzaElkotp committed Jun 2, 2023
1 parent 02379fd commit 9ad44ae
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
16 changes: 13 additions & 3 deletions ZChatGPT/assets/javascript/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const donateClose = document.querySelector('#donateClose');


const recentVesrion = window.localStorage.recentVesrion || (window.localStorage.recentVesrion = '');
const currentVersion = '1.3.1.1';

const currentVersion = '1.3.2';

const donateNoti = document.querySelector(".doNoti")
const today = (new Date).toLocaleDateString();
const dailyUsage = window.localStorage.dailyUsage ? JSON.parse(window.localStorage.dailyUsage) : JSON.parse(window.localStorage.dailyUsage = JSON.stringify({
"tokens": 0,
Expand Down Expand Up @@ -257,6 +257,14 @@ function agentHas(keyword) {
}


const showDonateNoti = ()=>{
donateNoti.classList.add("active");
}
const hideDonateNoti = ()=>{
setTimeout(() => {
donateNoti.classList.remove("active");
}, 10000);
}
const resetDate = ()=>{
if(today != dailyUsage.date){
dailyUsage.tokens = 0;
Expand All @@ -271,11 +279,13 @@ const addtokens = (data)=>{
window.localStorage.dailyUsage = JSON.stringify(dailyUsage);
}
const donateNotif = ()=>{
if(dailyUsage.notification == "no" && dailyUsage.tokens > "1500"){
if(dailyUsage.notification == "no" && dailyUsage.tokens > "500"){
startNoti()
dailyUsage.notification = "yes";
window.localStorage.dailyUsage = JSON.stringify(dailyUsage);
}
}
const startNoti = composer(showDonateNoti, hideDonateNoti);
const tokensAddNoti = composer(addtokens, donateNotif);


Expand Down
5 changes: 3 additions & 2 deletions ZChatGPT/assets/javascript/update.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"title": "🎊Congrats, Your ZChatGPT is now UpToDate!🥳",
"version": "<span class='is-size-6'>1st Jun</span> <span class='is-size-5'>Version</span> 1.3.1.1",
"version": "<span class='is-size-6'>1st Jun</span> <span class='is-size-5'>Version</span> 1.3.2",
"note": "Every Month There Is A Major Update",
"newNote": "See What Is New:👇",
"features": [
"Settings popup. click settings the above button to see it!⚙️",
"Dark mode. Enable it from settigns Popup🌚",
"Export your chats using the Download button📥",
"New welcoming message.✉️"
"New welcoming message.✉️",
"Fix Donation Notification.🔧"
],
"contact": "For problems and sugessions contact us on <span class='has-text-success'>[email protected]</span>",
"buttonMsg": "Light Mode is Bad, Welcome Export"
Expand Down
9 changes: 7 additions & 2 deletions ZChatGPT/assets/style/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ input:checked + .slider:before {
.doNoti.active .border {
width: 100%;
}

ul li {
font-weight: 600;
font-size: 14px;
}



Expand Down Expand Up @@ -644,7 +647,9 @@ body.dark .controler textarea::placeholder, body.dark .controler textarea{
body.dark .boxHalf{
background-color: var(--darkBg);
}

body.dark .doNoti{
color: #fff;
}



Expand Down
2 changes: 1 addition & 1 deletion ZChatGPT/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "ZChatGPT",
"description": "A simple extension to allow browser users to use ChatGPT in any tab without the need to open ChatGPT or having an account.",
"version": "1.3.1.1",
"version": "1.3.2",
"icons":{
"16": "/assets/logo/icon16.png",
"48": "/assets/logo/icon48.png",
Expand Down

0 comments on commit 9ad44ae

Please sign in to comment.