question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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();
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
lee-ttscommented, Jul 27, 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;).

2reactions
kalbasitcommented, Jul 26, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable Unnecessary escape character: \/ no-useless-escape
To disable all rules on a specific line, use a line or block comment in one of the ... Your regex will work...
Read more >
Regex Tutorial - Turning Modes On and Off for Only Part of ...
In a programming language, you pass them as a flag to the regex ... With these flavors, you can turn off modes by...
Read more >
Best Practices for Regular Expressions in .NET - Microsoft Learn
Consider the input source. In general, regular expressions can accept two types of input: constrained or unconstrained.
Read more >
How to disable or enable scripts with Regex - Perfmatters
You can disable or enable scripts in the Perfmatters Script Manager using Regex (regular expressions).
Read more >
Catastrophic backtracking - The Modern JavaScript Tutorial
The typical symptom – a regular expression works fine sometimes, ... case a web-browser suggests to kill the script and reload the page....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found