Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

David R. MacIver http://unenterprise.blogspot.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Chickenfoot shortcut script

Here's a little script to get Chickenfoot to add some keyboard shortcuts to firefox.

Add this to run as a trigger on window open and you'll be able to acquire focus on the current chickenfoot editor window by pressing 'alt-C' and to regain focus on the main tab (which is something I've often wanted to be able to do) with 'alt-D'

   1  
   2  // attach keyboard shortcut (Alt-C)
   3  chromeWindow.addEventListener("keypress",
   4     function(event) {
   5       if (event.altKey && event.charCode == 'c'.charCodeAt(0)) {
   6         event.preventDefault();
   7         var sidebar = Chickenfoot.getSidebarWindow(chromeWindow);
   8         if (sidebar) {
   9            sidebar.getSelectedBuffer().focus();
  10         }
  11       }
  12      },
  13      true);
  14  
  15  
  16  // attach keyboard shortcut (Alt-D)
  17  chromeWindow.addEventListener("keypress",
  18     function(event) {
  19       if (event.altKey && event.charCode == 'd'.charCodeAt(0)) {
  20         event.preventDefault();
  21  	   tab.focus();
  22         }
  23      },
  24      false);
  25  
  26  
  27  
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS