-
Notifications
You must be signed in to change notification settings - Fork 1
/
popup.js
33 lines (31 loc) · 1.22 KB
/
popup.js
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
/*var port = chrome.extension.connect({
name: "comm"
});
*/
document.getElementById('btn').onclick = function(){
var timer = (parseInt(document.getElementById('interval_mins').value) * 60) + parseInt(document.getElementById('interval_secs').value)
// port.postMessage(timer);
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {tick: timer});
//alert('msg sent from back.js');
});
//alert('msg sent');
/*chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {message: timer});
});*/
};
document.getElementById('resetbtn').onclick = function() {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {reset:true});
});
}
document.getElementById('pausebtn').onclick = function() {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {pause:true});
});
}
document.getElementById('resumebtn').onclick = function() {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {resume:true});
});
}