-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
41 lines (32 loc) · 1.09 KB
/
app.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
34
35
36
37
38
39
40
41
var killClick = false;
var increasingDelay = 200;
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.windows.getCurrent({populate : true}, function (Window) {
var tabArray = Window.tabs;
killClick = !killClick;
if (killClick)
chrome.browserAction.setIcon({ path: 'icon-r.png'});
else
chrome.browserAction.setIcon({ path: 'icon.png'});
while(tabArray.length !== 0)
{
var t = tabArray.shift();
increasingDelay += 700;
if ( !t.pinned && !t.highlighted && !t.active )
if (killClick)
(function (holdURL) {
chrome.tabs.update(t.id, { url: "chrome://kill" } );
chrome.tabs.update(t.id, { url: holdURL } );
}) (t.url);
else
(function (delay, id) {
setTimeout(function() {
chrome.tabs.reload(id);
console.log("reloaded "+t.id+" after delay "+delay);
}, delay);
}) (increasingDelay, t.id);
}
increasingDelay = 200;
});
});