diff --git a/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul b/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul index 304c2cc9f59..3deaab7c552 100644 --- a/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul +++ b/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul @@ -14,10 +14,6 @@ if (panel != undefined) { switch(panel) { - case "chrome://communicator/content/pref/pref-scripts.xul": - _elementIDs.push("javascriptAllowMailNews"); - _elementIDs.push("pluginAllowMailNews"); - break; case "chrome://communicator/content/pref/pref-appearance.xul": _elementIDs.push("generalStartupMail"); _elementIDs.push("generalStartupAddressBook"); @@ -27,19 +23,29 @@ ]]> + + + + + insertafter="javascriptAllowNavigator" + label="&enbJsCheckMailNews.label;" + accesskey="&enbJsCheckMailNews.accesskey;" + preference="javascript.allow.mailnews"/> - + diff --git a/suite/common/pref/pref-scripts.js b/suite/common/pref/pref-scripts.js index a495a70f4e4..f6e27da3c5a 100644 --- a/suite/common/pref/pref-scripts.js +++ b/suite/common/pref/pref-scripts.js @@ -40,14 +40,13 @@ function setDisableState(id, state) { var component = document.getElementById(id); - var prefString = component.getAttribute("prefstring"); - var isLocked = parent.hPrefWindow.getPrefIsLocked(prefString); + var preference = component.getAttribute("preference"); + var isLocked = document.getElementById(preference).locked; component.disabled = isLocked || state; } -function changeDisabledState(state){ +function changeDisabledState(state) { //Set the states of the groupbox children state based on the "javascript enabled" checkbox value - setDisableState("allowScripts", state); setDisableState("allowWindowMoveResize", state); setDisableState("allowImageSrcChange", state); setDisableState("allowWindowStatusChange", state); @@ -56,26 +55,19 @@ function changeDisabledState(state){ setDisableState("allowContextmenuDisable", state); } -function javascriptEnabledChange(){ - // if javascriptAllowMailNews is overlayed (mailnews is installed), then if javascriptAllowMailnews - // and javascriptAllowNavigator are unchecked, we disable the tree items. - // If javascriptAllowMailNews is not available, we only take javascriptAllowNavigator in consideration +function javascriptEnabledChange() { + // If javascript.allow.mailnews is overlayed (mailnews is installed), + // then if javascript.allow.mailnews and javascript.enabled are false, + // we disable the tree items. If javascript.allow.mailnews is not + // available, we only take javascript.enabled in consideration. - if (document.getElementById('javascriptAllowMailNews')){ - if (!document.getElementById('javascriptAllowNavigator').checked && !document.getElementById('javascriptAllowMailNews').checked) - changeDisabledState(true); - else changeDisabledState(false); - } else { - changeDisabledState(!document.getElementById('javascriptAllowNavigator').checked); - } + var javascriptDisabled = !document.getElementById('javascript.enabled').value; + var javascriptAllowMailNews = document.getElementById('javascript.allow.mailnews'); + if (javascriptDisabled && javascriptAllowMailNews) + javascriptDisabled = !javascriptAllowMailNews.value; + changeDisabledState(javascriptDisabled); } -function Startup(){ - //If we don't have a checkbox under groupbox pluginPreferences, we should hide it - var pluginGroup = document.getElementById("pluginPreferences"); - var children = pluginGroup.childNodes; - if (!children || children.length <= 1) // 1 for the caption - pluginGroup.setAttribute("hidden", "true"); - +function Startup() { javascriptEnabledChange(); } diff --git a/suite/common/pref/pref-scripts.xul b/suite/common/pref/pref-scripts.xul index 40be3c1a3e5..87a19b61024 100644 --- a/suite/common/pref/pref-scripts.xul +++ b/suite/common/pref/pref-scripts.xul @@ -37,62 +37,78 @@ - + - - + + - - + + + + + + + + + - - - - - + + + + + + diff --git a/suite/common/pref/preferences.xul b/suite/common/pref/preferences.xul index fbf60b79a4c..13b3bb951db 100644 --- a/suite/common/pref/preferences.xul +++ b/suite/common/pref/preferences.xul @@ -169,8 +169,11 @@ label="&advance.label;" url="chrome://communicator/content/pref/pref-advanced.xul"> - + +