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: Created July 19, 2013, 5:26 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
« no previous file with comments | « notification.html ('k') | popup.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
12 var titleElement = document.getElementById("title");
13 titleElement.innerHTML = texts.title;
14 var messageElement = document.getElementById("message");
15 messageElement.innerHTML = texts.message;
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 var url = linkElement.href;
29 if (!/^https?:\/\//.test(url))
30 {
31 reportError("Illegal link scheme in URL: " + url);
32 return;
33 }
34 chrome.tabs.create({url: linkElement.href});
35 });
36 }
37
38 var notificationElement = document.getElementById("notification");
39 notificationElement.className = notification.severity;
40 notificationElement.style.display = "block";
41 });
OLDNEW
« no previous file with comments | « notification.html ('k') | popup.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld