Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: notification.js

Issue 11161031: Show notifications on startup (Chrome) (Closed)
Patch Set: Address issue from the Firefox review Created July 20, 2013, 10:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 window.addEventListener("load", function()
2 {
3 var backgroundPage = chrome.extension.getBackgroundPage();
4 var notification = backgroundPage.activeNotification;
5 if (!notification)
6 return;
7
8 if (notification.onClicked)
9 notification.onClicked();
10
11 var texts = backgroundPage.getLocalizedTexts(notification);
Wladimir Palant 2013/07/21 11:15:30 Call Notification and Utils directly here (via req
Felix Dahlke 2013/07/22 12:30:15 Done. Not sure why I didn't do it in fact.
12 var titleElement = document.getElementById("title");
13 titleElement.innerHTML = texts.title;
Wladimir Palant 2013/07/21 11:15:30 textContent please, not innerHTML.
Felix Dahlke 2013/07/22 12:30:15 Done.
14 var messageElement = document.getElementById("message");
15 messageElement.innerHTML = texts.message;
Wladimir Palant 2013/07/21 11:15:30 Please use the same code as in Firefox here, not i
Felix Dahlke 2013/07/21 12:19:53 Hehe, I thought I'd try :D This should be safe in
Felix Dahlke 2013/07/22 12:30:15 Done. I think it's less than great that this code
16
17 var docLinks = backgroundPage.getDocLinks(notification);
18 var linkElements = messageElement.getElementsByTagName("a");
19 for (var i = 0; i < linkElements.length; i++)
20 {
21 var linkElement = linkElements[i];
22 if (docLinks && docLinks.length)
23 linkElement.href = docLinks.shift();
24 linkElement.addEventListener("click", function(event)
25 {
26 event.preventDefault();
27 event.stopPropagation();
28 chrome.tabs.create({url: linkElement.href});
29 });
30 }
31
32 var notificationElement = document.getElementById("notification");
33 notificationElement.className = notification.severity;
34 notificationElement.style.display = "block";
35 });
OLDNEW
« metadata.opera ('K') | « notification.html ('k') | popup.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld