| OLD | NEW |
| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 "use strict"; | 18 "use strict"; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * @fileOverview Handles notifications. | 21 * @fileOverview Handles notifications. |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 const {Prefs} = require("prefs"); | 24 import {Prefs} from "prefs"; |
| 25 const {Downloader, Downloadable, | 25 import {Downloader, Downloadable, |
| 26 MILLIS_IN_MINUTE, MILLIS_IN_HOUR, | 26 MILLIS_IN_MINUTE, MILLIS_IN_HOUR, |
| 27 MILLIS_IN_DAY} = require("./downloader"); | 27 MILLIS_IN_DAY} from "./downloader"; |
| 28 const {Utils} = require("utils"); | 28 import {Utils} from "utils"; |
| 29 const {Matcher, defaultMatcher} = require("./matcher"); | 29 import {Matcher, defaultMatcher} from "./matcher"; |
| 30 const {Filter, RegExpFilter, WhitelistFilter} = require("./filterClasses"); | 30 import {Filter, RegExpFilter, WhitelistFilter} from "./filterClasses"; |
| 31 | 31 |
| 32 const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; | 32 const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; |
| 33 const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; | 33 const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; |
| 34 const EXPIRATION_INTERVAL = 1 * MILLIS_IN_DAY; | 34 const EXPIRATION_INTERVAL = 1 * MILLIS_IN_DAY; |
| 35 const TYPE = { | 35 const TYPE = { |
| 36 information: 0, | 36 information: 0, |
| 37 question: 1, | 37 question: 1, |
| 38 relentless: 2, | 38 relentless: 2, |
| 39 critical: 3 | 39 critical: 3 |
| 40 }; | 40 }; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 * The object providing actual downloading functionality. | 106 * The object providing actual downloading functionality. |
| 107 * @type {Downloader} | 107 * @type {Downloader} |
| 108 */ | 108 */ |
| 109 let downloader = null; | 109 let downloader = null; |
| 110 let localData = []; | 110 let localData = []; |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Regularly fetches notifications and decides which to show. | 113 * Regularly fetches notifications and decides which to show. |
| 114 * @class | 114 * @class |
| 115 */ | 115 */ |
| 116 let Notification = exports.Notification = | 116 export let Notification = { |
| 117 { | |
| 118 /** | 117 /** |
| 119 * Called on module startup. | 118 * Called on module startup. |
| 120 */ | 119 */ |
| 121 init() | 120 init() |
| 122 { | 121 { |
| 123 downloader = new Downloader(this._getDownloadables.bind(this), | 122 downloader = new Downloader(this._getDownloadables.bind(this), |
| 124 INITIAL_DELAY, CHECK_INTERVAL); | 123 INITIAL_DELAY, CHECK_INTERVAL); |
| 125 downloader.onExpirationChange = this._onExpirationChange.bind(this); | 124 downloader.onExpirationChange = this._onExpirationChange.bind(this); |
| 126 downloader.onDownloadSuccess = this._onDownloadSuccess.bind(this); | 125 downloader.onDownloadSuccess = this._onDownloadSuccess.bind(this); |
| 127 downloader.onDownloadError = this._onDownloadError.bind(this); | 126 downloader.onDownloadError = this._onDownloadError.bind(this); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 else if (index != -1 && forceValue !== true) | 510 else if (index != -1 && forceValue !== true) |
| 512 categories.splice(index, 1); | 511 categories.splice(index, 1); |
| 513 | 512 |
| 514 // HACK: JSON values aren't saved unless they are assigned a | 513 // HACK: JSON values aren't saved unless they are assigned a |
| 515 // different object. | 514 // different object. |
| 516 Prefs.notifications_ignoredcategories = | 515 Prefs.notifications_ignoredcategories = |
| 517 JSON.parse(JSON.stringify(categories)); | 516 JSON.parse(JSON.stringify(categories)); |
| 518 } | 517 } |
| 519 }; | 518 }; |
| 520 Notification.init(); | 519 Notification.init(); |
| OLD | NEW |