FindBar-Tweak
FindBar-Tweak copied to clipboard
Better imitation of "global" find bar
I don't like new per-tab find bars, it's very annoying for me... I already have unchecked "Findbar starts closed in new tabs" in Options, but still see some difference between new and old behaviors.
So, can you use only one <xul:textbox> or <html:input> node to preserve undo/redo history (and move it into currently visible find bar after switching between tabs)? Or somehow modify that history, but I'm not sure about possibility to do it. Or at least sync values for each tabs.
I just want to have only one find bar. Or something, that looks like that. :)
I don't believe preserving/moving history like that between input fields is possible. Honestly, I think the only way to do this would be for FBT to create and handle its own history, overriding the native behavior, but that would be extremely laborious for the add-on, and would increase its processing requirements greatly, so I don't see this as a viable solution.
And to just have one input box is impossible, as the find bar in FF25 literally exists on a per-tab basis. I would have to override that completely, which is not as easy as it sounds, and may clash frequently with firefox itself if not done properly (once again, this may not even be possible, especially with FF27 onwards).
I do appreciate your suggestion and I will look into it, but if the history of the input box is the only issue here, that would affect a very minute percentage of case usage. If the effort needed to code this outweighs the benefits, which I'm guessing is the case, then I probably won't do it. I will definitely look into it, but I wanted to make sure you don't get your hopes up for this one.
I understand about difficulty. I think, that is (probably) possible to create one <textbox> per browser window and insert it instead of original textboxes in each tab after each "TabSelect" event.
Something like
var gInputFiled = getCurrentFindInput().cloneNode(true);
addEventListener("TabSelect", function(e) {
var tab = e.target;
setTimeout(function() {
var findInput = getCurrentFindInput();
if(gInputFiled.parentNode && gInputFiled.__origInput)
gInputFiled.parentNode.replaceChild(gInputFiled.__origInput, gInputFiled);
findInput.parentNode.replaceChild(gInputFiled, findInput);
gInputFiled.__origInput = findInput;
}, 0);
}, false);
function getCurrentFindInput() {
var findBar = gFindBar;
var findField = findBar._findField;
return findField.inputField;
}
But this code breaks find bar and preserve only text (and not undo/redo history... probably in case of some destructors). :(
Anyway, it should be easy to have the same text in each findbar.
It is somewhat easy (although still difficult) to do that now in FF25. With a few extra tweaks around the code it would definitely work.
However, FF27 introduces many changes to the mechanisms behind the find bar. Most of it becomes modularized, and the module itself is bound to a browser window, and assumes that there is a single bar per browser, which makes things much harder.
And I've tried before, changing a module from within an add-on is not as linear as changing methods in bindings. Such changes often caused many errors that I couldn't get around, and without changing this new Finder module itself, it becomes impossible to do this in FF27.
But don't take me wrong, this would be optimal for a global find bar feature, so I definitely will try to do it.
Also many users starts to use FindBar Tweak right after Firefox 25 release (which introduce per-tab find bars):
:)