Please Visit: http://ift.tt/1ajReyV
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1j5fTuR
via LifeLong Community
Activate extension via short cut key - Stack Overflow
UPDATE (5/24/2013): You can use the new (Link->http://ift.tt/1uDoZII) API, which provides built-in framework support for keyboard commands.
Original answer follows:
Step 1: Use a content script (Link->http://ift.tt/1j5fTuJ) to bind a keypress listener to every page.
// in the content script, listen for Crtl+Shift+E (upper or lowercase)
document.documentElement.addEventListener("keypress", function(event) {
if((e.keyCode == 69 || e.keyCode == 101) && e.ctrlKey && e.shiftKey) {
// do something (step 2, below)
}
}, true);
Step 2: For action outside of the content script, use message passing (Link->http://ift.tt/1j5fVTs) to notify the background page that the shortcut key has been pressed and it should perform some action.
Step 3: The background page does some action. It's currently not possible (and will likely desktop notification (Link->http://ift.tt/1uDoZIM) , open a new tab, or do a lot of other things.http://ift.tt/1j5fVTw
http://ift.tt/1uDp13f
UPDATE (5/24/2013): You can use the new (Link->http://ift.tt/1uDoZII) API, which provides built-in framework support for keyboard commands.
Original answer follows:
Step 1: Use a content script (Link->http://ift.tt/1j5fTuJ) to bind a keypress listener to every page.
// in the content script, listen for Crtl+Shift+E (upper or lowercase)
document.documentElement.addEventListener("keypress", function(event) {
if((e.keyCode == 69 || e.keyCode == 101) && e.ctrlKey && e.shiftKey) {
// do something (step 2, below)
}
}, true);
Step 2: For action outside of the content script, use message passing (Link->http://ift.tt/1j5fVTs) to notify the background page that the shortcut key has been pressed and it should perform some action.
Step 3: The background page does some action. It's currently not possible (and will likely desktop notification (Link->http://ift.tt/1uDoZIM) , open a new tab, or do a lot of other things.http://ift.tt/1j5fVTw
http://ift.tt/1uDp13f
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1j5fTuR
via LifeLong Community
No comments:
Post a Comment