cpriest / SnapLinksPlus

Snap Links Plus is a Browser Addon that lets you lasso links, checkboxes and other elements do things with them.
Other
196 stars 35 forks source link

Modify selected urls with regex #409

Open remi-garcia opened 2 years ago

remi-garcia commented 2 years ago

See first workaround of #408

It could be useful to include a prefix, like a proxy, to every selected url. This should not be too much work as it only requires to modify a bit the code around https://github.com/cpriest/SnapLinksPlus/blob/c8d588c7217ba136c65a59839993c42788c4e4fb/src/content-scripts/ActionMgr.js#L98-L104 and to include an option to set a prefix (leaving the option empty would do nothing: the current behavior) See #303 for an idea on how to modify the options.

(@chaoscreater this might simplify just a bit your first workaround)

cpriest commented 2 years ago

So the trouble I have with adding this sort of feature is that it's a one-off use case. One that can easily be accomplished in any editor like VS Code.

  1. Paste the selected IP addresses
  2. Prefix each line with the preferred text (dozens of ways to do this fast and efficiently, I would use multiple carets or regex)

Essentially basic text manipulation. Adding this feature would add something I think would be a rarely used feature, which means nobody will know how to answer questions about it or they'll want some other 'tweak' to make it work just a little differently for their purpose.

I would support adding a general-purpose regex replace modify copied links with regex feature. It would take a smidgen more technical know-how to use it, but there are thousands of resources on the topic or I can easily answer those questions.

If you're familiar with PCRE (Perl RE), something like this would be the input in the field: s#^#https://www.abuseipdb.com/check/# which translates to:

chaoscreater commented 2 years ago

Yes, it would be nice if we can have an option in the GUI to define a prefix.

At the moment, I'm hardcoding the prefix URL like this: let links = Array.from(new Set(SelectedElements.Links.map((elem) => 'https://www.abuseipdb.com/check/' + elem.textContent)));

It would also be nice if we can add a suffix to the end as well.

I'm terrible with using regex, but I get the basics and I support this being implemented too. Any sort of basic text manipulation feature would be nice to have. I know I mentioned this in a separate post, but the lasso select feature is so nice and not many extensions do this, so it'll be kind a waste to limit this to only work for links and not text as well. I can see the potential of this extension able to lasso select text, manipulate text and do all kinds of things with it. At the moment, I'm having to combine multiple extensions to do what I want and it'll be nice if I don't have to use so many.

cpriest commented 2 years ago

Thanks @remi-garcia for all the ticket cleanup!