philc / vimium

The hacker's browser.
https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb
MIT License
23.11k stars 2.48k forks source link

Feature request: Custom Exclusion of Link Hints #4031

Open ronstudy1 opened 2 years ago

ronstudy1 commented 2 years ago

it could be great to add the ability to exclude some links from being suggested by the link-hints shortkeys

Example Scenarios:

  1. Duplicate Links: Github's comments have links to the user's profile both in the avatar picture and in the username. In this case, one may wish to exclude "img.avatar" links all over "github.com"

  2. Rarely-Used Links: Gerrit includes a link "add this review to your favorites" per each record in the search results Those links double the amount of link-hints in the page although not being used so often

Advantages:

  1. the page looks less messy with the minimal amount of link-hints
  2. less links-hints means less letters used by the hints. so the length of the remained hints may become shorter
Klaster1 commented 5 months ago

Great idea, I have the same use case - not to show link hints for links that I never use. I inspected Vimium source code for clues and discovered that it ignores elements with aria-disabled attribute. To filter the hints, you can author a userscript and set the attribute based on any rules you (or ChatGPT) can imagine.

Example:

// ==UserScript==
// @name     Vimium filter
// @version  1
// @grant    none
// @match    https://news.ycombinator.com/*
// ==/UserScript==

document.querySelectorAll('a').forEach(a=>a.href.includes('vote') ? a.setAttribute('aria-disabled', 'false') : a.setAttribute('aria-disabled', 'true')) 

image

ronstudy1 commented 5 months ago

@Klaster1 Thank you for sharing this workaround. Currently, it seems like the easiest solution. Yet, I would still be glad to have this feature implemented so that everything can be managed through the same extension and be included in the same backups