-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.html
29 lines (27 loc) · 1 KB
/
background.html
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
<html>
<head>
<title>URLRotator</title>
<script type="text/javascript" src="URLRotator.js"></script>
<script>
if (!GB.getWatchThisInstead()) {
GB.setWatchThisInstead(chrome.extension.getURL("instead.html"));
}
chrome.tabs.onUpdated.addListener(function(tabId, changedInfo, tab) {
for (site in GB.getRotatingSites()) {
if (tab.url.match(site)) {
chrome.tabs.update(tabId, {"url" : GB.getWatchThisInstead()}, function () {});
}
}
});
chrome.tabs.onCreated.addListener(function(tab) {
for (site in GB.getBlockedSites()) {
if (tab.url.match(site)) {
chrome.tabs.update(tab.id, {"url" : GB.getWatchThisInstead()}, function () {});
}
}
});
</script>
</head>
<body>
</body>
</html>