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

Unified Diff: notification.js

Issue 5749582424178688: Ported over anti-adblock message notification (Closed)
Patch Set: Created March 19, 2014, 1:28 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « notification.html ('k') | webrequest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: notification.js
===================================================================
--- a/notification.js
+++ b/notification.js
@@ -65,9 +65,6 @@
if (!notification)
return;
- if (notification.onClicked)
- notification.onClicked();
-
var texts = Notification.getLocalizedTexts(notification);
var titleElement = document.getElementById("notification-title");
titleElement.textContent = texts.title;
@@ -88,12 +85,35 @@
ext.windows.getLastFocused(function(win) { win.openTab(link.href); });
});
+ if (notification.type == "question")
+ {
+ document.getElementById("notification-question").addEventListener("click", function(event)
+ {
+ event.preventDefault();
+ event.stopPropagation();
+
+ var approved = false;
+ switch (event.target.id)
+ {
+ case "notification-yes":
+ approved = true;
+ case "notification-no":
+ Notification.triggerQuestionListeners(notification.id, approved);
+ Notification.markAsShown(notification.id);
+ notification.onClicked();
+ break;
+ }
+ window.close();
+ }, true);
+ }
+
var notificationElement = document.getElementById("notification");
- notificationElement.className = notification.severity;
+ notificationElement.className = notification.type;
notificationElement.style.display = "block";
document.getElementById("close-notification").addEventListener("click", function()
{
notificationElement.style.display = "none";
+ notification.onClicked();
}, false);
}, false);
« no previous file with comments | « notification.html ('k') | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld