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 »

oneduality wrote:I'm attempting to use keyconfig simply to make a shortcut to strikethrough ..which so far I've been unable to do

I'm running the addon in thunderbird 2.0.0.23 on windows ..

I've tried:

doStyleUICommand("cmd_strikethrough")
That should work, ensure that you add it to the Compose Window (select it from the dropdown box while it is open or make the shortcut global).
oneduality
Posts: 5
Joined: September 28th, 2009, 8:42 am

Re: keyconfig 20080929

Post by oneduality »

"select it from the dropdown box while it is open or make the shortcut global"

I've made it global, which doesn't seem to help .. and I'm not sure what you mean by select it from the drop down box while it is open ... if I'm in the compose window I can't select the shortcut editor from tools (don't think that's what you mean though) .. and if I'm in the shortcut editor.. the drop down at the top only says "Inbox for xxx@yyy.com - Thunderbird" and "Keyconfig" below that
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

oneduality wrote:I've made it global, which doesn't seem to help [...]
Try again after restarting Thunderbird, the last Compose window doesn't get completely unloaded, so keyconfig won't apply any changes to it if it is opened again. Otherwise any errors in the Tools > Error Console (set javascript.options.showInConsole to true in about:config)?
oneduality wrote: [...] the drop down at the top only says "Inbox for xxx@yyy.com - Thunderbird" and "Keyconfig" below that
Open a Compose window (either before or after opening keyconfig) and it will appear in the dropdown box.
oneduality
Posts: 5
Joined: September 28th, 2009, 8:42 am

Re: keyconfig 20080929

Post by oneduality »

Ah ha! problem solved... setting it to global didn't seem to matter at all but doing as you said..

I opened keyconfig, then opened a compose window... went back and saw the compose window in the drop down, when i added it there it worked as expected... beautiful work Dorando! this is one of the handiest addons I've come accross so far..
oneduality
Posts: 5
Joined: September 28th, 2009, 8:42 am

Re: keyconfig 20080929

Post by oneduality »

I have one more thing to ask, if this is even possible - and I doubt it is .. (hunch)

I do web development and I wanted to be able to hit Ctrl+Shift+L for example, to insert some html into the selected text area ... the id however may not always be consistant ..

Is there a way for keyconfig to act on the selected textarea only? ... my thought is no ... but I hope it turns out to be a wrong thought :)
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

Try

Code: Select all

var editor = (commandDispatcher.focusedElement instanceof Components.interfaces.nsIDOMNSEditableElement) ?
              commandDispatcher.focusedElement.editor : null;

if(
editor) {
 editor instanceof Components.interfaces.nsIPlaintextEditor;
 editor.insertText("something");
}
 
User avatar
ekbworldwide
Posts: 53
Joined: May 28th, 2007, 3:53 am

copy and pasting

Post by ekbworldwide »

First - is there anyway to search just the "keyconfig 20080929" forum?
As far as I can see the answer is no - but I thought I'd check.

I hate to ask a simple question - the kind that's been asked and re-re-re-re-asked - but what's the code for copying and pasting from the clipboard?

examples

If I select >example< when I paste it I want choices like:

"example"
-or-
intitle:"example"
-or-
site:"example"

I have "functions for keyconfig" and with that I can see a lot of sample code - but it's strange - all the code for the defaults like Ctrl-C, Ctrl-V is hidden. No code is visible - only the comment "/* CODE */" - and that's it.

There's a google related add-on that does something similar. But I still need to learn the code since I want to use keyboard shortcuts and I also want to avoid add-on bloat.

___________

If I can solve any of my questions myself - I'll add edits at the bottom of this post.

___________

I tried

Code: Select all

goDoCommand("cmd_pasteNoFormatting");

It doesn't do anything.

Code: Select all

goDoCommand("cmd_paste");

It works - but I don't know if I can figure out how to add text to it.
...
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: copy and pasting

Post by dorando »

ekbworldwide wrote:[...] what's the code for copying [...]
Try

Code: Select all

goDoCommand("cmd_copy"); 
ekbworldwide wrote:[...] pasting from the clipboard? [...]
If I select >example< when I paste it I want choices like:

"example"
-or-
intitle:"example"
-or-
site:"example"
Try something like

Code: Select all

var editor = (commandDispatcher.focusedElement instanceof Components.interfaces.nsIDOMNSEditableElement) ?
          commandDispatcher.focusedElement.editor : null;

if(
editor) {
 editor instanceof Components.interfaces.nsIPlaintextEditor;
 editor.beginTransaction();
 editor.insertText('intitle:"');
 editor.paste(1);
 editor.insertText('"');
 editor.endTransaction();
}
 
ekbworldwide wrote:[...] I can see a lot of sample code - but it's strange - all the code for the defaults like Ctrl-C, Ctrl-V is hidden. No code is visible - only the comment "/* CODE */" - and that's it.
The grayed out shortcuts are not connected to any code, they exist for the menu.
User avatar
ekbworldwide
Posts: 53
Joined: May 28th, 2007, 3:53 am

Re: keyconfig 20080929

Post by ekbworldwide »

Thanks.

You gave me exactly what I asked for. But I made a mistake - I didn't ask for exactly what I need.

1. make copied >example< become intitle:"example"
-and-
2. make selected >example< become intitle:"example"

I forgot all about #2. Could you (or somebody) give me a code snippet that does 1 or 2 depending?

_____________________

This is probably a very stupid question - but can greasemonkey understand code like:

Code: Select all

goDoCommand("cmd_copy"); 

If so - how? Why? I'm a bit curious since I know enough to select text on the page - with the exception of text in text areas and input fields. I've gotten help at userscripts.org - but I've hit a wall and it seems my thread on it has died.

_____________________

I'm doing all this to try to figure out a way to fix a problem with SearchIt.

SearchIt
https://addons.mozilla.org/en-US/firefox/addon/9623

For the first 5 minutes of using it I thought it was the most fantastic add-on ever. All my keyword searches were available via the context-menu. But then I realized that it can't work in text areas and search fields. My plan is to:

use keyconfig stuff to create q (my search) > create a greasemonkey hack to send q to a div (or something) > q isn't in a text area or input field so SearchIt can work on it

What's a good place at forums.mozillazine.org (or elsewhere) to ask this question "Could somebody make a hack for SearchIt so it works on text areas and input fields"?

Is this a good place(?):

Extension Development • mozillaZine Forums
viewforum.php?f=19
...
dubsey
Posts: 18
Joined: July 9th, 2007, 8:41 am

Re: keyconfig 20080929

Post by dubsey »

Hi dear developer (dorando),

Thank you for such a wonderful addon. I wish you could someday add this to the main Firefox addons site for more people to share in using this great addon. =D>

OK, my main reply now is for this:

In Firefox 3.5 + keyconfig installed, I have succesfully emulated the same homepage shortcut as Opera browser has which is Ctrl+Space. The problem though is that the Space (which is the space bar) is NOT SHOWING making it look odd

Image

Please fix this for a next version or lemme know [-o<
User avatar
ekbworldwide
Posts: 53
Joined: May 28th, 2007, 3:53 am

Re: keyconfig 20080929

Post by ekbworldwide »

The screen shot you posted is from "functions for keyconfig". This forum's for keyconfig.

The add-on developer's page is here

Firefox Extension: functions for keyconfig
http://www.pqrs.org/tekezo/firefox/exte ... keyconfig/

There's a comment thread there - and his email is there too.
...
dubsey
Posts: 18
Joined: July 9th, 2007, 8:41 am

Re: keyconfig 20080929

Post by dubsey »

ekbworldwide wrote:The screen shot you posted is from "functions for keyconfig". This forum's for keyconfig.

The add-on developer's page is here

Firefox Extension: functions for keyconfig
http://www.pqrs.org/tekezo/firefox/exte ... keyconfig/

There's a comment thread there - and his email is there too.


But I downloaded Keyconfig from this very thread (the first page). Maybe the developer incorporated "functions for keyconfig" into the latest Keyconfig build :-k Please help
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: keyconfig 20080929

Post by dorando »

ekbworldwide wrote:1. make copied >example< become intitle:"example"
-and-
2. make selected >example< become intitle:"example"
Try

Code: Select all

var editor = (commandDispatcher.focusedElement instanceof Components.interfaces.nsIDOMNSEditableElement) ?
              commandDispatcher.focusedElement.editor : null;

if(
editor) {
 editor instanceof Components.interfaces.nsIPlaintextEditor;
 editor.beginTransaction();
 if(editor.selection.toString()) {
  editor.insertText('intitle:"'+editor.selection+'"');
 } else {
  editor.insertText('intitle:"');
  editor.paste(1);
  editor.insertText('"');
 }
 editor.endTransaction();
}
  
ekbworldwide wrote:use keyconfig stuff to create q (my search) > create a greasemonkey hack to send q to a div (or something) > q isn't in a text area or input field so SearchIt can work on it
You could try something like

Code: Select all

var div = content.document.getElementById("keyconfig_div");
if(
div) {
 div.parentNode.removeChild(div);
 return;
}

var editor = (commandDispatcher.focusedElement instanceof Components.interfaces.nsIDOMNSEditableElement) ?
              commandDispatcher.focusedElement.editor : null;

var selection = editor ? editor.selection : commandDispatcher.focusedWindow.getSelection();
if(!
selection.toString()) return;

div = content.document.createElement("div");
div.id = "keyconfig_div";
div.setAttribute("style","position:fixed; top:100px; left:300px; background:white; color:black; border: 3px solid black; padding: 5px");
div.innerHTML = '<p>intitle:"'+selection+'"</p>';
content.document.body.appendChild(div);

selection.removeAllRanges();
content.getSelection().selectAllChildren(div);
commandDispatcher.focusedElement = div;

var e = content.document.createEvent("MouseEvents");
e.initMouseEvent("contextmenu", true, false, content, 0, 300, 300, 0, 0, false, false, false, false, 0, null);
div.dispatchEvent(e);  
ekbworldwide wrote:What's a good place at forums.mozillazine.org (or elsewhere) to ask this question "Could somebody make a hack for SearchIt so it works on text areas and input fields"?
You could add to the end of Profile/extensions/{2e7fb9bc-45cb-406c-97f1-41d84848083f}/content/overlay.js the following

Code: Select all

 eval("window.getBrowserSelection ="+getBrowserSelection.toSource().replace(
 'if (selection)',
 'if (!selection && document.commandDispatcher.focusedElement instanceof Components.interfaces.nsIDOMNSEditableElement) \
   selection = document.commandDispatcher.focusedElement.editor.selection.toString(); \
  if (selection)'
));  
which should fix bug 360331

dubsey wrote:The problem though is that the Space (which is the space bar) is NOT SHOWING making it look odd

[...]

Please fix this for a next version or lemme know [-o<
On my list of things to consider. Note that keyconfig displays it currently in the same way as Firefox would in the menu.

ekbworldwide wrote:The screen shot you posted is from "functions for keyconfig".
Hu? "functions for keyconfig" only provides additional shortcuts intended to be edited with keyconfig.
vsub
Posts: 733
Joined: October 2nd, 2009, 2:20 pm

Re: keyconfig 20080929

Post by vsub »

dorando wrote:
ballyhairs wrote:[...] the other one to open addons in tab "which I wished it did" but it didn't work
This can be caused by NewTabURL which you seem to have installed. Try

Code: Select all

if(content.location == "chrome://mozapps/content/extensions/extensions.xul")
 gBrowser.removeCurrentTab();
else
 gBrowser.selectedTab = gBrowser.addTab("chrome://mozapps/content/extensions/extensions.xul"); 


Is there is a way to have that function(to open the add-ons in tab not in separate window)without installing add-on(add the code to some existing add-on(how) or modify FF itself.

Maybe I can add the code to userChrome.css(what exactly do I need to write there)

Never mind,I just tried "chrome://mozapps/content/extensions/extensions.xul" in the address bar and that was all that I wanted :)
vsub
Posts: 733
Joined: October 2nd, 2009, 2:20 pm

Re: keyconfig 20080929

Post by vsub »

Guess it's not that I really wanted :( I gen an error when I try to update.So the question above still remain
Post Reply