зеркало из https://github.com/mozilla/pjs.git
Redesigned open web location dialog (bug 23950) r=ben@netscape.com
This commit is contained in:
Родитель
456974e94c
Коммит
942233d3e1
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s): Michael Lowe <michael.lowe@bigfoot.com>
|
||||
*/
|
||||
|
||||
var browser;
|
||||
|
@ -27,24 +27,36 @@ var dialog;
|
|||
function onLoad() {
|
||||
dialog = new Object;
|
||||
dialog.input = document.getElementById( "dialog.input" );
|
||||
dialog.ok = document.getElementById( "ok" );
|
||||
dialog.help = document.getElementById( "dialog.help" );
|
||||
dialog.topWindow = document.getElementById( "dialog.topWindow" );
|
||||
dialog.topWindowDiv = document.getElementById( "dialog.topWindowDiv" );
|
||||
dialog.newWindow = document.getElementById( "dialog.newWindow" );
|
||||
dialog.newWindowDiv = document.getElementById( "dialog.newWindowDiv" );
|
||||
dialog.editNewWindow = document.getElementById( "dialog.editNewWindow" );
|
||||
dialog.open = document.getElementById("ok");
|
||||
dialog.openWhereBox = document.getElementById( "dialog.openWhereBox" );
|
||||
|
||||
|
||||
browser = window.arguments[0];
|
||||
|
||||
if ( !browser ) {
|
||||
dump( "No browser instance provided!\n" );
|
||||
dialog.newWindow.checked = true;
|
||||
dialog.newWindow.disabled = true;
|
||||
// window.close();
|
||||
// return;
|
||||
}
|
||||
dialog.topWindowDiv.setAttribute("style","display:none;");
|
||||
var pNode = dialog.newWindowDiv.parentNode;
|
||||
pNode.removeChild(dialog.newWindowDiv);
|
||||
pNode.appendChild(dialog.newWindowDiv);
|
||||
|
||||
dialog.editNewWindow.checked = true;
|
||||
} else {
|
||||
dialog.topWindow.checked = true;
|
||||
}
|
||||
doSetOKCancel(open, 0, 0, 0);
|
||||
|
||||
moveToAlertPosition();
|
||||
/* Give input field the focus. */
|
||||
dialog.input.focus();
|
||||
|
||||
// change OK to load
|
||||
dialog.open.setAttribute("value", document.getElementById("openLabel").getAttribute("value"));
|
||||
}
|
||||
|
||||
function onTyping( key ) {
|
||||
|
@ -53,32 +65,55 @@ function onTyping( key ) {
|
|||
// Check for valid input.
|
||||
if ( dialog.input.value == "" ) {
|
||||
// No input, disable ok button if enabled.
|
||||
if ( !dialog.ok.disabled ) {
|
||||
dialog.ok.setAttribute( "disabled", "" );
|
||||
if ( !dialog.open.disabled ) {
|
||||
dialog.open.setAttribute( "disabled", "" );
|
||||
}
|
||||
} else {
|
||||
// Input, enable ok button if disabled.
|
||||
if ( dialog.ok.disabled ) {
|
||||
dialog.ok.removeAttribute( "disabled" );
|
||||
if ( dialog.open.disabled ) {
|
||||
dialog.open.removeAttribute( "disabled" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function open() {
|
||||
if ( dialog.ok.disabled || dialog.input.value == "" ) {
|
||||
if ( dialog.open.disabled || dialog.input.value == "" ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var url = dialog.input.value;
|
||||
|
||||
if ( !dialog.newWindow.checked ) {
|
||||
if ( dialog.topWindow.checked ) {
|
||||
/* Load url in opener. */
|
||||
browser.loadUrl( url );
|
||||
} else {
|
||||
|
||||
} else if ( dialog.newWindow.checked ) {
|
||||
/* User wants new window. */
|
||||
window.opener.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "all,dialog=no", url );
|
||||
}
|
||||
window.opener.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "all,dialog=no", url );
|
||||
|
||||
} else if ( dialog.editNewWindow.checked ) {
|
||||
window.openDialog( "chrome://editor/content", "_blank", "chrome,all,dialog=no", url );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function createInstance( progid, iidName ) {
|
||||
var iid = eval( "Components.interfaces." + iidName );
|
||||
return Components.classes[ progid ].createInstance( iid );
|
||||
}
|
||||
|
||||
function onChooseFile() {
|
||||
// Get filespecwithui component.
|
||||
var fileSpec = createInstance( "component://netscape/filespecwithui", "nsIFileSpecWithUI" );
|
||||
try {
|
||||
fileSpec.parentWindow = window;
|
||||
var url = fileSpec.chooseFile( document.getElementById("chooseFileTitle").getAttribute("value") );
|
||||
fileSpec.parentWindow = null;
|
||||
dialog.input.value = fileSpec.nativePath;
|
||||
}
|
||||
catch( exception ) {
|
||||
// Just a cancel, probably.
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ Communications Corporation. Portions created by Netscape are
|
|||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): ______________________________________. -->
|
||||
Contributor(s): Michael Lowe <michael.lowe@bigfoot.com> -->
|
||||
|
||||
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
|
||||
|
||||
|
@ -38,35 +38,60 @@ Contributor(s): ______________________________________. -->
|
|||
<html:script language="javascript" src="openLocation.js"/>
|
||||
|
||||
<keyset id="keyset"/>
|
||||
|
||||
|
||||
<box align="horizontal" style="width: 36em; height: 100%;">
|
||||
|
||||
<box align="vertical" style="width: 43em; margin:1em;">
|
||||
|
||||
<html:div style="width: 45px; margin: 5px;">
|
||||
<html:img src="chrome://global/skin/question-icon.gif" width="32" height="32" border="0"/>
|
||||
</html:div>
|
||||
|
||||
<box align="vertical" flex="100%">
|
||||
|
||||
<box align="vertical" style="margin-bottom: 1em;">
|
||||
<html:div flex="100%">
|
||||
&enter.label;
|
||||
</html:div>
|
||||
</box>
|
||||
|
||||
<box align="horizontal" flex="100%">
|
||||
<html:input id="dialog.input" flex="100%" onkeyup="onTyping(event.which)"/>
|
||||
</box>
|
||||
|
||||
<box align="horizontal" flex="100%" style="margin-bottom: 1em; width: 100%;">
|
||||
<html:input type="checkbox" id="dialog.newWindow"/>
|
||||
<html:label for="dialog.newWindow">&openWin.label;</html:label>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
<html:label>
|
||||
&enter.label;
|
||||
</html:label>
|
||||
|
||||
<box id="okCancelButtons"/>
|
||||
</box>
|
||||
<html:label style="margin-left: 1em;" >
|
||||
&example.label;
|
||||
<html:i>
|
||||
&exampleURL.label;
|
||||
</html:i>
|
||||
</html:label>
|
||||
|
||||
<html:input style="margin-left: 1em;" id="dialog.input" type="text" flex="100%" onkeyup="onTyping(event.which)"/>
|
||||
|
||||
<html:div style="margin-top: 0.5em; margin-left: 2em; margin-bottom: 1em;" >
|
||||
<titledbutton class="dialog push" value="&chooseFile.label;" align="left" onclick="onChooseFile()"/>
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:div class="separator" align="horizontal" />
|
||||
</html:div>
|
||||
|
||||
<box align="horizontal" style="margin-top: 1em;" >
|
||||
<html:div>
|
||||
<html:label>&openWhere.label;</html:label>
|
||||
</html:div>
|
||||
|
||||
<box align="vertical" id="dialog.openWhereBox">
|
||||
<html:div id="dialog.topWindowDiv">
|
||||
<html:input type="radio" name="openWhereRadio" id="dialog.topWindow"/>
|
||||
<html:label for="dialog.topWindow">&topWindow.label;</html:label>
|
||||
</html:div>
|
||||
<html:div id="dialog.newWindowDiv">
|
||||
<html:input type="radio" name="openWhereRadio" id="dialog.newWindow"/>
|
||||
<html:label for="dialog.newWindow">&newWindow.label;</html:label>
|
||||
</html:div>
|
||||
<html:div id="dialog.editNewWindowDiv">
|
||||
<html:input type="radio" name="openWhereRadio" id="dialog.editNewWindow"/>
|
||||
<html:label for="dialog.editNewWindow">&editNewWindow.label;</html:label>
|
||||
</html:div>
|
||||
</box>
|
||||
|
||||
<spring flex="100%"/>
|
||||
|
||||
<html:div>
|
||||
<box id="okCancelButtons"/>
|
||||
</html:div>
|
||||
|
||||
</box>
|
||||
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<foo style="display:none;" id="openLabel" value="&open.label;"/>
|
||||
<foo style="display:none;" id="chooseFileTitle" value="&chooseFileTitle.label;"/>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
<!-- extracted from content/openLocation.xul -->
|
||||
|
||||
<!ENTITY enter.label "Enter the Web location (URL) you would like to open">
|
||||
<!ENTITY enter.label "Enter the web location (URL), or choose the file, you would like to open:">
|
||||
<!ENTITY chooseFile.label "Choose File...">
|
||||
<!ENTITY openWin.label "Open in new window">
|
||||
<!ENTITY ok.label "OK">
|
||||
<!ENTITY chooseFileTitle.label "Choose File">
|
||||
<!ENTITY newWindow.label "New Navigator">
|
||||
<!ENTITY topWindow.label "Current Navigator">
|
||||
<!ENTITY editNewWindow.label "New Composer">
|
||||
<!ENTITY open.label "Open">
|
||||
<!ENTITY cancel.label "Cancel">
|
||||
<!ENTITY caption.label "Open Web Location">
|
||||
<!ENTITY openWhere.label "Open in which window:">
|
||||
<!ENTITY example.label "Example: ">
|
||||
<!ENTITY exampleURL.label "www.mozilla.org">
|
||||
|
|
Загрузка…
Ссылка в новой задаче