зеркало из https://github.com/mozilla/pjs.git
prefwindow code tidy-up
This commit is contained in:
Родитель
b69bccb17f
Коммит
c62e0c1f1e
|
@ -81,19 +81,6 @@ nsPrefWindow.prototype =
|
|||
if( window.arguments[1] )
|
||||
this.closeBranches( window.arguments[1] );
|
||||
|
||||
// enable image blocker if "imageblocker.enabled" pref is true
|
||||
try {
|
||||
if (this.pref.GetBoolPref("imageblocker.enabled")) {
|
||||
element = document.getElementById("cookiesCell");
|
||||
valueWithImages = element.getAttribute("valueWithImages");
|
||||
element.setAttribute("value",valueWithImages);
|
||||
}
|
||||
} catch(e) {
|
||||
dump("imageblocker.enabled pref is missing from all.js");
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
onOK:
|
||||
|
@ -270,31 +257,6 @@ nsPrefWindow.prototype =
|
|||
onpageload:
|
||||
function ( aPageTag )
|
||||
{
|
||||
// enable image blocker if "imageblocker.enabled" pref is true
|
||||
try {
|
||||
if (this.pref.GetBoolPref("imageblocker.enabled")) {
|
||||
var element;
|
||||
if (aPageTag.indexOf("pref-cookies") != -1) {
|
||||
element = window.frames[this.contentFrame].document.getElementById("imagesArea");
|
||||
element.setAttribute("style","display: inline;" );
|
||||
element = window.frames[this.contentFrame].document.getElementById("cookieHeader");
|
||||
titleWithImages = element.getAttribute("titleWithImages");
|
||||
element.setAttribute("title",titleWithImages);
|
||||
descriptionWithImages = element.getAttribute("descriptionWithImages");
|
||||
element.setAttribute
|
||||
("description",descriptionWithImages );
|
||||
element = window.frames[this.contentFrame].document.getElementById("cookieWindow");
|
||||
titleWithImages = element.getAttribute("titleWithImages");
|
||||
element.setAttribute("title",titleWithImages);
|
||||
} else if (aPageTag.indexOf("pref-advanced") != -1) {
|
||||
element = window.frames[this.contentFrame].document.getElementById("advancedAlwaysLoadImages");
|
||||
element.setAttribute("style","display: none;" );
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
dump("imageblocker.enabled pref is missing from all.js");
|
||||
}
|
||||
|
||||
if( !this.wsm.dataManager.pageData[aPageTag] )
|
||||
{
|
||||
var prefElements = window.frames[this.contentFrame].document.getElementsByAttribute( "pref", "true" );
|
||||
|
|
|
@ -28,11 +28,22 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
class="color-dialog"
|
||||
align="vertical" title="&window.title;"
|
||||
onload="parent.initPanel('chrome://communicator/content/pref/pref-advanced.xul');">
|
||||
onload="imageBlockingEnabled(); parent.initPanel('chrome://communicator/content/pref/pref-advanced.xul');">
|
||||
|
||||
<script language="JavaScript">
|
||||
<![CDATA[
|
||||
_elementIDs = ["advancedAlwaysLoadImages", "advancedJavaAllow", "javascriptAllowMailNews", "javascriptEnabled", "CSSAllow", "advancedMailFTP"];
|
||||
|
||||
function imageBlockingEnabled()
|
||||
{
|
||||
if( parent.hPrefWindow.getPref( "bool", "imageblocker.enabled" ) )
|
||||
{
|
||||
var element = document.getElementById("advancedAlwaysLoadImages");
|
||||
element.setAttribute("hidden","true");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
|
|
@ -32,14 +32,26 @@
|
|||
<window debug="false" xmlns:html="http://www.w3.org/TR/REC-html40" id="cookieWindow"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
class="color-dialog"
|
||||
align="vertical" title="&window.title;" titleWithImages="&window.titleWithImages;"
|
||||
onload="parent.initPanel('chrome://communicator/content/pref/pref-cookies.xul');">
|
||||
align="vertical"
|
||||
onload="imageBlockingEnabled(); parent.initPanel('chrome://communicator/content/pref/pref-cookies.xul');">
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
||||
_elementIDs = ["networkCookieBehaviour", "networkWarnAboutCookies", "networkImageBehaviour", "networkImageWarnAboutImages"];
|
||||
|
||||
// enable image blocker if "imageblocker.enabled" pref is true
|
||||
function imageBlockingEnabled()
|
||||
{
|
||||
if( parent.hPrefWindow.getPref( "bool", "imageblocker.enabled" ) )
|
||||
{
|
||||
var element = document.getElementById( "imagesArea" );
|
||||
element.removeAttribute("hidden");
|
||||
var cookieHeader = document.getElementById( "cookieHeader" );
|
||||
cookieHeader.setAttribute( "title", cookieHeader.getAttribute( "titleWithImages" ) );
|
||||
}
|
||||
}
|
||||
|
||||
function updateImageFields( aInteger, aBoolean )
|
||||
{
|
||||
var imageBehaviourField = document.getElementById("networkImageBehaviour");
|
||||
|
@ -80,7 +92,7 @@
|
|||
</box>
|
||||
</titledbox>
|
||||
|
||||
<titledbox orient="vertical" id="imagesArea" style="display:none">
|
||||
<titledbox orient="vertical" id="imagesArea" hidden="true">
|
||||
<title><text value="&images;"/></title>
|
||||
|
||||
<html>&imageDetails;</html>
|
||||
|
|
|
@ -15,9 +15,37 @@
|
|||
class="dialog"
|
||||
persist="screenX screenY width height"
|
||||
screenX="24" screenY="24"
|
||||
onload="hPrefWindow = new nsPrefWindow('panelFrame');"
|
||||
onload="Startup();"
|
||||
width="620" height="470">
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
||||
var hPrefWindow = null;
|
||||
|
||||
/** General startup routine for preferences dialog.
|
||||
* Place all necessary modifications to pref tree here.
|
||||
**/
|
||||
function Startup()
|
||||
{
|
||||
hPrefWindow = new nsPrefWindow('panelFrame');
|
||||
|
||||
if( !hPrefWindow )
|
||||
throw "failed to create prefwindow";
|
||||
|
||||
// modify the cookie tree entry if imageblocking is disabled.
|
||||
if( hPrefWindow.getPref( "bool", "imageblocker.enabled" ) )
|
||||
{
|
||||
dump("*** foopy = " + hPrefWindow.getPref( "bool", "imageblocker.enabled" ) + "\n");
|
||||
var element = document.getElementById( "cookiesCell" );
|
||||
element.setAttribute( "value", element.getAttribute( "valueWithImages" ) );
|
||||
}
|
||||
}
|
||||
|
||||
]]>
|
||||
|
||||
</script>
|
||||
|
||||
<script language="javascript" src="chrome://global/content/nsWidgetStateManager.js"></script>
|
||||
<script language="javascript" src="chrome://communicator/content/pref/nsPrefWindow.js"></script>
|
||||
|
||||
|
@ -25,9 +53,9 @@
|
|||
|
||||
<box flex="1">
|
||||
<!-- tree sidebar -->
|
||||
<tree class="inset" id="prefsTree" flex="1"/>
|
||||
<tree class="inset" id="prefsTree" flex="2"/>
|
||||
|
||||
<iframe id="panelFrame" name="panelFrame" style="width:0px" flex="4"/>
|
||||
<iframe id="panelFrame" name="panelFrame" style="width:0px" flex="2"/>
|
||||
<script language="JavaScript">
|
||||
<![CDATA[
|
||||
if( window.arguments && window.arguments[0] ) {
|
||||
|
|
|
@ -92,3 +92,4 @@ function setHomePageToCurrentPage(folderFieldId)
|
|||
}
|
||||
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/pref/prefutilities.properties");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче