CHATGPT AI
storage
.sync.get(['total', 'limit'], function(budget){
document.getElementById('total').textContent = budget.total;
document.getElementById('limit').textContent = budget.limit;
});

// Event Listeners
document.getElementById('spendAmount').addEventListener('click', function(){
// Get the value of the amount entered
var amount = document.getElementById('amount').value;

if (amount){
// Update the total in the budget object
chrome.storage.sync.get(['total', 'limit'], function(budget){
var newTotal = 0;

if (budget.total){
newTotal += parseInt(budget.total);
}

newTotal += parseInt(amount);

chrome.storage.sync.set({'total': newTotal}, function(){

// Update the UI to reflect changes in total

if (newTotal >= budget.limit){
var notificationOptions = {
type: 'basic',
iconUrl: 'icon48x48_warning_icon_clipart_png_image_thumb2_1024x1024-removebg-preview-1-removebg-preview-1-removebg-preview-1-removebg-preview-1-.png',
title: 'Limit Reached!',
message: "Uh oh! Looks like you've reached your limit!"

};

chrome.notifications.create('limitNotif', notificationOptions);

} else {

chrome
.sync.get(['total', 'limit'], function(budget){ document.getElementById('total').textContent = budget.total; document.getElementById('limit').textContent = budget.limit; }); // Event Listeners document.getElementById('spendAmount').addEventListener('click', function(){ // Get the value of the amount entered var amount = document.getElementById('amount').value; if (amount){ // Update the total in the budget object chrome.storage.sync.get(['total', 'limit'], function(budget){ var newTotal = 0; if (budget.total){ newTotal += parseInt(budget.total); } newTotal += parseInt(amount); chrome.storage.sync.set({'total': newTotal}, function(){ // Update the UI to reflect changes in total if (newTotal >= budget.limit){ var notificationOptions = { type: 'basic', iconUrl: 'icon48x48_warning_icon_clipart_png_image_thumb2_1024x1024-removebg-preview-1-removebg-preview-1-removebg-preview-1-removebg-preview-1-.png', title: 'Limit Reached!', message: "Uh oh! Looks like you've reached your limit!" }; chrome.notifications.create('limitNotif', notificationOptions); } else { chrome
0 Comments & Tags 0 Anteile 1 Ansichten

Password Copied!

Please Wait....