| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 /* | 
|  | 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
|  | 3  * Copyright (C) 2006-present eyeo GmbH | 
|  | 4  * | 
|  | 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 | 
|  | 7  * published by the Free Software Foundation. | 
|  | 8  * | 
|  | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
|  | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12  * GNU General Public License for more details. | 
|  | 13  * | 
|  | 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/>. | 
|  | 16  */ | 
|  | 17 | 
|  | 18 /** @module browserAction */ | 
|  | 19 | 
|  | 20 "use strict"; | 
|  | 21 | 
|  | 22 const {getDecodedHostname} = require("url"); | 
|  | 23 const {checkWhitelisted} = require("whitelisting"); | 
|  | 24 const {showOptions} = require("options"); | 
|  | 25 | 
|  | 26 // On Firefox for Android, open the options page directly when the browser | 
|  | 27 // action is clicked. | 
|  | 28 chrome.browserAction.onClicked.addListener(() => | 
|  | 29 { | 
|  | 30   ext.pages.query({active: true, lastFocusedWindow: true}, pages => | 
|  | 31   { | 
|  | 32     let currentPage = pages[0]; | 
|  | 33 | 
|  | 34     showOptions(optionsPage => | 
|  | 35     { | 
|  | 36       if (!["http:", "https:"].includes(currentPage.url.protocol)) | 
|  | 37         return; | 
|  | 38 | 
|  | 39       optionsPage.sendMessage({ | 
|  | 40         type: "app.respond", | 
|  | 41         action: "showPageOptions", | 
|  | 42         args: [ | 
|  | 43           { | 
|  | 44             host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), | 
|  | 45             whitelisted: !!checkWhitelisted(currentPage) | 
|  | 46           } | 
|  | 47         ] | 
|  | 48       }); | 
|  | 49     }); | 
|  | 50   }); | 
|  | 51 }); | 
| OLD | NEW | 
|---|