Pressing Esc while urlbar has focus should revert url to that of page and select contents of urlbar (47863, patch by doronr@naboonline.com). r=bz sr=alecf

This commit is contained in:
blakeross%telocity.com 2001-04-18 03:50:15 +00:00
Родитель 334ce6620e
Коммит 94b6354336
3 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -1190,5 +1190,26 @@ function ShowAndSelectContentsOfURLBar()
else
gURLBar.focus();
}
// If "ESC" is pressed in the url bar, we replace the urlbar's value with the url of the page
// and highlight it, unless it is about:blank, where we reset it to "".
function resetURLBar()
{
var url = _content.location.href;
var throbberElement = document.getElementById("navigator-throbber");
if (!throbberElement.getAttribute("busy")){
if (url != "about:blank"){
gURLBar.value = url;
gURLBar.select();
} else { //if about:blank, urlbar becomes ""
gURLBar.value = "";
}
}
}
function handleURLBarKeyPress(event)
{
if (event.keyCode == KeyEvent.DOM_VK_RETURN) { addToUrlbarHistory(); BrowserLoadURL(); }
else if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) { resetURLBar(); }
}

Просмотреть файл

@ -151,6 +151,7 @@ Contributor(s): ______________________________________. -->
searchSessionType="urlbar" id="urlbar" tooltip="aTooltip" tooltiptext="&locationBar.tooltip;"
onclick="if (event.button == 0) URLBarLeftClickHandler(event);"
onblur="URLBarBlurHandler(event);"
onkeypress="handleURLBarKeyPress(event);" flex="1"/>
onkeypress="if (event.keyCode == 13) { addToUrlbarHistory(); BrowserLoadURL(); }" flex="1"/>
</hbox>
<menubutton class="menubutton-icon" id="ubhist">

Просмотреть файл

@ -329,6 +329,7 @@ var homeButtonObserver = {
onDragExit: function (aEvent, aDragSession)
{
var statusTextFld = document.getElementById("statusbar-display");
statusTextFld.label = "";
},