Adding Open Frame in New Tab support. NPODB

This commit is contained in:
dougt%meer.net 2006-04-05 21:50:05 +00:00
parent 8d96cf2bd3
commit d97f547b7b
3 changed files with 126 additions and 97 deletions

View File

@ -863,6 +863,14 @@ function MenuNavPopupShowing () {
}
function isContentFrame(aFocusedWindow)
{
if (!aFocusedWindow)
return false;
return (aFocusedWindow.top == window.content);
}
function BrowserContentAreaPopupShowing () {
var selectedRange=gBrowser.selectedBrowser.contentDocument.getSelection();
@ -899,6 +907,17 @@ function BrowserContentAreaPopupShowing () {
} else {
document.getElementById("link_as_new_tab").hidden=true;
}
/*
* Open Frame in new tab
*/
var frameItem = document.getElementById("open_frame_in_tab");
if (!content || !content.frames.length || !isContentFrame(document.commandDispatcher.focusedWindow))
frameItem.setAttribute("hidden", "true");
else
frameItem.removeAttribute("hidden");
}
/* Bookmarks */
@ -1121,6 +1140,13 @@ function DoToggleSoftwareKeyboard()
catch(ex) { alert(ex); }
}
function OpenFrameInTab()
{
var url = document.popupNode.ownerDocument.location.href;
BrowserOpenURLasTab(url);
}
function DoFullScreen()
{
gFullScreen = !gFullScreen;

View File

@ -1,42 +1,40 @@
<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
<!-- ***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Minimo.
The Initial Developer of the Original Code is
Doug Turner <dougt@meer.net>.
Portions created by the Initial Developer are Copyright (C) 2005
the Initial Developer. All Rights Reserved.
Contributor(s):
Marcio S. Galli, mgalli@geckonnection.com
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK ***** -->
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Minimo.
-
- The Initial Developer of the Original Code is
- Doug Turner <dougt@meer.net>
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Marcio S. Galli <mgalli@geckonnection.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://minimo/skin/minimo.css" type="text/css"?>
@ -76,7 +74,7 @@
<stringbundleset id="stringbundleset">
<stringbundle id="minimo_properties" src="chrome://minimo/locale/minimo.properties"/>
</stringbundleset>
<popupset id="mainPopupSet">
<popup type="autocomplete" id="PopupAutoComplete"/>
</popupset>
@ -85,19 +83,19 @@
<!-- ***** IMPORTANT *****
Everytime you edit these keys, you may also consider
to check/edit the key assignment on minimo.js/MenuHandleMenuEscape
-->
-->
<key id="minimo-key" keycode="VK_F9" oncommand="BrowserMenuSpin()"/>
<key id="minimo-key3" keycode="VK_F10" oncommand="DoToggleSoftwareKeyboard()"/>
</keyset>
<hbox flex="1">
<hbox id="appcontent" flex="100%">
<vbox id="browserleftbar">
<vbox id="homebarcontainer">
</vbox>
<vbox id="homebarcontainer">
</vbox>
</vbox>
<vbox id="browser" context="context" flex="1">
<tabbrowser id="content"
@ -113,14 +111,14 @@
</vbox>
</hbox>
</hbox>
<statusbar id="statusbar" hidden="false">
<statusbar id="statusbar" hidden="false">
<statusbarpanel id="statusbar-text" label="Minimo" flex="1"/>
</statusbar>
<toolbox id="mini-toolbars">
<command id="cmd_BrowserOpenTab" oncommand="BrowserOpenTab()"/>
<command id="cmd_BrowserScreenRotate" oncommand="BrowserScreenRotate()"/>
<command id="cmd_BrowserOpenInfo" oncommand="BrowserOpenInfo()"/>
@ -153,7 +151,7 @@
<command id="cmd_BrowserBookmarkThis" oncommand="BrowserBookmarkThis()" />
<command id="cmd_BrowserHomeBar" oncommand="BrowserHomeBar()" />
<command id="cmd_Pan" oncommand="BrowserPan()" />
<!-- Keyboard Focus Handler Controls -->
<!-- This entire focusnavigation set is not XBLized yet,
Minimo JS code will look into it anyways. -->
@ -192,10 +190,10 @@
onclick="URLBarClickHandler(event, this);">
<!--
<deck onclick="PageProxyClickHandler(event)" id='proxy-deck' >
<image id="urlbar-deck" />
</deck>
-->
<deck onclick="PageProxyClickHandler(event)" id='proxy-deck' >
<image id="urlbar-deck" />
</deck>
-->
<hbox>
<button type="menu" style="-moz-user-focus: none" class="plain" id="feed-button">
@ -204,7 +202,7 @@
<image id="lock-icon" class="security-na" />
</hbox>
</textbox>
<toolbarbutton tabindex="2" accessrule="focus_nav-bar" class="menu-button" id="nav-menu-button" command="cmd_BrowserNavMenu" />
</toolbar>
@ -216,7 +214,7 @@
<popupset>
<popup id="contentAreaContextMenu" onpopupshowing="BrowserContentAreaPopupShowing()">
<!--
<menuitem id="link_as_new_tab" label="&linknewtab.label;" command="cmd_BrowserOpenLinkAsNewTab" hidden="true"/>
@ -225,48 +223,52 @@
-->
<menuitem id="item-call" label="" insertbefore="context-sep-view" oncommand="" hidden="true"/>
<menuitem id="link_as_new_tab" label="&linknewtab.label;" command="cmd_BrowserOpenLinkAsNewTab" hidden="true"/>
<menuitem id="link_as_new_tab" label="&linknewtab.label;" command="cmd_BrowserOpenLinkAsNewTab" hidden="true"/>
<menuitem id="item-copy" label="&contextCopy.label;" oncommand="DoClipCopy()" hidden="true"/>
<menuitem id="item-paste" label="&contextPaste.label;" oncommand="DoClipPaste()" hidden="true"/>
<menuitem id="item-find" label="&findToolbar.label;" command="cmd_ViewFind" />
<menuseparator/>
<menuseparator/>
<menuitem id="open_frame_in_tab"
label="&openFrameInTab.label;"
oncommand="OpenFrameInTab()"
hidden="true"/>
<menuitem id="full_screen"
label="&toggleFullScreen.label;"
oncommand="DoFullScreen()"/>
<menuseparator/>
<menuitem id="item-back" hidden="true" label="&backCmd.label;" command="cmd_BrowserBack" />
<menuitem id="item-forward" hidden="true" label="&forwardCmd.label;" command="cmd_BrowserForward"/>
<menuitem id="item-reload" hidden="false" label="&reloadCmd.label;" command="cmd_BrowserReload"/>
label="&toggleFullScreen.label;"
oncommand="DoFullScreen()"/>
<menuseparator/>
<menuitem id="item-back" hidden="true" label="&backCmd.label;" command="cmd_BrowserBack" />
<menuitem id="item-forward" hidden="true" label="&forwardCmd.label;" command="cmd_BrowserForward"/>
<menuitem id="item-reload" hidden="false" label="&reloadCmd.label;" command="cmd_BrowserReload"/>
</popup>
<popup id="urlbarModeSelector" onpopuphidden="PageProxyHidden()">
<menuitem id="command_ViewDeckSearch"
image="chrome://minimo/skin/extensions/icon-google.png"
class="menuitem-iconic"
label="&decksearch.label;"
command="cmd_ViewDeckSearch"/>
<!--
<menuitem id="command_ViewDeckSB"
image="chrome://minimo/skin/extensions/icon-delicious.png"
class="menuitem-iconic"
label="&decksb.label;"
command="cmd_ViewDeckSB" />
-->
-->
<menuitem id="command_ViewDeckDefault"
image="chrome://minimo/skin/extensions/icon-urlbar.png"
class="menuitem-iconic"
@ -296,18 +298,18 @@
<menupopup id="MenuTabsContainer"
onpopupshown="BrowserMenuTabsActive()"
onpopuphidden="BrowserMenuTabsDestroy()" >
</menupopup>
</menu>
<menuseparator/>
<menuitem id="full_screen"
label="&gotoFullScreen.label;"
oncommand="DoFullScreen()"/>
<!-- this shouldn't be an option on smartphones -->
<!-- this shouldn't be an option on smartphones -->
<menuitem id="snav_toggle"
label=""
oncommand="DoSNavToggle()"/>
@ -315,12 +317,12 @@
<menuitem id="ssr_toggle"
label=""
oncommand="DoSSRToggle()"/>
<menuitem id="togglet_google"
<menuitem id="togglet_google"
label="&togglet_google.label;"
oncommand="DoGoogleToggle()"/>
<menuseparator/>
<menuitem id="textplus"
@ -340,16 +342,16 @@
<menuitem id="command_ViewFind"
command="cmd_ViewFind"
label="&findToolbar.label;" />
<menuitem id="command_ViewHomeBar"
command="cmd_ViewHomebar"
label="&homebarToolbar.label;" />
<!--
<menuitem id="command_ViewDownload"
command="cmd_ViewDownload"
label="&downloadText.label;" />
-->
<!--
<menuitem id="command_ViewDownload"
command="cmd_ViewDownload"
label="&downloadText.label;" />
-->
<menuseparator/>
<menuitem id="command_Quit"
@ -358,12 +360,11 @@
label="&quit.label;" />
</menupopup>
<menupopup id="menu_NavPopup"
onpopuphiding="MenuNavPopupHiding()"
onpopupshown="MenuEnableEscapeKeys()"
onpopuphidden="MenuDisableEscapeKeys()"
>
onpopuphidden="MenuDisableEscapeKeys()">
<menuitem id="command_BrowserBookmark"
command="cmd_BrowserBookmark"
@ -378,7 +379,7 @@
<menuitem id="command_home"
command="cmd_BrowserHome"
label="&homeCmd.label;" />
<!-- class="menuitem-iconic" image="chrome://minimo/skin/back-color.png" -->
<menuitem id="command_back"
command="cmd_BrowserBack"
@ -398,7 +399,7 @@
<menuitem id="command_go"
command="cmd_BrowserGo"
label="&goCmd.label;" />
<menuitem id="command_pan"
command="cmd_Pan"
label="&panCmd.label;" />

View File

@ -25,6 +25,8 @@
<!ENTITY toggleFullScreen.label "Toggle Full Screen">
<!ENTITY toggleSSR.label "Toggle Single Column Mode">
<!ENTITY openFrameInTab.label "View Frame In New Tab">
<!ENTITY textSizePlus.label "Text Size +">
<!ENTITY textSizeMinus.label "Text Size -">