-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.html
47 lines (40 loc) · 1.15 KB
/
background.html
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
<html>
<script type="text/javascript" src="jquery.js"></script>
<script>
var email = localStorage["email"];
var password = localStorage["password"];
function update_view(view, notes) {
for (i in notes) {
var uri = notes[i]['uri'];
$.ajax({
url: uri,
username: email,
password: password,
beforeSend: function(xreq) {
xreq.setRequestHeader('Cache-Control', 'no-cache');
},
dataType: 'json',
success: function(data) {
var note = data['note'];
view.update_skeleton_row(
note['subject'], note['content'], note['id']);
}
});
}
}
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
if (request.notes) {
sendResponse({});
var views = chrome.extension.getViews();
for (var i = 0; i < views.length; i++) {
var view = views[i];
if (!view.add_row)
continue;
update_view(view, request.notes);
}
}
}
);
</script>
</html>