OLD | NEW |
(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 }); |
OLD | NEW |