зеркало из https://github.com/mozilla/pjs.git
Bug 419865 Port scripts pane to use <preferences> r=Mano,IanN sr=jag a=beltzner
This commit is contained in:
Родитель
fbc9687a30
Коммит
b849e26ab9
|
@ -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 @@
|
|||
]]>
|
||||
</script>
|
||||
|
||||
<preferences id="scripts_preferences">
|
||||
<preference id="javascript.allow.mailnews"
|
||||
name="javascript.allow.mailnews"
|
||||
type="bool"
|
||||
onchange="javascriptEnabledChange();"/>
|
||||
<preference id="mailnews.message_display.allow.plugins"
|
||||
name="mailnews.message_display.allow.plugins"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
<!-- javascript toggle for mail/news -->
|
||||
<groupbox id="javascriptPreferences">
|
||||
<checkbox id="javascriptAllowMailNews"
|
||||
label="&enbJsCheckMailNews.label;" accesskey="&enbJsCheckMailNews.accesskey;"
|
||||
pref="true" preftype="bool" prefstring="javascript.allow.mailnews"
|
||||
prefattribute="checked" oncommand="javascriptEnabledChange();" insertafter="javascriptAllowNavigator"/>
|
||||
insertafter="javascriptAllowNavigator"
|
||||
label="&enbJsCheckMailNews.label;"
|
||||
accesskey="&enbJsCheckMailNews.accesskey;"
|
||||
preference="javascript.allow.mailnews"/>
|
||||
</groupbox>
|
||||
<!-- plugin toggle for mail/news -->
|
||||
<groupbox id="pluginPreferences">
|
||||
<groupbox id="pluginPreferences" hidden="false">
|
||||
<checkbox id="pluginAllowMailNews"
|
||||
label="&enbPluginCheckMailNews.label;" accesskey="&enbPluginCheckMailNews.accesskey;"
|
||||
pref="true" preftype="bool" prefstring="mailnews.message_display.allow.plugins"
|
||||
prefattribute="checked"/>
|
||||
label="&enbPluginCheckMailNews.label;"
|
||||
accesskey="&enbPluginCheckMailNews.accesskey;"
|
||||
preference="mailnews.message_display.allow.plugins"/>
|
||||
</groupbox>
|
||||
|
||||
<!-- mail startup toggle -->
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -37,62 +37,78 @@
|
|||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE page SYSTEM "chrome://communicator/locale/pref/pref-scripts.dtd">
|
||||
<!DOCTYPE overlay SYSTEM "chrome://communicator/locale/pref/pref-scripts.dtd">
|
||||
|
||||
<page id="scriptsAndWindowPanel" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="parent.initPanel('chrome://communicator/content/pref/pref-scripts.xul');"
|
||||
headertitle="&pref.scripts.title;">
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/pref/pref-scripts.js"/>
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
var panel = "chrome://communicator/content/pref/pref-scripts.xul";
|
||||
var _elementIDs = ["javascriptAllowNavigator",
|
||||
"allowWindowMoveResize",
|
||||
"allowWindowFlip",
|
||||
"allowWindowStatusChange",
|
||||
"allowImageSrcChange",
|
||||
"allowContextmenuDisable",
|
||||
"allowHideStatusBar"];
|
||||
]]>
|
||||
</script>
|
||||
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<prefpane id="scripts_pane"
|
||||
label="&pref.scripts.title;"
|
||||
script="chrome://communicator/content/pref/pref-scripts.js">
|
||||
|
||||
<groupbox id="javascriptPreferences" flex="1">
|
||||
<caption label="&enableJavaScript.label;"/>
|
||||
<preferences id="scripts_preferences">
|
||||
<preference id="javascript.enabled"
|
||||
name="javascript.enabled"
|
||||
type="bool"
|
||||
onchange="javascriptEnabledChange();"/>
|
||||
<preference id="dom.disable_window_move_resize"
|
||||
name="dom.disable_window_move_resize"
|
||||
type="bool" inverted="true"/>
|
||||
<preference id="dom.disable_window_flip"
|
||||
name="dom.disable_window_flip"
|
||||
type="bool" inverted="true"/>
|
||||
<preference id="dom.disable_window_open_feature.status"
|
||||
name="dom.disable_window_open_feature.status"
|
||||
type="bool" inverted="true"/>
|
||||
<preference id="dom.disable_window_status_change"
|
||||
name="dom.disable_window_status_change"
|
||||
type="bool" inverted="true"/>
|
||||
<preference id="dom.disable_image_src_set"
|
||||
name="dom.disable_image_src_set"
|
||||
type="bool" inverted="true"/>
|
||||
<preference id="dom.event.contextmenu.enabled"
|
||||
name="dom.event.contextmenu.enabled"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<checkbox id="javascriptAllowNavigator" label="&navigator.label;" accesskey="&navigator.accesskey;"
|
||||
pref="true" preftype="bool" prefstring="javascript.enabled"
|
||||
prefattribute="checked" oncommand="javascriptEnabledChange();"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
<label id="allowScripts" accesskey="&allowScripts.accesskey;" control="AllowList" value="&allowScripts.label;"/>
|
||||
<groupbox id="javascriptPreferences" flex="1">
|
||||
<caption label="&enableJavaScript.label;"/>
|
||||
|
||||
<listbox id="AllowList" flex="1">
|
||||
<listitem type="checkbox" id="allowWindowMoveResize" label="&allowWindowMoveResize.label;"
|
||||
reversed="true" prefstring="dom.disable_window_move_resize"/>
|
||||
<listitem type="checkbox" id="allowWindowFlip" label="&allowWindowFlip.label;"
|
||||
reversed="true" prefstring="dom.disable_window_flip"/>
|
||||
<listitem type="checkbox" id="allowHideStatusBar" label="&allowHideStatusBar.label;"
|
||||
reversed="true" prefstring="dom.disable_window_open_feature.status"/>
|
||||
<listitem type="checkbox" id="allowWindowStatusChange" label="&allowWindowStatusChange.label;"
|
||||
reversed="true" prefstring="dom.disable_window_status_change"/>
|
||||
<listitem type="checkbox" id="allowImageSrcChange" label="&allowWindowImageSrcChange.label;"
|
||||
reversed="true" prefstring="dom.disable_image_src_set"/>
|
||||
<listitem type="checkbox" id="allowContextmenuDisable" label="&allowContextmenuDisable.label;"
|
||||
prefstring="dom.event.contextmenu.enabled"/>
|
||||
</listbox>
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="pluginPreferences">
|
||||
<caption label="&enablePlugin.label;"/>
|
||||
<checkbox id="javascriptAllowNavigator"
|
||||
label="&navigator.label;"
|
||||
accesskey="&navigator.accesskey;"
|
||||
preference="javascript.enabled"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
<!-- mailnews will add its checkbox here using overlay (mailPrefOverlay.xul).
|
||||
The day we add a checkbox for plugins in browser, please do the following:
|
||||
1) make sure that doesn't break the mailnews overlay, we'll probably have to add an
|
||||
insertafter command to insure the proper order of the checkboxes
|
||||
2) remove the js code in pref-scripts.js that hide this groupbox when not checkbox
|
||||
has been defined (function Startup)
|
||||
-->
|
||||
</groupbox>
|
||||
|
||||
</page>
|
||||
<label control="AllowList"
|
||||
value="&allowScripts.label;" accesskey="&allowScripts.accesskey;"/>
|
||||
|
||||
<listbox id="AllowList" flex="1">
|
||||
<listitem type="checkbox" id="allowWindowMoveResize"
|
||||
label="&allowWindowMoveResize.label;"
|
||||
preference="dom.disable_window_move_resize"/>
|
||||
<listitem type="checkbox" id="allowWindowFlip"
|
||||
label="&allowWindowFlip.label;"
|
||||
preference="dom.disable_window_flip"/>
|
||||
<listitem type="checkbox" id="allowHideStatusBar"
|
||||
label="&allowHideStatusBar.label;"
|
||||
preference="dom.disable_window_open_feature.status"/>
|
||||
<listitem type="checkbox" id="allowWindowStatusChange"
|
||||
label="&allowWindowStatusChange.label;"
|
||||
preference="dom.disable_window_status_change"/>
|
||||
<listitem type="checkbox" id="allowImageSrcChange"
|
||||
label="&allowWindowImageSrcChange.label;"
|
||||
preference="dom.disable_image_src_set"/>
|
||||
<listitem type="checkbox" id="allowContextmenuDisable"
|
||||
label="&allowContextmenuDisable.label;"
|
||||
preference="dom.event.contextmenu.enabled"/>
|
||||
</listbox>
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="pluginPreferences" hidden="true">
|
||||
<caption label="&enablePlugin.label;"/>
|
||||
<!-- mailnews will add its checkbox here using overlay (mailPrefOverlay.xul).
|
||||
-->
|
||||
</groupbox>
|
||||
|
||||
</prefpane>
|
||||
</overlay>
|
||||
|
|
|
@ -169,8 +169,11 @@
|
|||
label="&advance.label;"
|
||||
url="chrome://communicator/content/pref/pref-advanced.xul">
|
||||
<treechildren id="advancedChildren">
|
||||
<treeitem label="&scriptsAndWindows.label;"
|
||||
-->
|
||||
<treeitem id="scriptsItem" label="&scriptsAndWindows.label;"
|
||||
prefpane="scripts_pane" helpTopic="advanced_pref_scripts"
|
||||
url="chrome://communicator/content/pref/pref-scripts.xul"/>
|
||||
<!--
|
||||
<treeitem label="&keynav.label;"
|
||||
url="chrome://communicator/content/pref/pref-keynav.xul"/>
|
||||
<treeitem label="&cache.label;"
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
<treechildren id="advancedChildren">
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell url="chrome://communicator/content/pref/pref-scripts.xul" label="&scriptsAndWindows.label;"/>
|
||||
<treecell label="(Migrated: &scriptsAndWindows.label;)"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem>
|
||||
|
|
|
@ -396,7 +396,8 @@
|
|||
else
|
||||
element.setAttribute(attribute, value);
|
||||
}
|
||||
if (aElement.localName == "checkbox")
|
||||
if (aElement.localName == "checkbox" ||
|
||||
aElement.localName == "listitem")
|
||||
setValue(aElement, "checked", val);
|
||||
else if (aElement.localName == "colorpicker")
|
||||
setValue(aElement, "color", val);
|
||||
|
@ -444,7 +445,8 @@
|
|||
return element[attribute];
|
||||
return element.getAttribute(attribute);
|
||||
}
|
||||
if (aElement.localName == "checkbox")
|
||||
if (aElement.localName == "checkbox" ||
|
||||
aElement.localName == "listitem")
|
||||
var value = getValue(aElement, "checked");
|
||||
else if (aElement.localName == "colorpicker")
|
||||
value = getValue(aElement, "color");
|
||||
|
|
Загрузка…
Ссылка в новой задаче