Infocatcher / Download_Panel_Tweaker

Some tweaks for built-in download panel, restartless extension for Firefox
https://addons.mozilla.org/addon/download-panel-tweaker/
Other
9 stars 2 forks source link

Incompatibility with OmniSidebar (easy to fix) #21

Closed Quicksaver closed 10 years ago

Quicksaver commented 10 years ago

Hey Infocatcher,

There's a little problem when you change the "Hotkey for downloads (Ctrl+J)" option to "Toggle sidebar". Result: the keyboard shortcut will always open, but never close the sidebar.

I saw in the code that you're using OmniSidebar's menu item to do the command, but if in OmniSidebar you enable the option "Don't close the sidebar from drop-down menus" (which will be enabled by default in the next version), it will never close the downloads sidebar because, technically, it is the "menu item" that's doing the command.

The solution is simple: get the broadcaster instead of the menuitem and do the command from there. The broadcaster id changes for Australis (Firefox 29), but the menuitem id stays the same, so for backwards compatibility it'll probably be better to get it from the menuitem's "observes" attribute. Basically change:

        var sbItem = document.getElementById("menu_dmSidebar") // OmniSidebar
            || document.getElementById("downloads-mitem"); // All-in-One Sidebar
        if(sbItem) {

to something like

        var sbItem = document.getElementById("menu_dmSidebar"); // OmniSidebar
        if(sbItem)
            sbItem = document.getElementById(sbItem.getAttribute('observes')); // use the broadcaster instead
        else
            sbItem = document.getElementById("downloads-mitem"); // All-in-One Sidebar
        if(sbItem) {
Quicksaver commented 10 years ago

Correction, OmniSidebar's downloads sidebar broadcaster id changed for Firefox 26, not 29. I forgot this had nothing to do with Australis, sorry about that.

Infocatcher commented 10 years ago

Corrected, thanks! I also switched to use broadcaster with AiOS: currently all works fine for me with All-in-One Sidebar 0.7.21 and OmniSidebar 1.3.2.

Test version: download_panel_tweaker-0.2.1pre5-fx.xpi (source).

Quicksaver commented 10 years ago

Yep, it's working great! Thanks!