Keyconfig shortcut key Customization

Source: Internet
Author: User

Reprinted from http://apps.hi.baidu.com/share/detail/17546269

1. Close the tab on the left:

Code:

Var tab = gBrowser. mCurrentTab. boxObject. previussibling;
If (tab) gBrowser. removeTab (tab );

2. Close the tab on the right:

Code

Var tab = gBrowser. mCurrentTab. boxObject. nextSibling;
If (tab) gBrowser. removeTab (tab );

3. Copy the current tab:

Code

Var oldHistory = gBrowser. webNavigation. sessionHistory;
GBrowser. selectedTab = gBrowser. addTab ("about: blank ");
Var newHistory = gBrowser. webNavigation. sessionHistory;
NewHistory. QueryInterface (Components. interfaces. nsISHistoryInternal );

For (var I = 0; I <oldHistory. count; I ++) {newHistory. addEntry (oldHistory. getEntryAtIndex (I, false), true );}

If (oldHistory. count) gBrowser. webNavigation. gotoIndex (oldHistory. index );

4. The next tab (the same as ctrl + pagedown ):

Code

GBrowser. mTabContainer. advanceSelectedTab (1, true );

5. The previous tab (the same as ctrl + pageup ):

Code

GBrowser. mTabContainer. advanceSelectedTab (-1, true );

6. Reload other tabs:

Code

Var browsers = gBrowser. browsers;
Var I = 0;
Var l = browsers. length;
Var x = gBrowser. mCurrentTab. _ tPos;

For (; I <l; I ++)
If (I! = X) try {browsers [I]. reload ();} catch (err ){};

7. Reload all tabs:

Code

GBrowser. reloadAllTabs ();

8. Reload all tabs on the left:

Code

Var browsers = gBrowser. browsers;
Var I = gBrowser. mCurrentTab. _ tPos-1;
Var l =-1;

For (; I> l; I --)
Try {browsers [I]. reload () ;} catch (err ){};

9. Reload all tabs on the right:

Code

Var browsers = gBrowser. browsers;
Var I = gBrowser. mCurrentTab. _ tPos + 1;
Var l = browsers. length;

For (; I <l; I ++)
Try {browsers [I]. reload () ;} catch (err ){};

10. Go to the leftmost tab:

Code

GBrowser. selectedTab = gBrowser. mTabContainer. firstChild;

11. Locate the rightmost tab:

Code

GBrowser. selectedTab =
GBrowser. tabContainer. childNodes [gBrowser. tabContainer. childNodes. length-1];

12. Close other tabs:

Code

GBrowser. removeAllTabsBut (gBrowser. mCurrentTab );

13. Close all tabs:

Code

GBrowser. removeAllTabsBut (gBrowser. mCurrentTab );
GBrowser. removeCurrentTab ();

14. Locate the left adjacent tab (do not loop ):

Code

GBrowser. mTabContainer. advanceSelectedTab (-1 );

15. Locate the right adjacent tab (do not loop ):

Code

GBrowser. mTabContainer. advanceSelectedTab (1 );

16. Create a new tab on the right of the current tab:

Code

Var x = gBrowser. mCurrentTab. _ tPos + 1;
GBrowser. moveTabTo (gBrowser. selectedTab = gBrowser. addTab ("about: blank"), x );

17. After highlighting the keywords, create a tab and search in the background (search engine in the current search bar, the same below ):

Code

BrowserSearch. loadSearch (getBrowserSelection (), true );

18. Create a tab for foreground search:

Code

GBrowser. mPrefs. setBoolPref ("browser. tabs. loadInBackground", false );
BrowserSearch. loadSearch (getBrowserSelection (), true );
GBrowser. mPrefs. setBoolPref ("browser. tabs. loadInBackground", true );

19. Search on the current tab:

Code

BrowserSearch. loadSearch (getBrowserSelection (), false );

20. Open about: config in the new window:

Code

ToOpenWindowByType ('pref: pref', 'about: config ');

21. bookmarks Manager dialog box:

Code

ToOpenWindowByType ('bookmarks: Manager ',
'Chrome: // browser/content/bookmarks/bookmarksManager. xul ');

22. Tool-option dialog box:

Code

OpenPreferences ();

23. Additional Software Dialog Box:

Code

ToOpenWindowByType ('add-ons: Manager ',
'Chrome: // your apps/content/extensions. xul ');

24. The scrapbook extension "Edit before obtaining" command:

Code

If (sbPageEditor. TOOLBAR. hidden |
Document. getElementById ("ScrapBookToolbox"). hidden ){
SbPageEditor. init ();
} Else {
SbPageEditor. exit (true );
}

25. Display/hide Bookmarks Toolbar:

Code

Const bmToolbar = document. getElementById ("PersonalToolbar ");
BmToolbar. collapsed =! BmToolbar. collapsed;

26. Display/hide the menu bar:

Code

Var mb = document. getElementById ("toolbar-menubar ");
Mb. collapsed =! Mb. collapsed;

27. scroll to the right of the page:

Code

GoDoCommand ('COMMAND _ scrollright ');

28. scroll to the left of the page:

Code

GoDoCommand ('COMMAND _ scrollleft ');

29. Scroll up the page:

Code

GoDoCommand ('COMMAND _ scrolllineup ');

30. Scroll down the page:

Code

GoDoCommand ('cmd_scrolllinedown ');

31. Flip down (the same as space ):

Code

GoDoCommand ('cmd_scrollpagedown ');

32. Page up (same as shift + space ):

Code

GoDoCommand ('cmd_scrollpageup ');

33. Back to the top (same as home ):

Code

GoDoCommand ('COMMAND _ scrollTop ');

34. Return to the end of the page (same as end ):

Code

GoDoCommand ('COMMAND _ scrollBottom ');

35. Close all running Firefox programs:

Code

GoQuitApplication ();

36. Copy the title of the current tab:

Code

Components. classes ["@ mozilla.org/widget/clipboardhelper1_1"]
. GetService (Components. interfaces. nsIClipboardHelper)
.CopyString(content.doc ument. title );

37. Open the webpage on the current tab:

Code

GBrowser. loadURI ('HTTP: // www.google.com /');

38. Open the webpage on the new tab: (it can also be used to open about: config. Great !)

Code

Var myUrl = "http://www.baidu.com ";
Var ff = document. getElementById ("content ");
Var tab = ff. addTab (myUrl );
Ff. selectedTab = tab;

39. Open the bookmarklets in the current tag with the defined bookmarks keyword (useful for running bookmarklets ):

Code

If (window. loadURI) loadURI (getShortcutOrURI ('fill In the keyword you defined ',{}));

40. Save the enter key once, similar to paste and go:

Code

Var url = readFromClipboard (); if (url) content. location = url;

41. Follow up on the next link (provided by Sprill of the Forum. Thank you. The same below .) :

Code

Var document = content.doc ument;
Var links = document. links;
For (I = 0; I <links. length; I ++ ){
If (links [I]. text = 'Next upload') | (links [I]. text = 'Next page ')
| (Links [I]. text = 'Next page> ') | (links [I]. text = 'Next page »')
| (Links [I]. text = 'Next page> ') | (links [I]. text =' [Next Page] ') |
(Links [I]. text = 'Next Page]') | (links [I]. text = 'Next') |
(Links [I]. text = 'Next') | (links [I]. text = '›') | (links [I]. text
= '>') Document. location = links [I]. href;
}

42. Tracking the previous link:

Code

Var document = content.doc ument;
Var links = document. links;
For (I = 0; I <links. length; I ++ ){
If (links [I]. text = 'previous upload') | (links [I]. text = 'previous page ')
| (Links [I]. text = '<Previous Page') | (links [I]. text = '« Previous Page ')
| (Links [I]. text = '<Previous Page') | (links [I]. text = '[Previous Page]') |
(Links [I]. text = 'Previous Page]') | (links [I]. text = 'previous ') |
(Links [I]. text = 'prev') | (links [I]. text = 'previous ') |
(Links [I]. text = 'prev') | (links [I]. text = 'qu Yun ') | (links [I]. text
= '<') Document. location = links [I]. href;
}

PS: Supplement

Close the current tag and locate the tag on the left:

Code

Var tab = gBrowser. mCurrentTab; if (tab. previussibling)
GBrowser. mTabContainer. selectedIndex --;
GBrowser. removeTab (tab );

Close the current tag and locate the tag on the right:

Code

Var tab = gBrowser. mCurrentTab; if (tab. nextSibling)
GBrowser. mTabContainer. selectedIndex ++;
GBrowser. removeTab (tab );

Another one, like paste and go, opens the url in the clipboard in the background of the new tab. I like it very much. The original code has expired. I tried to modify it and it will work.

Code

Var url = readFromClipboard (); if (url) content. location = gBrowser. addTab (url );

Use Google background search for highlighted keywords

Code

Var ss = Cc ["@ mozilla.org/browser/search-service1_1"]. getService (Ci. nsIBrowserSearchService );
Var submission = ss. defaultEngine. getSubmission (getBrowserSelection (), null );
GBrowser. loadOneTab (submission. uri. spec, null, null, submission. postData, true, false );

Highlighted keywords Google front-end search:

Code

Var ss = Cc ["@ mozilla.org/browser/search-service1_1"]. getService (Ci. nsIBrowserSearchService );
Var submission = ss. defaultEngine. getSubmission (getBrowserSelection (), null );
GBrowser. loadOneTab (submission. uri. spec, null, null, submission. postData, false, false );

The front-end of the new tab is displayed:

Code

Var paste = readFromClipboard ();
If (! Paste) return;
GBrowser. selectedTab = gBrowser. addTab (paste );

Undo the close tab:
CODE
GBrowser. undoRemoveTab ();

Quick Return

Code

If (gBrowser. sessionHistory. index> 0)
GBrowser. gotoIndex (0 );

Fast forward

Code

Var nav = gBrowser. webNavigation;
Var hist = nav. sessionHistory;
Nav. gotoIndex (hist. count-1 );

Script for tracking next link
Nextpage:

Code

Var document = content.doc ument;
Var links = document. links;
For (I = 0; I <links. length; I ++ ){
If (/^ ([^ \ d ^ \ w.] * (next page | next) [^ \ d ^ \ w] * | \ s * (» |> + | › +) \ s *) $/I. test (links [I]. text ))
Document. location = links [I]. href;
}

Prevpage:

Code

Var document = content.doc ument;
Var links = document. links;
For (I = 0; I <links. length; I ++ ){
If (/^ ([^ \ d ^ \ w.] * (previous | previous Page | previous | prev) [^ \ d ^ \ w] * | \ s * («| <+ | second +) \ s *) $/I. test (links [I]. text ))
Document. location = links [I]. href;
}

Copy the current page URL:
Code
Var
GClipboardHelper = Components. classes ["@ mozilla.org/widget/clipboardhelper1_1"]. getService (Components. interfaces. nsIClipboardHelper );
GClipboardHelper. copyString (window. _ content. location. href );

On/Off search bar

Code

gFindBar.hidden ? gFindBar.onFindCommand() : gFindBar.close();

Use the hotkey to restart ff3 and resume the tabs before restart.

Code

const nsIAppStartup = Components.interfaces.nsIAppStartup;

// Every y all windows that an application quit has been requested.
Var OS = Components. classes ["@ mozilla.org/observer-service1_1"]
. GetService (Components. interfaces. nsIObserverService );
Var cancelQuit = Components. classes ["@ mozilla.org/supports-prbool1_1"]
. CreateInstance (Components. interfaces. nsISupportsPRBool );
OS. policyobservers (cancelQuit, "quit-application-requested", null );

// Something aborted the quit process.
If (cancelQuit. data)
Return;

// Every y all windows that an application quit has been granted.
OS. policyobservers (null, "quit-application-granted", null );

// Enumerate all windows and call shutdown handlers
Var wm = Components. classes ["@ maid"]
. GetService (Components. interfaces. nsIWindowMediator );
Var windows = wm. getEnumerator (null );
While (windows. hasMoreElements ()){
Var win = windows. getNext ();
If ("tryToClose" in win )&&! Win. tryToClose ())
Return;
}
Components. classes ["@ mozilla.org/toolkit/app-startup00001"]. getService (nsIAppStartup)
. Quit (nsIAppStartup. eRestart | nsIAppStartup. eAttemptQuit );

Open configuration folder

Code

Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsILocalFile).launch();

Copy the URL of a tab

Code

var
gClipboardHelper=Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
gClipboardHelper.copyString(window._content.location.href);

Copy the tab title

Code

Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyString(content.document.title);

Copy the tab title and url in the format of "title"-"URL ")

Code

Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyString(content.document.title + " - " + content.location);

On/Off menu bar

Code

var toolbar = document.getElementById("toolbar-menubar");
toolbar.collapsed = !toolbar.collapsed;
document.persist(toolbar.id, "collapsed");

On/Off navigation bar

Code

var toolbar = document.getElementById("nav-bar");
toolbar.collapsed = !toolbar.collapsed;
document.persist(toolbar.id, "collapsed");

On/Off the Bookmarks Toolbar

Code

var toolbar = document.getElementById("PersonalToolbar");
toolbar.collapsed = !toolbar.collapsed;
document.persist(toolbar.id, "collapsed");

Or

goToggleToolbar('PersonalToolbar','');

On/Off label bar

Code

function tbtoggle (thisBTN)
{thisBTN.checked = !thisBTN.checked;
if ( thisBTN.checked )
{gBrowser.setStripVisibilityTo(false);
gBrowser.mPrefs.setBoolPref("browser.tabs.forceHide", true);}
else
{gBrowser.setStripVisibilityTo(true);
gBrowser.mPrefs.setBoolPref("browser.tabs.forceHide", false);}}
tbtoggle(this);

On/Off Google Toolbar

Code

goToggleToolbar('gtbToolbar','toggle_taskbar');

On/Off Status Bar

Code

goToggleToolbar('status-bar','toggle_taskbar');

Copy the link address when you place the cursor over the link

Code

if(XULBrowserWindow.overLink)
Components.classes["@mozilla.org/widget/clipboardhelper;1"].
getService(Components.interfaces.nsIClipboardHelper).copyString(XULBrowserWindow.

overLink);

Copy link text-link address

Code

if(XULBrowserWindow.overLink)
for (var i = 0, links = content.document.links, l = links.length ; i < l; i++)
if(links[i].href == XULBrowserWindow.overLink) {
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyString(links[i].text + " - " + links[i].href);

Break;
}

Enable/disable google talk for the online version on the sidebar

Code

var sidebar_box = document.getElementById('sidebar-box');
if(sidebar_box.hidden) {openWebPanel("Google Talk","http://talkgadget.google.com/talkgadget/popout");}
else {toggleSidebar();}

Knowledge Accumulation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.