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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 contextMenuUpdating = false; | 446 contextMenuUpdating = false; |
447 | 447 |
448 if (tabs.length == 0) | 448 if (tabs.length == 0) |
449 return; | 449 return; |
450 | 450 |
451 let items = contextMenuItems.get({id: tabs[0].id}); | 451 let items = contextMenuItems.get({id: tabs[0].id}); |
452 | 452 |
453 if (!items) | 453 if (!items) |
454 return; | 454 return; |
455 | 455 |
456 items.forEach(item => | 456 for (let item of items) |
457 { | 457 { |
458 browser.contextMenus.create({ | 458 browser.contextMenus.create({ |
459 title: item.title, | 459 title: item.title, |
460 contexts: item.contexts, | 460 contexts: item.contexts, |
461 onclick(info, tab) | 461 onclick(info, tab) |
462 { | 462 { |
463 item.onclick(new Page(tab)); | 463 item.onclick(new Page(tab)); |
464 } | 464 } |
465 }); | 465 }); |
466 }); | 466 } |
467 }); | 467 }); |
468 }); | 468 }); |
469 }; | 469 }; |
470 | 470 |
471 let ContextMenus = function(page) | 471 let ContextMenus = function(page) |
472 { | 472 { |
473 this._page = page; | 473 this._page = page; |
474 }; | 474 }; |
475 ContextMenus.prototype = { | 475 ContextMenus.prototype = { |
476 create(item) | 476 create(item) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 return frames.get(0) || null; | 603 return frames.get(0) || null; |
604 } | 604 } |
605 }; | 605 }; |
606 } | 606 } |
607 | 607 |
608 return ext.onMessage._dispatch( | 608 return ext.onMessage._dispatch( |
609 message, sender, sendResponse | 609 message, sender, sendResponse |
610 ).includes(true); | 610 ).includes(true); |
611 }); | 611 }); |
612 } | 612 } |
OLD | NEW |