Created javascript shortcut for "Add Selection to Zotero Note"
I have working javascript for adding a keyboard shortcut for the context menu option "Add Selection to Zotero Note." The code executes sucessfully in Execute JS. To work it must be used as you would expect to use the context menu option: text highlighted with zotero pane and current note open. It is below:
var Zotero = Components.classes["@zotero.org/Zotero;1"].getService(Components.interfaces.nsISupports).wrappedJSObject;
var ZoteroPane = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").ZoteroPane;
var focusedWindow = document.commandDispatcher.focusedWindow;
var str = focusedWindow.getSelection().toString();
var uri = "blank";
ZoteroPane.addTextToNote(str, uri)
I would like some help about how to implement the shortcut key. I have tried a bit with pentadactyl and greasemonkey, but it does not seem to work as expected. Any help appreciated.
var Zotero = Components.classes["@zotero.org/Zotero;1"].getService(Components.interfaces.nsISupports).wrappedJSObject;
var ZoteroPane = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").ZoteroPane;
var focusedWindow = document.commandDispatcher.focusedWindow;
var str = focusedWindow.getSelection().toString();
var uri = "blank";
ZoteroPane.addTextToNote(str, uri)
I would like some help about how to implement the shortcut key. I have tried a bit with pentadactyl and greasemonkey, but it does not seem to work as expected. Any help appreciated.
This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.