| 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-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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 { | 597 { |
| 598 chrome.storage.local.remove(key, callback); | 598 chrome.storage.local.remove(key, callback); |
| 599 }, | 599 }, |
| 600 onChanged: chrome.storage.onChanged | 600 onChanged: chrome.storage.onChanged |
| 601 }; | 601 }; |
| 602 | 602 |
| 603 /* Options */ | 603 /* Options */ |
| 604 | 604 |
| 605 if ("openOptionsPage" in chrome.runtime) | 605 if ("openOptionsPage" in chrome.runtime) |
| 606 { | 606 { |
| 607 ext.showOptions = chrome.runtime.openOptionsPage; | 607 ext.showOptions = function(callback) |
| 608 { |
| 609 if (!callback) |
| 610 { |
| 611 chrome.runtime.openOptionsPage(); |
| 612 } |
| 613 else |
| 614 { |
| 615 chrome.runtime.openOptionsPage(() => |
| 616 { |
| 617 if (chrome.runtime.lastError) |
| 618 return; |
| 619 |
| 620 chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => |
| 621 { |
| 622 if (tabs.length > 0) |
| 623 { |
| 624 window.setTimeout(() => |
| 625 { |
| 626 callback(new Page(tabs[0])); |
| 627 }); |
| 628 } |
| 629 }); |
| 630 }); |
| 631 } |
| 632 }; |
| 608 } | 633 } |
| 609 else | 634 else |
| 610 { | 635 { |
| 611 // Edge does not yet support runtime.openOptionsPage (tested version 38) | 636 // Edge does not yet support runtime.openOptionsPage (tested version 38) |
| 612 // and so this workaround needs to stay for now. | 637 // and so this workaround needs to stay for now. |
| 613 ext.showOptions = function(callback) | 638 ext.showOptions = function(callback) |
| 614 { | 639 { |
| 615 chrome.windows.getLastFocused(function(win) | 640 chrome.windows.getLastFocused(function(win) |
| 616 { | 641 { |
| 617 var optionsUrl = chrome.extension.getURL("options.html"); | 642 var optionsUrl = chrome.extension.getURL("options.html"); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 648 ext.windows = { | 673 ext.windows = { |
| 649 create: function(createData, callback) | 674 create: function(createData, callback) |
| 650 { | 675 { |
| 651 chrome.windows.create(createData, function(createdWindow) | 676 chrome.windows.create(createData, function(createdWindow) |
| 652 { | 677 { |
| 653 afterTabLoaded(callback)(createdWindow.tabs[0]); | 678 afterTabLoaded(callback)(createdWindow.tabs[0]); |
| 654 }); | 679 }); |
| 655 } | 680 } |
| 656 }; | 681 }; |
| 657 })(); | 682 })(); |
| OLD | NEW |