LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 }, | 158 }, |
159 has: function(tab) | 159 has: function(tab) |
160 { | 160 { |
161 return this._indexOf(tab) != -1; | 161 return this._indexOf(tab) != -1; |
162 }, | 162 }, |
163 clear: function() | 163 clear: function() |
164 { | 164 { |
165 while (this._data.length > 0) | 165 while (this._data.length > 0) |
166 this.delete(this._data[0].tab); | 166 this.delete(this._data[0].tab); |
167 } | 167 }, |
168 }; | 168 delete: function(tab) |
169 TabMap.prototype["delete"] = function(tab) | 169 { |
170 { | 170 var idx = this._indexOf(tab); |
171 var idx = this._indexOf(tab); | 171 |
172 | 172 if (idx != -1) |
173 if (idx != -1) | 173 { |
174 { | 174 tab = this._data[idx].tab; |
175 tab = this._data[idx].tab; | 175 this._data.splice(idx, 1); |
176 this._data.splice(idx, 1); | 176 |
177 | 177 tab.onRemoved.removeListener(this._delete); |
178 tab.onRemoved.removeListener(this._delete); | 178 tab.onLoading.removeListener(this.delete); |
179 tab.onLoading.removeListener(this.delete); | 179 } |
180 } | 180 } |
181 }; | 181 }; |
182 | 182 |
183 ext.tabs = { | 183 ext.tabs = { |
184 onLoading: new LoadingTabEventTarget(safari.application), | 184 onLoading: new LoadingTabEventTarget(safari.application), |
185 onCompleted: new TabEventTarget(safari.application, "navigate", true), | 185 onCompleted: new TabEventTarget(safari.application, "navigate", true), |
186 onActivated: new TabEventTarget(safari.application, "activate", true), | 186 onActivated: new TabEventTarget(safari.application, "activate", true), |
187 onRemoved: new TabEventTarget(safari.application, "close", true) | 187 onRemoved: new TabEventTarget(safari.application, "close", true) |
188 }; | 188 }; |
189 | 189 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 for (var i = 0; i < contextMenuItems.length; i++) | 706 for (var i = 0; i < contextMenuItems.length; i++) |
707 { | 707 { |
708 if (contextMenuItems[i].id == event.command) | 708 if (contextMenuItems[i].id == event.command) |
709 { | 709 { |
710 contextMenuItems[i].onclick(event.userInfo.srcUrl, new Tab(safari.applic
ation.activeBrowserWindow.activeTab)); | 710 contextMenuItems[i].onclick(event.userInfo.srcUrl, new Tab(safari.applic
ation.activeBrowserWindow.activeTab)); |
711 break; | 711 break; |
712 } | 712 } |
713 } | 713 } |
714 }, false); | 714 }, false); |
715 })(); | 715 })(); |
LEFT | RIGHT |