Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkHints.activateModeToDownloadImage #399

Closed
BioBox opened this issue Aug 7, 2021 · 7 comments
Closed

LinkHints.activateModeToDownloadImage #399

BioBox opened this issue Aug 7, 2021 · 7 comments

Comments

@BioBox
Copy link

BioBox commented Aug 7, 2021

The title says it all. LinkHints.activateModeToOpenImage is an awesome feature, but is there any way to just copy the URL of the image instead of opening it in my tab? Or at least have it open in a new tab so that it doesn't overwrite what I already have?

@BioBox BioBox changed the title Make LinkHints.activateModeToDownloadImage open in new tab LinkHints.activateModeToCopyImageUrl Aug 7, 2021
@gdh1995
Copy link
Owner

gdh1995 commented Aug 8, 2021

Um, the OpenImage command should open a new tab by default. How did you map keys and options to it ?

Up to now, there's no command name / command option to copy image URLs, but you may copy in opened image tabs:

  • map xxx Vomnibar.activateUrl and then on Vimium C Display page, Vomnibar will show an image URL (with a prefix).

@BioBox
Copy link
Author

BioBox commented Aug 15, 2021

Sorry for the late reply. I have it mapped as map zi LinkHints.activateModeToDownloadImage and it always opens it in the current tab. I tried disabling my "New Tab Redirect" extension but the behavior still persists.

@gdh1995
Copy link
Owner

gdh1995 commented Aug 17, 2021

Um, please try this: map zi LinkHints.activateModeToDownloadImage download="force".

To use download="force", firstly you need to give Vimium C the "downloads" permission on Vimium C Options page:

image

@gdh1995 gdh1995 changed the title LinkHints.activateModeToCopyImageUrl LinkHints.activateModeToDownloadImage Aug 17, 2021
@BioBox
Copy link
Author

BioBox commented Aug 17, 2021

It simply downloads the image without any hassle. Although I would still prefer to copy the address, this works well enough for me. Thank you!

@BioBox BioBox closed this as completed Aug 17, 2021
@gdh1995
Copy link
Owner

gdh1995 commented Aug 17, 2021

Well, in fact download="force" may fail on Chrome and in some edge cases, and in some of such cases removing it may make downloading succeed ...

As for copying URL, this need is too rare, so I still recommend LinkHints.activateOpenImage and then trigger Vomnibar.activateEditUrl .

@BioBox
Copy link
Author

BioBox commented Aug 17, 2021

Ah, okay that works too. When you said OpenImage I wasn't sure what you were talking about. Using activateOpenImage and then copying the auto-selected text from the omnibar-edit does the trick. It just takes a few extra steps.

@gdh1995
Copy link
Owner

gdh1995 commented Sep 27, 2021

Um, to copy URL of <img> elements, there're some ways I once forgot.

recommended on v1.92.4

Add this to Custom key mappings:

map Fa LinkHints.activateOpenImage sed="s@^@vimium://copy/@g" keyword="$copy"

And, add this to Custom search engines:

$copy: vimium://copy/$S Copy

since v1.93 (a future version on 2021-09-27)

Add this to Custom key mappings:

map Fa LinkHints.activateOpenImage sed="s@^@vimium://copy/@g"

An old trick

map Fa LinkHints.activateCopyLinkUrl match="img,video,audio" access="dataset.canonicalSrc,dataset.src,src"

This means to only show hints for img elements but not background images, and then find its src attribute and copy as a URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants