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 Feb. 28, 2014, 6:41 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
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);

Powered by Google App Engine
This is Rietveld