Updating urlbar to select all on the first click.

This commit is contained in:
dougt%meer.net 2005-12-08 20:07:13 +00:00
Родитель bd4d91f4d4
Коммит 7dbed7255a
2 изменённых файлов: 31 добавлений и 5 удалений

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

@ -41,6 +41,9 @@ const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
var gBookmarksDoc=null;
var gURLBar = null;
var gClickSelectsAll = true;
var gIgnoreFocus = false;
var gIgnoreClick = false;
var gBrowserStatusHandler;
var gSelectedTab=null;
var gFullScreen=false;
@ -239,6 +242,8 @@ function MiniNavStartup()
try {
gURLBar = document.getElementById("urlbar");
gURLBar.setAttribute("completedefaultindex", "true");
var currentTab=getBrowser().selectedTab;
browserInit(currentTab);
gSelectedTab=currentTab;
@ -1076,11 +1081,31 @@ function URLBarEntered()
return true;
}
function URLBarFocusHandler()
function URLBarFocusHandler(aEvent, aElt)
{
if (gIgnoreFocus)
gIgnoreFocus = false;
else if (gClickSelectsAll)
aElt.select();
gURLBar.setAttribute("open", "true");
gURLBar.showHistoryPopup();
}
function URLBarMouseDownHandler(aEvent, aElt)
{
gIgnoreFocus = true;
gIgnoreClick = false;
aElt.setSelectionRange(0, 0);
}
function URLBarClickHandler(aEvent, aElt)
{
if (!gIgnoreClick && aElt.selectionStart == aElt.selectionEnd)
aElt.select();
}
var gRotationDirection = true;
function BrowserScreenRotate()

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

@ -132,15 +132,16 @@
<textbox tabindex="5"
id="urlbar"
flex="100%"
flex="1"
type="autocomplete"
enablehistory="true"
autocompletesearch="history"
completeselectedindex="true"
autocompletepopup="PopupAutoComplete"
onfocus="URLBarFocusHandler();"
ontextentered="return URLBarEntered();">
ontextentered="return URLBarEntered();"
onfocus="URLBarFocusHandler(event, this);"
onmousedown="URLBarMouseDownHandler(event, this);"
onclick="URLBarClickHandler(event, this);">
<deck id='proxy-deck'>
<image id="urlbar-deck" />
</deck>