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

Side by Side Diff: lib/ui.js

Issue 29331700: Issue 3223 - Implement context menu fallback for SeaMonkey Mail and Thunderbird (Closed)
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:
View unified diff | Download patch
« no previous file with comments | « lib/child/contextMenu.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (!window.gContextMenuContentData || 1603 let data = window.gContextMenuContentData;
1604 typeof window.gContextMenuContentData.addonInfo != "object" || 1604 if (!data)
1605 typeof window.gContextMenuContentData.addonInfo.adblockplus != "object")
1606 { 1605 {
1607 return; 1606 // This is SeaMonkey Mail or Thunderbird, they won't get context menu data
1607 // for us. Send the notification ourselves.
1608 data = {
1609 event: {target: popup.triggerNode},
1610 addonInfo: {},
1611 get wrappedJSObject() {return this;}
1612 };
1613 Services.obs.notifyObservers(data, "AdblockPlus:content-contextmenu", null );
1608 } 1614 }
1609 1615
1610 let items = window.gContextMenuContentData.addonInfo.adblockplus; 1616 if (typeof data.addonInfo != "object" || typeof data.addonInfo.adblockplus ! = "object")
1617 return;
1618
1619 let items = data.addonInfo.adblockplus;
1611 let clicked = null; 1620 let clicked = null;
1612 let menuItems = []; 1621 let menuItems = [];
1613 1622
1614 function menuItemTriggered(id, nodeData) 1623 function menuItemTriggered(id, nodeData)
1615 { 1624 {
1616 clicked = id; 1625 clicked = id;
1617 this.blockItem(window, id, nodeData); 1626 this.blockItem(window, id, nodeData);
1618 } 1627 }
1619 1628
1620 for (let [id, nodeData] of items) 1629 for (let [id, nodeData] of items)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], 1896 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)],
1888 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)] 1897 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)]
1889 ]; 1898 ];
1890 1899
1891 onShutdown.add(function() 1900 onShutdown.add(function()
1892 { 1901 {
1893 for (let window of UI.applicationWindows) 1902 for (let window of UI.applicationWindows)
1894 if (UI.isBottombarOpen(window)) 1903 if (UI.isBottombarOpen(window))
1895 UI.toggleBottombar(window); 1904 UI.toggleBottombar(window);
1896 }); 1905 });
OLDNEW
« no previous file with comments | « lib/child/contextMenu.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld