-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotice.js
More file actions
38 lines (33 loc) · 991 Bytes
/
notice.js
File metadata and controls
38 lines (33 loc) · 991 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Show notifications to user.
var Notice = (function () {
var my = {};
my.last_id = {
info_bar: 0
};
// Show error notice.
my.error = function(type, text){
notification.show();
}
// Show status notice
my.status = function(id) {
if (!localStorage['status_' + id]) {
console.log('Suck! Tried to load missing status :(')
return false;
}
var notification = webkitNotifications.createHTMLNotification('status.html?id=' + id);
notification.show();
}
// Show direct message notice
my.direct_message = function(id) {
var notification = webkitNotifications.createHTMLNotification('direct_message.html?id=' + id);
notification.show();
}
my.show_info_bar = function(message) {
localStorage.info_bar_message = message;
chrome.tabs.getSelected(null, function(tab) {
my.last_id.info_bar = tab.id;
chrome.experimental.infobars.show({tabId: tab.id, path: 'infobar.html'});
});
}
return my;
}());