forked from kc596/Facebook_Timer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
47 lines (40 loc) · 975 Bytes
/
functions.js
File metadata and controls
47 lines (40 loc) · 975 Bytes
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
45
46
47
/**
* functions.js - contains necessary functions for Facebook Timer extension
* @author Kunal Chaudhary
*/
/**
* Timer functions
*/
function getSeconds(t){
t=""+(parseInt(t)%60);
if(t.length==1) t="0"+t;
return t;
}
function getMinutes(t){
t=""+(parseInt(t/60)%60);
if(t.length==1) t="0"+t;
return t;
}
function getHours(t){
t=""+parseInt(t/3600);
if(t.length==1) t="0"+t;
return t;
}
/**
* Helper functions
*/
function setTimerValue(){
chrome.storage.local.set({'curr_timer': _curr, 'total_timer': _total}, function(){})
}
function getTimerValue(){
chrome.storage.local.get(['curr_timer', 'total_timer'], function(result){
if(result['curr_timer']==undefined || result['curr_timer']==null)
_curr=0;
else
_curr=result['curr_timer'];
if(result['total_timer']==undefined || result['total_timer']==null)
_total=0;
else
_total=result['total_timer'];
});
}