зеркало из https://github.com/mozilla/gecko-dev.git
149812 - remove what's related domain blocking UI. r=bryner sr=ben
This commit is contained in:
Родитель
0742d58397
Коммит
edb3d6ae4b
|
@ -21,120 +21,6 @@
|
|||
* Diego Biurrun <diego@biurrun.de>
|
||||
*/
|
||||
|
||||
function Startup()
|
||||
{
|
||||
// populate listbox
|
||||
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 domainList = document.getElementById( "disabledDomains" );
|
||||
if (domainList.childNodes.length >= 1) {
|
||||
domainList.selectItem( domainList.firstChild );
|
||||
}
|
||||
}
|
||||
|
||||
function addDomain()
|
||||
{
|
||||
var domainField = document.getElementById( "addDomain" );
|
||||
if (domainField.value != "") {
|
||||
var domainList = document.getElementById( "disabledDomains" );
|
||||
domainList.selectItem( createCell( domainField.value ) );
|
||||
rebuildPrefValue();
|
||||
domainField.value = "";
|
||||
doButtonEnabling();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function removeDomain()
|
||||
{
|
||||
var domainList = document.getElementById( "disabledDomains" );
|
||||
var selectedItems = domainList.selectedItems;
|
||||
if (selectedItems.length >= 1)
|
||||
{
|
||||
for (var i = 0; i < selectedItems.length; i++)
|
||||
{
|
||||
domainList.removeChild( selectedItems[i] );
|
||||
}
|
||||
}
|
||||
selectFirstCell();
|
||||
rebuildPrefValue();
|
||||
toggleRemoveButton();
|
||||
}
|
||||
|
||||
function rebuildPrefValue()
|
||||
{
|
||||
var domainList = document.getElementById( "disabledDomains" );
|
||||
var string = "";
|
||||
if (domainList.hasChildNodes())
|
||||
{
|
||||
for (var i = 0; i < domainList.childNodes.length; i++)
|
||||
{
|
||||
var domain = domainList.childNodes[i].getAttribute("label");
|
||||
string += ( domain + "," );
|
||||
}
|
||||
}
|
||||
var domainPrefField = document.getElementById( "browserRelatedDisabledForDomains" );
|
||||
domainPrefField.setAttribute("value",string);
|
||||
}
|
||||
|
||||
function createCell( aLabel )
|
||||
{
|
||||
var domainList = document.getElementById( "disabledDomains" );
|
||||
var item = document.createElement( "listitem" );
|
||||
item.setAttribute( "label", aLabel );
|
||||
domainList.appendChild( item );
|
||||
return item;
|
||||
}
|
||||
|
||||
function listboxHandleEvent( aEvent )
|
||||
{
|
||||
if (aEvent.keyCode == 46)
|
||||
removeDomain();
|
||||
}
|
||||
|
||||
function doButtonEnabling()
|
||||
{
|
||||
var addDomain = document.getElementById("addDomain");
|
||||
var addDomainButton = document.getElementById("addDomainButton");
|
||||
var prefstring = document.getElementById("browserRelatedDisabledForDomains").getAttribute("value");
|
||||
if( addDomain.value == "" || prefstring.indexOf( addDomain.value + "," ) != -1 )
|
||||
addDomainButton.disabled = true;
|
||||
else
|
||||
addDomainButton.removeAttribute("disabled");
|
||||
if (parent.hPrefWindow.getPrefIsLocked(addDomainButton.getAttribute("prefstring")))
|
||||
addDomainButton.disabled = true;
|
||||
if (parent.hPrefWindow.getPrefIsLocked(addDomain.getAttribute("prefstring")))
|
||||
addDomain.disabled = true;
|
||||
|
||||
toggleRemoveButton();
|
||||
toggleAutoCompleteAdvancedButton();
|
||||
}
|
||||
|
||||
function toggleRemoveButton()
|
||||
{
|
||||
var domainList = document.getElementById("disabledDomains");
|
||||
var removeButton = document.getElementById("removeDomain");
|
||||
if (domainList.childNodes.length == 0)
|
||||
removeButton.disabled = true;
|
||||
else
|
||||
removeButton.disabled = false;
|
||||
}
|
||||
|
||||
function moreInfo()
|
||||
{
|
||||
var browserURL = null;
|
||||
|
|
|
@ -45,54 +45,13 @@
|
|||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
|
||||
var _elementIDs = ["browserRelatedDisabledForDomains", "addDomain",
|
||||
"browserGoBrowsingEnabled", "browserAutoCompleteEnabled",
|
||||
var _elementIDs = ["browserGoBrowsingEnabled", "browserAutoCompleteEnabled",
|
||||
"browserUrlbarAutoFill", "browserUrlbarShowPopup", "browserUrlbarShowSearch",
|
||||
"browserUrlbarMatchOnlyTyped"];
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<groupbox flex="1">
|
||||
<caption label="&whatsRelated.label;"/>
|
||||
|
||||
<description id="doNotAcceptText">&doNotDecp.label;</description>
|
||||
<separator class="thin"/>
|
||||
<grid flex="1">
|
||||
<columns>
|
||||
<column flex="5"/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<hbox align="center">
|
||||
<label id="domainText" value="&domain.label;" accesskey="&domain.accesskey;" control="addDomain"/>
|
||||
<textbox id="addDomain" flex="1" oninput="doButtonEnabling();" preftype="bool"
|
||||
prefstring="pref.browser.smartbrowsing.disable_textbox.add" prefattribute="disabled"/>
|
||||
</hbox>
|
||||
<vbox align="center">
|
||||
<button disabled="true" id="addDomainButton" label="&addDomain.label;" accesskey="&addDomain.accesskey;"
|
||||
oncommand="addDomain();" prefstring="pref.browser.smartbrowsing.disable_button.add"/>
|
||||
</vbox>
|
||||
</row>
|
||||
<separator class="thin"/>
|
||||
<row flex="1">
|
||||
<listbox id="disabledDomains" seltype="multiple"
|
||||
onkeyup="listboxHandleEvent(event)" style="height: 0px; width: 0px;" flex="1"/>
|
||||
<vbox align="center">
|
||||
<button id="removeDomain" label="&removeDomain.label;"
|
||||
accesskey="&removeDomain.accesskey;" disabled="true"
|
||||
oncommand="removeDomain();" prefstring="pref.browser.smartbrowsing.disable_button.remove"/>
|
||||
</vbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
<data id="browserRelatedDisabledForDomains" preftype="string"
|
||||
prefstring="browser.related.disabledForDomains" prefattribute="value" wsm_attributes="value"/>
|
||||
|
||||
</groupbox>
|
||||
|
||||
<groupbox>
|
||||
<caption label="&internetKeywordsHeader.label;"/>
|
||||
|
||||
|
|
|
@ -3,22 +3,6 @@
|
|||
<!--LOCALIZATION NOTE : FILE The SmartBrowsing prefs dialog -->
|
||||
<!ENTITY lHeader "Smart Browsing">
|
||||
|
||||
<!--LOCALIZATION NOTE (lHeader): Translate "What's Related" according to Netscape glossary -->
|
||||
<!ENTITY whatsRelated.label "What's Related Sidebar Tab">
|
||||
|
||||
<!ENTITY whatsRelatedEnabled.label "Enable What's Related">
|
||||
<!ENTITY whatsRelatedEnabled.accesskey "e">
|
||||
<!--LOCALIZATION NOTE (autoDecp.label): Translate "What's Related" according to Netscape glossary -->
|
||||
<!ENTITY autoDecp.label "Automatically load What's Related information as I browse">
|
||||
<!--LOCALIZATION NOTE (doNotDecp.label): Translate "What's Related" according to Netscape glossary -->
|
||||
<!ENTITY doNotDecp.label "Do not request What's Related information for the following domains:">
|
||||
<!ENTITY removeDomain.label "Remove">
|
||||
<!ENTITY removeDomain.accesskey "r">
|
||||
<!ENTITY addDomain.label "Add">
|
||||
<!ENTITY addDomain.accesskey "a">
|
||||
<!ENTITY domain.label "Domain:">
|
||||
<!ENTITY domain.accesskey "d">
|
||||
|
||||
<!--LOCALIZATION NOTE (internetKeywordsHeader.label): DONT_TRANSLATE -->
|
||||
<!ENTITY internetKeywordsHeader.label "Internet Keywords">
|
||||
<!ENTITY internetKeywordsDescription.label "&brandShortName; Internet Keywords enables fast access to services such as stock quotes, search and other information from the Location bar.">
|
||||
|
|
Загрузка…
Ссылка в новой задаче