| Left: | ||
| Right: |
| 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 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 if (event.oldValue != null) | 581 if (event.oldValue != null) |
| 582 change.oldValue = event.oldValue; | 582 change.oldValue = event.oldValue; |
| 583 if (event.newValue != null) | 583 if (event.newValue != null) |
| 584 change.newValue = event.newValue; | 584 change.newValue = event.newValue; |
| 585 | 585 |
| 586 ext.storage.onChanged._dispatch(changes); | 586 ext.storage.onChanged._dispatch(changes); |
| 587 }); | 587 }); |
| 588 | 588 |
| 589 | 589 |
| 590 /* Options */ | 590 /* Options */ |
| 591 | 591 ext.showPage = function(url, callback) |
| 592 ext.showOptions = function(callback) | |
| 593 { | 592 { |
| 594 var optionsUrl = safari.extension.baseURI + "options.html"; | |
| 595 | |
| 596 for (var id in pages) | 593 for (var id in pages) |
| 597 { | 594 { |
| 598 var page = pages[id]; | 595 var page = pages[id]; |
| 599 var tab = page._tab; | 596 var tab = page._tab; |
| 600 | 597 |
| 601 if (page.url.href == optionsUrl && tab.browserWindow == safari.application .activeBrowserWindow) | 598 if (page.url.href == url && tab.browserWindow == safari.application.active BrowserWindow) |
|
Sebastian Noack
2018/07/13 18:04:18
I just figured, this wouldn't work anyway as expec
Sebastian Noack
2018/07/13 18:06:37
Ignore that comment. It actually would work, since
kzar
2018/07/13 18:44:04
Yes, I originally made that mistake but noticed it
| |
| 602 { | 599 { |
| 603 tab.activate(); | 600 tab.activate(); |
| 604 if (callback) | 601 if (callback) |
| 605 callback(page); | 602 callback(page); |
| 606 return; | 603 return; |
| 607 } | 604 } |
| 608 } | 605 } |
| 609 | 606 |
| 610 ext.pages.open(optionsUrl, callback); | 607 ext.pages.open(url, callback); |
| 611 }; | 608 }; |
| 612 | 609 |
| 610 ext.showOptions = ext.showPage.bind(this, safari.extension.baseURI + "options. html"); | |
| 611 | |
| 613 /* Windows */ | 612 /* Windows */ |
| 614 ext.windows = { | 613 ext.windows = { |
| 615 // Safari doesn't provide as rich a windows API as Chrome does, so instead | 614 // Safari doesn't provide as rich a windows API as Chrome does, so instead |
| 616 // of chrome.windows.create we have to fall back to just opening a new tab. | 615 // of chrome.windows.create we have to fall back to just opening a new tab. |
| 617 create: function(createData, callback) | 616 create: function(createData, callback) |
| 618 { | 617 { |
| 619 ext.pages.open(createData.url, callback); | 618 ext.pages.open(createData.url, callback); |
| 620 } | 619 } |
| 621 }; | 620 }; |
| 622 })(); | 621 })(); |
| OLD | NEW |