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

Side by Side Diff: notification.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Oct. 9, 2017, 3:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 messageElement.addEventListener("click", event => 78 messageElement.addEventListener("click", event =>
79 { 79 {
80 let link = event.target; 80 let link = event.target;
81 while (link && link !== messageElement && link.localName !== "a") 81 while (link && link !== messageElement && link.localName !== "a")
82 link = link.parentNode; 82 link = link.parentNode;
83 if (!link) 83 if (!link)
84 return; 84 return;
85 event.preventDefault(); 85 event.preventDefault();
86 event.stopPropagation(); 86 event.stopPropagation();
87 chrome.tabs.create({url: link.href}); 87 browser.tabs.create({url: link.href});
88 }); 88 });
89 89
90 let notificationElement = document.getElementById("notification"); 90 let notificationElement = document.getElementById("notification");
91 notificationElement.className = notification.type; 91 notificationElement.className = notification.type;
92 notificationElement.hidden = false; 92 notificationElement.hidden = false;
93 notificationElement.addEventListener("click", event => 93 notificationElement.addEventListener("click", event =>
94 { 94 {
95 if (event.target.id == "notification-close") 95 if (event.target.id == "notification-close")
96 notificationElement.classList.add("closing"); 96 notificationElement.classList.add("closing");
97 else if (event.target.id == "notification-optout" || 97 else if (event.target.id == "notification-optout" ||
98 event.target.id == "notification-hide") 98 event.target.id == "notification-hide")
99 { 99 {
100 if (event.target.id == "notification-optout") 100 if (event.target.id == "notification-optout")
101 Notification.toggleIgnoreCategory("*", true); 101 Notification.toggleIgnoreCategory("*", true);
102 102
103 notificationElement.hidden = true; 103 notificationElement.hidden = true;
104 notification.onClicked(); 104 notification.onClicked();
105 } 105 }
106 }, true); 106 }, true);
107 }, false); 107 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld