MozillaZine


keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
ybbao
 
Posts: 13
Joined: August 23rd, 2010, 2:38 am

Post Posted September 5th, 2015, 4:08 pm

I have PM the private FTP to you. Please check it. Thanks.

nigelle
 
Posts: 117
Joined: June 9th, 2005, 8:30 am
Location: France

Post Posted September 20th, 2015, 9:52 am

For Thunderbird
I have open the list of mailboxes of an account, the list is long and take more than a screen.
How to define a short-cut to close the list or go back to the top ?

iPhilip
 
Posts: 2
Joined: September 23rd, 2015, 12:51 pm

Post Posted September 23rd, 2015, 1:14 pm

Folks,

I would like to share four pieces of code I put together recently so that others may benefit from it. They all are under the theme of expanding/collapsing folder trees.

The first one expands all branches of a tree:

Code: Select all
// Expand all branches of a tree - Ctrl+Right Arrow
var tree = document.getElementById('folderTree');
if ( tree ) {
  var view = tree.view;
  var row = tree.currentIndex;
  var parentIndex = row;
  do {
    tree.changeOpenState(row, true);
    row++;
  } while (row < view.rowCount && parentIndex <= view.getParentIndex(row))
}

The counterpart collapses all branches of a tree (note that it does so from the bottom up so that they don't show expanded when reopened):

Code: Select all
// Collapse all branches of a tree - Ctrl+Left Arrow
var tree = document.getElementById('folderTree');
if ( tree ) {
  var view = tree.view;
  var row = tree.currentIndex;
  var parentIndex = row;
  do {
    row++;
  } while (row < view.rowCount && parentIndex <= view.getParentIndex(row))
  do {
    row--;
    tree.changeOpenState(row, false);
  } while (row > parentIndex)
}

The next one expands a single branch and selects the first row in the branch:

Code: Select all
// Expand a single branch and select the first row in the branch - Ctrl+[
var tree = document.getElementById('folderTree');
if ( tree ) {
  var row = tree.currentIndex;
  if (tree.changeOpenState(row, true)) {
    tree.view.selection.select(row+1);
    tree.treeBoxObject.ensureRowIsVisible(row+1);
  }
}

The final one collapses the current branch and selects the parent row:

Code: Select all
// Collapse a branch and select the parent row - Ctrl+]
var tree = document.getElementById('folderTree');
if ( tree ) {
  var row = tree.currentIndex;
  var parentIndex = tree.view.getParentIndex(row);
  tree.changeOpenState(parentIndex, false);
  tree.view.selection.select(parentIndex);
  tree.treeBoxObject.ensureRowIsVisible(parentIndex);
}

Enjoy!

pepicek1977
 
Posts: 1
Joined: September 25th, 2015, 12:44 am

Post Posted September 25th, 2015, 12:57 am

Many, many years ago, dorando posted the code for a key to switch the focus to the folder pane or the thread pane in Thunderbird, using SetFocusFolderPane() and SetFocusThreadPane(). See viewtopic.php?p=2923606.

Getting the latter one to work was no problem: I can now use a key to switch to the thread pane. However, for the life of me, I haven't been able to get the former one working: there's no way that in Thunderbird 38.2.0 I can get the key to switch the focus to the folder pane to function as I would like it to.

The code is as specified, the key combination I use is available and, as said, the other one works just fine.

Has anything changed in Thunderbird's behaviour? Am I overlooking something simple?

Thanks to anyone who can help me out on this one!

[Update]
After lots of searching, I stumbled upon the solution:

document.getElementById("folderTree").focus()

...does the trick

forbrute
 
Posts: 2
Joined: October 13th, 2015, 10:19 am

Post Posted October 14th, 2015, 3:43 am

Can anyone here provide me signed version of keyconfig?

DanRaisch
Moderator

User avatar
 
Posts: 124270
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Post Posted October 14th, 2015, 4:43 am

You can get that from the AMO site -- https://addons.mozilla.org/en-US/firefo ... ey-config/

WildcatRay

User avatar
 
Posts: 7481
Joined: October 18th, 2007, 7:03 pm
Location: Columbus, OH

Post Posted October 14th, 2015, 4:45 am

DanRaisch wrote:You can get that from the AMO site -- https://addons.mozilla.org/en-US/firefo ... ey-config/

Anyone know if the key bindings need to be redone? (I would assume so.)
Ray

OS'es: 4 computers with Win10 Pro 64-bit; Current Firefox, Beta, Nightly, Chrome, Vivaldi

forbrute
 
Posts: 2
Joined: October 13th, 2015, 10:19 am

Post Posted October 14th, 2015, 9:36 am

DanRaisch wrote:You can get that from the AMO site -- https://addons.mozilla.org/en-US/firefo ... ey-config/

I need dorando's version. It's much better in customizing shortcuts.

Leo van der Waal
 
Posts: 1
Joined: October 16th, 2015, 8:23 pm

Post Posted October 16th, 2015, 8:40 pm

forbrute wrote:
DanRaisch wrote:You can get that from the AMO site -- https://addons.mozilla.org/en-US/firefo ... ey-config/

I need dorando's version. It's much better in customizing shortcuts.

Same here. Unfortunately, I cannot PM RDL (yet).

RDL
 
Posts: 1258
Joined: August 22nd, 2004, 1:39 am

Post Posted October 17th, 2015, 4:46 am

forbrute wrote:Can anyone here provide me signed version of keyconfig?

Well, I replied to your PM but you haven't yet read my reply.

Leo van der Waal wrote:..Same here. Unfortunately, I cannot PM RDL (yet).

I've been up all night so I'm going to sleep. I'll try to look out for your PM when I'm awake.

rbfye14
 
Posts: 26
Joined: April 9th, 2012, 8:23 am

Post Posted October 25th, 2015, 7:01 am

Please how can I emulate keydown (or keyup) event for Esc key?

Brummelchen
 
Posts: 4616
Joined: March 19th, 2005, 10:51 am

Post Posted October 25th, 2015, 9:09 am

that is not possible:
https://addons.mozilla.org/de/firefox/a ... cclosetab/
I was unable to use my favorite custom hotkey (Close active tab on Esc key), defined with the Dorando's keyconfig extension
the magic number is 51 and you are probably part of it :p

avada
 
Posts: 1884
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Post Posted November 8th, 2015, 9:18 am

Hello!

Is there some code I can use to cycle between languages of spell checking? I only have two languages, and it's rather frustrating to get to the language section of the context menu.

Historically dictionary switcher used to work well, but nowadays it's broken on most websites' text fields. And I found no alternative to automatization.

bege
 
Posts: 128
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Post Posted November 10th, 2015, 11:19 am

avada wrote:Hello!

Is there some code I can use to cycle between languages of spell checking? I only have two languages, and it's rather frustrating to get to the language section of the context menu.

Historically dictionary switcher used to work well, but nowadays it's broken on most websites' text fields. And I found no alternative to automatization.


I got this previously in this forum. You need one key binding for each dictionary. Set the respective language in the first line (e.g. "en-US")

Code: Select all
 var dictionary = "de-DE";

    var Cc = Components.classes; var Ci = Components.interfaces;

    Cc['@mozilla.org/spellchecker/engine;1'].getService(Ci.mozISpellCheckingEngine).dictionary = dictionary;

    var nsIContentPrefService2 = Cc["@mozilla.org/content-pref/service;1"].getService(Ci.nsIContentPrefService2);
    var target = document.commandDispatcher.focusedWindow;
    if(target == window) target = content;
    var loadContext = target.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsILoadContext);
    nsIContentPrefService2.set(target.location, "spellcheck.lang", dictionary, loadContext);

    Services.prefs.setCharPref("spellchecker.dictionary", dictionary);

avada
 
Posts: 1884
Joined: February 10th, 2008, 6:30 am
Location: Hungary

Post Posted November 11th, 2015, 2:20 pm

Thanks for the tip. I'll try it.

I seems like it could be enhanced to what I want, if there was a way to get/determine the current language.

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 2 guests