Skip to content
New issue

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

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

Already on GitHub? # to your account

a sound operation on the variants of LinkHints.activate #340

Closed
OnceThenEver opened this issue May 5, 2021 · 10 comments
Closed

a sound operation on the variants of LinkHints.activate #340

OnceThenEver opened this issue May 5, 2021 · 10 comments

Comments

@OnceThenEver
Copy link

OnceThenEver commented May 5, 2021

Currently, LinkHints.activate's several variants, including:

  • LinkHints.activateModeWithQueue,
  • LinkHints.activateModeToOpenInNewForegroundTab,
  • LinkHints.activateModeToOpenInNewTab,

have their own unique distinguishing characteristics, and those characteristics can blend into new compound commands through the combination of Ctrl Shift or Alt. But in facing some webs' own inclinations, like whether open pages in new tabs or not, the above commands have inconsistent behavior with their HUDs on different pages. For example, there's no command indeed that can open a new page in the current tab if the web would open it in the new tab, but the HUD of LinkHints.activate says it can.

So I combed through the behaviors about opening pages and clicking, concluding the table below:

Trigger JS / Open Page In the New/Current Tab To New Foreground Tab With Queue Trigger (inclination dependent)
Open Page New Ctrl + Alt
Open Page New Ctrl
Open Page New Alt
Open Page New Default / Shift
Open Page Current Default / ×
Trigger JS* Current Default
Trigger JS Current Alt

* Actually, this behavior is the same as the 4th and the 5th, namely clicking once.

I suggest a new parameter of LinkHints.activate to identify the users' inclination about whether to open a page in the new or current tab, Ctrl to toggle between whether to new foreground tab or not, Shift to toggle between the users' inclination and the opposite, and Alt to stay unchanged.

@gdh1995
Copy link
Owner

gdh1995 commented May 5, 2021 via email

@OnceThenEver
Copy link
Author

No, you don't have to detect that. I mean you can neglect webs' inclination and unify the behavior on different pages.

@gdh1995
Copy link
Owner

gdh1995 commented May 5, 2021 via email

@gdh1995
Copy link
Owner

gdh1995 commented May 5, 2021 via email

@OnceThenEver
Copy link
Author

Please remember, a web page can use JavaScript to do whatever it want

Although I separate the behaviors into Trigger JS and Open Page, I recognize that they are not exhaustive. You may see the former as any clicking event other than Open Page, as far as Vimium-C can simulate.

I cannot force those web page "buttons which want to open a new table" to open in a current table.
it seems possible to force vimium c to open a URL in a current tab

I think to some extent forcing Vimium-C to open a URL in a current tab and forcing the webpage to do so are just different descriptions of one thing, because they have identical results.

I may add an option to do so.

That's the key, which fixes up the drawback where the cross in the table lies.

@gdh1995
Copy link
Owner

gdh1995 commented May 5, 2021 via email

@OnceThenEver
Copy link
Author

What's "dispatch"?
Is that replacing the URL-1 with URL-2 by immediately click it after URL-1?

@gdh1995
Copy link
Owner

gdh1995 commented May 5, 2021 via email

@OnceThenEver
Copy link
Author

Thanks to your explanation, I understand that the behavior of the web is exclusively up to its designer.
And if you are going to only accept adding to force Vimium-C to open URL in the current tab, that would still be good.

@gdh1995
Copy link
Owner

gdh1995 commented Jun 3, 2021

Hello. v1.90.0+ has support newtab="force-mode", and if with it, LinkHints will only open link in a new tab when HUD shows it's in newtab mode, and if the tip is "in current page", it will open link in a current tab (without dispatching any click event on <a>).

For any non-anchor element, newtab won't change how Linkhints simulates clicking.

You may use the trick in https://github.com/gdh1995/vimium-c/wiki/Map-a-key-to-different-commands-on-different-websites to limit the scope of map ... LinkHints.activate newtab="force-mode" to a few websites.

@gdh1995 gdh1995 closed this as completed Jul 4, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants