Implement CTRL+enter www/com completion in the URL bar.
This commit is contained in:
@@ -768,10 +768,15 @@ function BrowserLoadURL(aTriggeringEvent)
|
|||||||
if (url.match(/^view-source:/)) {
|
if (url.match(/^view-source:/)) {
|
||||||
BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null, null);
|
BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null, null);
|
||||||
} else {
|
} else {
|
||||||
|
if (aTriggeringEvent && 'ctrlKey' in aTriggeringEvent &&
|
||||||
|
aTriggeringEvent.ctrlKey)
|
||||||
|
// Tack www. and .com on.
|
||||||
|
url = gURLBar.value = "www." + url + ".com";
|
||||||
|
|
||||||
if (gPrefService && gPrefService.getBoolPref("browser.tabs.opentabfor.urlbar") &&
|
if (gPrefService && gPrefService.getBoolPref("browser.tabs.opentabfor.urlbar") &&
|
||||||
getBrowser().localName == "tabbrowser" &&
|
getBrowser().localName == "tabbrowser" &&
|
||||||
aTriggeringEvent && 'ctrlKey' in aTriggeringEvent &&
|
aTriggeringEvent && 'shiftKey' in aTriggeringEvent &&
|
||||||
aTriggeringEvent.ctrlKey) {
|
aTriggeringEvent.shiftKey) {
|
||||||
var t = getBrowser().addTab(getShortcutOrURI(url)); // open link in new tab
|
var t = getBrowser().addTab(getShortcutOrURI(url)); // open link in new tab
|
||||||
getBrowser().selectedTab = t;
|
getBrowser().selectedTab = t;
|
||||||
}
|
}
|
||||||
@@ -4138,7 +4143,7 @@ function openNewTabOrWindow(event, href, linkNode)
|
|||||||
if (gPrefService && gPrefService.getBoolPref("browser.tabs.opentabfor.middleclick") &&
|
if (gPrefService && gPrefService.getBoolPref("browser.tabs.opentabfor.middleclick") &&
|
||||||
("getBrowser" in window) && getBrowser().localName == "tabbrowser") {
|
("getBrowser" in window) && getBrowser().localName == "tabbrowser") {
|
||||||
var loadInBackground = gPrefService.getBoolPref("browser.tabs.loadInBackground");
|
var loadInBackground = gPrefService.getBoolPref("browser.tabs.loadInBackground");
|
||||||
if (event.shiftKey)
|
if (event.ctrlKey)
|
||||||
loadInBackground = !loadInBackground;
|
loadInBackground = !loadInBackground;
|
||||||
var theTab = getBrowser().addTab(href, getReferrer(document));
|
var theTab = getBrowser().addTab(href, getReferrer(document));
|
||||||
if (!loadInBackground)
|
if (!loadInBackground)
|
||||||
@@ -4173,19 +4178,11 @@ function handleLinkClick(event, href, linkNode)
|
|||||||
{
|
{
|
||||||
switch (event.button) {
|
switch (event.button) {
|
||||||
case 0: // if left button clicked
|
case 0: // if left button clicked
|
||||||
if (event.metaKey || event.ctrlKey) { // and meta or ctrl are down
|
if (event.metaKey || event.shiftKey) { // and meta or shift are down
|
||||||
if (openNewTabOrWindow(event, href, linkNode))
|
if (openNewTabOrWindow(event, href, linkNode))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var saveModifier = true;
|
var saveModifier = event.altKey;
|
||||||
if (gPrefService) {
|
|
||||||
try {
|
|
||||||
saveModifier = gPrefService.getBoolPref("ui.key.saveLink.shift");
|
|
||||||
}
|
|
||||||
catch(ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
saveModifier = saveModifier ? event.shiftKey : event.altKey;
|
|
||||||
|
|
||||||
if (saveModifier) { // if saveModifier is down
|
if (saveModifier) { // if saveModifier is down
|
||||||
saveURL(href, linkNode ? gatherTextUnder(linkNode) : "");
|
saveURL(href, linkNode ? gatherTextUnder(linkNode) : "");
|
||||||
@@ -4211,8 +4208,8 @@ function middleMousePaste( event )
|
|||||||
if (!url)
|
if (!url)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// On ctrl-middleclick, open in new window or tab.
|
// On shift-middleclick, open in new window or tab.
|
||||||
if (event.ctrlKey)
|
if (event.shiftKey)
|
||||||
return openNewTabOrWindow(event, url, null);
|
return openNewTabOrWindow(event, url, null);
|
||||||
|
|
||||||
// If ctrl wasn't down, then just load the url in the current win/tab.
|
// If ctrl wasn't down, then just load the url in the current win/tab.
|
||||||
|
|||||||
@@ -1607,8 +1607,8 @@ var BookmarksUtils = {
|
|||||||
var button = aEvent.type == "command" || aEvent.type == "keypress"? 0:aEvent.button;
|
var button = aEvent.type == "command" || aEvent.type == "keypress"? 0:aEvent.button;
|
||||||
if (button == 2)
|
if (button == 2)
|
||||||
return "";
|
return "";
|
||||||
if (aEvent.metaKey || aEvent.ctrlKey || button == 1)
|
if (aEvent.metaKey || aEvent.shiftKey || button == 1)
|
||||||
if (aEvent.shiftKey)
|
if (aEvent.ctrlKey)
|
||||||
return "window";
|
return "window";
|
||||||
else
|
else
|
||||||
return "tab";
|
return "tab";
|
||||||
|
|||||||
@@ -105,12 +105,12 @@
|
|||||||
<tree id="historyTree" flex="1" class="plain"
|
<tree id="historyTree" flex="1" class="plain"
|
||||||
context="historyMenu" persist="ref"
|
context="historyMenu" persist="ref"
|
||||||
datasources="rdf:history" ref="NC:HistoryByDate" flags="dont-build-content"
|
datasources="rdf:history" ref="NC:HistoryByDate" flags="dont-build-content"
|
||||||
onkeypress="if (event.keyCode == 13) OpenURL(event.ctrlKey || event.metaKey);"
|
onkeypress="if (event.keyCode == 13) OpenURL(event.shiftKey || event.metaKey);"
|
||||||
onselect="this.treeBoxObject.view.selectionChanged();
|
onselect="this.treeBoxObject.view.selectionChanged();
|
||||||
historyOnSelect();"
|
historyOnSelect();"
|
||||||
hidecolumnpicker="true"
|
hidecolumnpicker="true"
|
||||||
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, historyDNDObserver);"
|
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, historyDNDObserver);"
|
||||||
ondblclick="if (validClickConditions(event)) OpenURL(event.ctrlKey || event.metaKey);">
|
ondblclick="if (validClickConditions(event)) OpenURL(event.shiftKey || event.metaKey);">
|
||||||
<template>
|
<template>
|
||||||
<rule>
|
<rule>
|
||||||
<treechildren>
|
<treechildren>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!ENTITY autoHide.label "Hide the tab bar when only one tab is open">
|
<!ENTITY autoHide.label "Hide the tab bar when only one tab is open">
|
||||||
<!ENTITY background.label "Load links in the background">
|
<!ENTITY background.label "Load links in the background">
|
||||||
<!ENTITY openTabs.label "Open tabs instead of windows for">
|
<!ENTITY openTabs.label "Open tabs instead of windows for">
|
||||||
<!ENTITY middleClick.label "Middle-click or control-click of links in a Web page">
|
<!ENTITY middleClick.label "Middle-click or shift-click of links in a Web page">
|
||||||
<!ENTITY urlbar.label "Control+Enter in the Location bar">
|
<!ENTITY urlbar.label "Shift+Enter in the Location bar">
|
||||||
<!ENTITY openFolder.label "When opening a bookmark folder in tabs">
|
<!ENTITY openFolder.label "When opening a bookmark folder in tabs">
|
||||||
<!ENTITY openFolderReplace.label "Replace the current set of tabs">
|
<!ENTITY openFolderReplace.label "Replace the current set of tabs">
|
||||||
|
|||||||
Reference in New Issue
Block a user