| 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-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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 callback(new Page(openedTab)); | 69 callback(new Page(openedTab)); |
| 70 } | 70 } |
| 71 }; | 71 }; |
| 72 chrome.tabs.onUpdated.addListener(onUpdated); | 72 chrome.tabs.onUpdated.addListener(onUpdated); |
| 73 }; | 73 }; |
| 74 } | 74 } |
| 75 | 75 |
| 76 ext.pages = { | 76 ext.pages = { |
| 77 open: function(url, callback) | 77 open: function(url, callback) |
| 78 { | 78 { |
| 79 if (callback) | 79 chrome.tabs.create({url: url}, callback && afterTabLoaded(callback)); |
| 80 chrome.tabs.create({url: url}, afterTabLoaded(callback)); | |
|
Sebastian Noack
2016/02/15 14:53:44
Why didn't you go for |callback && afterTabLoaded(
kzar
2016/02/15 15:46:06
Done.
| |
| 81 else | |
| 82 chrome.tabs.create({url: url}); | |
| 83 }, | 80 }, |
| 84 query: function(info, callback) | 81 query: function(info, callback) |
| 85 { | 82 { |
| 86 var rawInfo = {}; | 83 var rawInfo = {}; |
| 87 for (var property in info) | 84 for (var property in info) |
| 88 { | 85 { |
| 89 switch (property) | 86 switch (property) |
| 90 { | 87 { |
| 91 case "active": | 88 case "active": |
| 92 case "lastFocusedWindow": | 89 case "lastFocusedWindow": |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 ext.pages.open(optionsUrl, callback); | 587 ext.pages.open(optionsUrl, callback); |
| 591 } | 588 } |
| 592 }); | 589 }); |
| 593 }); | 590 }); |
| 594 }; | 591 }; |
| 595 | 592 |
| 596 /* Windows */ | 593 /* Windows */ |
| 597 ext.windows = { | 594 ext.windows = { |
| 598 create: function(createData, callback) | 595 create: function(createData, callback) |
| 599 { | 596 { |
| 600 if (callback) | 597 chrome.windows.create(createData, function(createdWindow) |
|
Sebastian Noack
2016/02/15 14:53:44
It seems, creating a window without callback is a
kzar
2016/02/15 15:46:06
Done.
| |
| 601 chrome.windows.create(createData, function(createdWindow) | 598 { |
| 602 { | 599 afterTabLoaded(callback)(createdWindow.tabs[0]); |
| 603 afterTabLoaded(callback)(createdWindow.tabs[0]); | 600 }); |
| 604 }); | |
| 605 else | |
| 606 chrome.windows.create(createData); | |
| 607 } | 601 } |
| 608 }; | 602 }; |
| 609 })(); | 603 })(); |
| LEFT | RIGHT |