Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/ui.js

Issue 29331700: Issue 3223 - Implement context menu fallback for SeaMonkey Mail and Thunderbird (Closed)
Left Patch Set: Created Dec. 1, 2015, 2:48 p.m.
Right Patch Set: Don`t send real event, minimal object will do Created Dec. 2, 2015, 12:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/child/contextMenu.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 let data = window.gContextMenuContentData; 1603 let data = window.gContextMenuContentData;
1604 if (!data) 1604 if (!data)
1605 { 1605 {
1606 // This is SeaMonkey Mail or Thunderbird, they won't get context menu data 1606 // This is SeaMonkey Mail or Thunderbird, they won't get context menu data
1607 // for us. Send the notification ourselves. 1607 // for us. Send the notification ourselves.
1608 let event = new Event("contextmenu");
1609 Object.defineProperty(event, "target", {"get": () => popup.triggerNode});
1610 data = { 1608 data = {
1611 event: event, 1609 event: {target: popup.triggerNode},
1612 addonInfo: {}, 1610 addonInfo: {},
1613 get wrappedJSObject() {return this;} 1611 get wrappedJSObject() {return this;}
1614 }; 1612 };
1615 Services.obs.notifyObservers(data, "content-contextmenu", null); 1613 Services.obs.notifyObservers(data, "AdblockPlus:content-contextmenu", null );
Wladimir Palant 2015/12/02 11:21:46 I thought a bit more about this and it's probably
1616 } 1614 }
1617 1615
1618 if (typeof data.addonInfo != "object" || typeof data.addonInfo.adblockplus ! = "object") 1616 if (typeof data.addonInfo != "object" || typeof data.addonInfo.adblockplus ! = "object")
1619 return; 1617 return;
1620 1618
1621 let items = data.addonInfo.adblockplus; 1619 let items = data.addonInfo.adblockplus;
1622 let clicked = null; 1620 let clicked = null;
1623 let menuItems = []; 1621 let menuItems = [];
1624 1622
1625 function menuItemTriggered(id, nodeData) 1623 function menuItemTriggered(id, nodeData)
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], 1896 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)],
1899 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)] 1897 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)]
1900 ]; 1898 ];
1901 1899
1902 onShutdown.add(function() 1900 onShutdown.add(function()
1903 { 1901 {
1904 for (let window of UI.applicationWindows) 1902 for (let window of UI.applicationWindows)
1905 if (UI.isBottombarOpen(window)) 1903 if (UI.isBottombarOpen(window))
1906 UI.toggleBottombar(window); 1904 UI.toggleBottombar(window);
1907 }); 1905 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld