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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1593 hideElement(prefix + "contributebutton", Prefs.hideContributeButton); | 1593 hideElement(prefix + "contributebutton", Prefs.hideContributeButton); |
1594 }, | 1594 }, |
1595 | 1595 |
1596 /** | 1596 /** |
1597 * Adds Adblock Plus menu items to the content area context menu when it shows | 1597 * Adds Adblock Plus menu items to the content area context menu when it shows |
1598 * up. | 1598 * up. |
1599 */ | 1599 */ |
1600 fillContentContextMenu: function(/**Element*/ popup) | 1600 fillContentContextMenu: function(/**Element*/ popup) |
1601 { | 1601 { |
1602 let window = popup.ownerDocument.defaultView; | 1602 let window = popup.ownerDocument.defaultView; |
1603 if (typeof window.gContextMenuContentData != "object" || | 1603 if (!window.gContextMenuContentData || |
1604 typeof window.gContextMenuContentData.addonInfo != "object" || | 1604 typeof window.gContextMenuContentData.addonInfo != "object" || |
1605 typeof window.gContextMenuContentData.addonInfo.adblockplus != "object") | 1605 typeof window.gContextMenuContentData.addonInfo.adblockplus != "object") |
1606 { | 1606 { |
1607 return; | 1607 return; |
1608 } | 1608 } |
1609 | 1609 |
1610 let items = window.gContextMenuContentData.addonInfo.adblockplus; | 1610 let items = window.gContextMenuContentData.addonInfo.adblockplus; |
1611 let clicked = null; | 1611 let clicked = null; |
1612 let menuItems = []; | 1612 let menuItems = []; |
1613 | 1613 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1657 if (event.eventPhase != event.AT_TARGET) | 1657 if (event.eventPhase != event.AT_TARGET) |
1658 return; | 1658 return; |
1659 | 1659 |
1660 popup.removeEventListener("popuphidden", cleanUp, false); | 1660 popup.removeEventListener("popuphidden", cleanUp, false); |
1661 for (let menuItem of menuItems) | 1661 for (let menuItem of menuItems) |
1662 if (menuItem.parentNode) | 1662 if (menuItem.parentNode) |
1663 menuItem.parentNode.removeChild(menuItem); | 1663 menuItem.parentNode.removeChild(menuItem); |
1664 | 1664 |
1665 for (let [id, nodeData] of items) | 1665 for (let [id, nodeData] of items) |
1666 if (id && id != clicked) | 1666 if (id && id != clicked) |
1667 Policy.deleteNodes(id); | 1667 Policy.deleteNodes(id); |
Erik
2015/12/03 23:21:57
I'm not quite sure what this piece is for.
Wladimir Palant
2015/12/04 12:05:10
We are keeping a reference to the nodes in the con
| |
1668 }.bind(this); | 1668 }.bind(this); |
1669 popup.addEventListener("popuphidden", cleanUp, false); | 1669 popup.addEventListener("popuphidden", cleanUp, false); |
1670 }, | 1670 }, |
1671 | 1671 |
1672 /** | 1672 /** |
1673 * Called when the user presses a key in the application window, reacts to our | 1673 * Called when the user presses a key in the application window, reacts to our |
1674 * shortcut keys. | 1674 * shortcut keys. |
1675 */ | 1675 */ |
1676 onKeyPress: function(/**Event*/ event) | 1676 onKeyPress: function(/**Event*/ event) |
1677 { | 1677 { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1887 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], | 1887 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], |
1888 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)] | 1888 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)] |
1889 ]; | 1889 ]; |
1890 | 1890 |
1891 onShutdown.add(function() | 1891 onShutdown.add(function() |
1892 { | 1892 { |
1893 for (let window of UI.applicationWindows) | 1893 for (let window of UI.applicationWindows) |
1894 if (UI.isBottombarOpen(window)) | 1894 if (UI.isBottombarOpen(window)) |
1895 UI.toggleBottombar(window); | 1895 UI.toggleBottombar(window); |
1896 }); | 1896 }); |
LEFT | RIGHT |