-
Notifications
You must be signed in to change notification settings - Fork 0
/
grooveshark_page_watcher.js
42 lines (40 loc) · 1.44 KB
/
grooveshark_page_watcher.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
42
/**
* Copyright 2011 Kurtis L. Nusbaum
*
* This file is part of UDJ.
*
* UDJ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* UDJ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with UDJ. If not, see <http://www.gnu.org/licenses/>.
*/
// Called when the url of a tab changes.
function checkForValidUrl(tabId, changeInfo, tab) {
// If the tabs url starts with "http://specificsite.com"...
if (tab.url.indexOf('http://grooveshark.com') ==0) {
// ... show the page action.
chrome.pageAction.show(tabId);
}
if (tab.url.indexOf('https://grooveshark.com') ==0) {
// ... show the page action.
chrome.pageAction.show(tabId);
}
if (tab.url.indexOf('http://www.grooveshark.com') ==0) {
// ... show the page action.
chrome.pageAction.show(tabId);
}
if (tab.url.indexOf('https://www.grooveshark.com') ==0) {
// ... show the page action.
chrome.pageAction.show(tabId);
}
};
// Listen for any changes to the URL of any tab.
chrome.tabs.onUpdated.addListener(checkForValidUrl);