| 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-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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // options page to open instead of the bubble. Unfortunately there's a bug[1] | 181 // options page to open instead of the bubble. Unfortunately there's a bug[1] |
| 182 // which prevents us from doing that, so we must avoid setting the URL on | 182 // which prevents us from doing that, so we must avoid setting the URL on |
| 183 // Firefox from the manifest at all, instead setting it here only for | 183 // Firefox from the manifest at all, instead setting it here only for |
| 184 // non-mobile. | 184 // non-mobile. |
| 185 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1414613 | 185 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1414613 |
| 186 if ("getBrowserInfo" in browser.runtime) | 186 if ("getBrowserInfo" in browser.runtime) |
| 187 { | 187 { |
| 188 browser.runtime.getBrowserInfo().then(browserInfo => | 188 browser.runtime.getBrowserInfo().then(browserInfo => |
| 189 { | 189 { |
| 190 if (browserInfo.name == "Fennec") | 190 if (browserInfo.name == "Fennec") |
| 191 browser.browserAction.setPopup({popup: null}); | 191 browser.browserAction.setPopup({popup: ""}); |
| 192 }); | 192 }); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // On Firefox for Android, open the options page directly when the browser | 195 // On Firefox for Android, open the options page directly when the browser |
| 196 // action is clicked. | 196 // action is clicked. |
| 197 browser.browserAction.onClicked.addListener(() => | 197 browser.browserAction.onClicked.addListener(() => |
| 198 { | 198 { |
| 199 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => | 199 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => |
| 200 { | 200 { |
| 201 let currentPage = new ext.Page(tab); | 201 let currentPage = new ext.Page(tab); |
| 202 | 202 |
| 203 showOptions((optionsPage, port) => | 203 showOptions((optionsPage, port) => |
| 204 { | 204 { |
| 205 if (!/^https?:$/.test(currentPage.url.protocol)) | 205 if (!/^https?:$/.test(currentPage.url.protocol)) |
| 206 return; | 206 return; |
| 207 | 207 |
| 208 port.postMessage({ | 208 port.postMessage({ |
| 209 type: "app.respond", | 209 type: "app.respond", |
| 210 action: "showPageOptions", | 210 action: "showPageOptions", |
| 211 args: [ | 211 args: [ |
| 212 { | 212 { |
| 213 host: currentPage.url.hostname.replace(/^www\./, ""), | 213 host: currentPage.url.hostname.replace(/^www\./, ""), |
| 214 whitelisted: !!checkWhitelisted(currentPage) | 214 whitelisted: !!checkWhitelisted(currentPage) |
| 215 } | 215 } |
| 216 ] | 216 ] |
| 217 }); | 217 }); |
| 218 }); | 218 }); |
| 219 }); | 219 }); |
| 220 }); | 220 }); |
| LEFT | RIGHT |