clean up.

This commit is contained in:
dougt%meer.net 2006-01-12 19:53:26 +00:00
parent 21ca39c740
commit d537e13ffa
4 changed files with 79 additions and 47 deletions

View File

@ -117,7 +117,12 @@ nsBrowserStatusHandler.prototype =
catch(e) {}
document.getElementById("statusbar").hidden=false;
// document.getElementById("menu_NavPopup").
if(aRequest && aWebProgress.DOMWindow == content) {
this.startDocumentLoad(aRequest);
}
@ -568,10 +573,10 @@ function BrowserOpenTab()
} catch (e) {
alert(e);
}
// if (gURLBar) setTimeout(function() { gURLBar.focus(); }, 0);
// if (gURLBar) setTimeout(function() { gURLBar.focus(); }, 0);
}
/*
* Used by the Context Menu - Open link as Tab
*/
@ -684,46 +689,56 @@ function BrowserResetZoomMinus() {
}
/*
We want to intercept before it shows,
to evaluate when the selected content area is a phone number,
thus mutate the popup menu to the right make call item
*/
function MenuMainPopupShowing () {
try {
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(nsCI.nsIPrefBranch);
if (pref.getBoolPref("snav.enabled"))
{
document.getElementById("snav_toggle").label = "Enable arrow key scrolling";
}
else
{
document.getElementById("snav_toggle").label = "Enable jump to links";
}
function BrowserPopupShowing () {
/*
* Open Link as New Tab
*/
if(document.commandDispatcher.focusedElement && document.commandDispatcher.focusedElement.href) {
gFocusedElementHREFContextMenu=document.commandDispatcher.focusedElement.href;
document.getElementById("link_as_new_tab").hidden=false;
document.getElementById("item-backbutton").hidden=true;
document.getElementById("item-forwardbutton").hidden=true;
document.getElementById("item-reloadbutton").hidden=true;
} else {
document.getElementById("link_as_new_tab").hidden=true;
document.getElementById("item-backbutton").hidden=false;
document.getElementById("item-forwardbutton").hidden=false;
document.getElementById("item-reloadbutton").hidden=false;
if (pref.getBoolPref("ssr.enabled"))
{
document.getElementById("ssr_toggle").label = "Desktop layout";
}
else
{
document.getElementById("ssr_toggle").label = "Single column layout";
}
}
catch(ex) { alert(ex); }
}
function MenuNavPopupShowing () {
/*
command_back
command_forward
command_go
command_reload
command_stop
*/
}
function BrowserContentAreaPopupShowing () {
var selectedRange=gBrowser.selectedBrowser.contentDocument.getSelection();
/* Enable Copy */
if(selectedRange.toString()) {
document.getElementById("item-copy").style.display="block";
document.getElementById("item-copy").disabled=false;
} else {
document.getElementById("item-copy").style.display="none";
document.getElementById("item-copy").disabled=true;
}
/* Enable Paste - Can paste only if the focused element has a value attribute. :)
@ -732,9 +747,9 @@ function BrowserPopupShowing () {
if (document.commandDispatcher.focusedElement) {
if(document.commandDispatcher.focusedElement.nodeName=="INPUT"||document.commandDispatcher.focusedElement.nodeName=="TEXTAREA") {
if(DoClipCheckPaste()) {
document.getElementById("item-paste").style.display="block";
document.getElementById("item-paste").disabled=false;
} else {
document.getElementById("item-paste").style.display="none";
document.getElementById("item-paste").disabled=true;
}
}
}
@ -754,6 +769,8 @@ function BrowserBookmarkThis() {
storeBookmarks();
refreshBookmarks();
alert("Bookmark Saved.");
}
function BrowserBookmark() {
@ -922,9 +939,6 @@ function DoFullScreen()
}
window.fullScreen = gFullScreen;
document.getElementById("nav-bar-contextual").hidden = !gFullScreen;
}
/*

View File

@ -104,6 +104,7 @@
<toolbox id="mini-toolbars">
<command id="cmd_BrowserOpenTab" oncommand="BrowserOpenTab()"/>
<command id="cmd_BrowserScreenRotate" oncommand="BrowserScreenRotate()"/>
<command id="cmd_BrowserOpenInfo" oncommand="BrowserOpenInfo()"/>
@ -161,6 +162,7 @@
enablehistory="true"
autocompletesearch="history"
completeselectedindex="true"
maxrows="14"
autocompletepopup="PopupAutoComplete"
ontextentered="return URLBarEntered();"
onfocus="URLBarFocusHandler(event, this);"
@ -188,7 +190,7 @@
<!-- place holder for our app popups and hook to the overlay -->
<popupset>
<popup id="contentAreaContextMenu" onpopupshowing="BrowserPopupShowing()">
<popup id="contentAreaContextMenu" onpopupshowing="BrowserContentAreaPopupShowing()">
<menuitem id="full_screen"
label="&toggleFullScreen.label;"
@ -202,6 +204,8 @@
-->
<menuitem id="item-call" label="" insertbefore="context-sep-view" oncommand="" hidden="true"/>
<menuseparator/>
<menuitem id="item-copy" label="Copy" oncommand="DoClipCopy()" />
<menuitem id="item-paste" label="Paste" oncommand="DoClipPaste()"/>
@ -240,31 +244,36 @@
</popup>
<menupopup id="menu_MainPopup">
<menupopup id="menu_MainPopup"
onpopupshowing="MenuMainPopupShowing()" >
<menuitem id="command_BrowserOpenTab"
command="cmd_BrowserOpenTab"
label="&newtab.label;" />
<menu id="command_TabFocus"
label="&tabs.label;" >
<menupopup id="MenuTabsContainer" onpopupshown="BrowserMenuTabsActive()" onpopuphidden="BrowserMenuTabsDestroy()" >
<menupopup id="MenuTabsContainer"
onpopupshown="BrowserMenuTabsActive()"
onpopuphidden="BrowserMenuTabsDestroy()" >
</menupopup>
</menu>
<menuseparator/>
<menuitem id="full_screen"
label="&toggleFullScreen.label;"
label="&gotoFullScreen.label;"
oncommand="DoFullScreen()"/>
<!-- this shouldn't be an option on smartphones -->
<menuitem id="snav_toggle"
label="&toggleSNav.label;"
label=""
oncommand="DoSNavToggle()"/>
<menuitem id="ssr_toggle"
label="&toggleSSR.label;"
label=""
oncommand="DoSSRToggle()"/>
<menuseparator/>

View File

@ -18,7 +18,11 @@
<!ENTITY searchButton.label "Search">
<!ENTITY searchButton.tooltip "Type a word in the field to the left, then click Search">
<!ENTITY toggleSNav.label "Toggle Spatial Navigation">
<!ENTITY toggleSNavOn.label "Navigate via arrow keys">
<!ENTITY toggleSNavOff.label "Scroll via arrow keys">
<!ENTITY gotoFullScreen.label "Full Screen mode">
<!ENTITY toggleFullScreen.label "Toggle Full Screen">
<!ENTITY toggleSSR.label "Toggle Single Column Mode">

View File

@ -149,6 +149,7 @@ nsSSRSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar
if (!strcmp(pref, "ssr.enabled"))
{
prefBranch->GetBoolPref(pref, &mUsingSSR);
return NS_OK;
}
}
@ -156,7 +157,11 @@ nsSSRSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar
if (!strcmp(aTopic, "loading-domain"))
{
if (!mUsingSSR)
{
SetSSREnabled(PR_FALSE);
SetSiteSSREnabled(PR_FALSE);
return NS_OK;
}
const char* domain = NS_ConvertUCS2toUTF8(aData).get();