blob: 5f8d31a8240b86cfd58cd68e220561f4418795fc (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<script>
(function () {
// Contains all notifications received since the page was loaded as a
// map from each data type to the number of notifications received for
// it.
chrome.sync.notifications = {};
function updateNotificationsEnabledInfo(notificationsEnabled) {
var notificationsEnabledInfo =
document.getElementById('notificationsEnabledInfo');
jstProcess(
new JsEvalContext({ 'notificationsEnabled': notificationsEnabled }),
notificationsEnabledInfo);
}
function updateNotificationInfo(notification) {
var notificationInfo = document.getElementById('notificationInfo');
jstProcess(
new JsEvalContext({ 'notificationInfo':
JSON.stringify(notification, null, 2)
}),
notificationInfo);
}
function onLoad() {
chrome.sync.getNotificationState(updateNotificationsEnabledInfo);
chrome.sync.getNotificationInfo(updateNotificationInfo);
chrome.sync.onSyncNotificationStateChange.addListener(
updateNotificationsEnabledInfo);
chrome.sync.onSyncIncomingNotification.addListener(function(changedTypes) {
for (var i = 0; i < changedTypes.length; ++i) {
var changedType = changedTypes[i];
chrome.sync.notifications[changedType] =
chrome.sync.notifications[changedType] || 0;
++chrome.sync.notifications[changedType];
}
var infos = [];
for (var k in chrome.sync.notifications) {
var info = {
'modelType': k,
'notificationCount': chrome.sync.notifications[k]
};
infos.push(info);
}
var notificationsInfo =
document.getElementById('notificationsInfo');
jstProcess(new JsEvalContext({ 'notifications': infos }),
notificationsInfo);
chrome.sync.getNotificationInfo(updateNotificationInfo);
});
}
document.addEventListener("DOMContentLoaded", onLoad, false);
})();
</script>
<style>
table#notificationsInfo tr:nth-child(odd) {
background: #eff3ff;
}
</style>
<p id='notificationsEnabledInfo'>
Enabled: <span jscontent='notificationsEnabled'></span>
</p>
<p id='notificationInfo'>
<span jscontent='notificationInfo'></span>
</p>
<table id='notificationsInfo'>
<tr jsselect='notifications'>
<td jscontent='modelType'/>
<td jscontent='notificationCount'/>
</tr>
</table>
|