mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Bug 1155518 - Implement "Save to Pocket" context menu item, r=jaws.
This commit is contained in:
parent
7976b9d3b3
commit
640bf32e81
@ -266,6 +266,10 @@
|
||||
label="&savePageCmd.label;"
|
||||
accesskey="&savePageCmd.accesskey2;"
|
||||
oncommand="gContextMenu.savePageAs();"/>
|
||||
<menuitem id="context-pocket"
|
||||
label="&saveToPocketCmd.label;"
|
||||
accesskey="&saveToPocketCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveToPocket();"/>
|
||||
<menu id="context-markpageMenu" label="&social.markpageMenu.label;"
|
||||
accesskey="&social.markpageMenu.accesskey;">
|
||||
<menupopup/>
|
||||
|
@ -3,6 +3,8 @@
|
||||
%brandDTD;
|
||||
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd" >
|
||||
%browserDTD;
|
||||
<!ENTITY % browserPocketDTD SYSTEM "chrome://browser/content/browser-pocket.dtd" >
|
||||
%browserPocketDTD;
|
||||
<!ENTITY % baseMenuDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd" >
|
||||
%baseMenuDTD;
|
||||
<!ENTITY % charsetDTD SYSTEM "chrome://global/locale/charsetMenu.dtd" >
|
||||
|
9
browser/base/content/browser-pocket.dtd
Normal file
9
browser/base/content/browser-pocket.dtd
Normal file
@ -0,0 +1,9 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!-- This is a temporary file and not meant for localization; later versions
|
||||
- of Firefox include these strings in browser.dtd -->
|
||||
|
||||
<!ENTITY saveToPocketCmd.label "Save Page to Pocket">
|
||||
<!ENTITY saveToPocketCmd.accesskey "k">
|
@ -177,6 +177,17 @@ nsContextMenu.prototype = {
|
||||
SimpleServiceDiscovery.services.length > 0 &&
|
||||
CastingApps.getServicesForVideo(this.target).length > 0;
|
||||
this.setItemAttr("context-castvideo", "disabled", !shouldShowCast);
|
||||
|
||||
let canPocket = false;
|
||||
if (shouldShow && window.gBrowser &&
|
||||
this.browser.getTabBrowser() == window.gBrowser) {
|
||||
let uri = this.browser.currentURI;
|
||||
canPocket =
|
||||
CustomizableUI.getPlacementOfWidget("pocket-button") &&
|
||||
(uri.schemeIs("http") || uri.schemeIs("https") ||
|
||||
(uri.schemeIs("about") && ReaderMode.getOriginalUrl(uri.spec)));
|
||||
}
|
||||
this.showItem("context-pocket", canPocket && window.Pocket && Pocket.isLoggedIn);
|
||||
},
|
||||
|
||||
initViewItems: function CM_initViewItems() {
|
||||
@ -1621,6 +1632,22 @@ nsContextMenu.prototype = {
|
||||
saveDocument(this.browser.contentDocumentAsCPOW);
|
||||
},
|
||||
|
||||
saveToPocket: function CM_saveToPocket() {
|
||||
let pocketWidget = document.getElementById("pocket-button");
|
||||
let placement = CustomizableUI.getPlacementOfWidget("pocket-button");
|
||||
if (!placement)
|
||||
return;
|
||||
|
||||
if (placement.area == CustomizableUI.AREA_PANEL) {
|
||||
PanelUI.show().then(function() {
|
||||
pocketWidget = document.getElementById("pocket-button");
|
||||
pocketWidget.doCommand();
|
||||
});
|
||||
} else {
|
||||
pocketWidget.doCommand();
|
||||
}
|
||||
},
|
||||
|
||||
printFrame: function CM_printFrame() {
|
||||
PrintUtils.print(this.target.ownerDocument.defaultView, this.browser);
|
||||
},
|
||||
|
@ -12,6 +12,8 @@
|
||||
<!DOCTYPE page [
|
||||
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
|
||||
%browserDTD;
|
||||
<!ENTITY % browserPocketDTD SYSTEM "chrome://browser/content/browser-pocket.dtd">
|
||||
%browserPocketDTD;
|
||||
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd">
|
||||
%textcontextDTD;
|
||||
]>
|
||||
|
@ -76,6 +76,7 @@ browser.jar:
|
||||
* content/browser/browser.js (content/browser.js)
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
content/browser/browser-pocket.properties (content/browser-pocket.properties)
|
||||
content/browser/browser-pocket.dtd (content/browser-pocket.dtd)
|
||||
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
|
||||
* content/browser/chatWindow.xul (content/chatWindow.xul)
|
||||
content/browser/tab-content.js (content/tab-content.js)
|
||||
|
@ -661,7 +661,7 @@ this.BrowserUITelemetry = {
|
||||
"copyvideourl", "copyaudiourl", "saveimage", "shareimage", "sendimage",
|
||||
"setDesktopBackground", "viewimageinfo", "viewimagedesc", "savevideo",
|
||||
"sharevideo", "saveaudio", "video-saveimage", "sendvideo", "sendaudio",
|
||||
"ctp-play", "ctp-hide", "sharepage", "savepage", "markpageMenu",
|
||||
"ctp-play", "ctp-hide", "sharepage", "savepage", "pocket", "markpageMenu",
|
||||
"viewbgimage", "undo", "cut", "copy", "paste", "delete", "selectall",
|
||||
"keywordfield", "searchselect", "shareselect", "frame", "showonlythisframe",
|
||||
"openframeintab", "openframe", "reloadframe", "bookmarkframe", "saveframe",
|
||||
|
Loading…
Reference in New Issue
Block a user