-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbackground.js
37 lines (33 loc) · 1.07 KB
/
background.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
//Check if TrelloScrum is installed
// id as of v. 0.53
var trelloScrumExtensionId = "jdbcdblgjdpmfninkoogcfpnkjmndgje";
var trelloScrumInstalled=false;
chrome.extension.sendRequest(trelloScrumExtensionId, {getTargetData: true},
function(response) {
console.log("Options :: Checking if Trello Scrum ("+trelloScrumExtensionId+") is installed: "+response);
trelloScrumInstalled = true;
});
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.method == "getLocalStorage") {
if (request.key==="pointpicker") {
var pointPickerSettings = {
type: localStorage["pointsSequence"],
values: localStorage["pointsSequence-values"]
};
sendResponse({
data : pointPickerSettings
});
}else {
sendResponse({
data : localStorage[request.key]
});
}
console.log("Options :: Received request: " + request.method + " from " + sender+" = "+localStorage[request.key]);
}else if (request.method == "trelloScrumInstalled") {
sendResponse({
data : trelloScrumInstalled
});
} else {
sendResponse({}); // snub them.
}
});