-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoptions.js
More file actions
44 lines (39 loc) · 1.25 KB
/
options.js
File metadata and controls
44 lines (39 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// let page = document.getElementById('buttonDiv');
// const kButtonColors = ['#3aa757', '#e8453c', '#f9bb2d', '#4688f1'];
// function constructOptions(kButtonColors) {
// for (let item of kButtonColors) {
// let button = document.createElement('button');
// button.style.backgroundColor = item;
// button.addEventListener('click', function() {
// chrome.storage.sync.set({color: item}, function() {
// console.log('color is ' + item);
// })
// });
// page.appendChild(button);
// }
// }
// constructOptions(kButtonColors);
$(function(){
chrome.storage.sync.get('limit', function(budget){
$('#limit').val(budget.limit);
})
$('#saveLimit').click(function(){
var limit = $('#limit').val();
if(limit){
chrome.storage.sync.set({'limit' : limit}, function(){
close();
});
}
});
$('#resetTotal').click(function(){
chrome.storage.sync.set({'total': 0}, function(){
var notifOptions = {
type: "basic",
iconUrl: "images/get_started48.png",
title: "Changing total spendings",
message: "Total spendings has now been reset to 0."
};
chrome.notifications.create('resetNotif', notifOptions);
});
});
});