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

regex for disabling (or just programmatic disabling on the page) #63

Closed
WuTheFWasThat opened this issue May 27, 2016 · 10 comments
Closed

Comments

@WuTheFWasThat
Copy link

I just found this extension and it's great! there's one thing I miss, though, which is being able to specify a domain to disable on, rather than a page.

I think I'd like a function which sets/toggles whether surfingKeys is active. i.e. when called, it disables everything in surfingkeys except the hotkey to re-enable it. It should be more or less whatever Alt-s is mapping to.

ideally i could then write stuff in the configuration like

if (document.domain is in my whitelist of regexes) {
   disableSurfingKeys();
}
@brookhong
Copy link
Owner

brookhong commented May 30, 2016

Added it in ca4220c

Please add setting as below

settings.blacklistPattern = /.*somethingtobeexcluded/i;

To delete the pattern:

settings.blacklistPattern = undefined;

@WuTheFWasThat
Copy link
Author

thanks! this is good enough for my problem, which was wildcard subdomains. but i do still think a list/function would be a bit nicer!

@HaleTom
Copy link

HaleTom commented Dec 15, 2017

Is there a smart way to split this regex over multiple lines to blacklist more than one site?

@jaekyeom
Copy link

jaekyeom commented Mar 1, 2018

I agree with @HaleTom. We need settings.blacklistPatterns.

@HaleTom
Copy link

HaleTom commented May 26, 2018

I'm using:

unmapAllExcept([], /\/todoist.com\//);

This can be used multiple times.

@lee-tts
Copy link

lee-tts commented Jul 26, 2018

It's possible to string together multiple patterns using pipe | as a separator. I figured that out from this gist showing some kind soul's settings:

https://gist.github.com/thameera/8c846c48fd1c9f859cf602931e18a502

Their example:

settings.blacklistPattern = /.*mail.google.com.*|.*inbox.google.com.*|trello.com|duolingo.com|youtube.com|udemy.com/i;

My settings to make Surfingkeys play nice with KeyPass on login pages:

settings.blacklistPattern = /.*zendesk.com\/access.*|.*login.*|.*signin.*/i;

I've also learned that it seems this setting is kept somewhere outside the visible Surfkeys settings and can get messed up if you enter stuff wrong, at which point you'll need to do a settings.blacklistPattern = undefined;, save it in the Surfkeys settings page, set the patterns again, and save again on the Surfingkeys settings page.

Also don't forget to escape / characters (ex. /.*google.com\/flights.*/i;).

@kalbasit
Copy link
Contributor

@lee-tts this works because settings.blacklistPattern is nothing more than a Javascript Regex.

@sebastianst
Copy link

Shouldn't we also escape the .s?

@lee-tts
Copy link

lee-tts commented Oct 11, 2018

Good point. It depends how explicit you want to be. There might be some edge cases where using . in place of \. might cause problems but I can't think of any off hand, given the limited scope of web URIs.

@HaleTom
Copy link

HaleTom commented Jan 8, 2024

Note that this has changed to blocklistPattern

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

No branches or pull requests

7 participants