-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpopup.js
More file actions
32 lines (26 loc) · 1004 Bytes
/
popup.js
File metadata and controls
32 lines (26 loc) · 1004 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
// function injectTheScript() {
// chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
// // query the active tab, which will be only one tab
// //and inject the script in it
// chrome.tabs.executeScript(tabs[0].id, {file: "content_script.js"});
// });
// }
var refreshIntervalId;
var tabId;
// var timeStamp = Date.now();
document.getElementById('startbutton').addEventListener('click', function(){
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
tabId = tabs[0].id;
refreshIntervalId = setInterval(function() {
// timeStamp = Date.now() - timeStamp;
// var interval = timeStamp/1000;
chrome.tabs.executeScript( tabId, {
code: "location.reload();"
});
// timeStamp = Date.now();
}, 2000);
});
});
document.getElementById('stopbutton').addEventListener('click', function(){
clearInterval(refreshIntervalId);
});