| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 let BrowserAction = function(tabId) | 320 let BrowserAction = function(tabId) |
| 321 { | 321 { |
| 322 this._tabId = tabId; | 322 this._tabId = tabId; |
| 323 this._changes = null; | 323 this._changes = null; |
| 324 }; | 324 }; |
| 325 BrowserAction.prototype = { | 325 BrowserAction.prototype = { |
| 326 _applyChanges() | 326 _applyChanges() |
| 327 { | 327 { |
| 328 if ("iconPath" in this._changes) | 328 if ("iconPath" in this._changes) |
| 329 { | 329 { |
| 330 // Firefox for Android displays the browser action not as an icon but | |
| 331 // as a menu item. There is no icon, but such an option may be added in | |
| 332 // the future. | |
| 333 // https://bugzilla.mozilla.org/show_bug.cgi?id=1331746 | |
| 330 if ("setIcon" in chrome.browserAction) | 334 if ("setIcon" in chrome.browserAction) |
|
Wladimir Palant
2017/08/16 10:52:07
Here and below, maybe add a comment explaining whi
Manish Jethani
2017/08/16 11:45:42
Done.
| |
| 331 { | 335 { |
| 332 chrome.browserAction.setIcon({ | 336 chrome.browserAction.setIcon({ |
| 333 tabId: this._tabId, | 337 tabId: this._tabId, |
| 334 path: { | 338 path: { |
| 335 16: this._changes.iconPath.replace("$size", "16"), | 339 16: this._changes.iconPath.replace("$size", "16"), |
| 336 19: this._changes.iconPath.replace("$size", "19"), | 340 19: this._changes.iconPath.replace("$size", "19"), |
| 337 20: this._changes.iconPath.replace("$size", "20"), | 341 20: this._changes.iconPath.replace("$size", "20"), |
| 338 32: this._changes.iconPath.replace("$size", "32"), | 342 32: this._changes.iconPath.replace("$size", "32"), |
| 339 38: this._changes.iconPath.replace("$size", "38"), | 343 38: this._changes.iconPath.replace("$size", "38"), |
| 340 40: this._changes.iconPath.replace("$size", "40") | 344 40: this._changes.iconPath.replace("$size", "40") |
| 341 } | 345 } |
| 342 }); | 346 }); |
| 343 } | 347 } |
| 344 } | 348 } |
| 345 | 349 |
| 346 if ("badgeText" in this._changes) | 350 if ("badgeText" in this._changes) |
| 347 { | 351 { |
| 352 // There is no badge on Firefox for Android; the browser action is | |
| 353 // simply a menu item. | |
| 348 if ("setBadgeText" in chrome.browserAction) | 354 if ("setBadgeText" in chrome.browserAction) |
| 349 { | 355 { |
| 350 chrome.browserAction.setBadgeText({ | 356 chrome.browserAction.setBadgeText({ |
| 351 tabId: this._tabId, | 357 tabId: this._tabId, |
| 352 text: this._changes.badgeText | 358 text: this._changes.badgeText |
| 353 }); | 359 }); |
| 354 } | 360 } |
| 355 } | 361 } |
| 356 | 362 |
| 357 if ("badgeColor" in this._changes) | 363 if ("badgeColor" in this._changes) |
| 358 { | 364 { |
| 365 // There is no badge on Firefox for Android; the browser action is | |
| 366 // simply a menu item. | |
| 359 if ("setBadgeBackgroundColor" in chrome.browserAction) | 367 if ("setBadgeBackgroundColor" in chrome.browserAction) |
| 360 { | 368 { |
| 361 chrome.browserAction.setBadgeBackgroundColor({ | 369 chrome.browserAction.setBadgeBackgroundColor({ |
| 362 tabId: this._tabId, | 370 tabId: this._tabId, |
| 363 color: this._changes.badgeColor | 371 color: this._changes.badgeColor |
| 364 }); | 372 }); |
| 365 } | 373 } |
| 366 } | 374 } |
| 367 | 375 |
| 368 this._changes = null; | 376 this._changes = null; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 748 ext.windows = { | 756 ext.windows = { |
| 749 create(createData, callback) | 757 create(createData, callback) |
| 750 { | 758 { |
| 751 chrome.windows.create(createData, createdWindow => | 759 chrome.windows.create(createData, createdWindow => |
| 752 { | 760 { |
| 753 afterTabLoaded(callback)(createdWindow.tabs[0]); | 761 afterTabLoaded(callback)(createdWindow.tabs[0]); |
| 754 }); | 762 }); |
| 755 } | 763 } |
| 756 }; | 764 }; |
| 757 }()); | 765 }()); |
| LEFT | RIGHT |