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-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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 target = target.ownerDocument.elementFromPoint(Math.max(rect.left, 0), Mat
h.max(rect.top, 0)); | 1605 target = target.ownerDocument.elementFromPoint(Math.max(rect.left, 0), Mat
h.max(rect.top, 0)); |
1606 } | 1606 } |
1607 | 1607 |
1608 if (!target) | 1608 if (!target) |
1609 return; | 1609 return; |
1610 | 1610 |
1611 let window = popup.ownerDocument.defaultView; | 1611 let window = popup.ownerDocument.defaultView; |
1612 let menuItems = []; | 1612 let menuItems = []; |
1613 let addMenuItem = function([node, nodeData]) | 1613 let addMenuItem = function([node, nodeData]) |
1614 { | 1614 { |
1615 let type = nodeData.typeDescr.toLowerCase(); | 1615 let type = nodeData.type.toLowerCase(); |
1616 if (type == "background") | 1616 if (type == "background") |
1617 { | 1617 { |
1618 type = "image"; | 1618 type = "image"; |
1619 node = null; | 1619 node = null; |
1620 } | 1620 } |
1621 | 1621 |
1622 let label = this.overlay.attributes[type + "contextlabel"]; | 1622 let label = this.overlay.attributes[type + "contextlabel"]; |
1623 if (!label) | 1623 if (!label) |
1624 return; | 1624 return; |
1625 | 1625 |
1626 let item = popup.ownerDocument.createElement("menuitem"); | 1626 let item = popup.ownerDocument.createElement("menuitem"); |
1627 item.setAttribute("label", label); | 1627 item.setAttribute("label", label); |
1628 item.setAttribute("class", "abp-contextmenuitem"); | 1628 item.setAttribute("class", "abp-contextmenuitem"); |
1629 item.addEventListener("command", this.blockItem.bind(this, window, node, n
odeData), false); | 1629 item.addEventListener("command", this.blockItem.bind(this, window, node, n
odeData), false); |
1630 popup.appendChild(item); | 1630 popup.appendChild(item); |
1631 | 1631 |
1632 menuItems.push(item); | 1632 menuItems.push(item); |
1633 }.bind(this); | 1633 }.bind(this); |
1634 | 1634 |
1635 // Look up data that we have for the node | 1635 // Look up data that we have for the node |
1636 let data = RequestNotifier.getDataForNode(target); | 1636 let data = RequestNotifier.getDataForNode(target); |
1637 let hadImage = false; | 1637 let hadImage = false; |
1638 if (data && !data[1].filter) | 1638 if (data && !data[1].filter) |
1639 { | 1639 { |
1640 addMenuItem(data); | 1640 addMenuItem(data); |
1641 hadImage = (data[1].typeDescr == "IMAGE"); | 1641 hadImage = (data[1].type == "IMAGE"); |
1642 } | 1642 } |
1643 | 1643 |
1644 // Look for frame data | 1644 // Look for frame data |
1645 let wnd = Utils.getWindow(target); | 1645 let wnd = Utils.getWindow(target); |
1646 if (wnd.frameElement) | 1646 if (wnd.frameElement) |
1647 { | 1647 { |
1648 let data = RequestNotifier.getDataForNode(wnd.frameElement, true); | 1648 let data = RequestNotifier.getDataForNode(wnd.frameElement, true); |
1649 if (data && !data[1].filter) | 1649 if (data && !data[1].filter) |
1650 addMenuItem(data); | 1650 addMenuItem(data); |
1651 } | 1651 } |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], | 1941 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], |
1942 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa
tegory.bind(Notification, "*", null)] | 1942 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa
tegory.bind(Notification, "*", null)] |
1943 ]; | 1943 ]; |
1944 | 1944 |
1945 onShutdown.add(function() | 1945 onShutdown.add(function() |
1946 { | 1946 { |
1947 for (let window of UI.applicationWindows) | 1947 for (let window of UI.applicationWindows) |
1948 if (UI.isBottombarOpen(window)) | 1948 if (UI.isBottombarOpen(window)) |
1949 UI.toggleBottombar(window); | 1949 UI.toggleBottombar(window); |
1950 }); | 1950 }); |
OLD | NEW |