-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
53 lines (33 loc) · 1.22 KB
/
popup.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
43
44
45
46
47
48
49
50
51
52
53
chrome.tabs.query({currentWindow: true, active: true}, function (tabs) {
currentURL = chrome.extension.getBackgroundPage().getURI(tabs[0].url);
protocol = currentURL.protocol();
console.log(protocol);
if (protocol.indexOf("http") === 0) {
chrome.extension.getBackgroundPage().checkIfTracking(currentURL.host(), function(t){
if (t) {
$("#question").html("Already Tracking");
$("#hero").html(currentURL.host());
$("button#track").hide();
} else {
$("#question").html("Start Tracking");
$("#hero").html(currentURL.host() + "?");
}
});
} else {
$("#question").html("Cannot Track Current Site");
$("#hero").html(currentURL);
$("#track").hide();
z
}
});
$(document).ready(function () {
$("button#track").click(function () {
$(this).fadeOut(500);
chrome.extension.getBackgroundPage().addURL(currentURL.host());
$("#question").html("Now Tracking . . . ");
$("#hero").html(currentURL);
});
$("button#options").click(function () {
chrome.tabs.create({url: "/Options_Page/options_new.html"});
})
});