-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
24 lines (24 loc) · 715 Bytes
/
background.js
File metadata and controls
24 lines (24 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
chrome.extension.onMessage.addListener(function (objRequest, _, sendResponse) {
if (objRequest.cmd == 'ajax') {
$.ajax($.extend(objRequest.param, {
success: function (data, textStatus, jqXHR) {
sendResponse({
success: true,
data: data,
textStatus: textStatus,
jqXHR: jqXHR
});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
sendResponse({
success: false,
XMLHttpRequest: XMLHttpRequest,
textStatus: textStatus,
errorThrown: errorThrown
});
}
}, true));
} else if (objRequest.cmd == "activate_icon") {
chrome.pageAction.show(sender.tab.id);
}
});