| Index: lib/notificationHelper.js |
| =================================================================== |
| --- a/lib/notificationHelper.js |
| +++ b/lib/notificationHelper.js |
| @@ -191,25 +191,35 @@ |
| let message = (texts.message || "").replace(/<\/?(a|strong)>/g, ""); |
| let iconUrl = browser.extension.getURL("icons/detailed/abp-128.png"); |
| let linkCount = (activeNotification.links || []).length; |
| if ("notifications" in browser) |
| { |
| activeButtons = getNotificationButtons(activeNotification.type, |
| texts.message); |
| - browser.notifications.create("", { |
| + let notificationOptions = { |
| type: "basic", |
| title, |
| iconUrl, |
| message, |
| buttons: activeButtons.map(button => ({title: button.title})), |
| // We use the highest priority to prevent the notification |
| // from closing automatically. |
| priority: 2 |
| + }; |
| + browser.notifications.create("", notificationOptions, () => |
| + { |
| + // Opera does not support the addtition of buttons to notifications. |
|
Sebastian Noack
2017/11/01 18:45:03
Typo: addtition
|
| + // Question type notfications always include buttons. |
| + if (browser.runtime.lastError && activeNotification.type != "question") |
| + { |
| + delete notificationOptions.buttons; |
| + browser.notifications.create("", notificationOptions); |
| + } |
| }); |
| } |
| else if ("Notification" in window && activeNotification.type != "question") |
| { |
| if (linkCount > 0) |
| { |
| message += " " + browser.i18n.getMessage( |
| "notification_without_buttons" |