Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 { | 217 { |
218 if (typeof notification.interval == "number") | 218 if (typeof notification.interval == "number") |
219 { | 219 { |
220 if (shown + notification.interval > Date.now()) | 220 if (shown + notification.interval > Date.now()) |
221 continue; | 221 continue; |
222 } | 222 } |
223 else if (shown) | 223 else if (shown) |
224 continue; | 224 continue; |
225 } | 225 } |
226 | 226 |
227 if (Prefs.notifications_ignoredcategories.indexOf("*") != -1) | 227 if (notification.type !== "relentless" && Prefs.notifications_ignoredcat egories.indexOf("*") != -1) |
228 continue; | 228 continue; |
229 } | 229 } |
230 | 230 |
231 if (typeof url === "string" || notification.urlFilters instanceof Array) | 231 if (typeof url === "string" || notification.urlFilters instanceof Array) |
232 { | 232 { |
233 if (Prefs.enabled && typeof url === "string" && notification.urlFilters instanceof Array) | 233 if (Prefs.enabled && typeof url === "string" && notification.urlFilters instanceof Array) |
234 { | 234 { |
235 let host; | 235 let host; |
236 try | 236 try |
237 { | 237 { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 * @param {String} id ID of the notification to be marked as shown | 299 * @param {String} id ID of the notification to be marked as shown |
300 */ | 300 */ |
301 markAsShown: function(id) | 301 markAsShown: function(id) |
302 { | 302 { |
303 let now = Date.now(); | 303 let now = Date.now(); |
304 let data = Prefs.notificationdata; | 304 let data = Prefs.notificationdata; |
305 | 305 |
306 if (data.shown instanceof Array) | 306 if (data.shown instanceof Array) |
307 { | 307 { |
308 let newShown = {}; | 308 let newShown = {}; |
309 for (let old_id of data.shown) | 309 for (let oldId of data.shown) |
310 newShown[old_id] = now; | 310 newShown[oldId] = now; |
311 data.shown = newShown; | 311 data.shown = newShown; |
312 } | 312 } |
313 | 313 |
314 if (!(typeof data.shown == "object")) | 314 if (typeof data.shown != "object") |
Sebastian Noack
2017/01/06 14:17:02
How about |typeof != "object"|?
wspee
2017/01/06 14:35:54
Done.
| |
315 data.shown = {}; | 315 data.shown = {}; |
316 | 316 |
317 data.shown[id] = now; | 317 data.shown[id] = now; |
318 | 318 |
319 saveNotificationData(); | 319 saveNotificationData(); |
320 }, | 320 }, |
321 | 321 |
322 /** | 322 /** |
323 * Localizes the texts of the supplied notification. | 323 * Localizes the texts of the supplied notification. |
324 * @param {Object} notification notification to translate | 324 * @param {Object} notification notification to translate |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 Prefs.notifications_showui = true; | 419 Prefs.notifications_showui = true; |
420 } | 420 } |
421 else if (index != -1 && forceValue !== true) | 421 else if (index != -1 && forceValue !== true) |
422 categories.splice(index, 1); | 422 categories.splice(index, 1); |
423 | 423 |
424 // HACK: JSON values aren't saved unless they are assigned a different objec t. | 424 // HACK: JSON values aren't saved unless they are assigned a different objec t. |
425 Prefs.notifications_ignoredcategories = JSON.parse(JSON.stringify(categories )); | 425 Prefs.notifications_ignoredcategories = JSON.parse(JSON.stringify(categories )); |
426 } | 426 } |
427 }; | 427 }; |
428 Notification.init(); | 428 Notification.init(); |
LEFT | RIGHT |