Open sebast889 opened 5 years ago
I'll try to add that in the next version. Not sure when that will be however :)
As another implementation possibility, only when importing, Redirector could ask the user if they want to start fresh.
Personally, I don't need a "clear" functionality, but I completely understand why some users might find it helpful.
@sebast889 In the meantime, you should be able to manually delete Redirector's data files to clear all rules. Not ideal, but if you have tons of rules, it might be faster than removing each one manually.
Also another method, export the rules, open the JSON in a text editor, remove unused rules and import it back! Of course just check once that the JSON format and other needed rules are unchanged :)
On Thu, 28 Mar 2019 at 17:08, Gitoffthelawn notifications@github.com wrote:
As another implementation possibility, only when importing, Redirector could ask the user if they want to start fresh.
Personally, I don't need a "clear" functionality, but I completely understand why some users might find it helpful.
@sebast889 https://github.com/sebast889 In the meantime, you should be able to manually delete Redirector's data files to clear all rules. Not ideal, but if you have tons of rules, it might be faster than removing each one manually.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/einaregilsson/Redirector/issues/136#issuecomment-477496556, or mute the thread https://github.com/notifications/unsubscribe-auth/AGopdsOG3A0oEBKDFDoWgJsX3nS2dcITks5vbHy7gaJpZM4Z70j6 .
I am facing the same issue. The current Import
option is misleading in the sense that it is more like a Merge
function. Ideally, Import
should just simply replace and overwrite the existing settings.
A possible solution is to have two buttons. Rename current Import
as Merge
or Import and Merge
. Add new Import
or Import and Replace
which would just overwrite existing rules.
@in4u Good ideas. To keep the UI simple, here's a suggestion based on your ideas:
When the user presses the Import
button, issue a small dialog box with 3 radio buttons:
o Add imported rules above existing rules o Add imported rules below existing rules o Replace all existing rules
Sounds good @Gitoffthelawn! I am new to this extension and very much like it but this merging thing is really putting me off to the extent that I am forced to look for alternatives. Do you know any which works on both Firefox desktop and mobile?
@in4u Great! I'm glad you like. :)
I do not know of any similar extension which works on both Firefox desktop and mobile, and was unaware whether or not this extension worked well on mobile.
Einar (the original author and main contributor) has been very busy lately, but I think he might have some updates for us all soon. Plus, he is good at accepting pull requests. See: https://github.com/einaregilsson/Redirector/graphs/contributors
If Einar doesn't have any time at all in the foreseeable future, I might talk to him about the possibility of sharing access or forking so we can keep things moving a little.
BTW, how are your JavaScript skills?
Yeah, I figured this project is just in maintenance mode now.
Anyways, have found and switched over to a more actively developed alternative - Request Control - which is working well for me on both Firefox desktop and mobile. So, I guess my googling skills are perhaps better than my javascript skills, haha!
I think it's sorta in a combination of "when Einar has free time" and "when the community submits a pull request" mode! :)
Request Control is on my list of extensions to eventually look at when I have some time. It looks powerful, but I'm not sure if it has some of the great features of Redirector like URL encoding, URL decoding, URL double-decoding, and BASE64 decoding (all of which I use). Also, since I haven't looked at Request Control's source code yet, I'm unclear as to why it's 3 times the size of Redirector.
Regardless, I hope one of these projects meets you needs or can be enhanced to meet your needs! :)
The features you mentioned already seem to be available in Request Control as per its manual.
I don't mind the size of addons, per se. When comparing similar addons, I prefer to check their performance via about:performance
in Firefox and pick the one which isn't very resource-heavy. Redirector and Request Control have almost similar performance and seem to be light-weight for my usage.
I will definitely keep a tab on both the projects though and see where they go and how they can be improved further!
@in4u Thank you for the link you provided. I'll read it soon.
I go through the source code before I install or update an extension, so larger extensions sometimes take more time to review. But often the extra bulk is just a bunch of resources that aren't executed.
Modern browsers are huge memory hogs, and some extensions cause more memory to be used per tab. So smaller is often better. But for extensions like Redirector and Request Control, that shouldn't be an issue.
There's also browser open and close times to consider, but 100KB probably won't be noticeable on it's own. Collectively, it can make a difference.
I like your idea of using about:performance
. I use it too. I'm not sure how accurate it is, but it's definitely easy to use. I find Firefox to be much slower (and more powerful) with the extensions I use, but I haven't found a good way to figure out what is slowing things down besides testing every possible combination of extensions. I have a hunch a couple of them are not playing nicely together, but I need to learn a better technique to determine the cause besides trying all the combinations.
Anyways, this reply is much longer than I intended, so I'll close by saying that I look forward to your contributions and feedback on either or both extensions. :)
Hey @einaregilsson, until you get time to implement other detailed suggestions in this thread, I propose the following changes as an immediate solution to the problem at hand:
Add a reset button
<a class="btn blue large" id="reset-rules">Reset</a>
Insert a new function
function resetRules() {
if (confirm("This will delete all the existing rules. Do you want to proceed?")) {
REDIRECTS.splice(0, REDIRECTS.length);
saveChanges();
renderRedirects();
showMessage("Reset was successful and all the rules were deleted.", true);
}
}
in importexport.js
. In the same file, add
el("#reset-rules").addEventListener('mousedown', resetRules);
A new Reset
button next to Import
and Export
.
Clicking on the Reset
button will show a warning message "This will delete all the existing rules. Do you want to proceed?".
Clicking OK
will delete all existing rules and a "Reset was successful and all the rules were deleted." message will be displayed. If Cancel
was clicked instead then nothing will happen.
I tested these changes while debugging as a temporary addon in Firefox and everything seems to be work fine. Let me know if there's something wrong or if I missed something.
@in4u Thanks for your contribution! Instead of its own button, what do you think of adding the contents of the function you wrote to be called when the user presses the Import
button (and add a yes/no for deleting all rules before import)?
The way you have it currently is very flexible (the user can reset whenever they like), and so I like that a lot, but it does add a rarely-used and hazardous button (even with the prompt) to the main UI.
If the reset functionality is added to Import
, the additional complexity is hidden until the user wants to perform a reset. The downside, of course, is that the user cannot perform a reset without performing an Import.
I think either way is reasonable. One way has a cleaner UI and the other way has more functionality. Personally, I'm probably never going to use this (I've never had the need to delete all my rules!), so I'm just presenting a couple options for discussion.
I still like our previous idea of being able to specify what happens when the user imports, as we discussed here: https://github.com/einaregilsson/Redirector/issues/136#issuecomment-598538310
Thanks for the feedback @Gitoffthelawn! I don't think the button is hazardous when combined with an explicit confirmation warning. Burying the reset option in a dropdown menu will only force users like me, who just want to start with a clean slate of rules or overwrite existing rules, to make an unnecessary extra click to achieve that goal.
And after playing around with Redirector some more, I couldn't personally find any utility of having an option of importing rules above/below existing rules as per your previous suggestion. What I did find was possibly another bug (?) which is unrelated to this issue: When the export includes some disabled rules then their order priority is lost and they are pushed to the bottom while importing them later.
Anyways, an alternative that I can think of is just having two buttons: Export/Import
and Reset
. The Export/Import
button being a dropdown having Export all rules
, Import and merge with existing rules
and Import and replace all existing rules
options with a confirmation warning for the third option.
@in4u You're welcome! Responses:
I actually wasn't thinking of a dropdown... I was thinking of a dialog that pops up when you press Import
that would immediately be displayed.
Regarding "import above/below" functionality: My main use for import is currently to add rules that I often can't edit within Redirector because of the current implementation of the rule validator (see https://github.com/einaregilsson/Redirector/issues/174), so I write/edit the rule in JSON and then import it in to Redirector to get around that issue. Being able to import above/below existing rules (or at a certain spot) would be nice, but not a huge issue.
Regarding disabled items exported being exported last, I just tried it, and the rules were exported in the correct order for me. So I'm guessing it's the import that has the issue. I didn't try importing the export. If you conclude the same, you may consider filing an issue.
Regarding your button ideas, those sound good too. They do violate my first comment in this post, but that's just a preference of mine, not a hard and fast rule. To take your idea one step further, there could be a Rules
button that has all the options you mentioned (including Reset
, which perhaps would be Delete All
) as a dropdown. That would make the main UI cleaner, and hide the less commonly used functions, but it would require one additional click to access a couple items.
Overall, I think all the ideas we're discussing are good and definitely viable.
I am okay with any solution so long as the basic underlying issue is resolved. The code I proposed would simply bring it at par with Request Control which currently also has just three buttons for exporting, importing and restoring. Anything on top of that is like cherry on the cake for me.
So, let's just wait and see what @einaregilsson ultimately decides!
@in4u Sounds good!
It looks like this was never implemented. Is there an alternative way to quickly clear the extension's data in Chrome before importing? I have a ~100 redirects that I import periodically after updating from other sources - right now it's practically impossible to do this (deleting the existing ~100). Sync would not work for me.
In your situation it may be best to simply uninstall and install the extension again.
There should be a clear all rules button/option (with 'Are you sure?' prompt). When trying to import a new Redirector rules backup on a setup with old Redirector rules it is painful to remove each rule one by one then import the new Redirector rules backup.