keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

Try

Code: Select all

var pref = "dom.event.contextmenu.enabled";
gBrowser.mPrefs.setBoolPref(pref, !gBrowser.mPrefs.getBoolPref(pref)); 
Iceweasel
Posts: 39
Joined: April 9th, 2008, 9:41 am
Location: Scotland

Re: keyconfig 20080929

Post by Iceweasel »

Dorando, thank you for taking the time to answer my question how to hide/unhide the TabMixPlus tab bar. I am totally impressed by your ongoing support!

Is it possible to write functions which can be called from various keys?
Is it possible to store a state which can be read the net time a key is pressed?

I would like to hide/unhide my tool and tab bars (when I need more screen estate). I have already written a function that does that. But preferably, I would like to be able to toggle the state of individual menus as well as having a toggle all, which is why I'd like to create a callable function:

Code: Select all

toggleElement (element)
var b = document.getElementById(element);
b.collapsed = !b.collapsed;
return b.collapsed;


Rather than just toggling all menu states, I'd like to hide them all the first time - and if they are hidden already, remember that and only unhide those the next time that were visible before.
Soar Alba
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

Iceweasel wrote:Is it possible to write functions which can be called from various keys?
Not really, you'll need to add the relevant code to all <key>s.
Iceweasel wrote:Is it possible to store a state which can be read the net time a key is pressed?
If only needed for the current window/session adding anything to a global object should suffice (window.blah = "something") otherwise you can store anything in the Preferences or maybe with
DOM Storage. You can also save attributes on elements with an id by using document.persist(id, attribute).
Iceweasel wrote:I would like to hide/unhide my tool and tab bars (when I need more screen estate). I have already written a function that does that. But preferably, I would like to be able to toggle the state of individual menus as well as having a toggle all, which is why I'd like to create a callable function:

Code: Select all

toggleElement (element)
var b = document.getElementById(element);
b.collapsed = !b.collapsed;
return b.collapsed;
Rather than just toggling all menu states, I'd like to hide them all the first time - and if they are hidden already, remember that and only unhide those the next time that were visible before.
Try

Code: Select all

if(keyconfig.toolbars) {
 keyconfig.toolbars.forEach(function(node){
  node.collapsed = false;
 });
 delete keyconfig.toolbars;
}
 else {
 keyconfig.toolbars = [];
 ["toolbar-menubar","nav-bar","PersonalToolbar","status-bar"].forEach(function(id){
  var node = document.getElementById(id);
  if(!node.collapsed) {
   keyconfig.toolbars.push(node);
   node.collapsed = true;
  }
 });
 if(!gBrowser.mStrip.collapsed) {
  gBrowser.mStrip.collapsed = true;
  keyconfig.toolbars.push(gBrowser.mStrip);
 }
}
 
OzarksCrescentMural
Posts: 20
Joined: July 23rd, 2010, 5:18 pm

Re: keyconfig 20080929

Post by OzarksCrescentMural »

Hi,

I need the keyconfig command codes for Select All, Copy, Paste.

I'm just trying to set Add a New Key for Select All and Copy and another one for Select All and Paste. I do these keystrokes a million times a night for my job.

Your help is much appreciated.

Thanks!
OzarksCrescentMural
Posts: 20
Joined: July 23rd, 2010, 5:18 pm

Re: keyconfig 20080929

Post by OzarksCrescentMural »

Actually, is it possible to set a command code for the following:

Say, I've already highlighted the text I want.

So I'd want the command to do the following:

Copy
Switch to Tab 2
Click in the search box
Select all and paste
Enter

If someone knows the code for all this, then I could just do one keystroke for it.

Thanks!
User avatar
FireLove
Posts: 108
Joined: July 27th, 2008, 5:59 pm

Re: keyconfig 20080929

Post by FireLove »

OzarksCrescentMural wrote:Hi,

I need the keyconfig command codes for Select All, Copy, Paste.

I'm just trying to set Add a New Key for Select All and Copy and another one for Select All and Paste. I do these keystrokes a million times a night for my job.

Your help is much appreciated.

Thanks!


What kind of monkey job is that ? :shock: ](*,)

Anyways nothing good could come out of the labor like that!
Also for putting up with that, and especially for shipping out fruits of your toil, you deserve nothing but eternal fire, or at least a Master Shortcut that'll explode 50 computers in your vicinity.
Pray to Mozilla Code Gurus, and you'll be delivered my brother ;)
User avatar
FireLove
Posts: 108
Joined: July 27th, 2008, 5:59 pm

Re: keyconfig 20080929

Post by FireLove »

On the other news, Dorando I need your voodoo once again, could not make sense of DOM Inspector myself :x

Session Manager had big update, broke shortcuts I had for it's functions.
Only shortcut for toolbar button still works.

Code: Select all

document.getElementById("sessionmanager-toolbar").open = true;

The broken ones are:

Code: Select all

gSessionManager.load();
gSessionManager.saveWindow();
gSessionManager.save();
gSessionManager.remove();

Could you please help me fix those.

BTW, Evernote's clipper button (which I hid for good) stopped clipping when they updated to 4.x (no relationship to Firefox versioning I believe)
The code that still works (I won't update anyway - they start to bloat things - but it might be useful for some others)

Code: Select all

evernote_performClip(null);
PumpkinEater
Posts: 28
Joined: July 23rd, 2010, 11:10 pm

Re: keyconfig 20080929

Post by PumpkinEater »

From earlier posts, I suspect you will already know this, but keyconfig 20080929 is apparently not compatible with Firefox 3.6.8. Will there be a new version, or workaround in the meantime?

Thanks for the great plugin.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

Compatibility information has been updated, it might be necessary to click on Tools > Add-ons > Find Updates (which might incorrectly state at the top that "No updates were found" while "A compatibility update has been applied" as stated below the extension name) if the extensions didn't got re-enabled already.

Note that it is possible to disable the compatibility enforcing by adding a boolean 'extensions.checkCompatibility.3.6' through about:config.

OzarksCrescentMural wrote:I need the keyconfig command codes for Select All, Copy, Paste.
Try

Code: Select all

goDoCommand("cmd_selectAll");
goDoCommand("cmd_copy");
goDoCommand("cmd_paste"); 
OzarksCrescentMural wrote:Say, I've already highlighted the text I want.

So I'd want the command to do the following:

Copy
Switch to Tab 2
Click in the search box
Select all and paste
Enter
Try

Code: Select all

goDoCommand("cmd_copy");
gBrowser.selectTabAtIndex(1);
var input = content.document.getElementsByName("q")[0];
input.focus();
goDoCommand("cmd_selectAll");
goDoCommand("cmd_paste");
input.form.submit();  
or

Code: Select all

goDoCommand("cmd_copy");
gBrowser.selectTabAtIndex(1);
var input = content.document.getElementsByName("q")[0];
input.focus();
goDoCommand("cmd_selectAll");
goDoCommand("cmd_paste");

var utils = commandDispatcher.focusedWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);

utils.sendKeyEvent("keypress", KeyEvent.DOM_VK_ENTER, 0, 0);  
Adjust

Code: Select all

var input = content.document.getElementsByName("q")[0];  
to select the search box (the example works with Google).

FireLove wrote:Session Manager had big update, broke shortcuts I had for it's functions.
[...]
The broken ones are:

Code: Select all

gSessionManager.load();
gSessionManager.saveWindow();
gSessionManager.save();
gSessionManager.remove();
Try

Code: Select all

com.morac.gSessionManager.load(window);
com.morac.gSessionManager.saveWindow(window);
com.morac.gSessionManager.save(window);
com.morac.gSessionManager.remove();  
OzarksCrescentMural
Posts: 20
Joined: July 23rd, 2010, 5:18 pm

Re: keyconfig 20080929

Post by OzarksCrescentMural »

Thank you so much for your help.

The first two keys I wanted worked perfectly. Since Apple+Y and Apple+E are not designated, I decided to take two keyboard shortcuts and make one by creating Select All and CopY for Apple+Y with the following:

goDoCommand("cmd_selectAll");
goDoCommand("cmd_copy");

And Select All and PastE for Apple+E:

goDoCommand("cmd_selectAll");
goDoCommand("cmd_paste");

No problems there, but when I went to do the more complicated command set I outlined, I had to swap out a Go to Next Tab command I found on an AskMetafilter forum with what you had because it wasn't working. All the other command lines worked OK. So I used your first suggestion, but I swapped out the second line:

goDoCommand("cmd_copy");
gBrowser.mTabContainer.advanceSelectedTab(1, true);
var input = content.document.getElementsByName("q")[0];
input.focus();
goDoCommand("cmd_selectAll");
goDoCommand("cmd_paste");
input.form.submit();

And it does exactly what I asked for it to do. I assigned it to Apple+G for Google (I disabled the original G that does Find Again first).

Thanks a lot. You are wonderful.

I'm just reprinting all of this in case someone wants these same commands in the future. Makes life easier that way.

Take care!
Iceweasel
Posts: 39
Joined: April 9th, 2008, 9:41 am
Location: Scotland

Re: keyconfig 20080929

Post by Iceweasel »

Dorando, thank you for helping with toggling all tool bars unless they are no hidden already:

I added a couple of missing brackets and incorporated the logic for TabMixPlus tab bars:

Code: Select all

var tabs = "extensions.tabmix.hideTabbar";

if(!keyconfig.toolbars) // 1st, 3rd, ...
{
    keyconfig.toolbars = [];
    keyconfig.tabbar = gBrowser.mPrefs.getIntPref(tabs);
    if (keyconfig.tabbar == 0)
   {
        gBrowser.mPrefs.setIntPref(tabs, 2);
    }
    ["toolbar-menubar","nav-bar","PersonalToolbar","aios-toolbox-left","FindToolbar"].forEach(
    function(id)
    {
        var node = document.getElementById(id);
        if(!node.collapsed)
        {
            keyconfig.toolbars.push(node);
            node.collapsed = true;
        }
    });
}
else // 2nd, 4th, ...
{
    if (keyconfig.tabbar == 0)
    {
         gBrowser.mPrefs.setIntPref(tabs, 0);
    }
    keyconfig.toolbars.forEach (
    function(node)
    {
        node.collapsed = false;
    });
    delete keyconfig.toolbars;
}


PS: how do you colour code your code snippets?
Last edited by Iceweasel on July 24th, 2010, 11:31 pm, edited 1 time in total.
Soar Alba
PumpkinEater
Posts: 28
Joined: July 23rd, 2010, 11:10 pm

Re: keyconfig 20080929

Post by PumpkinEater »

Thanks dorando for the quick reply and update! Much appreciated. Keyconfig (and single-key shortcuts) has become so essential to me, I was half-considering going back to Opera while I couldn't get it to work.

Thanks again!
User avatar
FireLove
Posts: 108
Joined: July 27th, 2008, 5:59 pm

Re: keyconfig 20080929

Post by FireLove »

dorando wrote:
FireLove wrote:Session Manager had big update, broke shortcuts I had for it's functions.
[...]
The broken ones are:

Code: Select all

gSessionManager.load();
gSessionManager.saveWindow();
gSessionManager.save();
gSessionManager.remove();
Try

Code: Select all

com.morac.gSessionManager.load(window);
com.morac.gSessionManager.saveWindow(window);
com.morac.gSessionManager.save(window);
com.morac.gSessionManager.remove();  

Thank you!
Works perfectly!
adulttw
Posts: 63
Joined: July 3rd, 2004, 10:46 pm

Re: keyconfig 20080929

Post by adulttw »

Next tab is
gBrowser.mTabContainer.advanceSelectedTab(1);

Previous Tab is
gBrowser.mTabContainer.advanceSelectedTab(-1);

I want to they can be cycle.

ex:
When view the last tab,I use Next tab,it will go to the first tab.
When view the first tab,I use previous tab,it will go to the last tab.

Is any idea?

Thank you~
Iceweasel
Posts: 39
Joined: April 9th, 2008, 9:41 am
Location: Scotland

Re: keyconfig 20080929

Post by Iceweasel »

cycle through tabs

Code: Select all

gBrowser.mTabContainer.advanceSelectedTab(1,true) /* next */
gBrowser.mTabContainer.advanceSelectedTab(-1,true) /* previous */
Soar Alba
Post Reply