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

Make this extension work with any part of the url and for selected bookmarks #1

Open
35609902357 opened this issue Nov 5, 2019 · 12 comments
Assignees

Comments

@35609902357
Copy link

This extension is very limited since it can only modify the domain, it would be more useful if it could modify any part of the url, like wildcards.
For example, let's say the user https://github.com/MrOtherGuy/ moves all his projects to https://github.com/MrOtherGuy-2/, I want to modify all the projects I bookmarked from https://github.com/MrOtherGuy/* to https://github.com/MrOtherGuy-2/$1. Or maybe I want to switch from https to http for all Tor hidden addresses, so switching from https://*.onion to http://$1.onion.
This extension also allows to modify bookmarks on an 'all or nothing' basis, so for example, if I want to modify only some of the scanned bookmarks I cannot exclude those I don't want to edit, this option should be added.
This way this extension might become a very nice bookmarks manager.

@MrOtherGuy
Copy link
Owner

I somewhat agree. Regexp matching is something I have preliminary planned and implementing shouldn't be too hard now that selection between two scanning modes is already supported (instead of just one hardcoded behavior)

I'm not sure about the exclusion after scanning though, it's not a priority at least.

But I'll give them both a bit more thought when I can.

@MrOtherGuy
Copy link
Owner

So, I added a preliminary support for regexp matching (not published, you need to build it from source or run it via about:debugging) just to test basic functionality.

Only the "search for" uses regexp and you still need to give it a string to replace results with. So the question is - Is the behavior as expected? Could it even work in some different way?

Note that the same regexp that was used for scanning is what will be replaced by the script. So, by using a slightly wrong regexp may create bookmarks with invalid url - which is basically why I did not include regexp functionality in the first place.

@35609902357
Copy link
Author

Apologies for the late reply. I managed to test the new update (although not thoroughly) and it seems everything works as it should as far as RegExp are concerned. Thank you.

@35609902357
Copy link
Author

35609902357 commented Feb 13, 2020

I tried some RegExp, but it messed up everything. Can you write a small guide in the README.md to explain how RegExp is supposed to work? For example if I want to delete ?disable_polymer=true from all youtube links how would I do? Inserting https://www.youtube.com/*?disable_polymer=true returns 0 results. What is the syntax you chose?

@35609902357 35609902357 reopened this Feb 13, 2020
@MrOtherGuy
Copy link
Owner

The way that is supposed to work is to use ?disablepolymer=true as a filter and leave the replacement input empty, so in effect replace the found matches with empty string.

But it doesn't work. I'm fairly certain that it did work at some point though. I'll need to fix this.

The format you used, youtube.com*?disablepolymer=true doesn't work because you are trying here to limit the search for youtube but the program would go and try to replace the full match including youtube.com with the replacement value. I opted to doing for simplicity and because I could think of any plausible scenario where one would like to remove/modify a specific part of the url but only on specific urls such as ones that are on youtube domain.

@MrOtherGuy MrOtherGuy self-assigned this Feb 13, 2020
@35609902357
Copy link
Author

Redirector has wildcards and they work great. Those would be perfect for managing bookmarks

@MrOtherGuy
Copy link
Owner

Could you explain how wildcards would make any difference here. You can certainly use regexp like you used as youtube.com*?disablepolymer=true (except I think you'll need to escape the ? with \ probably) but the problem is that this nor wildcards like redirector uses doesn't result in a url that you want. At least, I don't think that it will.

The result you would get if you used empty field as a replacement would be just https://www. because the extension code would replace the full match with a empty string, not just the portion that comes after the wildcard.

Or am I mistaken about how those wildcards work?

@35609902357
Copy link
Author

Let's say example.com changes the way urls are handled, and now https://example.com/user/Thomas has become https://example.com/id/Thomas, so I want to change all the bookmarks to reflect that. It would be useful to have a way to input something like https://example.com/*/* as url pattern and specify $1 as id and not input any value for $2, so the end result would be the desired one. I mentioned Redirector extension because it manages this very efficiently and flexibly (it outputs the result while typing so you can check any mistakes immediately) and because it's free software, so looking at the code may help. That flexibility would be great to have for this extension too

@tsilvs
Copy link

tsilvs commented Oct 17, 2024

Probably related, but tell me if it needs to be in a separate issue: what if there was a match reference for titles that could be used for replacements in URLs or vice versa? E.g. $url1, $url2, $title1, title2, etc.

Use cases:

  1. Using parts of URLs to rename bookmarks
  2. Using titles to fix broken bookmarks (in cases when bookmarks are saved with about:blank URL but contain proper URL in the title)

@MrOtherGuy
Copy link
Owner

I'll need to think about this. It sounds like a useful feature and it sounds similar enough to the original issue so no need to open a new issue. I do need some time to figure out how that behavior would work though, because the update procedure needs to behave very expectedly - last thing I want is that someone "loses" bunch of bookmarks because their input did something a bit different then they thought it would.

Anyway, this extension should probably be updated to use manifest v3 soon - so I'll think about this feature when doing the necessary rewrites.

@35609902357
Copy link
Author

35609902357 commented Oct 18, 2024

what if there was a match reference for titles that could be used for replacements in URLs or vice versa?

Bad idea to implement in my opinion, what you want to do would be much better accomplished by the extension connecting to the website, fetching the title of the page and replacing it for the bookmark. It seems like this feature would need some work though, because it should be run not only for batch patterns, but also for single bookmarks. And the user should be able to decide if the title is correct or acceptable. I'm also not sure this function would be allowed with manifest v3 (which seems to be unnecessary since this extension is for Firefox, which is not going to shut down manifest v2, in fact, people are flocking to Firefox to be able to keep using manifest v2 extensions.

@MrOtherGuy if you're going to implement this, please rename the extension to something more generic like "Bookmarks manager" and find a good icon, I promise this extension's userbase will shoot up, other oxtensions for managing bookmarks have thousands of users and do less stuff than this one. It's unfortunate, but people are put off by the lack of an icon and a non-catchy name.

@MrOtherGuy
Copy link
Owner

I don't know about that. I'm not looking to create a full featured "bookmarks manager" or something like that. I like the fact that it's a simple tool that does one thing (batch update numerous bookmarks) and one can then uninstall it when done.

Connecting to a website then, if I would add such a feature in the first place, is something that I think would need to be explictly requested by the user for specific bookmarks.

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

3 participants