ssborbis / ContextSearch-web-ext

Search engine manager for modern browsers
349 stars 37 forks source link

Feature requests and suggestions, about tools #485

Closed yejinson closed 2 years ago

yejinson commented 2 years ago

Copy to clipboard is to copy image link, it is recommended to change to copy image, add copy image link and save the image as, thank you.

yejinson commented 2 years ago

Also add open link in the background, because I want to use quick menu on image, if the above items are missing, it won't work.

ssborbis commented 2 years ago

it is recommended to change to copy image, add copy image link and save the image as, thank you.

I'll see if I can set that up.

Also add open link in the background, because I want to use quick menu on image

The Open As Link tool should respect the mouse button settings under CS Options -> Quick Menu -> Search Actions. If you want to open in a background tab, assign that action to one of your mouse buttons.

ssborbis commented 2 years ago

Copy to clipboard is to copy image link, it is recommended to change to copy image, add copy image link and save the image as, thank you.

I've had some luck, but the clipboard API has limitations. It will NOT work in Firefox, or on non-HTTPS pages.

Test code is in the development branch if you want to play around.

yejinson commented 2 years ago

it is recommended to change to copy image, add copy image link and save the image as, thank you.

I'll see if I can set that up.

Also add open link in the background, because I want to use quick menu on image

The Open As Link tool should respect the mouse button settings under CS Options -> Quick Menu -> Search Actions. If you want to open in a background tab, assign that action to one of your mouse buttons.

I was wrong, what I was trying to say was open as a link, the tool already exists, but it doesn't work on images, not even text and links, it should be a bug.

yejinson commented 2 years ago

Copy to clipboard is to copy image link, it is recommended to change to copy image, add copy image link and save the image as, thank you.

I've had some luck, but the clipboard API has limitations. It will NOT work in Firefox, or on non-HTTPS pages.

Test code is in the development branch if you want to play around.

I tested that copying the image is still copying the link, and I didn't find the “save image as” tool.

ssborbis commented 2 years ago

I tested that copying the image is still copying the link

Are you on Chrome? Have you granted this addon the Clipboard permission? Are you on a secure website ( https:// ) ? What website is it failing? I checked locally and on google images, and Copy To Clipboard tool is copying images. I tested by pasting into a document app.

I didn't find the “save image as” tool.

No "save image" option yet.

yejinson commented 2 years ago

I tested that copying the image is still copying the link

Are you on Chrome? Have you granted this addon the Clipboard permission? Are you on a secure website ( https:// ) ? What website is it failing? I checked locally and on google images, and Copy To Clipboard tool is copying images. I tested by pasting into a document app.

I didn't find the “save image as” tool.

No "save image" option yet.

I tested that copying the image is still copying the link

Are you on Chrome? Have you granted this addon the Clipboard permission? Are you on a secure website ( https:// ) ? What website is it failing? I checked locally and on google images, and Copy To Clipboard tool is copying images. I tested by pasting into a document app.

I didn't find the “save image as” tool.

No "save image" option yet.

Yes chrome Copy permission has been granted yes, URLs starting with HTTPS I just found a picture from Google Images, the address: https://www.nestle.com/sites/default/files/styles/da_vinci_header_hero_desktop/public/2022-02/sustainability-nature-forest-river-article-header-fw.jpg?h=a612ed85 Copy to word document, paste to get the URL address And copy the image with edge, get the image

ssborbis commented 2 years ago

Looks like it works fine for smaller images, but if the canvas drawing takes too long, it fails. So any large image is not being copied. I think it has to do with the clipboard API only working with short user actions ( click ) and the canvas drawing taking longer than the user-event timeout. This may not be possible. I'll see if any other addons have a workaround.

In the meantime, why exactly are you copying to the clipboard? You may be able to use a new engine ( type = app launcher ) to run a script that copies the image url to the clipboard, or open in an external program. For instance, I have an app launcher that opens images in GIMP when i press the 'G' hotkey.

ssborbis commented 2 years ago

I take it back. The problem is the quick menu is closing before the clipboard.write event. I updated the repo with code for testing that keeps the menu open when using the copy to clipboard tool. See if you get better results that way.

yejinson commented 2 years ago

Looks like it works fine for smaller images, but if the canvas drawing takes too long, it fails. So any large image is not being copied. I think it has to do with the clipboard API only working with short user actions ( click ) and the canvas drawing taking longer than the user-event timeout. This may not be possible. I'll see if any other addons have a workaround.

In the meantime, why exactly are you copying to the clipboard? You may be able to use a new engine ( type = app launcher ) to run a script that copies the image url to the clipboard, or open in an external program. For instance, I have an app launcher that opens images in GIMP when i press the 'G' hotkey.

Because copying image is an option that comes with the context menu, although the probability of using it is smaller than opening a link in a new tab and saving the image as, but because I want to replace the context menu with the quick menu, the options must be full, otherwise when you need it No, that's bad.

yejinson commented 2 years ago

I take it back. The problem is the quick menu is closing before the clipboard.write event. I updated the repo with code for testing that keeps the menu open when using the copy to clipboard tool. See if you get better results that way.

I tried still the url.

yejinson commented 2 years ago

Looks like it works fine for smaller images, but if the canvas drawing takes too long, it fails. So any large image is not being copied. I think it has to do with the clipboard API only working with short user actions ( click ) and the canvas drawing taking longer than the user-event timeout. This may not be possible. I'll see if any other addons have a workaround.

In the meantime, why exactly are you copying to the clipboard? You may be able to use a new engine ( type = app launcher ) to run a script that copies the image url to the clipboard, or open in an external program. For instance, I have an app launcher that opens images in GIMP when i press the 'G' hotkey.

Like this, the options are needed since I'm replacing the context menu with quick menu on the image. And I want to hide when on text and links and show when on image, like context menu.

ssborbis commented 2 years ago

I've pushed some new code for the copy feature to the dev repo. The 'copy to clipboard' tool waits for the copying to complete before closing the quick menu. I think that was causing problems with some basic copying before it handled images, so, good to get that fixed.

The clipboard API can only write PNG images, so every image must be drawn to canvas and converted to PNG. This can be slow for large images. I've seen over 4 seconds for 20-megapixel photos.

I think I've gotten around CORS issues by processing the request in the background page.

I'm not convinced this isn't more trouble than it's worth. See what you think about the copy lag. I've mostly been testing on DuckDuckGo images, but it's working 100% of the time.

yejinson commented 2 years ago

I've pushed some new code for the copy feature to the dev repo. The 'copy to clipboard' tool waits for the copying to complete before closing the quick menu. I think that was causing problems with some basic copying before it handled images, so, good to get that fixed.

The clipboard API can only write PNG images, so every image must be drawn to canvas and converted to PNG. This can be slow for large images. I've seen over 4 seconds for 20-megapixel photos.

I think I've gotten around CORS issues by processing the request in the background page.

I'm not convinced this isn't more trouble than it's worth. See what you think about the copy lag. I've mostly been testing on DuckDuckGo images, but it's working 100% of the time.

Image lag isn't a problem, because when HD images are needed, save image as is often used, and copying is only used for forums or notes, where special HD images are not required. I tried it, but it didn't work, and I randomly found another site's images from Google Images, the image URL: https://www.nature.org/en-us/, but I tried DuckDuckGo images, and it did. If it is more troublesome to copy the image to achieve, let's put it for a while, it is more important to open the image in a new tab and save the image as.

ssborbis commented 2 years ago

I've been working on "Open Image in new Tab" as a tool, which will allow opening with any of the normal search action methods ( new tab, background, new window. etc ) but there is a limitation. Images using data URIs will not open due to security issues.

yejinson commented 2 years ago

I've been working on "Open Image in new Tab" as a tool, which will allow opening with any of the normal search action methods ( new tab, background, new window. etc ) but there is a limitation. Images using data URIs will not open due to security issues.

The content of the link is incomprehensible, which means that some images can be opened, but others can't, right? In this case, the tool has no meaning to exist. Is there a way to bypass the restriction or implement it in another way? If it really doesn't work, I can only cancel the use of the quick menu on the image. I don't like the context menu. Many programs are stuffed into it, which is too complicated, and sometimes using the quick menu for searching and sometimes using the context menu does not feel good. But if I use the quick menu, there is no open image in the new link, it will require a lot of back operations, which is not convenient. PS, what about save image as, Can this be achieved?

ssborbis commented 2 years ago

which means that some images can be opened, but others can't, right? In this case, the tool has no meaning to exist.

I'd say MOST images can be opened, but some images cannot. Depending on what sites and types of images you're scraping images from, you may never run into this problem.

PS, what about save image as, Can this be achieved?

Basic "save image" is in the dev repo. Right now, it's really a "download" button. It does not discriminate between images or anything else.

yejinson commented 2 years ago

which means that some images can be opened, but others can't, right? In this case, the tool has no meaning to exist.

I'd say MOST images can be opened, but some images cannot. Depending on what sites and types of images you're scraping images from, you may never run into this problem.

PS, what about save image as, Can this be achieved?

Basic "save image" is in the dev repo. Right now, it's really a "download" button. It does not discriminate between images or anything else.

It's great, just a little problem, the text can't be seen.

ssborbis commented 2 years ago

It's great, just a little problem, the text can't be seen.

Thanks. I'll get there when I update the icons.

yejinson commented 2 years ago

It's great, just a little problem, the text can't be seen.

Thanks. I'll get there when I update the icons.

Ok, I will download it again when you update it, thank you for your hard work.

ssborbis commented 2 years ago

Should be ready to go now. There's bound to be bugs, so let me know what you find.

yejinson commented 2 years ago

Should be ready to go now. There's bound to be bugs, so let me know what you find.

Perfect, I really appreciate your work.

justsome12 commented 2 years ago

Copy to clipboard is to copy image link, it is recommended to change to copy image, add copy image link and save the image as, thank you.

I use Gesturefy and/or Glitter Drag for operations like these. Probably my second most beloved pluggins after this one:)

yejinson commented 2 years ago

Copy to clipboard is to copy image link, it is recommended to change to copy image, add copy image link and save the image as, thank you.

I use Gesturefy and/or Glitter Drag for operations like these. Probably my second most beloved pluggins after this one:)

Thanks for the recommendation, Glitter Drag looks good, but I only found for Firefox, no chrome.

ssborbis commented 2 years ago

@yejinson

Can you try the release candidate and tell me if everything is still working correctly? I've removed images from the AutoCopy feature, as it was causing a severe performance hit, but the Open Image tool appears to be functioning.

https://github.com/ssborbis/ContextSearch-web-ext/releases/download/1.40beta/contextsearch_web_ext-1.40rc1.xpi

yejinson commented 2 years ago

@yejinson

Can you try the release candidate and tell me if everything is still working correctly? I've removed images from the AutoCopy feature, as it was causing a severe performance hit, but the Open Image tool appears to be functioning.

https://github.com/ssborbis/ContextSearch-web-ext/releases/download/1.40beta/contextsearch_web_ext-1.40rc1.xpi

Just tried it, as you said, the Copy image is gone, but the Open Image tool is normal, canceling the Copy image is no problem, because it is only valid under certain conditions, it is not easy to use.