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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 { | 114 { |
115 chrome.tabs.onUpdated.removeListener(onUpdated); | 115 chrome.tabs.onUpdated.removeListener(onUpdated); |
116 callback(new Page(openedTab)); | 116 callback(new Page(openedTab)); |
117 } | 117 } |
118 }; | 118 }; |
119 chrome.tabs.onUpdated.addListener(onUpdated); | 119 chrome.tabs.onUpdated.addListener(onUpdated); |
120 }; | 120 }; |
121 } | 121 } |
122 | 122 |
123 ext.pages = { | 123 ext.pages = { |
124 query(info, callback) | |
125 { | |
126 let rawInfo = {}; | |
127 for (let property in info) | |
128 { | |
129 switch (property) | |
130 { | |
131 case "active": | |
132 case "lastFocusedWindow": | |
133 rawInfo[property] = info[property]; | |
134 } | |
135 } | |
136 | |
137 chrome.tabs.query(rawInfo, tabs => | |
138 { | |
139 callback(tabs.map(tab => new Page(tab))); | |
140 }); | |
141 }, | |
142 onLoading: new ext._EventTarget(), | 124 onLoading: new ext._EventTarget(), |
143 onActivated: new ext._EventTarget(), | 125 onActivated: new ext._EventTarget(), |
144 onRemoved: new ext._EventTarget() | 126 onRemoved: new ext._EventTarget() |
145 }; | 127 }; |
146 | 128 |
147 chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => | 129 chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => |
148 { | 130 { |
149 if (changeInfo.status == "loading") | 131 if (changeInfo.status == "loading") |
150 ext.pages.onLoading._dispatch(new Page(tab)); | 132 ext.pages.onLoading._dispatch(new Page(tab)); |
151 }); | 133 }); |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 ext.windows = { | 675 ext.windows = { |
694 create(createData, callback) | 676 create(createData, callback) |
695 { | 677 { |
696 chrome.windows.create(createData, createdWindow => | 678 chrome.windows.create(createData, createdWindow => |
697 { | 679 { |
698 afterTabLoaded(callback)(createdWindow.tabs[0]); | 680 afterTabLoaded(callback)(createdWindow.tabs[0]); |
699 }); | 681 }); |
700 } | 682 } |
701 }; | 683 }; |
702 }()); | 684 }()); |
OLD | NEW |