gecko-dev/xpfe/components/prefwindow/resources/content/pref-smart_browsing.xul

251 lines
8.2 KiB
Plaintext
Raw Normal View History

1999-06-04 23:28:56 +00:00
<?xml version="1.0"?>
1999-08-10 02:48:56 +00:00
<!--
The contents of this file are subject to the Netscape 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/NPL/
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 Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
Blake Ross <blakeross@telocity.com>
1999-08-10 02:48:56 +00:00
-->
1999-06-04 23:28:56 +00:00
2000-04-21 10:13:18 +00:00
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
2000-03-14 11:31:54 +00:00
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
2000-04-25 02:17:38 +00:00
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
<!ENTITY % prefSmartBrowsingDTD SYSTEM "chrome://communicator/locale/pref/pref-smart_browsing.dtd" >
%prefSmartBrowsingDTD;
]>
<window xmlns:html="http://www.w3.org/1999/xhtml"
2000-04-25 02:17:38 +00:00
class="color-dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
2000-04-25 02:17:38 +00:00
title="&title.label;"
orient="vertical"
onload="parent.initPanel('chrome://communicator/content/pref/pref-smart_browsing.xul');">
<script language="Javascript" src="chrome://global/content/strres.js" />
2000-04-25 02:17:38 +00:00
<script language="JavaScript">
<![CDATA[
var _elementIDs = ["browserRelatedDisabledForDomains", "addDomain", "browserGoBrowsingEnabled", "browserAutoCompleteEnabled"];
2000-04-25 02:17:38 +00:00
function Startup()
{
// populate tree
var domainPrefField = document.getElementById( "browserRelatedDisabledForDomains" );
var domains = domainPrefField.getAttribute("value").split(",");
if( domains[0] != "" )
{
for( var i = 0; i < domains.length; i++ )
createCell( domains[i] );
}
// select the first item
selectFirstCell();
// enable buttons
doButtonEnabling();
}
function selectFirstCell()
{
var domainKids = document.getElementById( "disabledKids" );
if( domainKids.childNodes.length >= 1 ) {
var domainTree = document.getElementById( "disabledDomains" );
domainTree.selectItem( domainKids.firstChild );
}
}
function addDomain()
{
var domainField = document.getElementById( "addDomain" );
if( domainField.value != "" ) {
var domainTree = document.getElementById( "disabledDomains" );
domainTree.selectItem( createCell( domainField.value ) );
rebuildPrefValue();
domainField.value = "";
doButtonEnabling();
}
}
function removeDomain()
{
var domainTree = document.getElementById( "disabledDomains" );
var treeKids = document.getElementById( "disabledKids" );
var selectedItems = domainTree.selectedItems;
if( selectedItems.length >= 1 )
{
for( var i = 0; i < selectedItems.length; i++ )
{
treeKids.removeChild( selectedItems[i] );
}
}
selectFirstCell();
rebuildPrefValue();
}
function rebuildPrefValue()
{
var treeKids = document.getElementById( "disabledKids" );
var string = "";
if( treeKids.hasChildNodes() )
{
for( var i = 0; i < treeKids.childNodes.length; i++ )
{
var domain = treeKids.childNodes[i].firstChild.firstChild.getAttribute("value");
string += ( domain + "," );
}
}
var domainPrefField = document.getElementById( "browserRelatedDisabledForDomains" );
domainPrefField.setAttribute("value",string);
}
function createCell( aValue )
{
var treeKids = document.getElementById( "disabledKids" );
var item = document.createElement( "treeitem" );
var row = document.createElement( "treerow" );
var cell = document.createElement( "treecell" );
cell.setAttribute( "value", aValue );
row.appendChild( cell );
item.appendChild( row );
treeKids.appendChild( item );
return item;
}
function treeHandleEvent( aEvent )
{
if( aEvent.keyCode == 46 )
2000-04-25 02:17:38 +00:00
removeDomain();
}
function doButtonEnabling()
{
var addDomain = document.getElementById("addDomain");
var prefstring = document.getElementById("browserRelatedDisabledForDomains").getAttribute("value");
if( addDomain.value == "" || prefstring.indexOf( addDomain.value + "," ) != -1 )
document.getElementById("addDomainButton").setAttribute("disabled","true");
else
document.getElementById("addDomainButton").removeAttribute("disabled");
}
1999-06-04 23:28:56 +00:00
function moreInfo()
{
var browserURL = null;
var bundle = srGetStrBundle("chrome://global-region/locale/region.properties");
if (bundle)
var smartBrowsingURL = bundle.GetStringFromName("smartBrowsingURL");
if (smartBrowsingURL) {
try {
var prefs = Components.classes["@mozilla.org/preferences;1"];
if (prefs) {
prefs = prefs.getService();
if (prefs)
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
if (prefs) {
var url = prefs.CopyCharPref("browser.chromeURL");
if (url)
browserURL = url;
}
} catch(e) {
}
if (browserURL == null)
browserURL = "chrome://navigator/content/navigator.xul";
window.openDialog( browserURL, "_blank", "chrome,all,dialog=no", smartBrowsingURL );
}
}
2000-04-25 02:17:38 +00:00
]]>
</script>
<box class="box-smallheader" title="&lHeader;"/>
2000-04-25 02:17:38 +00:00
<titledbox orient="vertical">
<title><text value="&whatsRelated.label;"/></title>
2000-04-25 02:17:38 +00:00
<html id="doNotAcceptText">&doNotDecp.label;</html>
<grid flex="1">
<columns>
<column flex="1"/>
<column/>
</columns>
<rows>
<row>
<tree class="inset" id="disabledDomains" multiple="true" onkeyup="treeHandleEvent(event)" style="height: 100px;" flex="1">
<treecolgroup>
<treecol flex="1"/>
</treecolgroup>
<treechildren id="disabledKids" flex="1"/>
2000-04-25 02:17:38 +00:00
</tree>
<box autostretch="never" valign="top">
<button class="dialog" id="removeDomain" value="&removeDomain.label;" accesskey="&removeDomain.accesskey;"
oncommand="removeDomain();"/>
</box>
</row>
<row>
<box autostretch="never">
<text class="label" id="domainText" value="&domain.label;" accesskey="&domain.accesskey;" for="addDomain"/>
<textfield id="addDomain" flex="1" oninput="doButtonEnabling();"/>
2000-04-25 02:17:38 +00:00
</box>
<button disabled="true" class="dialog" id="addDomainButton" value="&addDomain.label;" accesskey="&addDomain.accesskey;"
oncommand="addDomain();"/>
</row>
</rows>
</grid>
<data id="browserRelatedDisabledForDomains" pref="true" preftype="string"
prefstring="browser.related.disabledForDomains" prefattribute="value" wsm_attributes="value"/>
2000-04-25 02:17:38 +00:00
</titledbox>
<titledbox orient="vertical">
<title><text value="&internetKeywordsHeader.label;"/></title>
<html>&internetKeywordsDescription.label;</html>
<box autostretch="never">
<checkbox id="browserGoBrowsingEnabled" value="&keywordsEnabled.label;" accesskey="&keywordsEnabled.accesskey;"
pref="true" preftype="bool" prefstring="keyword.enabled"
prefattribute="checked"/>
<spring flex="1"/>
<button class="dialog" value="&moreInformation.label;" accesskey="&moreInformation.accesskey;" oncommand="moreInfo();"/>
2000-04-25 02:17:38 +00:00
</box>
</titledbox>
<titledbox orient="vertical">
<title><text value="&autoCompleteHeader.label;"/></title>
<html>&autoCompleteDescription.label;</html>
<box autostretch="never">
<checkbox id="browserAutoCompleteEnabled" value="&autoCompleteEnabled.label;" accesskey="&autoCompleteEnabled.accesskey;"
pref="true" preftype="bool" prefstring="browser.urlbar.autocomplete.enabled"
prefattribute="checked"/>
<spring flex="1"/>
</box>
</titledbox>
2000-02-14 01:42:09 +00:00
</window>