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

Unified Diff: lib/notificationHelper.js

Issue 29569649: Issue 4580 - Replace ext.i18n with i18n (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Update adblockplusui dependency Created Oct. 10, 2017, 1 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 | « lib/filterValidation.js ('k') | lib/utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/notificationHelper.js
===================================================================
--- a/lib/notificationHelper.js
+++ b/lib/notificationHelper.js
@@ -52,21 +52,21 @@
function getNotificationButtons(notificationType, message)
{
let buttons = [];
if (notificationType == "question")
{
buttons.push({
type: "question",
- title: ext.i18n.getMessage("overlay_notification_button_yes")
+ title: chrome.i18n.getMessage("overlay_notification_button_yes")
});
buttons.push({
type: "question",
- title: ext.i18n.getMessage("overlay_notification_button_no")
+ title: chrome.i18n.getMessage("overlay_notification_button_no")
});
}
else
{
let regex = /<a>(.*?)<\/a>/g;
let match;
while (match = regex.exec(message))
{
@@ -79,25 +79,25 @@
// Chrome only allows two notification buttons so we need to fall back
// to a single button to open all links if there are more than two.
let maxButtons = (notificationType == "critical") ? 2 : 1;
if (buttons.length > maxButtons)
{
buttons = [
{
type: "open-all",
- title: ext.i18n.getMessage("notification_open_all")
+ title: chrome.i18n.getMessage("notification_open_all")
}
];
}
if (!["critical", "relentless"].includes(notificationType))
{
buttons.push({
type: "configure",
- title: ext.i18n.getMessage("notification_configure")
+ title: chrome.i18n.getMessage("notification_configure")
});
}
}
return buttons;
}
function openNotificationLinks()
@@ -205,17 +205,17 @@
// We use the highest priority to prevent the notification
// from closing automatically.
priority: 2
});
}
else if ("Notification" in window && activeNotification.type != "question")
{
if (linkCount > 0)
- message += " " + ext.i18n.getMessage("notification_without_buttons");
+ message += " " + chrome.i18n.getMessage("notification_without_buttons");
let widget = new Notification(
title,
{
lang: Utils.appLocale,
dir: Utils.readingDirection,
body: message,
icon: iconUrl
@@ -224,17 +224,17 @@
widget.addEventListener("click", openNotificationLinks);
widget.addEventListener("close", notificationClosed);
}
else
{
message = title + "\n" + message;
if (linkCount > 0)
- message += "\n\n" + ext.i18n.getMessage("notification_with_buttons");
+ message += "\n\n" + chrome.i18n.getMessage("notification_with_buttons");
let approved = confirm(message);
if (activeNotification.type == "question")
notificationButtonClick(approved ? 0 : 1);
else if (approved)
openNotificationLinks();
}
}
« no previous file with comments | « lib/filterValidation.js ('k') | lib/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld