aboutsummaryrefslogtreecommitdiffstats
path: root/better-scrumdo-background.js
blob: faec893343d04205f0db3304f701f980be491319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(function() {
	var scrumdo_regex = /.+:\/\/.+\.scrumdo\.com\/.+\/board/
	var scrumdo_tab_id = 0;
	
	// When a new tab is selected,
	chrome.tabs.onActivated.addListener(function(active_info) {
		chrome.tabs.get(active_info.tabId, function(tab) {
			if (scrumdo_regex.test(tab.url)) {
				scrumdo_tab_id = tab.id;
				
				// set interval
				chrome.tabs.sendMessage(tab.id, {scrumdo_loaded: true});
			}
			else {
				// clear interval
				chrome.tabs.sendMessage(scrumdo_tab_id, {scrumdo_unloaded: true});
			}
		});
	});
})();