Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

search image on context menu #2607

Merged
merged 2 commits into from
Jul 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/menu.properties
Original file line number Diff line number Diff line change
@@ -109,6 +109,7 @@ saveImage=Save Image...
openImageInNewTab=Open Image in New Tab
copyImageAddress=Copy Image Address
copyImage=Copy Image
searchImage=Search Image
viewPageSource=View Page Source
addToReadingList=Add to reading list
about=About
1 change: 1 addition & 0 deletions app/locale.js
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ var rendererIdentifiers = function () {
'openImageInNewTab',
'saveImage',
'copyImage',
'searchImage',
'copyLinkAddress',
'copyEmailAddress',
'saveLinkAs',
18 changes: 16 additions & 2 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
@@ -765,9 +765,23 @@ function mainTemplateInit (nodeProps, frame) {
}
}
},
copyAddressMenuItem('copyImageAddress', nodeProps.srcURL),
CommonMenu.separatorMenuItem
copyAddressMenuItem('copyImageAddress', nodeProps.srcURL)
)
if (getSetting(settings.DEFAULT_SEARCH_ENGINE) === 'content/search/google.xml' &&
nodeProps.srcURL && urlParse(nodeProps.srcURL).protocol !== 'data:') {
template.push(
{
label: locale.translation('searchImage'),
click: (item) => {
let searchUrl = windowStore.getState().getIn(['searchDetail', 'searchURL'])
.replace('{searchTerms}', encodeURIComponent(nodeProps.srcURL))
.replace('?q', 'byimage?image_url')
windowActions.newFrame({ location: searchUrl }, true)
}
}
)
}
template.push(CommonMenu.separatorMenuItem)
}

if (isInputField) {