mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 637031 - Add "bookmark link" to context menu [r=vingtetun, uir=madhava]
This commit is contained in:
parent
2365897ad6
commit
322645e3a8
@ -73,6 +73,23 @@ var ContextCommands = {
|
||||
SharingUI.show(ContextHelper.popupState.mediaURL, null);
|
||||
},
|
||||
|
||||
bookmarkLink: function cc_bookmarkLink() {
|
||||
let state = ContextHelper.popupState;
|
||||
let bookmarks = PlacesUtils.bookmarks;
|
||||
try {
|
||||
bookmarks.insertBookmark(BookmarkList.panel.mobileRoot,
|
||||
Util.makeURI(state.linkURL),
|
||||
bookmarks.DEFAULT_INDEX,
|
||||
state.linkTitle || state.linkURL);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
let message = Strings.browser.GetStringFromName("alertLinkBookmarked");
|
||||
let toaster = Cc["@mozilla.org/toaster-alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
toaster.showAlertNotification(null, message, "", false, "", null);
|
||||
},
|
||||
|
||||
sendCommand: function cc_playVideo(aCommand) {
|
||||
let browser = ContextHelper.popupState.target;
|
||||
browser.messageManager.sendAsyncMessage("Browser:ContextCommand", { command: aCommand });
|
||||
|
@ -612,6 +612,9 @@
|
||||
<richlistitem class="context-command" id="context-openinnewtab" type="link-openable" onclick="ContextCommands.openInNewTab();">
|
||||
<label value="&contextOpenInNewTab.label;"/>
|
||||
</richlistitem>
|
||||
<richlistitem class="context-command" id="context-bookmark-link" type="link" onclick="ContextCommands.bookmarkLink();">
|
||||
<label value="&contextBookmarkLink.label;"/>
|
||||
</richlistitem>
|
||||
<richlistitem class="context-command" id="context-savelink" type="link-saveable" onclick="ContextCommands.saveLink();">
|
||||
<label value="&contextSaveLink.label;"/>
|
||||
</richlistitem>
|
||||
|
@ -931,6 +931,10 @@ var ContextHandler = {
|
||||
|
||||
ContextHandler.init();
|
||||
|
||||
ContextHandler.registerType("link", function(aState, aElement) {
|
||||
return !!aState.linkURL;
|
||||
});
|
||||
|
||||
ContextHandler.registerType("mailto", function(aState, aElement) {
|
||||
return aState.linkProtocol == "mailto";
|
||||
});
|
||||
|
@ -95,6 +95,7 @@
|
||||
<!ENTITY contextSaveImage.label "Save Image">
|
||||
<!ENTITY contextShareLink.label "Share Link">
|
||||
<!ENTITY contextShareImage.label "Share Image">
|
||||
<!ENTITY contextBookmarkLink.label "Bookmark Link">
|
||||
<!ENTITY contextSaveVideo.label "Save Video">
|
||||
<!ENTITY contextShareVideo.label "Share Video">
|
||||
<!ENTITY contextPlayMedia.label "Play">
|
||||
|
@ -91,6 +91,7 @@ alertAddonsInstalling=Installing add-on
|
||||
alertAddonsInstalled=Installation complete. Restart required.
|
||||
alertAddonsInstalledNoRestart=Installation complete
|
||||
alertAddonsFail=Installation failed
|
||||
alertLinkBookmarked=Bookmark added
|
||||
alertLockScreen=Screen Orientation
|
||||
alertLockScreen.locked=Locked
|
||||
alertLockScreen.unlocked=Unlocked
|
||||
|
Loading…
Reference in New Issue
Block a user