mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Big UI cleanup for XUL 1.0 compliance, b=93732, r=syd,brade; sr=sfraser
This commit is contained in:
parent
c9bd4e9d1f
commit
03583963c2
@ -182,7 +182,7 @@
|
||||
<toolbarbutton id="linkButton"/>
|
||||
<toolbarbutton id="namedAnchorButton"/>
|
||||
<spacer flex="1"/>
|
||||
<hbox id="throbber-box" autostretch="never">
|
||||
<hbox id="throbber-box" align="center">
|
||||
<button id="navigator-throbber" oncommand="goClickThrobber('editor.throbber.url')" tooltip="aTooltip" tooltiptext="&throbber.tooltip;">
|
||||
<observes element="Editor:Throbber" attribute="busy"/>
|
||||
</button>
|
||||
@ -190,7 +190,7 @@
|
||||
</toolbar>
|
||||
<toolbar id="FormatToolbar" persist="collapsed" tbalign="center" grippytooltip="aTooltip" grippytooltiptext="&formatToolbar.tooltip;">
|
||||
<!-- We need this else menulists get stretched -->
|
||||
<hbox autostretch="never">
|
||||
<hbox align="center">
|
||||
<!-- from editorOverlay -->
|
||||
<menulist id="ParagraphSelect"/>
|
||||
<stack id="ColorButtons"/>
|
||||
@ -252,7 +252,7 @@
|
||||
</vbox>
|
||||
</deck>
|
||||
|
||||
<hbox id="EditModeToolbar" hidden="false" autostretch="never" valign="middle" persist="collapsed">
|
||||
<hbox id="EditModeToolbar" align="center" hidden="false" persist="collapsed">
|
||||
<tabs id="EditModeTabs" class="tabs-bottom" flex="1">
|
||||
<tab id="NormalModeButton"/>
|
||||
<tab id="TagModeButton"/>
|
||||
|
@ -727,7 +727,7 @@
|
||||
</menupopup>
|
||||
</menulist>
|
||||
|
||||
<stack id="ColorButtons" autostretch="never">
|
||||
<stack id="ColorButtons" align="center">
|
||||
<observes element="cmd_fontColor" attribute="state" onbroadcast="onFontColorChange()"/>
|
||||
<observes element="cmd_backgroundColor" attribute="state" onbroadcast="onBackgroundColorChange()"/>
|
||||
<text class="color-button" id="BackgroundColorButton"
|
||||
|
@ -35,26 +35,22 @@ var dialog;
|
||||
|
||||
function Startup()
|
||||
{
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
return false;
|
||||
|
||||
dialog.ColorPreview = document.getElementById("ColorPreview");
|
||||
dialog.NormalText = document.getElementById("NormalText");
|
||||
dialog.LinkText = document.getElementById("LinkText");
|
||||
dialog.ActiveLinkText = document.getElementById("ActiveLinkText");
|
||||
dialog.VisitedLinkText = document.getElementById("VisitedLinkText");
|
||||
dialog.DefaultColorsRadio = document.getElementById("DefaultColorsRadio");
|
||||
dialog.CustomColorsRadio = document.getElementById("CustomColorsRadio");
|
||||
dialog.BackgroundImageInput = document.getElementById("BackgroundImageInput");
|
||||
gDialog.ColorPreview = document.getElementById("ColorPreview");
|
||||
gDialog.NormalText = document.getElementById("NormalText");
|
||||
gDialog.LinkText = document.getElementById("LinkText");
|
||||
gDialog.ActiveLinkText = document.getElementById("ActiveLinkText");
|
||||
gDialog.VisitedLinkText = document.getElementById("VisitedLinkText");
|
||||
gDialog.DefaultColorsRadio = document.getElementById("DefaultColorsRadio");
|
||||
gDialog.CustomColorsRadio = document.getElementById("CustomColorsRadio");
|
||||
gDialog.BackgroundImageInput = document.getElementById("BackgroundImageInput");
|
||||
|
||||
// The data elements that hold the pref values
|
||||
dialog.NormalData = document.getElementById("textData");
|
||||
dialog.LinkData = document.getElementById("linkData");
|
||||
dialog.ActiveLinkData = document.getElementById("aLinkData");
|
||||
dialog.VisitedLinkData = document.getElementById("fLinkData");
|
||||
dialog.BackgroundColorData = document.getElementById("backgroundColorData");
|
||||
dialog.BackgroundImageData = document.getElementById("backgroundImageData");
|
||||
gDialog.NormalData = document.getElementById("textData");
|
||||
gDialog.LinkData = document.getElementById("linkData");
|
||||
gDialog.ActiveLinkData = document.getElementById("aLinkData");
|
||||
gDialog.VisitedLinkData = document.getElementById("fLinkData");
|
||||
gDialog.BackgroundColorData = document.getElementById("backgroundColorData");
|
||||
gDialog.BackgroundImageData = document.getElementById("backgroundImageData");
|
||||
|
||||
browserColors = GetDefaultBrowserColors();
|
||||
|
||||
@ -67,14 +63,14 @@ function Startup()
|
||||
defaultBackgroundColor= browserColors.BackgroundColor;
|
||||
|
||||
// Get the colors and image set by prefs init code
|
||||
customTextColor = dialog.NormalData.getAttribute("value");
|
||||
customLinkColor = dialog.LinkData.getAttribute("value");
|
||||
customActiveColor = dialog.ActiveLinkData.getAttribute("value");
|
||||
customVisitedColor = dialog.VisitedLinkData.getAttribute("value");
|
||||
customBackgroundColor = dialog.BackgroundColorData.getAttribute("value");
|
||||
backgroundImage = dialog.BackgroundImageData.getAttribute("value");
|
||||
customTextColor = gDialog.NormalData.getAttribute("value");
|
||||
customLinkColor = gDialog.LinkData.getAttribute("value");
|
||||
customActiveColor = gDialog.ActiveLinkData.getAttribute("value");
|
||||
customVisitedColor = gDialog.VisitedLinkData.getAttribute("value");
|
||||
customBackgroundColor = gDialog.BackgroundColorData.getAttribute("value");
|
||||
backgroundImage = gDialog.BackgroundImageData.getAttribute("value");
|
||||
if (backgroundImage)
|
||||
dialog.BackgroundImageInput.value = backgroundImage;
|
||||
gDialog.BackgroundImageInput.value = backgroundImage;
|
||||
|
||||
// "value" attribute value is a string conversion of boolean!
|
||||
if( document.getElementById( "useCustomColors" ).value == "true" )
|
||||
@ -88,7 +84,7 @@ function Startup()
|
||||
function GetColorAndUpdate(ColorWellID)
|
||||
{
|
||||
// Only allow selecting when in custom mode
|
||||
if (!dialog.CustomColorsRadio.checked) return;
|
||||
if (!gDialog.CustomColorsRadio.checked) return;
|
||||
|
||||
var colorObj = new Object;
|
||||
var colorWell = document.getElementById(ColorWellID);
|
||||
@ -132,23 +128,23 @@ function GetColorAndUpdate(ColorWellID)
|
||||
{
|
||||
case "textCW":
|
||||
color = customTextColor = colorObj.TextColor;
|
||||
dialog.NormalData.setAttribute("value", color);
|
||||
gDialog.NormalData.setAttribute("value", color);
|
||||
break;
|
||||
case "linkCW":
|
||||
color = customLinkColor = colorObj.TextColor;
|
||||
dialog.LinkData.setAttribute("value", color);
|
||||
gDialog.LinkData.setAttribute("value", color);
|
||||
break;
|
||||
case "activeCW":
|
||||
color = customActiveColor = colorObj.TextColor;
|
||||
dialog.ActiveLinkData.setAttribute("value", color);
|
||||
gDialog.ActiveLinkData.setAttribute("value", color);
|
||||
break;
|
||||
case "visitedCW":
|
||||
color = customVisitedColor = colorObj.TextColor;
|
||||
dialog.VisitedLinkData.setAttribute("value", color);
|
||||
gDialog.VisitedLinkData.setAttribute("value", color);
|
||||
break;
|
||||
case "backgroundCW":
|
||||
color = customBackgroundColor = colorObj.BackgroundColor;
|
||||
dialog.BackgroundColorData.setAttribute("value", color);
|
||||
gDialog.BackgroundColorData.setAttribute("value", color);
|
||||
break;
|
||||
}
|
||||
setColorWell(ColorWellID, color);
|
||||
@ -160,16 +156,16 @@ function SetColorPreview(ColorWellID, color)
|
||||
switch( ColorWellID )
|
||||
{
|
||||
case "textCW":
|
||||
dialog.NormalText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.NormalText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "linkCW":
|
||||
dialog.LinkText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.LinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "activeCW":
|
||||
dialog.ActiveLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.ActiveLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "visitedCW":
|
||||
dialog.VisitedLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.VisitedLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "backgroundCW":
|
||||
// Must combine background color and image style values
|
||||
@ -177,7 +173,7 @@ function SetColorPreview(ColorWellID, color)
|
||||
if (backgroundImage)
|
||||
styleValue += ";"+backImageStyle+backgroundImage+");";
|
||||
|
||||
dialog.ColorPreview.setAttribute(styleStr,styleValue);
|
||||
gDialog.ColorPreview.setAttribute(styleStr,styleValue);
|
||||
previewBGColor = color;
|
||||
break;
|
||||
}
|
||||
@ -208,11 +204,11 @@ function UseCustomColors()
|
||||
setColorWell("visitedCW", customVisitedColor);
|
||||
setColorWell("backgroundCW", customBackgroundColor);
|
||||
|
||||
dialog.NormalData.setAttribute("value", customTextColor);
|
||||
dialog.LinkData.setAttribute("value", customLinkColor);
|
||||
dialog.ActiveLinkData.setAttribute("value", customActiveColor);
|
||||
dialog.VisitedLinkData.setAttribute("value", customVisitedColor);
|
||||
dialog.BackgroundColorData.setAttribute("value", customBackgroundColor);
|
||||
gDialog.NormalData.setAttribute("value", customTextColor);
|
||||
gDialog.LinkData.setAttribute("value", customLinkColor);
|
||||
gDialog.ActiveLinkData.setAttribute("value", customActiveColor);
|
||||
gDialog.VisitedLinkData.setAttribute("value", customVisitedColor);
|
||||
gDialog.BackgroundColorData.setAttribute("value", customBackgroundColor);
|
||||
}
|
||||
|
||||
function UseDefaultColors()
|
||||
@ -252,10 +248,10 @@ function ChooseImageFile()
|
||||
var fileName = GetLocalFileURL("img");
|
||||
if (fileName)
|
||||
{
|
||||
dialog.BackgroundImageInput.value = fileName;
|
||||
gDialog.BackgroundImageInput.value = fileName;
|
||||
ValidateAndPreviewImage(true);
|
||||
}
|
||||
SetTextboxFocus(dialog.BackgroundImageInput);
|
||||
SetTextboxFocus(gDialog.BackgroundImageInput);
|
||||
}
|
||||
|
||||
function ChangeBackgroundImage()
|
||||
@ -269,7 +265,7 @@ function ValidateAndPreviewImage(ShowErrorMessage)
|
||||
// First make a string with just background color
|
||||
var styleValue = backColorStyle+previewBGColor+";";
|
||||
|
||||
var image = dialog.BackgroundImageInput.value.trimString();
|
||||
var image = gDialog.BackgroundImageInput.value.trimString();
|
||||
if (image)
|
||||
{
|
||||
if (IsValidImage(image))
|
||||
@ -283,7 +279,7 @@ function ValidateAndPreviewImage(ShowErrorMessage)
|
||||
backgroundImage = "";
|
||||
if (ShowErrorMessage)
|
||||
{
|
||||
SetTextboxFocus(dialog.BackgroundImageInput);
|
||||
SetTextboxFocus(gDialog.BackgroundImageInput);
|
||||
// Tell user about bad image
|
||||
ShowInputErrorMessage(GetString("MissingImageError"));
|
||||
}
|
||||
@ -293,9 +289,9 @@ function ValidateAndPreviewImage(ShowErrorMessage)
|
||||
backgroundImage = "";
|
||||
|
||||
// Set style on preview (removes image if not valid)
|
||||
dialog.ColorPreview.setAttribute(styleStr, styleValue);
|
||||
gDialog.ColorPreview.setAttribute(styleStr, styleValue);
|
||||
|
||||
// Set the pref data so pref code saves it
|
||||
dialog.BackgroundImageData.setAttribute("value", backgroundImage ? backgroundImage : "");
|
||||
gDialog.BackgroundImageData.setAttribute("value", backgroundImage ? backgroundImage : "");
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
<!-- Recent files menu -->
|
||||
<groupbox orient="vertical">
|
||||
<caption label="&recentFiles.title;"/>
|
||||
<hbox autostretch="never" valign="middle">
|
||||
<hbox align="center">
|
||||
<text value="&documentsInMenu;"/>
|
||||
<textbox
|
||||
id="recentFiles"
|
||||
@ -68,7 +68,7 @@
|
||||
<groupbox orient="vertical">
|
||||
<caption label="&savingFiles.title;"/>
|
||||
<spacer class="spacer"/>
|
||||
<radiogroup orient="vertical" autostretch="never"
|
||||
<radiogroup orient="vertical" align="start"
|
||||
id = "preserveFormatting"
|
||||
pref = "true"
|
||||
preftype = "bool"
|
||||
@ -93,7 +93,7 @@
|
||||
</radiogroup>
|
||||
</groupbox>
|
||||
|
||||
<groupbox orient="vertical" autostretch="never">
|
||||
<groupbox orient="vertical" align="start">
|
||||
<caption label="&tableEditing.label;"/>
|
||||
<checkbox
|
||||
label = "&maintainTableStructure.label;"
|
||||
@ -106,13 +106,13 @@
|
||||
prefattribute="checked"
|
||||
/>
|
||||
<separator class = "thin"/>
|
||||
<hbox autostretch="never" valign="top">
|
||||
<hbox align="start">
|
||||
<text class="label"
|
||||
value="&pressingTheDeleteKey.label;"
|
||||
tooltip = "aTooltip" tooltiptext="&pressingTheDeleteKey.tooltip;"
|
||||
for="tableDeleteKey"
|
||||
/>
|
||||
<radiogroup orient="vertical" autostretch="never"
|
||||
<radiogroup orient="vertical" align="start"
|
||||
id = "tableDeleteKey"
|
||||
pref = "true"
|
||||
preftype = "int"
|
||||
@ -127,7 +127,7 @@
|
||||
<!-- Take out Auto-Save; not supported at this time
|
||||
<groupbox orient="vertical">
|
||||
<caption label="&saving;"/>
|
||||
<hbox valign="middle">
|
||||
<hbox align="center">
|
||||
<checkbox
|
||||
label = "&AutoSaveCheck;"
|
||||
id = "shouldAutoSave"
|
||||
@ -194,7 +194,7 @@
|
||||
preftype = "string"
|
||||
prefstring = "editor.image_editor"
|
||||
/>
|
||||
<button class="dialog" label="&chooseButton.label;" />
|
||||
<button label="&chooseButton.label;" />
|
||||
</hbox>
|
||||
|
||||
</groupbox>
|
||||
|
@ -55,9 +55,9 @@
|
||||
</hbox>
|
||||
</vbox>
|
||||
<spacer class="smallspacer"/>
|
||||
<groupbox orient="vertical" autostretch="never">
|
||||
<groupbox orient="vertical" align="start">
|
||||
<caption label="&pageColorHeader;"/>
|
||||
<radiogroup id="useCustomColors" orient="vertical" autostretch="never"
|
||||
<radiogroup id="useCustomColors" orient="vertical" align="start"
|
||||
pref="true" preftype="bool" prefstring="editor.use_custom_colors"
|
||||
prefattribute="value">
|
||||
<radio class="small-margin" group="useCustomColors" id="DefaultColorsRadio"
|
||||
@ -74,35 +74,35 @@
|
||||
<grid>
|
||||
<columns><column/><column/></columns>
|
||||
<rows>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Text" value="&normalText.label;&colon.character;" />
|
||||
<button id="TextButton" class="color-button" oncommand="GetColorAndUpdate('textCW');">
|
||||
<spacer id="textCW" class="color-well"/>
|
||||
</button>
|
||||
<data id="textData" pref="true" preftype="color" prefstring="editor.text_color" prefattribute="value" wsm_attributes="value"/>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Link" value="&linkText.label;&colon.character;" />
|
||||
<button id="LinkButton" class="color-button" oncommand="GetColorAndUpdate('linkCW');">
|
||||
<spacer id="linkCW" class="color-well"/>
|
||||
</button>
|
||||
<data id="linkData" pref="true" preftype="color" prefstring="editor.link_color" prefattribute="value" wsm_attributes="value"/>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Active" value="&activeLinkText.label;&colon.character;" />
|
||||
<button id="ActiveLinkButton" class="color-button" oncommand="GetColorAndUpdate('activeCW');">
|
||||
<spacer id="activeCW" class="color-well"/>
|
||||
</button>
|
||||
<data id="aLinkData" pref="true" preftype="color" prefstring="editor.active_link_color" prefattribute="value" wsm_attributes="value"/>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Visited" value ="&visitedLinkText.label;&colon.character;" />
|
||||
<button id="VisitedLinkButton" class="color-button" oncommand="GetColorAndUpdate('visitedCW');">
|
||||
<spacer id="visitedCW" class="color-well"/>
|
||||
</button>
|
||||
<data id="fLinkData" pref="true" preftype="color" prefstring="editor.followed_link_color" prefattribute="value" wsm_attributes="value"/>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Background" value="&background.label;" />
|
||||
<button id="BackgroundButton" class="color-button" oncommand="GetColorAndUpdate('backgroundCW');">
|
||||
<spacer id="backgroundCW" class="color-well"/>
|
||||
@ -126,11 +126,11 @@
|
||||
</hbox>
|
||||
<spacer class="spacer"/>
|
||||
<text class="label small-margin" value="&backgroundImage.label;" accesskey="&backgroundImage.accesskey;"/>
|
||||
<hbox valign="middle" autostretch="never">
|
||||
<hbox align="center">
|
||||
<textbox id="BackgroundImageInput" oninput="ChangeBackgroundImage();" style="min-width: 23em" flex="1">
|
||||
<observes element="backgroundImageData" attribute="disabled"/>
|
||||
</textbox>
|
||||
<button class="dialog" label="&chooseFile.label;" accesskey="&chooseFile.accesskey;"
|
||||
<button label="&chooseFile.label;" accesskey="&chooseFile.accesskey;"
|
||||
oncommand="ChooseImageFile()">
|
||||
<observes element="backgroundImageData" attribute="disabled"/>
|
||||
</button>
|
||||
|
@ -39,7 +39,7 @@
|
||||
<vbox id="sidebox" flex="1">
|
||||
<hbox class="sidebartitle">
|
||||
<spacer flex="1"/>
|
||||
<button class="dialog borderless paneltitle"
|
||||
<button class="borderless paneltitle"
|
||||
label="&sidebar.reload.label;"
|
||||
oncommand="window.location.reload()" />
|
||||
<button class="borderless paneltitle"
|
||||
|
@ -59,11 +59,11 @@ function BuildCSSAttributeTable()
|
||||
// add or select attribute in the tree widget
|
||||
function onChangeCSSAttribute()
|
||||
{
|
||||
var name = TrimString(dialog.AddCSSAttributeNameInput.value);
|
||||
var name = TrimString(gDialog.AddCSSAttributeNameInput.value);
|
||||
if ( !name )
|
||||
return;
|
||||
|
||||
var value = TrimString(dialog.AddCSSAttributeValueInput.value);
|
||||
var value = TrimString(gDialog.AddCSSAttributeValueInput.value);
|
||||
|
||||
// First try to update existing attribute
|
||||
// If not found, add new attribute
|
||||
@ -73,10 +73,10 @@ function onChangeCSSAttribute()
|
||||
|
||||
function ClearCSSInputWidgets()
|
||||
{
|
||||
dialog.AddCSSAttributeTree.clearItemSelection();
|
||||
dialog.AddCSSAttributeNameInput.value ="";
|
||||
dialog.AddCSSAttributeValueInput.value = "";
|
||||
dialog.AddCSSAttributeNameInput.inputField.focus();
|
||||
gDialog.AddCSSAttributeTree.clearItemSelection();
|
||||
gDialog.AddCSSAttributeNameInput.value ="";
|
||||
gDialog.AddCSSAttributeValueInput.value = "";
|
||||
gDialog.AddCSSAttributeNameInput.inputField.focus();
|
||||
}
|
||||
|
||||
function onSelectCSSTreeItem()
|
||||
@ -84,38 +84,38 @@ function onSelectCSSTreeItem()
|
||||
if (!gDoOnSelectTree)
|
||||
return;
|
||||
|
||||
var tree = dialog.AddCSSAttributeTree;
|
||||
var tree = gDialog.AddCSSAttributeTree;
|
||||
if (tree && tree.selectedItems && tree.selectedItems.length)
|
||||
{
|
||||
dialog.AddCSSAttributeNameInput.value = GetTreeItemAttributeStr(tree.selectedItems[0]);
|
||||
dialog.AddCSSAttributeValueInput.value = GetTreeItemValueStr(tree.selectedItems[0]);
|
||||
gDialog.AddCSSAttributeNameInput.value = GetTreeItemAttributeStr(tree.selectedItems[0]);
|
||||
gDialog.AddCSSAttributeValueInput.value = GetTreeItemValueStr(tree.selectedItems[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function onInputCSSAttributeName()
|
||||
{
|
||||
var attName = TrimString(dialog.AddCSSAttributeNameInput.value).toLowerCase();
|
||||
var attName = TrimString(gDialog.AddCSSAttributeNameInput.value).toLowerCase();
|
||||
var newValue = "";
|
||||
|
||||
var existingValue = GetAndSelectExistingAttributeValue(attName, "CSSAList");
|
||||
if (existingValue)
|
||||
newValue = existingValue;
|
||||
|
||||
dialog.AddCSSAttributeValueInput.value = newValue;
|
||||
gDialog.AddCSSAttributeValueInput.value = newValue;
|
||||
}
|
||||
|
||||
function onInputCSSAttributeValue()
|
||||
{
|
||||
// Update value in the tree list
|
||||
UpdateExistingAttribute( dialog.AddCSSAttributeNameInput.value,
|
||||
dialog.AddCSSAttributeValueInput.value,
|
||||
UpdateExistingAttribute( gDialog.AddCSSAttributeNameInput.value,
|
||||
gDialog.AddCSSAttributeValueInput.value,
|
||||
"CSSAList" );
|
||||
}
|
||||
|
||||
function editCSSAttributeValue(targetCell)
|
||||
{
|
||||
if (IsNotTreeHeader(targetCell))
|
||||
dialog.AddCSSAttributeValueInput.inputField.select();
|
||||
gDialog.AddCSSAttributeValueInput.inputField.select();
|
||||
}
|
||||
|
||||
function UpdateCSSAttributes()
|
||||
@ -151,12 +151,12 @@ function UpdateCSSAttributes()
|
||||
|
||||
function RemoveCSSAttribute()
|
||||
{
|
||||
var treechildren = dialog.AddCSSAttributeTree.lastChild;
|
||||
var treechildren = gDialog.AddCSSAttributeTree.lastChild;
|
||||
|
||||
// We only allow 1 selected item
|
||||
if (dialog.AddCSSAttributeTree.selectedItems.length)
|
||||
if (gDialog.AddCSSAttributeTree.selectedItems.length)
|
||||
{
|
||||
var item = dialog.AddCSSAttributeTree.selectedItems[0];
|
||||
var item = gDialog.AddCSSAttributeTree.selectedItems[0];
|
||||
|
||||
// Remove the item from the tree
|
||||
// We always rebuild complete "style" string,
|
||||
@ -171,7 +171,7 @@ function SelectCSSTree( index )
|
||||
{
|
||||
gDoOnSelectTree = false;
|
||||
try {
|
||||
dialog.AddCSSAttributeTree.selectedIndex = index;
|
||||
gDialog.AddCSSAttributeTree.selectedIndex = index;
|
||||
} catch (e) {}
|
||||
gDoOnSelectTree = true;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
function BuildHTMLAttributeNameList()
|
||||
{
|
||||
ClearMenulist(dialog.AddHTMLAttributeNameInput);
|
||||
ClearMenulist(gDialog.AddHTMLAttributeNameInput);
|
||||
|
||||
var elementName = gElement.localName.toLowerCase();
|
||||
var attNames = gHTMLAttr[elementName];
|
||||
@ -49,17 +49,17 @@ function BuildHTMLAttributeNameList()
|
||||
limitFirstChar = name.indexOf("^") >= 0;
|
||||
if (limitFirstChar)
|
||||
{
|
||||
menuitem = AppendStringToMenulist(dialog.AddHTMLAttributeNameInput, name.replace(/\^/g, ""));
|
||||
menuitem = AppendStringToMenulist(gDialog.AddHTMLAttributeNameInput, name.replace(/\^/g, ""));
|
||||
menuitem.setAttribute("limitFirstChar", "true");
|
||||
}
|
||||
else
|
||||
AppendStringToMenulist(dialog.AddHTMLAttributeNameInput, name);
|
||||
AppendStringToMenulist(gDialog.AddHTMLAttributeNameInput, name);
|
||||
}
|
||||
}
|
||||
else if (name == "-")
|
||||
{
|
||||
// Signal for separator
|
||||
var popup = dialog.AddHTMLAttributeNameInput.firstChild;
|
||||
var popup = gDialog.AddHTMLAttributeNameInput.firstChild;
|
||||
if (popup)
|
||||
{
|
||||
var sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuseparator");
|
||||
@ -80,7 +80,7 @@ function BuildHTMLAttributeNameList()
|
||||
// Strip flag characters
|
||||
name = name.replace(/[!^#%$+]/g, "");
|
||||
|
||||
menuitem = AppendStringToMenulist(dialog.AddHTMLAttributeNameInput, name);
|
||||
menuitem = AppendStringToMenulist(gDialog.AddHTMLAttributeNameInput, name);
|
||||
if (menuitem)
|
||||
{
|
||||
// Signify "required" attributes by special style
|
||||
@ -139,11 +139,11 @@ function BuildHTMLAttributeTable()
|
||||
// add or select an attribute in the tree widget
|
||||
function onChangeHTMLAttribute()
|
||||
{
|
||||
var name = TrimString(dialog.AddHTMLAttributeNameInput.value);
|
||||
var name = TrimString(gDialog.AddHTMLAttributeNameInput.value);
|
||||
if (!name)
|
||||
return;
|
||||
|
||||
var value = TrimString(dialog.AddHTMLAttributeValueInput.value);
|
||||
var value = TrimString(gDialog.AddHTMLAttributeValueInput.value);
|
||||
|
||||
// First try to update existing attribute
|
||||
// If not found, add new attribute
|
||||
@ -153,10 +153,10 @@ function onChangeHTMLAttribute()
|
||||
|
||||
function ClearHTMLInputWidgets()
|
||||
{
|
||||
dialog.AddHTMLAttributeTree.clearItemSelection();
|
||||
dialog.AddHTMLAttributeNameInput.value ="";
|
||||
dialog.AddHTMLAttributeValueInput.value = "";
|
||||
dialog.AddHTMLAttributeNameInput.inputField.focus();
|
||||
gDialog.AddHTMLAttributeTree.clearItemSelection();
|
||||
gDialog.AddHTMLAttributeNameInput.value ="";
|
||||
gDialog.AddHTMLAttributeValueInput.value = "";
|
||||
gDialog.AddHTMLAttributeNameInput.inputField.focus();
|
||||
}
|
||||
|
||||
function onSelectHTMLTreeItem()
|
||||
@ -164,20 +164,20 @@ function onSelectHTMLTreeItem()
|
||||
if (!gDoOnSelectTree)
|
||||
return;
|
||||
|
||||
var tree = dialog.AddHTMLAttributeTree;
|
||||
var tree = gDialog.AddHTMLAttributeTree;
|
||||
if (tree && tree.selectedItems && tree.selectedItems.length)
|
||||
{
|
||||
var inputName = TrimString(dialog.AddHTMLAttributeNameInput.value).toLowerCase();
|
||||
var inputName = TrimString(gDialog.AddHTMLAttributeNameInput.value).toLowerCase();
|
||||
var selectedName = tree.selectedItems[0].firstChild.firstChild.getAttribute("label");
|
||||
|
||||
if (inputName == selectedName)
|
||||
{
|
||||
// Already editing selected name - just update the value input
|
||||
dialog.AddHTMLAttributeValueInput.value = GetTreeItemValueStr(tree.selectedItems[0]);
|
||||
gDialog.AddHTMLAttributeValueInput.value = GetTreeItemValueStr(tree.selectedItems[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.AddHTMLAttributeNameInput.value = selectedName;
|
||||
gDialog.AddHTMLAttributeNameInput.value = selectedName;
|
||||
|
||||
// Change value input based on new selected name
|
||||
onInputHTMLAttributeName();
|
||||
@ -187,11 +187,11 @@ function onSelectHTMLTreeItem()
|
||||
|
||||
function onInputHTMLAttributeName()
|
||||
{
|
||||
var attName = TrimString(dialog.AddHTMLAttributeNameInput.value).toLowerCase();
|
||||
var attName = TrimString(gDialog.AddHTMLAttributeNameInput.value).toLowerCase();
|
||||
|
||||
// Clear value widget, but prevent triggering update in tree
|
||||
gUpdateTreeValue = false;
|
||||
dialog.AddHTMLAttributeValueInput.value = "";
|
||||
gDialog.AddHTMLAttributeValueInput.value = "";
|
||||
gUpdateTreeValue = true;
|
||||
|
||||
if (attName)
|
||||
@ -220,7 +220,7 @@ function onInputHTMLAttributeName()
|
||||
var valueList = gHTMLAttr[valueListName];
|
||||
|
||||
// Index to which widget we were using to edit the value
|
||||
deckIndex = dialog.AddHTMLAttributeValueDeck.getAttribute("index");
|
||||
deckIndex = gDialog.AddHTMLAttributeValueDeck.getAttribute("index");
|
||||
|
||||
listLen = valueList.length;
|
||||
if (listLen > 0)
|
||||
@ -230,13 +230,13 @@ function onInputHTMLAttributeName()
|
||||
// one (default) item, don't use menulist for that
|
||||
if (listLen > 1)
|
||||
{
|
||||
ClearMenulist(dialog.AddHTMLAttributeValueMenulist);
|
||||
ClearMenulist(gDialog.AddHTMLAttributeValueMenulist);
|
||||
|
||||
if (deckIndex != "1")
|
||||
{
|
||||
// Switch to using editable menulist
|
||||
dialog.AddHTMLAttributeValueInput = dialog.AddHTMLAttributeValueMenulist;
|
||||
dialog.AddHTMLAttributeValueDeck.setAttribute("index", "1");
|
||||
gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueMenulist;
|
||||
gDialog.AddHTMLAttributeValueDeck.setAttribute("index", "1");
|
||||
}
|
||||
// Rebuild the list
|
||||
for (var i = 0; i < listLen; i++)
|
||||
@ -244,7 +244,7 @@ function onInputHTMLAttributeName()
|
||||
if (valueList[i] == "-")
|
||||
{
|
||||
// Signal for separator
|
||||
var popup = dialog.AddHTMLAttributeValueInput.firstChild;
|
||||
var popup = gDialog.AddHTMLAttributeValueInput.firstChild;
|
||||
if (popup)
|
||||
{
|
||||
var sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuseparator");
|
||||
@ -252,7 +252,7 @@ function onInputHTMLAttributeName()
|
||||
popup.appendChild(sep);
|
||||
}
|
||||
} else {
|
||||
AppendStringToMenulist(dialog.AddHTMLAttributeValueMenulist, valueList[i]);
|
||||
AppendStringToMenulist(gDialog.AddHTMLAttributeValueMenulist, valueList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,8 +261,8 @@ function onInputHTMLAttributeName()
|
||||
if (listLen <= 1 && deckIndex != "0")
|
||||
{
|
||||
// No list: Use textbox for input instead
|
||||
dialog.AddHTMLAttributeValueInput = dialog.AddHTMLAttributeValueTextbox;
|
||||
dialog.AddHTMLAttributeValueDeck.setAttribute("index", "0");
|
||||
gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueTextbox;
|
||||
gDialog.AddHTMLAttributeValueDeck.setAttribute("index", "0");
|
||||
}
|
||||
|
||||
// If attribute already exists in tree, use associated value,
|
||||
@ -271,7 +271,7 @@ function onInputHTMLAttributeName()
|
||||
if (existingValue)
|
||||
newValue = existingValue;
|
||||
|
||||
dialog.AddHTMLAttributeValueInput.value = newValue;
|
||||
gDialog.AddHTMLAttributeValueInput.value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,13 +282,13 @@ function onInputHTMLAttributeValue()
|
||||
|
||||
// Trim spaces only from left since we must allow spaces within the string
|
||||
// (we always reset the input field's value below)
|
||||
var value = TrimStringLeft(dialog.AddHTMLAttributeValueInput.value);
|
||||
var value = TrimStringLeft(gDialog.AddHTMLAttributeValueInput.value);
|
||||
if (value)
|
||||
{
|
||||
// Do value filtering based on type of attribute
|
||||
// (Do not use "LimitStringLength()" and "forceInteger()"
|
||||
// to avoid multiple reseting of input's value and flickering)
|
||||
var selectedItem = dialog.AddHTMLAttributeNameInput.selectedItem;
|
||||
var selectedItem = gDialog.AddHTMLAttributeNameInput.selectedItem;
|
||||
|
||||
if (selectedItem)
|
||||
{
|
||||
@ -326,19 +326,19 @@ function onInputHTMLAttributeValue()
|
||||
}
|
||||
|
||||
// Update once only if it changed
|
||||
if ( value != dialog.AddHTMLAttributeValueInput.value )
|
||||
dialog.AddHTMLAttributeValueInput.value = value;
|
||||
if (value != gDialog.AddHTMLAttributeValueInput.value)
|
||||
gDialog.AddHTMLAttributeValueInput.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Always update value in the tree list
|
||||
UpdateExistingAttribute( dialog.AddHTMLAttributeNameInput.value, value, "HTMLAList" );
|
||||
UpdateExistingAttribute(gDialog.AddHTMLAttributeNameInput.value, value, "HTMLAList");
|
||||
}
|
||||
|
||||
function editHTMLAttributeValue(targetCell)
|
||||
{
|
||||
if (IsNotTreeHeader(targetCell))
|
||||
dialog.AddHTMLAttributeValueInput.inputField.select();
|
||||
gDialog.AddHTMLAttributeValueInput.inputField.select();
|
||||
}
|
||||
|
||||
|
||||
@ -349,7 +349,7 @@ function UpdateHTMLAttributes()
|
||||
var i;
|
||||
|
||||
// remove removed attributes
|
||||
for( i = 0; i < HTMLRAttrs.length; i++ )
|
||||
for (i = 0; i < HTMLRAttrs.length; i++)
|
||||
{
|
||||
var name = HTMLRAttrs[i];
|
||||
|
||||
@ -370,12 +370,12 @@ function UpdateHTMLAttributes()
|
||||
|
||||
function RemoveHTMLAttribute()
|
||||
{
|
||||
var treechildren = dialog.AddHTMLAttributeTree.lastChild;
|
||||
var treechildren = gDialog.AddHTMLAttributeTree.lastChild;
|
||||
|
||||
// We only allow 1 selected item
|
||||
if (dialog.AddHTMLAttributeTree.selectedItems.length)
|
||||
if (gDialog.AddHTMLAttributeTree.selectedItems.length)
|
||||
{
|
||||
var item = dialog.AddHTMLAttributeTree.selectedItems[0];
|
||||
var item = gDialog.AddHTMLAttributeTree.selectedItems[0];
|
||||
var attr = GetTreeItemAttributeStr(item);
|
||||
|
||||
// remove the item from the attribute array
|
||||
@ -395,7 +395,7 @@ function SelectHTMLTree( index )
|
||||
|
||||
gDoOnSelectTree = false;
|
||||
try {
|
||||
dialog.AddHTMLAttributeTree.selectedIndex = index;
|
||||
gDialog.AddHTMLAttributeTree.selectedIndex = index;
|
||||
} catch (e) {}
|
||||
gDoOnSelectTree = true;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
function BuildJSEAttributeNameList()
|
||||
{
|
||||
ClearMenulist(dialog.AddJSEAttributeNameList);
|
||||
ClearMenulist(gDialog.AddJSEAttributeNameList);
|
||||
|
||||
// Get events specific to current element
|
||||
var elementName = gElement.localName.toLowerCase();
|
||||
@ -48,9 +48,9 @@ function BuildJSEAttributeNameList()
|
||||
}
|
||||
|
||||
for (i = 0; i < attNames.length; i++)
|
||||
AppendStringToMenulist(dialog.AddJSEAttributeNameList, attNames[i]);
|
||||
AppendStringToMenulist(gDialog.AddJSEAttributeNameList, attNames[i]);
|
||||
|
||||
popup = dialog.AddJSEAttributeNameList.firstChild;
|
||||
popup = gDialog.AddJSEAttributeNameList.firstChild;
|
||||
if (popup)
|
||||
{
|
||||
sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuseparator");
|
||||
@ -66,7 +66,7 @@ function BuildJSEAttributeNameList()
|
||||
if (gCoreJSEvents[i] == "-")
|
||||
{
|
||||
if (!popup)
|
||||
popup = dialog.AddJSEAttributeNameList.firstChild;
|
||||
popup = gDialog.AddJSEAttributeNameList.firstChild;
|
||||
|
||||
sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuseparator");
|
||||
|
||||
@ -74,15 +74,15 @@ function BuildJSEAttributeNameList()
|
||||
popup.appendChild(sep);
|
||||
}
|
||||
else
|
||||
AppendStringToMenulist(dialog.AddJSEAttributeNameList, gCoreJSEvents[i]);
|
||||
AppendStringToMenulist(gDialog.AddJSEAttributeNameList, gCoreJSEvents[i]);
|
||||
}
|
||||
|
||||
dialog.AddJSEAttributeNameList.selectedIndex = 0;
|
||||
gDialog.AddJSEAttributeNameList.selectedIndex = 0;
|
||||
|
||||
// Use current name and value of first tree item if it exists
|
||||
onSelectJSETreeItem();
|
||||
|
||||
dialog.AddJSEAttributeNameList.focus();
|
||||
gDialog.AddJSEAttributeNameList.focus();
|
||||
}
|
||||
|
||||
// build attribute list in tree form from element attributes
|
||||
@ -106,7 +106,7 @@ function BuildJSEAttributeTable()
|
||||
|
||||
// Select first item
|
||||
if (added)
|
||||
dialog.AddJSEAttributeTree.selectedIndex = 0;
|
||||
gDialog.AddJSEAttributeTree.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,27 +126,27 @@ function onSelectJSEAttribute()
|
||||
if(!gDoOnSelectTree)
|
||||
return;
|
||||
|
||||
dialog.AddJSEAttributeValueInput.value =
|
||||
GetAndSelectExistingAttributeValue(dialog.AddJSEAttributeNameList.label, "JSEAList");
|
||||
gDialog.AddJSEAttributeValueInput.value =
|
||||
GetAndSelectExistingAttributeValue(gDialog.AddJSEAttributeNameList.label, "JSEAList");
|
||||
}
|
||||
|
||||
function onSelectJSETreeItem()
|
||||
{
|
||||
var tree = dialog.AddJSEAttributeTree;
|
||||
var tree = gDialog.AddJSEAttributeTree;
|
||||
if (tree && tree.selectedItems && tree.selectedItems.length)
|
||||
{
|
||||
var name = GetTreeItemAttributeStr(tree.selectedItems[0]);
|
||||
|
||||
// Select attribute name in list
|
||||
if (dialog.AddJSEAttributeNameList.firstChild)
|
||||
if (gDialog.AddJSEAttributeNameList.firstChild)
|
||||
{
|
||||
var arr = dialog.AddJSEAttributeNameList.firstChild.getElementsByAttribute('label', name);
|
||||
var arr = gDialog.AddJSEAttributeNameList.firstChild.getElementsByAttribute('label', name);
|
||||
if (arr && arr.length)
|
||||
dialog.AddJSEAttributeNameList.selectedItem = arr[0];
|
||||
gDialog.AddJSEAttributeNameList.selectedItem = arr[0];
|
||||
|
||||
// Set value input to that in tree (no need to update this in the tree)
|
||||
gUpdateTreeValue = false;
|
||||
dialog.AddJSEAttributeValueInput.value = GetTreeItemValueStr(tree.selectedItems[0]);
|
||||
gDialog.AddJSEAttributeValueInput.value = GetTreeItemValueStr(tree.selectedItems[0]);
|
||||
gUpdateTreeValue = true;
|
||||
}
|
||||
}
|
||||
@ -157,8 +157,8 @@ function onInputJSEAttributeValue()
|
||||
if (gUpdateTreeValue)
|
||||
{
|
||||
|
||||
var name = TrimString(dialog.AddJSEAttributeNameList.label);
|
||||
var value = TrimString(dialog.AddJSEAttributeValueInput.value);
|
||||
var name = TrimString(gDialog.AddJSEAttributeNameList.label);
|
||||
var value = TrimString(gDialog.AddJSEAttributeValueInput.value);
|
||||
|
||||
// Update value in the tree list
|
||||
// Since we have a non-editable menulist,
|
||||
@ -171,7 +171,7 @@ function onInputJSEAttributeValue()
|
||||
function editJSEAttributeValue(targetCell)
|
||||
{
|
||||
if (IsNotTreeHeader(targetCell))
|
||||
dialog.AddJSEAttributeValueInput.inputField.select();
|
||||
gDialog.AddJSEAttributeValueInput.inputField.select();
|
||||
}
|
||||
|
||||
function UpdateJSEAttributes()
|
||||
@ -199,18 +199,18 @@ function UpdateJSEAttributes()
|
||||
|
||||
function RemoveJSEAttribute()
|
||||
{
|
||||
var treechildren = dialog.AddJSEAttributeTree.lastChild;
|
||||
var treechildren = gDialog.AddJSEAttributeTree.lastChild;
|
||||
|
||||
// This differs from HTML and CSS panels:
|
||||
// We reselect after removing, because there is not
|
||||
// editable attribute name input, so we can't clear that
|
||||
// like we do in other panels
|
||||
var newIndex = dialog.AddJSEAttributeTree.selectedIndex;
|
||||
var newIndex = gDialog.AddJSEAttributeTree.selectedIndex;
|
||||
|
||||
// We only allow 1 selected item
|
||||
if (dialog.AddJSEAttributeTree.selectedItems.length)
|
||||
if (gDialog.AddJSEAttributeTree.selectedItems.length)
|
||||
{
|
||||
var item = dialog.AddJSEAttributeTree.selectedItems[0];
|
||||
var item = gDialog.AddJSEAttributeTree.selectedItems[0];
|
||||
|
||||
// Name is the text of the treecell
|
||||
var attr = GetTreeItemAttributeStr(item);
|
||||
@ -227,6 +227,6 @@ function RemoveJSEAttribute()
|
||||
treechildren.removeChild (item);
|
||||
|
||||
// Reselect an item
|
||||
dialog.AddJSEAttributeTree.selectedIndex = newIndex;
|
||||
gDialog.AddJSEAttributeTree.selectedIndex = newIndex;
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,6 @@ var JSERAttrs = []; // removed js events
|
||||
var gDoOnSelectTree = true;
|
||||
var gUpdateTreeValue = true;
|
||||
|
||||
var dialog;
|
||||
|
||||
/************** INITIALISATION && SETUP **************/
|
||||
|
||||
/**
|
||||
@ -77,23 +75,22 @@ function Startup()
|
||||
tagLabel.setAttribute("value", ("<" + gElement.localName + ">"));
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = {};
|
||||
dialog.AddHTMLAttributeNameInput = document.getElementById("AddHTMLAttributeNameInput");
|
||||
gDialog.AddHTMLAttributeNameInput = document.getElementById("AddHTMLAttributeNameInput");
|
||||
|
||||
// We use a <deck> to switch between editable menulist and textbox
|
||||
dialog.AddHTMLAttributeValueDeck = document.getElementById("AddHTMLAttributeValueDeck");
|
||||
dialog.AddHTMLAttributeValueMenulist = document.getElementById("AddHTMLAttributeValueMenulist");
|
||||
dialog.AddHTMLAttributeValueTextbox = document.getElementById("AddHTMLAttributeValueTextbox");
|
||||
dialog.AddHTMLAttributeValueInput = dialog.AddHTMLAttributeValueTextbox;
|
||||
gDialog.AddHTMLAttributeValueDeck = document.getElementById("AddHTMLAttributeValueDeck");
|
||||
gDialog.AddHTMLAttributeValueMenulist = document.getElementById("AddHTMLAttributeValueMenulist");
|
||||
gDialog.AddHTMLAttributeValueTextbox = document.getElementById("AddHTMLAttributeValueTextbox");
|
||||
gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueTextbox;
|
||||
|
||||
dialog.AddHTMLAttributeTree = document.getElementById("HTMLATree");
|
||||
dialog.AddCSSAttributeNameInput = document.getElementById("AddCSSAttributeNameInput");
|
||||
dialog.AddCSSAttributeValueInput = document.getElementById("AddCSSAttributeValueInput");
|
||||
dialog.AddCSSAttributeTree = document.getElementById("CSSATree");
|
||||
dialog.AddJSEAttributeNameList = document.getElementById("AddJSEAttributeNameList");
|
||||
dialog.AddJSEAttributeValueInput = document.getElementById("AddJSEAttributeValueInput");
|
||||
dialog.AddJSEAttributeTree = document.getElementById("JSEATree");
|
||||
dialog.okButton = document.getElementById("ok");
|
||||
gDialog.AddHTMLAttributeTree = document.getElementById("HTMLATree");
|
||||
gDialog.AddCSSAttributeNameInput = document.getElementById("AddCSSAttributeNameInput");
|
||||
gDialog.AddCSSAttributeValueInput = document.getElementById("AddCSSAttributeValueInput");
|
||||
gDialog.AddCSSAttributeTree = document.getElementById("CSSATree");
|
||||
gDialog.AddJSEAttributeNameList = document.getElementById("AddJSEAttributeNameList");
|
||||
gDialog.AddJSEAttributeValueInput = document.getElementById("AddJSEAttributeValueInput");
|
||||
gDialog.AddJSEAttributeTree = document.getElementById("JSEATree");
|
||||
gDialog.okButton = document.getElementById("ok");
|
||||
|
||||
// build the attribute trees
|
||||
BuildHTMLAttributeTable();
|
||||
|
@ -37,7 +37,9 @@
|
||||
style="width: 40em;"
|
||||
xmlns ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
buttonpack="end"
|
||||
onload="Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<keyset id="dialogKeys"/>
|
||||
@ -59,7 +61,7 @@
|
||||
|
||||
<broadcaster id="args" value=""/>
|
||||
|
||||
<hbox autostretch="never">
|
||||
<hbox>
|
||||
<text class="label" value="¤tattributesfor.label;"/>
|
||||
<text class="label header" id="tagLabel"/>
|
||||
</hbox>
|
||||
@ -96,21 +98,21 @@
|
||||
</treehead>
|
||||
<treechildren id="HTMLAList" flex="1"/>
|
||||
</tree>
|
||||
<hbox valign="middle" autostretch="never" flex="1">
|
||||
<hbox align="center" flex="1">
|
||||
<text class="label" value="&editAttribute.label;"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="dialog" label="&removeAttribute.label;" oncommand="RemoveHTMLAttribute();"/>
|
||||
<button label="&removeAttribute.label;" oncommand="RemoveHTMLAttribute();"/>
|
||||
</hbox>
|
||||
<grid>
|
||||
<columns>
|
||||
<column flex="1"/><column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="bottom" equalsize="always">
|
||||
<row equalsize="always">
|
||||
<text class="label" for="AddHTMLAttributeNameInput" value="&AttName.label;"/>
|
||||
<text class="label" for="AddHTMLAttributeValueInput" value="&AttValue.label;"/>
|
||||
</row>
|
||||
<row valign="middle" equalsize="always">
|
||||
<row align="center" equalsize="always">
|
||||
<!-- Lists are built at runtime -->
|
||||
<menulist id="AddHTMLAttributeNameInput" editable="true" flex="1"
|
||||
oninput="onInputHTMLAttributeName();"
|
||||
@ -146,21 +148,21 @@
|
||||
</treehead>
|
||||
<treechildren id="CSSAList" flex="1"/>
|
||||
</tree>
|
||||
<hbox valign="middle" autostretch="never" flex="1">
|
||||
<hbox align="center" flex="1">
|
||||
<text class="label" value="&editAttribute.label;"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="dialog" label="&removeAttribute.label;" oncommand="RemoveCSSAttribute();"/>
|
||||
<button label="&removeAttribute.label;" oncommand="RemoveCSSAttribute();"/>
|
||||
</hbox>
|
||||
<grid>
|
||||
<columns>
|
||||
<column flex="1"/><column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="bottom" equalsize="always">
|
||||
<row equalsize="always">
|
||||
<text class="label" for="AddCSSAttributeNameInput" value="&PropertyName.label;"/>
|
||||
<text class="label" for="AddCSSAttributeValueInput" value="&AttValue.label;"/>
|
||||
</row>
|
||||
<row valign="middle" equalsize="always">
|
||||
<row equalsize="always">
|
||||
<textbox id="AddCSSAttributeNameInput" flex="1"
|
||||
oninput="onInputCSSAttributeName();"
|
||||
onchange="onChangeCSSAttribute();"/>
|
||||
@ -191,21 +193,21 @@
|
||||
</treehead>
|
||||
<treechildren id="JSEAList" flex="1"/>
|
||||
</tree>
|
||||
<hbox valign="middle" autostretch="never" flex="1">
|
||||
<hbox align="center" flex="1">
|
||||
<text class="label" value="&editAttribute.label;"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="dialog" label="&removeAttribute.label;" oncommand="RemoveJSEAttribute()"/>
|
||||
<button label="&removeAttribute.label;" oncommand="RemoveJSEAttribute()"/>
|
||||
</hbox>
|
||||
<grid>
|
||||
<columns>
|
||||
<column flex="1"/><column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="bottom" equalsize="always">
|
||||
<row equalsize="always">
|
||||
<text class="label" for="AddJSEAttributeNameList" value="&AttName.label;"/>
|
||||
<text class="label" for="AddJSEAttributeValueInput" value="&AttValue.label;"/>
|
||||
</row>
|
||||
<row valign="middle" equalsize="always">
|
||||
<row align="center" equalsize="always">
|
||||
<!-- List is built at runtime -->
|
||||
<menulist id="AddJSEAttributeNameList" flex="1"
|
||||
oncommand="onSelectJSEAttribute();"/>
|
||||
|
@ -24,8 +24,7 @@
|
||||
//Cancel() is in EdDialogCommon.js
|
||||
var insertNew = true;
|
||||
var tagname = "TAG NAME"
|
||||
var dialog;
|
||||
var color = "";
|
||||
var gColor = "";
|
||||
var LastPickedColor = "";
|
||||
var ColorType = "Text";
|
||||
var TextType = false;
|
||||
@ -47,17 +46,14 @@ function Startup()
|
||||
gColorObj = window.arguments[1];
|
||||
gColorObj.Cancel = false;
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
|
||||
dialog.ColorPicker = document.getElementById("ColorPicker");
|
||||
dialog.ColorInput = document.getElementById("ColorInput");
|
||||
dialog.LastPickedButton = document.getElementById("LastPickedButton");
|
||||
dialog.LastPickedColor = document.getElementById("LastPickedColor");
|
||||
dialog.TableRadio = document.getElementById("TableRadio");
|
||||
dialog.CellRadio = document.getElementById("CellRadio");
|
||||
dialog.Ok = document.getElementById("ok");
|
||||
dialog.ColorSwatch = document.getElementById("ColorPickerSwatch");
|
||||
gDialog.ColorPicker = document.getElementById("ColorPicker");
|
||||
gDialog.ColorInput = document.getElementById("ColorInput");
|
||||
gDialog.LastPickedButton = document.getElementById("LastPickedButton");
|
||||
gDialog.LastPickedColor = document.getElementById("LastPickedColor");
|
||||
gDialog.TableRadio = document.getElementById("TableRadio");
|
||||
gDialog.CellRadio = document.getElementById("CellRadio");
|
||||
gDialog.Ok = document.getElementById("ok");
|
||||
gDialog.ColorSwatch = document.getElementById("ColorPickerSwatch");
|
||||
|
||||
// The type of color we are setting:
|
||||
// text: Text, Link, ActiveLink, VisitedLink,
|
||||
@ -74,7 +70,7 @@ function Startup()
|
||||
window.title = GetString("Color");
|
||||
|
||||
|
||||
dialog.ColorInput.value = "";
|
||||
gDialog.ColorInput.value = "";
|
||||
var tmpColor;
|
||||
var haveTableRadio = false;
|
||||
|
||||
@ -83,15 +79,15 @@ function Startup()
|
||||
case "Page":
|
||||
tmpColor = gColorObj.PageColor;
|
||||
if (tmpColor && tmpColor.toLowerCase() != "window")
|
||||
color = tmpColor;
|
||||
gColor = tmpColor;
|
||||
break;
|
||||
case "Table":
|
||||
if (gColorObj.TableColor)
|
||||
color = gColorObj.TableColor;
|
||||
gColor = gColorObj.TableColor;
|
||||
break;
|
||||
case "Cell":
|
||||
if (gColorObj.CellColor)
|
||||
color = gColorObj.CellColor;
|
||||
gColor = gColorObj.CellColor;
|
||||
break;
|
||||
case "TableOrCell":
|
||||
TableOrCell = true;
|
||||
@ -99,15 +95,15 @@ function Startup()
|
||||
haveTableRadio = true;
|
||||
if (gColorObj.TableColor)
|
||||
{
|
||||
color = gColorObj.TableColor;
|
||||
dialog.TableRadio.checked = true;
|
||||
dialog.TableRadio.focus();
|
||||
gColor = gColorObj.TableColor;
|
||||
gDialog.TableRadio.checked = true;
|
||||
gDialog.TableRadio.focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
color = gColorObj.CellColor;
|
||||
dialog.CellRadio.checked = true;
|
||||
dialog.CellRadio.focus();
|
||||
gColor = gColorObj.CellColor;
|
||||
gDialog.CellRadio.checked = true;
|
||||
gDialog.CellRadio.focus();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -115,39 +111,39 @@ function Startup()
|
||||
TextType = true;
|
||||
tmpColor = gColorObj.TextColor;
|
||||
if (tmpColor && tmpColor.toLowerCase() != "windowtext")
|
||||
color = gColorObj.TextColor;
|
||||
gColor = gColorObj.TextColor;
|
||||
break;
|
||||
}
|
||||
|
||||
// Set initial color in input field and in the colorpicker
|
||||
SetCurrentColor(color);
|
||||
dialog.ColorPicker.initColor(color);
|
||||
SetCurrentColor(gColor);
|
||||
gDialog.ColorPicker.initColor(gColor);
|
||||
|
||||
// Use last-picked colors passed in, or those persistent on dialog
|
||||
if (TextType)
|
||||
{
|
||||
if ( !("LastTextColor" in gColorObj) || !gColorObj.LastTextColor)
|
||||
gColorObj.LastTextColor = dialog.LastPickedColor.getAttribute("LastTextColor");
|
||||
gColorObj.LastTextColor = gDialog.LastPickedColor.getAttribute("LastTextColor");
|
||||
LastPickedColor = gColorObj.LastTextColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !("LastBackgroundColor" in gColorObj) || !gColorObj.LastBackgroundColor)
|
||||
gColorObj.LastBackgroundColor = dialog.LastPickedColor.getAttribute("LastBackgroundColor");
|
||||
gColorObj.LastBackgroundColor = gDialog.LastPickedColor.getAttribute("LastBackgroundColor");
|
||||
LastPickedColor = gColorObj.LastBackgroundColor;
|
||||
}
|
||||
dialog.LastPickedColor.setAttribute("style","background-color: "+LastPickedColor);
|
||||
gDialog.LastPickedColor.setAttribute("style","background-color: "+LastPickedColor);
|
||||
|
||||
doSetOKCancel(onOK, onCancelColor);
|
||||
|
||||
// Set method to detect clicking on OK button
|
||||
// so we don't get fooled by changing "default" behavior
|
||||
dialog.Ok.setAttribute("onclick", "SetDefaultToOk()");
|
||||
gDialog.Ok.setAttribute("onclick", "SetDefaultToOk()");
|
||||
|
||||
// Make the "Last-picked" the default button
|
||||
// until the user selects a color
|
||||
dialog.Ok.removeAttribute("default");
|
||||
dialog.LastPickedButton.setAttribute("default","true");
|
||||
gDialog.Ok.removeAttribute("default");
|
||||
gDialog.LastPickedButton.setAttribute("default","true");
|
||||
|
||||
// Caller can prevent user from submitting an empty, i.e., default color
|
||||
NoDefault = gColorObj.NoDefault;
|
||||
@ -159,20 +155,20 @@ function Startup()
|
||||
|
||||
// Set focus to colorpicker if not set to table radio buttons above
|
||||
if (!haveTableRadio)
|
||||
dialog.ColorPicker.focus();
|
||||
gDialog.ColorPicker.focus();
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
|
||||
function ChangePalette(palette)
|
||||
{
|
||||
dialog.ColorPicker.setAttribute("palettename", palette);
|
||||
gDialog.ColorPicker.setAttribute("palettename", palette);
|
||||
window.sizeToContent();
|
||||
}
|
||||
|
||||
function SelectColor()
|
||||
{
|
||||
var color = dialog.ColorPicker.color;
|
||||
var color = gDialog.ColorPicker.color;
|
||||
if (color)
|
||||
SetCurrentColor(color);
|
||||
}
|
||||
@ -180,7 +176,7 @@ function SelectColor()
|
||||
function RemoveColor()
|
||||
{
|
||||
SetCurrentColor("");
|
||||
dialog.ColorInput.focus();
|
||||
gDialog.ColorInput.focus();
|
||||
SetDefaultToOk();
|
||||
}
|
||||
|
||||
@ -197,58 +193,59 @@ function SelectLastPickedColor()
|
||||
{
|
||||
SetCurrentColor(LastPickedColor);
|
||||
if ( onOK() )
|
||||
window.close();
|
||||
//window.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
function SetCurrentColor(color)
|
||||
{
|
||||
// TODO: Validate color?
|
||||
if(!color) color = "";
|
||||
color = color.trimString().toLowerCase();
|
||||
if (color == "mixed")
|
||||
color = "";
|
||||
dialog.ColorInput.value = color;
|
||||
gColor = color.trimString().toLowerCase();
|
||||
if (gColor == "mixed")
|
||||
gColor = "";
|
||||
gDialog.ColorInput.value = gColor;
|
||||
SetColorSwatch();
|
||||
}
|
||||
|
||||
function SetColorSwatch()
|
||||
{
|
||||
// TODO: DON'T ALLOW SPACES?
|
||||
var color = dialog.ColorInput.value.trimString();
|
||||
var color = gDialog.ColorInput.value.trimString();
|
||||
if (color.length > 0)
|
||||
{
|
||||
dialog.ColorSwatch.setAttribute("style",("background-color:"+color));
|
||||
dialog.ColorSwatch.removeAttribute("default");
|
||||
gDialog.ColorSwatch.setAttribute("style",("background-color:"+color));
|
||||
gDialog.ColorSwatch.removeAttribute("default");
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.ColorSwatch.setAttribute("style",("background-color:inherit"));
|
||||
dialog.ColorSwatch.setAttribute("default","true");
|
||||
gDialog.ColorSwatch.setAttribute("style",("background-color:inherit"));
|
||||
gDialog.ColorSwatch.setAttribute("default","true");
|
||||
}
|
||||
}
|
||||
|
||||
function SetDefaultToOk()
|
||||
{
|
||||
dialog.LastPickedButton.removeAttribute("default");
|
||||
dialog.Ok.setAttribute("default","true");
|
||||
gDialog.LastPickedButton.removeAttribute("default");
|
||||
gDialog.Ok.setAttribute("default","true");
|
||||
LastPickedIsDefault = false;
|
||||
}
|
||||
|
||||
function ValidateData()
|
||||
{
|
||||
if (LastPickedIsDefault)
|
||||
color = LastPickedColor;
|
||||
gColor = LastPickedColor;
|
||||
else
|
||||
color = dialog.ColorInput.value;
|
||||
gColor = gDialog.ColorInput.value;
|
||||
|
||||
color = color.trimString().toLowerCase();
|
||||
gColor = gColor.trimString().toLowerCase();
|
||||
|
||||
// TODO: Validate the color string!
|
||||
|
||||
if (NoDefault && !color)
|
||||
if (NoDefault && !gColor)
|
||||
{
|
||||
ShowInputErrorMessage(GetString("NoColorError"));
|
||||
SetTextboxFocus(dialog.ColorInput);
|
||||
SetTextboxFocus(gDialog.ColorInput);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -262,23 +259,23 @@ function onOK()
|
||||
// Set return values and save in persistent color attributes
|
||||
if (TextType)
|
||||
{
|
||||
gColorObj.TextColor = color;
|
||||
if (color.length > 0)
|
||||
gColorObj.TextColor = gColor;
|
||||
if (gColor.length > 0)
|
||||
{
|
||||
dialog.LastPickedColor.setAttribute("LastTextColor", color);
|
||||
gColorObj.LastTextColor = color;
|
||||
gDialog.LastPickedColor.setAttribute("LastTextColor", gColor);
|
||||
gColorObj.LastTextColor = gColor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gColorObj.BackgroundColor = color;
|
||||
if (color.length > 0)
|
||||
gColorObj.BackgroundColor = gColor;
|
||||
if (gColor.length > 0)
|
||||
{
|
||||
dialog.LastPickedColor.setAttribute("LastBackgroundColor", color);
|
||||
gColorObj.LastBackgroundColor = color;
|
||||
gDialog.LastPickedColor.setAttribute("LastBackgroundColor", gColor);
|
||||
gColorObj.LastBackgroundColor = gColor;
|
||||
}
|
||||
// If table or cell requested, tell caller which element to set on
|
||||
if (TableOrCell && dialog.TableRadio.checked)
|
||||
if (TableOrCell && gDialog.TableRadio.checked)
|
||||
gColorObj.Type = "Table";
|
||||
}
|
||||
SaveWindowLocation();
|
||||
@ -291,5 +288,5 @@ function onCancelColor()
|
||||
// Tells caller that user canceled
|
||||
gColorObj.Cancel = true;
|
||||
SaveWindowLocation();
|
||||
window.close();
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@
|
||||
<window class="dialog"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttonpack="end"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical"
|
||||
>
|
||||
|
||||
@ -44,7 +46,7 @@
|
||||
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
|
||||
|
||||
<keyset id="dialogKeys"/>
|
||||
<hbox id="TableOrCellGroup" valign="middle" autostretch="never" collapsed="true">
|
||||
<hbox id="TableOrCellGroup" align="center" collapsed="true">
|
||||
<text value="&background.label;"/>
|
||||
<radiogroup id="1" orient="horizontal">
|
||||
<radio group="1" id="TableRadio" label="&table.label;"/>
|
||||
@ -58,7 +60,7 @@
|
||||
onkeypress="SelectColorByKeypress(event);"
|
||||
onselect="SelectColor();"/>
|
||||
<!-- Web palette is not implemented???
|
||||
<hbox valign="middle" autostretch="never">
|
||||
<hbox align="center">
|
||||
<text class="label" value="&palette.label;"/>
|
||||
<radio id="StandardPalette" label="&standardPalette.label;" oncommand="ChangePalette('standard')"/>
|
||||
<radio id="WebPalette" label="&webPalette.label;" oncommand="ChangePalette('web')"/>
|
||||
@ -75,12 +77,12 @@
|
||||
<text class="label" value="&setColor1.label;"/>
|
||||
<text class="label" value="&setColor2.label;"/>
|
||||
<text class="label" value="&setColorExample.label;"/>
|
||||
<hbox valign="middle" autostretch="never" flex="1=">
|
||||
<hbox align="center" flex="1=">
|
||||
<textbox id="ColorInput" style="width: 8em" oninput="SetColorSwatch(); SetDefaultToOk();"/>
|
||||
<spacer flex="1"/>
|
||||
<spacer id="ColorPickerSwatch"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="DefaultColorButton" class="dialog" label="&default.label;"
|
||||
<button id="DefaultColorButton" label="&default.label;"
|
||||
style="margin-right:0px;" oncommand="RemoveColor()"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
@ -35,7 +35,6 @@
|
||||
var BodyElement;
|
||||
var prefs;
|
||||
var backgroundImage;
|
||||
var dialog;
|
||||
|
||||
// Initialize in case we can't get them from prefs???
|
||||
var defaultTextColor="#000000";
|
||||
@ -70,21 +69,14 @@ function Startup()
|
||||
if (!InitEditorShell())
|
||||
return;
|
||||
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
window.close();
|
||||
}
|
||||
|
||||
dialog.ColorPreview = document.getElementById("ColorPreview");
|
||||
dialog.NormalText = document.getElementById("NormalText");
|
||||
dialog.LinkText = document.getElementById("LinkText");
|
||||
dialog.ActiveLinkText = document.getElementById("ActiveLinkText");
|
||||
dialog.VisitedLinkText = document.getElementById("VisitedLinkText");
|
||||
dialog.DefaultColorsRadio = document.getElementById("DefaultColorsRadio");
|
||||
dialog.CustomColorsRadio = document.getElementById("CustomColorsRadio");
|
||||
dialog.BackgroundImageInput = document.getElementById("BackgroundImageInput");
|
||||
gDialog.ColorPreview = document.getElementById("ColorPreview");
|
||||
gDialog.NormalText = document.getElementById("NormalText");
|
||||
gDialog.LinkText = document.getElementById("LinkText");
|
||||
gDialog.ActiveLinkText = document.getElementById("ActiveLinkText");
|
||||
gDialog.VisitedLinkText = document.getElementById("VisitedLinkText");
|
||||
gDialog.DefaultColorsRadio = document.getElementById("DefaultColorsRadio");
|
||||
gDialog.CustomColorsRadio = document.getElementById("CustomColorsRadio");
|
||||
gDialog.BackgroundImageInput = document.getElementById("BackgroundImageInput");
|
||||
|
||||
BodyElement = editorShell.editorDocument.body;
|
||||
if (!BodyElement)
|
||||
@ -116,10 +108,10 @@ function Startup()
|
||||
|
||||
InitDialog();
|
||||
|
||||
if (dialog.DefaultColorsRadio.checked)
|
||||
dialog.DefaultColorsRadio.focus();
|
||||
if (gDialog.DefaultColorsRadio.checked)
|
||||
gDialog.DefaultColorsRadio.focus();
|
||||
else
|
||||
dialog.CustomColorsRadio.focus();
|
||||
gDialog.CustomColorsRadio.focus();
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
@ -130,8 +122,8 @@ function InitDialog()
|
||||
backgroundImage = globalElement.getAttribute(backgroundStr);
|
||||
if (backgroundImage.length)
|
||||
{
|
||||
dialog.BackgroundImageInput.value = backgroundImage;
|
||||
dialog.ColorPreview.setAttribute(styleStr, backImageStyle+backgroundImage+");");
|
||||
gDialog.BackgroundImageInput.value = backgroundImage;
|
||||
gDialog.ColorPreview.setAttribute(styleStr, backImageStyle+backgroundImage+");");
|
||||
}
|
||||
|
||||
SetRelativeCheckbox();
|
||||
@ -163,12 +155,12 @@ function InitDialog()
|
||||
if (haveCustomColor)
|
||||
{
|
||||
// If any colors are set, then check the "Custom" radio button
|
||||
dialog.CustomColorsRadio.checked = true;
|
||||
gDialog.CustomColorsRadio.checked = true;
|
||||
UseCustomColors();
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.DefaultColorsRadio.checked = true;
|
||||
gDialog.DefaultColorsRadio.checked = true;
|
||||
UseDefaultColors();
|
||||
}
|
||||
}
|
||||
@ -176,7 +168,7 @@ function InitDialog()
|
||||
function GetColorAndUpdate(ColorWellID)
|
||||
{
|
||||
// Only allow selecting when in custom mode
|
||||
if (!dialog.CustomColorsRadio.checked) return;
|
||||
if (!gDialog.CustomColorsRadio.checked) return;
|
||||
|
||||
var colorObj = new Object;
|
||||
var colorWell = document.getElementById(ColorWellID);
|
||||
@ -237,9 +229,6 @@ function GetColorAndUpdate(ColorWellID)
|
||||
|
||||
setColorWell(ColorWellID, color);
|
||||
SetColorPreview(ColorWellID, color);
|
||||
|
||||
// Setting a color automatically changes into UseCustomColors mode
|
||||
//dialog.CustomColorsRadio.checked = true;
|
||||
}
|
||||
|
||||
function SetColorPreview(ColorWellID, color)
|
||||
@ -247,16 +236,16 @@ function SetColorPreview(ColorWellID, color)
|
||||
switch( ColorWellID )
|
||||
{
|
||||
case "textCW":
|
||||
dialog.NormalText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.NormalText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "linkCW":
|
||||
dialog.LinkText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.LinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "activeCW":
|
||||
dialog.ActiveLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.ActiveLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "visitedCW":
|
||||
dialog.VisitedLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
gDialog.VisitedLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "backgroundCW":
|
||||
// Must combine background color and image style values
|
||||
@ -264,7 +253,7 @@ function SetColorPreview(ColorWellID, color)
|
||||
if (backgroundImage)
|
||||
styleValue += ";"+backImageStyle+backgroundImage+");";
|
||||
|
||||
dialog.ColorPreview.setAttribute(styleStr,styleValue);
|
||||
gDialog.ColorPreview.setAttribute(styleStr,styleValue);
|
||||
previewBGColor = color;
|
||||
break;
|
||||
}
|
||||
@ -334,13 +323,13 @@ function chooseFile()
|
||||
if (gHaveDocumentUrl)
|
||||
fileName = MakeRelativeUrl(fileName);
|
||||
|
||||
dialog.BackgroundImageInput.value = fileName;
|
||||
gDialog.BackgroundImageInput.value = fileName;
|
||||
|
||||
SetRelativeCheckbox();
|
||||
|
||||
ValidateAndPreviewImage(true);
|
||||
}
|
||||
SetTextboxFocus(dialog.BackgroundImageInput);
|
||||
SetTextboxFocus(gDialog.BackgroundImageInput);
|
||||
}
|
||||
|
||||
function ChangeBackgroundImage()
|
||||
@ -356,7 +345,7 @@ function ValidateAndPreviewImage(ShowErrorMessage)
|
||||
var styleValue = backColorStyle+previewBGColor+";";
|
||||
|
||||
var retVal = true;
|
||||
var image = dialog.BackgroundImageInput.value.trimString();
|
||||
var image = gDialog.BackgroundImageInput.value.trimString();
|
||||
if (image)
|
||||
{
|
||||
if (IsValidImage(image))
|
||||
@ -372,7 +361,7 @@ function ValidateAndPreviewImage(ShowErrorMessage)
|
||||
backgroundImage = null;
|
||||
if (ShowErrorMessage)
|
||||
{
|
||||
SetTextboxFocus(dialog.BackgroundImageInput);
|
||||
SetTextboxFocus(gDialog.BackgroundImageInput);
|
||||
// Tell user about bad image
|
||||
ShowInputErrorMessage(GetString("MissingImageError"));
|
||||
}
|
||||
@ -381,9 +370,8 @@ function ValidateAndPreviewImage(ShowErrorMessage)
|
||||
}
|
||||
else backgroundImage = null;
|
||||
|
||||
dump("Set preview background CSS: "+styleValue+"\n");
|
||||
// Set style on preview (removes image if not valid)
|
||||
dialog.ColorPreview.setAttribute(styleStr, styleValue);
|
||||
gDialog.ColorPreview.setAttribute(styleStr, styleValue);
|
||||
|
||||
// Note that an "empty" string is valid
|
||||
return retVal;
|
||||
@ -392,7 +380,7 @@ dump("Set preview background CSS: "+styleValue+"\n");
|
||||
function ValidateData()
|
||||
{
|
||||
// Colors values are updated as they are picked, no validation necessary
|
||||
if (dialog.DefaultColorsRadio.checked)
|
||||
if (gDialog.DefaultColorsRadio.checked)
|
||||
{
|
||||
globalElement.removeAttribute(textStr);
|
||||
globalElement.removeAttribute(linkStr);
|
||||
|
@ -35,7 +35,9 @@
|
||||
<window class="dialog" title="&windowTitle.label;"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttonpack="end"
|
||||
onload="Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
@ -47,9 +49,9 @@
|
||||
<keyset id="dialogKeys"/>
|
||||
<popupset id="aTooltipSet" />
|
||||
|
||||
<groupbox orient="vertical" autostretch="never">
|
||||
<groupbox orient="vertical" align="start">
|
||||
<caption label="&pageColors.label;"/>
|
||||
<radiogroup id="pageColorGroup" orient="vertical" autostretch="never">
|
||||
<radiogroup id="pageColorGroup" orient="vertical" align="start">
|
||||
<radio group="pageColorGroup" id="DefaultColorsRadio" label="&defaultColorsRadio.label;" oncommand="UseDefaultColors()"
|
||||
tooltip="aTooltip" tooltiptext="&defaultColorsRadio.tooltip;" />
|
||||
<radio group="pageColorGroup" id="CustomColorsRadio" label="&customColorsRadio.label;" oncommand="UseCustomColors()"
|
||||
@ -59,31 +61,31 @@
|
||||
<grid>
|
||||
<columns><column/><column/></columns>
|
||||
<rows>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Text" value="&normalText.label;&colon.character;" />
|
||||
<button id="TextButton" class="color-button" oncommand="GetColorAndUpdate('textCW');">
|
||||
<spacer id="textCW" class="color-well"/>
|
||||
</button>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Link" value="&linkText.label;&colon.character;" />
|
||||
<button id="LinkButton" class="color-button" oncommand="GetColorAndUpdate('linkCW');">
|
||||
<spacer id="linkCW" class="color-well"/>
|
||||
</button>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Active" value="&activeLinkText.label;&colon.character;" />
|
||||
<button id="ActiveLinkButton" class="color-button" oncommand="GetColorAndUpdate('activeCW');">
|
||||
<spacer id="activeCW" class="color-well"/>
|
||||
</button>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Visited" value ="&visitedLinkText.label;&colon.character;" />
|
||||
<button id="VisitedLinkButton" class="color-button" oncommand="GetColorAndUpdate('visitedCW');">
|
||||
<spacer id="visitedCW" class="color-well"/>
|
||||
</button>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="Background" value="&background.label;" />
|
||||
<button id="BackgroundButton" class="color-button" oncommand="GetColorAndUpdate('backgroundCW');">
|
||||
<spacer id="backgroundCW" class="color-well"/>
|
||||
@ -113,7 +115,7 @@
|
||||
tooltip="aTooltip" tooltiptext="&backgroundImage.tooltip;"
|
||||
style="min-width : 21em"/>
|
||||
<!-- from EdDialogOverlay.xul -->
|
||||
<button class="dialog" id="ChooseFile"/>
|
||||
<button id="ChooseFile"/>
|
||||
</hbox>
|
||||
<!-- from EdDialogOverlay.xul 'for' identifies the textfield to get URL from -->
|
||||
<checkbox id="MakeRelativeCheckbox" for="BackgroundImageInput"/>
|
||||
@ -121,7 +123,7 @@
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<!-- from EdDialogOverlay.xul -->
|
||||
<button class="dialog" id="AdvancedEditButton"/>
|
||||
<button id="AdvancedEditButton"/>
|
||||
</hbox>
|
||||
<separator class="groove"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
|
@ -20,7 +20,6 @@
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
var dialog;
|
||||
var gIndex;
|
||||
var gCommaIndex = "0";
|
||||
var gSpaceIndex = "1";
|
||||
@ -34,17 +33,15 @@ function Startup()
|
||||
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
dialog.sepRadioGroup = document.getElementById("SepRadioGroup");
|
||||
dialog.sepCharacterInput = document.getElementById("SepCharacterInput");
|
||||
dialog.deleteSepCharacter = document.getElementById("DeleteSepCharacter");
|
||||
dialog.collapseSpaces = document.getElementById("CollapseSpaces");
|
||||
gDialog.sepRadioGroup = document.getElementById("SepRadioGroup");
|
||||
gDialog.sepCharacterInput = document.getElementById("SepCharacterInput");
|
||||
gDialog.deleteSepCharacter = document.getElementById("DeleteSepCharacter");
|
||||
gDialog.collapseSpaces = document.getElementById("CollapseSpaces");
|
||||
|
||||
// We persist the user's separator character
|
||||
dialog.sepCharacterInput.value = dialog.sepRadioGroup.getAttribute("character");
|
||||
gDialog.sepCharacterInput.value = gDialog.sepRadioGroup.getAttribute("character");
|
||||
|
||||
gIndex = dialog.sepRadioGroup.getAttribute("index");
|
||||
gIndex = gDialog.sepRadioGroup.getAttribute("index");
|
||||
|
||||
switch (gIndex)
|
||||
{
|
||||
@ -63,14 +60,14 @@ function Startup()
|
||||
// Set initial enable state on character input and "collapse" checkbox
|
||||
SelectCharacter(gIndex);
|
||||
|
||||
SetTextboxFocus(dialog.sepRadioGroup);
|
||||
SetTextboxFocus(gDialog.sepRadioGroup);
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
|
||||
function InputSepCharacter()
|
||||
{
|
||||
var str = dialog.sepCharacterInput.value;
|
||||
var str = gDialog.sepCharacterInput.value;
|
||||
|
||||
// Limit input to 1 character
|
||||
if (str.length > 1)
|
||||
@ -80,7 +77,7 @@ function InputSepCharacter()
|
||||
if (str == "<" || str == ">" || str == "&" || str == ";" || str == " ")
|
||||
str = "";
|
||||
|
||||
dialog.sepCharacterInput.value = str;
|
||||
gDialog.sepCharacterInput.value = str;
|
||||
}
|
||||
|
||||
function SelectCharacter(radioGroupIndex)
|
||||
@ -102,7 +99,7 @@ function onOK()
|
||||
sepCharacter = " ";
|
||||
break;
|
||||
case gOtherIndex:
|
||||
sepCharacter = dialog.sepCharacterInput.value.slice(0,1);
|
||||
sepCharacter = gDialog.sepCharacterInput.value.slice(0,1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -206,7 +203,7 @@ function onOK()
|
||||
|
||||
// Replace separator characters with table cells
|
||||
var replaceString;
|
||||
if (dialog.deleteSepCharacter.checked)
|
||||
if (gDialog.deleteSepCharacter.checked)
|
||||
{
|
||||
replaceString = "";
|
||||
}
|
||||
@ -230,7 +227,7 @@ function onOK()
|
||||
{
|
||||
// If checkbox is checked,
|
||||
// one or more adjacent spaces are one separator
|
||||
if (dialog.collapseSpaces.checked)
|
||||
if (gDialog.collapseSpaces.checked)
|
||||
tempStr = "\\s+"
|
||||
else
|
||||
tempStr = "\\s";
|
||||
@ -333,9 +330,9 @@ function onOK()
|
||||
editorShell.EndBatchChanges();
|
||||
|
||||
// Save persisted attributes
|
||||
dialog.sepRadioGroup.setAttribute("index", gIndex);
|
||||
gDialog.sepRadioGroup.setAttribute("index", gIndex);
|
||||
if (gIndex == gOtherIndex)
|
||||
dialog.sepRadioGroup.setAttribute("character", sepCharacter);
|
||||
gDialog.sepRadioGroup.setAttribute("character", sepCharacter);
|
||||
|
||||
SaveWindowLocation();
|
||||
return true;
|
||||
|
@ -36,6 +36,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -56,7 +57,7 @@
|
||||
style="margin-left:2em" checked="true" persist="checked"
|
||||
tooltip="aTooltip" tooltiptext="&collapseSpaces.tooltip;"/>
|
||||
</vbox>
|
||||
<hbox autostretch="never">
|
||||
<hbox align="center">
|
||||
<radio group="SepRadioGroup" id="other" label="&otherRadio.label;" oncommand="SelectCharacter('2');"/>
|
||||
<textbox class="narrow" id="SepCharacterInput" oninput="InputSepCharacter()"/>
|
||||
</hbox>
|
||||
|
@ -32,6 +32,10 @@
|
||||
// Each editor window must include this file
|
||||
// Variables shared by all dialogs:
|
||||
var editorShell;
|
||||
|
||||
// Object to attach commonly-used widgets (all dialogs should use this)
|
||||
var gDialog = {};
|
||||
|
||||
// Bummer! Can't get at enums from nsIDocumentEncoder.h
|
||||
var gOutputSelectionOnly = 1;
|
||||
var gOutputFormatted = 2;
|
||||
@ -146,7 +150,7 @@ function ValidateNumber(inputWidget, listWidget, minVal, maxVal, element, attNam
|
||||
|
||||
// or expand dialog for users of "More / Fewer" button
|
||||
if ("dialog" in window && dialog &&
|
||||
"MoreSection" in dialog && dialog.MoreSection)
|
||||
"MoreSection" in gDialog && gDialog.MoreSection)
|
||||
{
|
||||
if ( !SeeMore )
|
||||
onMoreFewer();
|
||||
@ -895,9 +899,9 @@ function InitMoreFewer()
|
||||
{
|
||||
// Set SeeMore bool to the OPPOSITE of the current state,
|
||||
// which is automatically saved by using the 'persist="more"'
|
||||
// attribute on the dialog.MoreFewerButton button
|
||||
// attribute on the gDialog.MoreFewerButton button
|
||||
// onMoreFewer will toggle it and redraw the dialog
|
||||
SeeMore = (dialog.MoreFewerButton.getAttribute("more") != "1");
|
||||
SeeMore = (gDialog.MoreFewerButton.getAttribute("more") != "1");
|
||||
onMoreFewer();
|
||||
}
|
||||
|
||||
@ -905,18 +909,18 @@ function onMoreFewer()
|
||||
{
|
||||
if (SeeMore)
|
||||
{
|
||||
dialog.MoreSection.setAttribute("collapsed","true");
|
||||
gDialog.MoreSection.setAttribute("collapsed","true");
|
||||
window.sizeToContent();
|
||||
dialog.MoreFewerButton.setAttribute("more","0");
|
||||
dialog.MoreFewerButton.setAttribute("label",GetString("MoreProperties"));
|
||||
gDialog.MoreFewerButton.setAttribute("more","0");
|
||||
gDialog.MoreFewerButton.setAttribute("label",GetString("MoreProperties"));
|
||||
SeeMore = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.MoreSection.removeAttribute("collapsed");
|
||||
gDialog.MoreSection.removeAttribute("collapsed");
|
||||
window.sizeToContent();
|
||||
dialog.MoreFewerButton.setAttribute("more","1");
|
||||
dialog.MoreFewerButton.setAttribute("label",GetString("FewerProperties"));
|
||||
gDialog.MoreFewerButton.setAttribute("more","1");
|
||||
gDialog.MoreFewerButton.setAttribute("label",GetString("FewerProperties"));
|
||||
SeeMore = true;
|
||||
}
|
||||
}
|
||||
@ -1143,7 +1147,8 @@ function SaveWindowLocation()
|
||||
function onCancel()
|
||||
{
|
||||
SaveWindowLocation();
|
||||
window.close();
|
||||
// Close dialog by returning true
|
||||
return true;
|
||||
}
|
||||
|
||||
function GetDefaultBrowserColors()
|
||||
|
@ -29,10 +29,10 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<vbox id="AdvancedEdit" flex="1">
|
||||
<hbox flex="1" style="margin-top: 0.2em" autostretch="never">
|
||||
<hbox flex="1" style="margin-top: 0.2em" align="center">
|
||||
<!-- This will right-align the button -->
|
||||
<spacer flex="1"/>
|
||||
<button class="dialog" id="AdvancedEditButton1" oncommand="onAdvancedEdit()" label="&AdvancedEditButton.label;"
|
||||
<button id="AdvancedEditButton1" oncommand="onAdvancedEdit()" label="&AdvancedEditButton.label;"
|
||||
tooltip="aTooltip" tooltiptext="&AdvancedEditButton.tooltip;"/>
|
||||
</hbox>
|
||||
<separator class="groove"/>
|
||||
|
@ -33,52 +33,30 @@ function Startup()
|
||||
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
// GET EACH CONTROL -- E.G.:
|
||||
//dialog.editBox = document.getElementById("editBox");
|
||||
// gDialog is declared in EdDialogCommon.js
|
||||
// Set commonly-used widgets like this:
|
||||
gDialog.fooButton = document.getElementById("fooButton");
|
||||
|
||||
initDialog();
|
||||
|
||||
// SET FOCUS TO FIRST CONTROL
|
||||
//SetTextboxFocus(dialog.editBox);
|
||||
// Set window location relative to parent window (based on persisted attributes)
|
||||
SetWindowLocation();
|
||||
|
||||
// Set focus to first widget in dialog, e.g.:
|
||||
SetTextboxFocus(gDialog.fooButton);
|
||||
}
|
||||
|
||||
function InitDialog() {
|
||||
// Get a single selected element of the desired type
|
||||
element = editorShell.GetSelectedElement(tagName);
|
||||
|
||||
if (element) {
|
||||
// We found an element and don't need to insert one
|
||||
insertNew = false;
|
||||
dump("Found existing image\n");
|
||||
} else {
|
||||
insertNew = true;
|
||||
// We don't have an element selected,
|
||||
// so create one with default attributes
|
||||
dump("Element not selected - calling createElementWithDefaults\n");
|
||||
element = editorShell.createElementWithDefaults(tagName);
|
||||
}
|
||||
|
||||
if(!element)
|
||||
{
|
||||
dump("Failed to get selected element or create a new one!\n");
|
||||
window.close();
|
||||
}
|
||||
function InitDialog()
|
||||
{
|
||||
// Initialize all dialog widgets here,
|
||||
// e.g., get attributes from an element for property dialog
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
// Set attribute example:
|
||||
// imageElement.setAttribute("src",dialog.srcInput.value);
|
||||
if (insertNew) {
|
||||
try {
|
||||
editorShell.InsertElementAtSelection(element, false);
|
||||
} catch (e) {
|
||||
dump("Exception occured in InsertElementAtSelection\n");
|
||||
}
|
||||
}
|
||||
// Validate all user data and set attributes and possibly insert new element here
|
||||
// If there's an error the user must correct, return false to keep dialog open.
|
||||
|
||||
SaveWindowLocation();
|
||||
return true; // do close the window
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -48,5 +49,5 @@
|
||||
<!-- from EdDialogOverlay -->
|
||||
<vbox id="AdvancedEdit"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
@ -37,32 +37,25 @@ function Startup()
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
Close();
|
||||
}
|
||||
// The word to add word is passed as the 2nd extra parameter in window.openDialog()
|
||||
gWordToAdd = window.arguments[1];
|
||||
|
||||
dialog.WordInput = document.getElementById("WordInput");
|
||||
dialog.DictionaryList = document.getElementById("DictionaryList");
|
||||
gDialog.WordInput = document.getElementById("WordInput");
|
||||
gDialog.DictionaryList = document.getElementById("DictionaryList");
|
||||
|
||||
dialog.WordInput.value = gWordToAdd;
|
||||
gDialog.WordInput.value = gWordToAdd;
|
||||
FillDictionaryList();
|
||||
|
||||
// Select the supplied word if it is already in the list
|
||||
SelectWordToAddInList();
|
||||
SetTextboxFocus(dialog.WordInput);
|
||||
SetTextboxFocus(gDialog.WordInput);
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
|
||||
function ValidateWordToAdd()
|
||||
{
|
||||
gWordToAdd = TrimString(dialog.WordInput.value);
|
||||
gWordToAdd = TrimString(gDialog.WordInput.value);
|
||||
if (gWordToAdd.length > 0)
|
||||
{
|
||||
return true;
|
||||
@ -73,11 +66,11 @@ function ValidateWordToAdd()
|
||||
|
||||
function SelectWordToAddInList()
|
||||
{
|
||||
for (var index = 0; index < dialog.DictionaryList.getAttribute("length"); index++)
|
||||
for (var index = 0; index < gDialog.DictionaryList.getAttribute("length"); index++)
|
||||
{
|
||||
if (gWordToAdd == GetTreelistValueAt(dialog.DictionaryList,index))
|
||||
if (gWordToAdd == GetTreelistValueAt(gDialog.DictionaryList,index))
|
||||
{
|
||||
dialog.DictionaryList.selectedIndex = index;
|
||||
gDialog.DictionaryList.selectedIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -98,7 +91,7 @@ function AddWord()
|
||||
FillDictionaryList();
|
||||
|
||||
SelectWordToAddInList();
|
||||
dialog.WordInput.value = "";
|
||||
gDialog.WordInput.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,16 +99,16 @@ function ReplaceWord()
|
||||
{
|
||||
if (ValidateWordToAdd())
|
||||
{
|
||||
var selIndex = dialog.DictionaryList.selectedIndex;
|
||||
var selIndex = gDialog.DictionaryList.selectedIndex;
|
||||
if (selIndex >= 0)
|
||||
{
|
||||
gSpellChecker.RemoveWordFromDictionary(GetSelectedTreelistValue(dialog.DictionaryList));
|
||||
gSpellChecker.RemoveWordFromDictionary(GetSelectedTreelistValue(gDialog.DictionaryList));
|
||||
try {
|
||||
// Add to the dictionary list
|
||||
gSpellChecker.AddWordToDictionary(gWordToAdd);
|
||||
// Just change the text on the selected item
|
||||
// instead of rebuilding the list
|
||||
ReplaceStringInTreeList(dialog.DictionaryList, selIndex, gWordToAdd);
|
||||
ReplaceStringInTreeList(gDialog.DictionaryList, selIndex, gWordToAdd);
|
||||
} catch (e) {
|
||||
// Rebuild list and select the word - it was probably already in the list
|
||||
dump("Exception occured adding word in ReplaceWord\n");
|
||||
@ -128,13 +121,13 @@ function ReplaceWord()
|
||||
|
||||
function RemoveWord()
|
||||
{
|
||||
var selIndex = dialog.DictionaryList.selectedIndex;
|
||||
var selIndex = gDialog.DictionaryList.selectedIndex;
|
||||
if (selIndex >= 0)
|
||||
{
|
||||
var word = GetSelectedTreelistValue(dialog.DictionaryList);
|
||||
var word = GetSelectedTreelistValue(gDialog.DictionaryList);
|
||||
|
||||
// Remove word from list
|
||||
RemoveSelectedTreelistItem(dialog.DictionaryList);
|
||||
RemoveSelectedTreelistItem(gDialog.DictionaryList);
|
||||
|
||||
// Remove from dictionary
|
||||
try {
|
||||
@ -152,10 +145,10 @@ function RemoveWord()
|
||||
|
||||
function FillDictionaryList()
|
||||
{
|
||||
var selIndex = dialog.DictionaryList.selectedIndex;
|
||||
var selIndex = gDialog.DictionaryList.selectedIndex;
|
||||
|
||||
// Clear the current contents of the list
|
||||
ClearTreelist(dialog.DictionaryList);
|
||||
ClearTreelist(gDialog.DictionaryList);
|
||||
// Get the list from the spell checker
|
||||
gSpellChecker.GetPersonalDictionary()
|
||||
|
||||
@ -166,7 +159,7 @@ function FillDictionaryList()
|
||||
var word = gSpellChecker.GetPersonalDictionaryWord();
|
||||
if (word != "")
|
||||
{
|
||||
AppendStringToTreelist(dialog.DictionaryList, word);
|
||||
AppendStringToTreelist(gDialog.DictionaryList, word);
|
||||
haveList = true;
|
||||
}
|
||||
} while (word != "");
|
||||
@ -174,14 +167,14 @@ function FillDictionaryList()
|
||||
//XXX: BUG 74467: If list is empty, tree doesn't layout to full height correctly
|
||||
// (ignores "rows" attribute) (bug is latered, so we are fixing here for now)
|
||||
if (!haveList)
|
||||
AppendStringToTreelist(dialog.DictionaryList, " ");
|
||||
AppendStringToTreelist(gDialog.DictionaryList, " ");
|
||||
|
||||
ResetSelectedItem(selIndex);
|
||||
}
|
||||
|
||||
function ResetSelectedItem(index)
|
||||
{
|
||||
var lastIndex = dialog.DictionaryList.getAttribute("length") - 1;
|
||||
var lastIndex = gDialog.DictionaryList.getAttribute("length") - 1;
|
||||
if (index > lastIndex)
|
||||
index = lastIndex;
|
||||
|
||||
@ -192,7 +185,7 @@ function ResetSelectedItem(index)
|
||||
|
||||
dump("ResetSelectedItem to index="+index+"\n");
|
||||
|
||||
dialog.DictionaryList.selectedIndex = index;
|
||||
gDialog.DictionaryList.selectedIndex = index;
|
||||
}
|
||||
|
||||
function Close()
|
||||
|
@ -28,6 +28,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="Close()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -51,7 +52,7 @@
|
||||
</row>
|
||||
<row>
|
||||
<textbox id="WordInput" flex="1"/>
|
||||
<button class="dialog" flex="1" id="AddWord" oncommand="AddWord()" label="&AddButton.label;"/>
|
||||
<button flex="1" id="AddWord" oncommand="AddWord()" label="&AddButton.label;"/>
|
||||
</row>
|
||||
<row>
|
||||
<text class="label" value="&DictionaryList.label;"/>
|
||||
@ -62,9 +63,9 @@
|
||||
<treecolgroup><treecol flex="1"/></treecolgroup>
|
||||
</tree>
|
||||
<vbox flex="1">
|
||||
<button class="dialog" id="ReplaceWord" oncommand="ReplaceWord()" label="&ReplaceButton.label;"/>
|
||||
<button id="ReplaceWord" oncommand="ReplaceWord()" label="&ReplaceButton.label;"/>
|
||||
<spacer class="spacer"/>
|
||||
<button class="dialog" id="RemoveWord" oncommand="RemoveWord()" label="&RemoveButton.label;"/>
|
||||
<button id="RemoveWord" oncommand="RemoveWord()" label="&RemoveButton.label;"/>
|
||||
<spacer class="spacer"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="exit-dialog" id="close" label="&CloseButton.label;" default="true" oncommand="Close();"/>
|
||||
|
@ -26,7 +26,6 @@ var width;
|
||||
var height;
|
||||
var align;
|
||||
var shading;
|
||||
var dialog;
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
@ -44,15 +43,13 @@ function Startup()
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
dialog.heightInput = document.getElementById("height");
|
||||
dialog.widthInput = document.getElementById("width");
|
||||
dialog.leftAlign = document.getElementById("leftAlign");
|
||||
dialog.centerAlign = document.getElementById("centerAlign");
|
||||
dialog.rightAlign = document.getElementById("rightAlign");
|
||||
dialog.shading = document.getElementById("3dShading");
|
||||
dialog.pixelOrPercentMenulist = document.getElementById("pixelOrPercentMenulist");
|
||||
gDialog.heightInput = document.getElementById("height");
|
||||
gDialog.widthInput = document.getElementById("width");
|
||||
gDialog.leftAlign = document.getElementById("leftAlign");
|
||||
gDialog.centerAlign = document.getElementById("centerAlign");
|
||||
gDialog.rightAlign = document.getElementById("rightAlign");
|
||||
gDialog.shading = document.getElementById("3dShading");
|
||||
gDialog.pixelOrPercentMenulist = document.getElementById("pixelOrPercentMenulist");
|
||||
|
||||
// Make a copy to use for AdvancedEdit and onSaveDefault
|
||||
globalElement = hLineElement.cloneNode(false);
|
||||
@ -61,7 +58,7 @@ function Startup()
|
||||
InitDialog()
|
||||
|
||||
// SET FOCUS TO FIRST CONTROL
|
||||
SetTextboxFocus(dialog.widthInput);
|
||||
SetTextboxFocus(gDialog.widthInput);
|
||||
|
||||
// Resize window
|
||||
window.sizeToContent();
|
||||
@ -81,25 +78,25 @@ function InitDialog()
|
||||
}
|
||||
|
||||
// We will use "height" here and in UI
|
||||
dialog.heightInput.value = height;
|
||||
gDialog.heightInput.value = height;
|
||||
|
||||
// Get the width attribute of the element, stripping out "%"
|
||||
// This sets contents of menulist (adds pixel and percent menuitems elements)
|
||||
dialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, hLineElement, "width","pixelOrPercentMenulist");
|
||||
gDialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, hLineElement, "width","pixelOrPercentMenulist");
|
||||
|
||||
align = globalElement.getAttribute("align").toLowerCase();
|
||||
|
||||
dialog.centerAlign.checked = (align == "center" || !align);
|
||||
dialog.rightAlign.checked = (align == "right");
|
||||
dialog.leftAlign.checked = (align == "left");
|
||||
gDialog.centerAlign.checked = (align == "center" || !align);
|
||||
gDialog.rightAlign.checked = (align == "right");
|
||||
gDialog.leftAlign.checked = (align == "left");
|
||||
|
||||
// This is tricky! Since the "noshade" attribute doesn't always have a value,
|
||||
// we can't use getAttribute to figure out if it's set!
|
||||
// This gets the attribute NODE from the attributes NamedNodeMap
|
||||
if (globalElement.attributes.getNamedItem("noshade"))
|
||||
dialog.shading.checked = false;
|
||||
gDialog.shading.checked = false;
|
||||
else
|
||||
dialog.shading.checked = true;
|
||||
gDialog.shading.checked = true;
|
||||
|
||||
}
|
||||
|
||||
@ -160,21 +157,21 @@ function onSaveDefault()
|
||||
function ValidateData()
|
||||
{
|
||||
// Height is always pixels
|
||||
height = ValidateNumber(dialog.heightInput, null, 1, maxPixels,
|
||||
height = ValidateNumber(gDialog.heightInput, null, 1, maxPixels,
|
||||
globalElement, "size", false);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
||||
width = ValidateNumber(dialog.widthInput, dialog.pixelOrPercentMenulist, 1, maxPixels,
|
||||
width = ValidateNumber(gDialog.widthInput, gDialog.pixelOrPercentMenulist, 1, maxPixels,
|
||||
globalElement, "width", false);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
||||
align = "left";
|
||||
if (dialog.centerAlign.checked) {
|
||||
if (gDialog.centerAlign.checked) {
|
||||
// Don't write out default attribute
|
||||
align = "";
|
||||
} else if (dialog.rightAlign.checked) {
|
||||
} else if (gDialog.rightAlign.checked) {
|
||||
align = "right";
|
||||
}
|
||||
if (align)
|
||||
@ -182,7 +179,7 @@ function ValidateData()
|
||||
else
|
||||
globalElement.removeAttribute("align");
|
||||
|
||||
if (dialog.shading.checked) {
|
||||
if (gDialog.shading.checked) {
|
||||
shading = true;
|
||||
globalElement.removeAttribute("noshade");
|
||||
} else {
|
||||
|
@ -36,6 +36,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -52,13 +53,13 @@
|
||||
<grid>
|
||||
<columns><column/><column/><column /></columns>
|
||||
<rows>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" value="&widthEditField.label;" />
|
||||
<textbox class="narrow" id="width" flex="1" oninput="forceInteger('width')"/>
|
||||
<menulist id="pixelOrPercentMenulist" />
|
||||
<!-- menupopup and menuitems added by JS -->
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" value="&heightEditField.label;" />
|
||||
<textbox class="narrow" id="height" oninput="forceInteger('height')"/>
|
||||
<text class="label" value="&pixelsPopup.value;" />
|
||||
@ -77,7 +78,7 @@
|
||||
</groupbox>
|
||||
<spacer class="spacer"/>
|
||||
<hbox>
|
||||
<button class="dialog" id="SaveDefault" label="&saveSettings.label;"
|
||||
<button id="SaveDefault" label="&saveSettings.label;"
|
||||
oncommand="onSaveDefault()"
|
||||
tooltip="aTooltip" tooltiptext="&saveSettings.tooltip;" />
|
||||
<spacer flex="1"/>
|
||||
@ -85,5 +86,5 @@
|
||||
</hbox>
|
||||
<separator class="groove"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
@ -67,7 +67,7 @@ function initDialog(){
|
||||
//check for relative url
|
||||
if (!((srcInput.value.indexOf("http://") != -1) || (srcInput.value.indexOf("file://") != -1))){
|
||||
if (editorShell.editorDocument.location == "about:blank"){
|
||||
alert(GetString("ImapRelative"));
|
||||
alert(GetString("SaveToUseRelativeUrl"));
|
||||
window.close();
|
||||
//TODO: add option to save document now
|
||||
}
|
||||
@ -344,10 +344,3 @@ function deleteAreas(){
|
||||
return true;
|
||||
}
|
||||
|
||||
// This is contained in editor.js (should be in a common js file
|
||||
// I did not want to include the whole file so I copied the function here
|
||||
// It retrieves strings from editor string bundle
|
||||
function GetString(id)
|
||||
{
|
||||
return editorShell.GetString(id);
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://editor/skin/EdImageMap.css" type="text/css"?>
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
|
||||
<?xml-stylesheet href="chrome://editor/skin/" type="text/css"?>
|
||||
|
||||
|
@ -21,8 +21,6 @@
|
||||
* Dan Haddix
|
||||
*/
|
||||
|
||||
var dialog;
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
{
|
||||
@ -31,32 +29,30 @@ function Startup()
|
||||
|
||||
doSetOKCancel(onOK, onCancel); // Map OK/Cancel to relevant functions
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
dialog.urlInput = document.getElementById("urlInput");
|
||||
dialog.targetInput = document.getElementById("targetInput");
|
||||
dialog.altInput = document.getElementById("altInput");
|
||||
dialog.commonInput = document.getElementById("commonInput");
|
||||
gDialog.urlInput = document.getElementById("urlInput");
|
||||
gDialog.targetInput = document.getElementById("targetInput");
|
||||
gDialog.altInput = document.getElementById("altInput");
|
||||
gDialog.commonInput = document.getElementById("commonInput");
|
||||
|
||||
dialog.hsHref = window.arguments[0].getAttribute("hsHref");
|
||||
if (dialog.hsHref != '')
|
||||
dialog.urlInput.value = dialog.hsHref;
|
||||
gDialog.hsHref = window.arguments[0].getAttribute("hsHref");
|
||||
if (gDialog.hsHref != '')
|
||||
gDialog.urlInput.value = gDialog.hsHref;
|
||||
|
||||
dialog.hsAlt = window.arguments[0].getAttribute("hsAlt");
|
||||
if (dialog.hsAlt != '')
|
||||
dialog.altInput.value = dialog.hsAlt;
|
||||
gDialog.hsAlt = window.arguments[0].getAttribute("hsAlt");
|
||||
if (gDialog.hsAlt != '')
|
||||
gDialog.altInput.value = gDialog.hsAlt;
|
||||
|
||||
dialog.hsTarget = window.arguments[0].getAttribute("hsTarget");
|
||||
if (dialog.hsTarget != ''){
|
||||
dialog.targetInput.value = dialog.hsTarget;
|
||||
len = dialog.commonInput.length;
|
||||
gDialog.hsTarget = window.arguments[0].getAttribute("hsTarget");
|
||||
if (gDialog.hsTarget != ''){
|
||||
gDialog.targetInput.value = gDialog.hsTarget;
|
||||
len = gDialog.commonInput.length;
|
||||
for (i=0; i<len; i++){
|
||||
if (dialog.hsTarget == dialog.commonInput.options[i].value)
|
||||
dialog.commonInput.options[i].selected = "true";
|
||||
if (gDialog.hsTarget == gDialog.commonInput.options[i].value)
|
||||
gDialog.commonInput.options[i].selected = "true";
|
||||
}
|
||||
}
|
||||
|
||||
SetTextboxFocus(dialog.urlInput);
|
||||
SetTextboxFocus(gDialog.urlInput);
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
@ -64,9 +60,9 @@ function Startup()
|
||||
function onOK()
|
||||
{
|
||||
dump(window.arguments[0].id+"\n");
|
||||
window.arguments[0].setAttribute("hsHref", dialog.urlInput.value);
|
||||
window.arguments[0].setAttribute("hsAlt", dialog.altInput.value);
|
||||
window.arguments[0].setAttribute("hsTarget", dialog.targetInput.value);
|
||||
window.arguments[0].setAttribute("hsHref", gDialog.urlInput.value);
|
||||
window.arguments[0].setAttribute("hsAlt", gDialog.altInput.value);
|
||||
window.arguments[0].setAttribute("hsTarget", gDialog.targetInput.value);
|
||||
|
||||
SaveWindowLocation();
|
||||
|
||||
@ -74,7 +70,7 @@ function onOK()
|
||||
}
|
||||
|
||||
function changeTarget() {
|
||||
dialog.targetInput.value=dialog.commonInput.value;
|
||||
gDialog.targetInput.value=gDialog.commonInput.value;
|
||||
}
|
||||
|
||||
function chooseFile()
|
||||
@ -83,9 +79,9 @@ function chooseFile()
|
||||
|
||||
fileName = GetLocalFileURL("html");
|
||||
if (fileName && fileName != "") {
|
||||
dialog.urlInput.value = fileName;
|
||||
gDialog.urlInput.value = fileName;
|
||||
}
|
||||
|
||||
// Put focus into the input field
|
||||
SetTextboxFocus(dialog.urlInput);
|
||||
SetTextboxFocus(gDialog.urlInput);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical"
|
||||
>
|
||||
|
||||
@ -56,7 +57,7 @@
|
||||
|
||||
<textbox id="urlInput" class="MinWidth20em" value="http://"/>
|
||||
|
||||
<button class="dialog" id="Browse" oncommand="chooseFile()" label="&browseButton.label;"/>
|
||||
<button id="Browse" oncommand="chooseFile()" label="&browseButton.label;"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@ -82,7 +83,7 @@
|
||||
<text class="label" id="commonLabel" value="&commonFieldset.label;"/>
|
||||
|
||||
<menulist id="commonInput" oncommand="changeTarget()">
|
||||
<menupopup valign="middle">
|
||||
<menupopup align="center">
|
||||
<menuitem class="middle" value="" label="&none.value;"/>
|
||||
<menuitem class="middle" value="_self" label="&same.value;"/>
|
||||
<menuitem class="middle" value="_top" label="&whole.value;"/>
|
||||
@ -97,5 +98,5 @@
|
||||
</groupbox>
|
||||
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
@ -35,7 +35,6 @@ var imageElement;
|
||||
var imageMap = 0;
|
||||
var canRemoveImageMap = false;
|
||||
var imageMapDisabled = false;
|
||||
var dialog;
|
||||
var globalMap;
|
||||
var firstTimeOkUsed = true;
|
||||
var doAltTextError = false;
|
||||
@ -69,29 +68,26 @@ function Startup()
|
||||
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
|
||||
dialog.srcInput = document.getElementById( "srcInput" );
|
||||
dialog.altTextInput = document.getElementById( "altTextInput" );
|
||||
dialog.MoreFewerButton = document.getElementById( "MoreFewerButton" );
|
||||
dialog.MoreSection = document.getElementById( "MoreSection" );
|
||||
dialog.customSizeRadio = document.getElementById( "customSizeRadio" );
|
||||
dialog.actualSizeRadio = document.getElementById( "actualSizeRadio" );
|
||||
dialog.constrainCheckbox = document.getElementById( "constrainCheckbox" );
|
||||
dialog.widthInput = document.getElementById( "widthInput" );
|
||||
dialog.heightInput = document.getElementById( "heightInput" );
|
||||
dialog.widthUnitsMenulist = document.getElementById( "widthUnitsMenulist" );
|
||||
dialog.heightUnitsMenulist = document.getElementById( "heightUnitsMenulist" );
|
||||
dialog.imagelrInput = document.getElementById( "imageleftrightInput" );
|
||||
dialog.imagetbInput = document.getElementById( "imagetopbottomInput" );
|
||||
dialog.border = document.getElementById( "border" );
|
||||
dialog.alignTypeSelect = document.getElementById( "alignTypeSelect" );
|
||||
dialog.ImageHolder = document.getElementById( "preview-image-holder" );
|
||||
dialog.PreviewWidth = document.getElementById( "PreviewWidth" );
|
||||
dialog.PreviewHeight = document.getElementById( "PreviewHeight" );
|
||||
dialog.PreviewSize = document.getElementById( "PreviewSize" );
|
||||
dialog.PreviewImage = null;
|
||||
gDialog.srcInput = document.getElementById( "srcInput" );
|
||||
gDialog.altTextInput = document.getElementById( "altTextInput" );
|
||||
gDialog.MoreFewerButton = document.getElementById( "MoreFewerButton" );
|
||||
gDialog.MoreSection = document.getElementById( "MoreSection" );
|
||||
gDialog.customSizeRadio = document.getElementById( "customSizeRadio" );
|
||||
gDialog.actualSizeRadio = document.getElementById( "actualSizeRadio" );
|
||||
gDialog.constrainCheckbox = document.getElementById( "constrainCheckbox" );
|
||||
gDialog.widthInput = document.getElementById( "widthInput" );
|
||||
gDialog.heightInput = document.getElementById( "heightInput" );
|
||||
gDialog.widthUnitsMenulist = document.getElementById( "widthUnitsMenulist" );
|
||||
gDialog.heightUnitsMenulist = document.getElementById( "heightUnitsMenulist" );
|
||||
gDialog.imagelrInput = document.getElementById( "imageleftrightInput" );
|
||||
gDialog.imagetbInput = document.getElementById( "imagetopbottomInput" );
|
||||
gDialog.border = document.getElementById( "border" );
|
||||
gDialog.alignTypeSelect = document.getElementById( "alignTypeSelect" );
|
||||
gDialog.ImageHolder = document.getElementById( "preview-image-holder" );
|
||||
gDialog.PreviewWidth = document.getElementById( "PreviewWidth" );
|
||||
gDialog.PreviewHeight = document.getElementById( "PreviewHeight" );
|
||||
gDialog.PreviewSize = document.getElementById( "PreviewSize" );
|
||||
gDialog.PreviewImage = null;
|
||||
|
||||
// Get a single selected image element
|
||||
var tagName = "img"
|
||||
@ -129,23 +125,23 @@ function Startup()
|
||||
InitDialog();
|
||||
|
||||
// Save initial source URL
|
||||
gOriginalSrc = dialog.srcInput.value;
|
||||
gOriginalSrc = gDialog.srcInput.value;
|
||||
|
||||
// By default turn constrain on, but both width and height must be in pixels
|
||||
dialog.constrainCheckbox.checked =
|
||||
dialog.widthUnitsMenulist.selectedIndex == 0 &&
|
||||
dialog.heightUnitsMenulist.selectedIndex == 0;
|
||||
gDialog.constrainCheckbox.checked =
|
||||
gDialog.widthUnitsMenulist.selectedIndex == 0 &&
|
||||
gDialog.heightUnitsMenulist.selectedIndex == 0;
|
||||
|
||||
// Set SeeMore bool to the OPPOSITE of the current state,
|
||||
// which is automatically saved by using the 'persist="more"'
|
||||
// attribute on the MoreFewerButton button
|
||||
// onMoreFewer will toggle the state and redraw the dialog
|
||||
SeeMore = (dialog.MoreFewerButton.getAttribute("more") != "1");
|
||||
SeeMore = (gDialog.MoreFewerButton.getAttribute("more") != "1");
|
||||
|
||||
// Initialize widgets with image attributes in the case where the entire dialog isn't visible
|
||||
onMoreFewer(); // this call will initialize all widgets if entire dialog is visible
|
||||
onMoreFewer();
|
||||
|
||||
SetTextboxFocus(dialog.srcInput);
|
||||
SetTextboxFocus(gDialog.srcInput);
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
@ -157,7 +153,7 @@ function InitDialog()
|
||||
{
|
||||
// Set the controls to the image's attributes
|
||||
|
||||
dialog.srcInput.value = globalElement.getAttribute("src");
|
||||
gDialog.srcInput.value = globalElement.getAttribute("src");
|
||||
|
||||
// Set "Relativize" checkbox according to current URL state
|
||||
SetRelativeCheckbox();
|
||||
@ -165,7 +161,7 @@ function InitDialog()
|
||||
// Force loading of image from its source and show preview image
|
||||
LoadPreviewImage();
|
||||
|
||||
dialog.altTextInput.value = globalElement.getAttribute("alt");
|
||||
gDialog.altTextInput.value = globalElement.getAttribute("alt");
|
||||
|
||||
// setup the height and width widgets
|
||||
var width = InitPixelOrPercentMenulist(globalElement,
|
||||
@ -177,20 +173,20 @@ function InitDialog()
|
||||
|
||||
// Set actual radio button if both set values are the same as actual
|
||||
if (actualWidth && actualHeight)
|
||||
dialog.actualSizeRadio.checked = (width == actualWidth) && (height == actualHeight);
|
||||
gDialog.actualSizeRadio.checked = (width == actualWidth) && (height == actualHeight);
|
||||
else if ( !(width || height) )
|
||||
dialog.actualSizeRadio.checked = true;
|
||||
gDialog.actualSizeRadio.checked = true;
|
||||
|
||||
if (!dialog.actualSizeRadio.checked)
|
||||
dialog.customSizeRadio.checked = true;
|
||||
if (!gDialog.actualSizeRadio.checked)
|
||||
gDialog.customSizeRadio.checked = true;
|
||||
|
||||
dialog.widthInput.value = constrainWidth = width ? width : (actualWidth ? actualWidth : "");
|
||||
dialog.heightInput.value = constrainHeight = height ? height : (actualHeight ? actualHeight : "");
|
||||
gDialog.widthInput.value = constrainWidth = width ? width : (actualWidth ? actualWidth : "");
|
||||
gDialog.heightInput.value = constrainHeight = height ? height : (actualHeight ? actualHeight : "");
|
||||
|
||||
// set spacing editfields
|
||||
dialog.imagelrInput.value = globalElement.getAttribute("hspace");
|
||||
dialog.imagetbInput.value = globalElement.getAttribute("vspace");
|
||||
dialog.border.value = globalElement.getAttribute("border");
|
||||
gDialog.imagelrInput.value = globalElement.getAttribute("hspace");
|
||||
gDialog.imagetbInput.value = globalElement.getAttribute("vspace");
|
||||
gDialog.border.value = globalElement.getAttribute("border");
|
||||
|
||||
// Get alignment setting
|
||||
var align = globalElement.getAttribute("align");
|
||||
@ -205,10 +201,10 @@ function InitDialog()
|
||||
case "center":
|
||||
case "right":
|
||||
case "left":
|
||||
dialog.alignTypeSelect.value = align;
|
||||
gDialog.alignTypeSelect.value = align;
|
||||
break;
|
||||
default: // Default or "bottom"
|
||||
dialog.alignTypeSelect.value = "bottom";
|
||||
gDialog.alignTypeSelect.value = "bottom";
|
||||
}
|
||||
|
||||
// Get image map for image
|
||||
@ -217,7 +213,7 @@ function InitDialog()
|
||||
globalMap = imageMap;
|
||||
|
||||
// we want to force an update so initialize "wasEnableAll" to be the opposite of what the actual state is
|
||||
wasEnableAll = !IsValidImage(dialog.srcInput.value);
|
||||
wasEnableAll = !IsValidImage(gDialog.srcInput.value);
|
||||
doOverallEnabling();
|
||||
doDimensionEnabling();
|
||||
}
|
||||
@ -255,7 +251,7 @@ function chooseFile()
|
||||
if (gHaveDocumentUrl)
|
||||
fileName = MakeRelativeUrl(fileName);
|
||||
|
||||
dialog.srcInput.value = fileName;
|
||||
gDialog.srcInput.value = fileName;
|
||||
|
||||
SetRelativeCheckbox();
|
||||
doOverallEnabling();
|
||||
@ -263,16 +259,16 @@ function chooseFile()
|
||||
LoadPreviewImage();
|
||||
|
||||
// Put focus into the input field
|
||||
SetTextboxFocus(dialog.srcInput);
|
||||
SetTextboxFocus(gDialog.srcInput);
|
||||
}
|
||||
|
||||
function PreviewImageLoaded()
|
||||
{
|
||||
if (dialog.PreviewImage)
|
||||
if (gDialog.PreviewImage)
|
||||
{
|
||||
// Image loading has completed -- we can get actual width
|
||||
actualWidth = dialog.PreviewImage.naturalWidth;
|
||||
actualHeight = dialog.PreviewImage.naturalHeight;
|
||||
actualWidth = gDialog.PreviewImage.naturalWidth;
|
||||
actualHeight = gDialog.PreviewImage.naturalHeight;
|
||||
|
||||
if (actualWidth && actualHeight)
|
||||
{
|
||||
@ -289,32 +285,32 @@ function PreviewImageLoaded()
|
||||
height = gPreviewImageHeight;
|
||||
width = actualWidth * (gPreviewImageHeight / actualHeight);
|
||||
}
|
||||
dialog.PreviewImage.width = width;
|
||||
dialog.PreviewImage.height = height;
|
||||
gDialog.PreviewImage.width = width;
|
||||
gDialog.PreviewImage.height = height;
|
||||
|
||||
dialog.PreviewWidth.setAttribute("value", actualWidth);
|
||||
dialog.PreviewHeight.setAttribute("value", actualHeight);
|
||||
gDialog.PreviewWidth.setAttribute("value", actualWidth);
|
||||
gDialog.PreviewHeight.setAttribute("value", actualHeight);
|
||||
|
||||
dialog.PreviewSize.setAttribute("collapsed", "false");
|
||||
dialog.ImageHolder.setAttribute("collapsed", "false");
|
||||
gDialog.PreviewSize.setAttribute("collapsed", "false");
|
||||
gDialog.ImageHolder.setAttribute("collapsed", "false");
|
||||
|
||||
// Use values as start for constrain proportions
|
||||
}
|
||||
|
||||
if (dialog.actualSizeRadio.checked)
|
||||
if (gDialog.actualSizeRadio.checked)
|
||||
SetActualSize();
|
||||
}
|
||||
}
|
||||
|
||||
function LoadPreviewImage()
|
||||
{
|
||||
dialog.PreviewSize.setAttribute("collapsed", "true");
|
||||
gDialog.PreviewSize.setAttribute("collapsed", "true");
|
||||
|
||||
var imageSrc = TrimString(dialog.srcInput.value);
|
||||
var imageSrc = TrimString(gDialog.srcInput.value);
|
||||
if (!imageSrc)
|
||||
return;
|
||||
|
||||
if (IsValidImage(dialog.srcInput.value))
|
||||
if (IsValidImage(gDialog.srcInput.value))
|
||||
{
|
||||
try {
|
||||
// Remove the image URL from image cache so it loads fresh
|
||||
@ -343,28 +339,28 @@ function LoadPreviewImage()
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
if(dialog.PreviewImage)
|
||||
if(gDialog.PreviewImage)
|
||||
removeEventListener("load", PreviewImageLoaded, true);
|
||||
|
||||
if (dialog.ImageHolder.firstChild)
|
||||
dialog.ImageHolder.removeChild(dialog.ImageHolder.firstChild);
|
||||
if (gDialog.ImageHolder.firstChild)
|
||||
gDialog.ImageHolder.removeChild(gDialog.ImageHolder.firstChild);
|
||||
|
||||
dialog.PreviewImage = document.createElementNS("http://www.w3.org/1999/xhtml", "html:img");
|
||||
if(dialog.PreviewImage)
|
||||
gDialog.PreviewImage = document.createElementNS("http://www.w3.org/1999/xhtml", "html:img");
|
||||
if(gDialog.PreviewImage)
|
||||
{
|
||||
dialog.ImageHolder.appendChild(dialog.PreviewImage);
|
||||
dialog.PreviewImage.addEventListener("load", PreviewImageLoaded, true);
|
||||
dialog.PreviewImage.src = imageSrc;
|
||||
gDialog.ImageHolder.appendChild(gDialog.PreviewImage);
|
||||
gDialog.PreviewImage.addEventListener("load", PreviewImageLoaded, true);
|
||||
gDialog.PreviewImage.src = imageSrc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SetActualSize()
|
||||
{
|
||||
dialog.widthInput.value = actualWidth ? actualWidth : "";
|
||||
dialog.widthUnitsMenulist.selectedIndex = 0;
|
||||
dialog.heightInput.value = actualHeight ? actualHeight : "";
|
||||
dialog.heightUnitsMenulist.selectedIndex = 0;
|
||||
gDialog.widthInput.value = actualWidth ? actualWidth : "";
|
||||
gDialog.widthUnitsMenulist.selectedIndex = 0;
|
||||
gDialog.heightInput.value = actualHeight ? actualHeight : "";
|
||||
gDialog.heightUnitsMenulist.selectedIndex = 0;
|
||||
doDimensionEnabling();
|
||||
}
|
||||
|
||||
@ -378,7 +374,7 @@ function ChangeImageSrc()
|
||||
function doDimensionEnabling()
|
||||
{
|
||||
// Enabled only if "Custom" is checked
|
||||
var enable = (dialog.customSizeRadio.checked);
|
||||
var enable = (gDialog.customSizeRadio.checked);
|
||||
|
||||
// BUG 74145: After input field is disabled,
|
||||
// setting it enabled causes blinking caret to appear
|
||||
@ -392,8 +388,8 @@ function doDimensionEnabling()
|
||||
SetElementEnabledById( "widthUnitsMenulist", enable );
|
||||
|
||||
var constrainEnable = enable
|
||||
&& ( dialog.widthUnitsMenulist.selectedIndex == 0 )
|
||||
&& ( dialog.heightUnitsMenulist.selectedIndex == 0 );
|
||||
&& ( gDialog.widthUnitsMenulist.selectedIndex == 0 )
|
||||
&& ( gDialog.heightUnitsMenulist.selectedIndex == 0 );
|
||||
|
||||
SetElementEnabledById( "constrainCheckbox", constrainEnable );
|
||||
}
|
||||
@ -402,7 +398,7 @@ function doOverallEnabling()
|
||||
{
|
||||
// An image is "valid" if it loaded correctly in the preview window
|
||||
// or has the proper file extension
|
||||
var canEnableOk = IsValidImage(dialog.srcInput.value);
|
||||
var canEnableOk = IsValidImage(gDialog.srcInput.value);
|
||||
if ( wasEnableAll == canEnableOk )
|
||||
return;
|
||||
|
||||
@ -420,12 +416,12 @@ function ToggleConstrain()
|
||||
{
|
||||
// If just turned on, save the current width and height as basis for constrain ratio
|
||||
// Thus clicking on/off lets user say "Use these values as aspect ration"
|
||||
if (dialog.constrainCheckbox.checked && !dialog.constrainCheckbox.disabled
|
||||
&& (dialog.widthUnitsMenulist.selectedIndex == 0)
|
||||
&& (dialog.heightUnitsMenulist.selectedIndex == 0))
|
||||
if (gDialog.constrainCheckbox.checked && !gDialog.constrainCheckbox.disabled
|
||||
&& (gDialog.widthUnitsMenulist.selectedIndex == 0)
|
||||
&& (gDialog.heightUnitsMenulist.selectedIndex == 0))
|
||||
{
|
||||
constrainWidth = Number(dialog.widthInput.value.trimString());
|
||||
constrainHeight = Number(dialog.heightInput.value.trimString());
|
||||
constrainWidth = Number(gDialog.widthInput.value.trimString());
|
||||
constrainHeight = Number(gDialog.heightInput.value.trimString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,12 +439,12 @@ function constrainProportions( srcID, destID )
|
||||
forceInteger( srcID );
|
||||
|
||||
if (!actualWidth || !actualHeight ||
|
||||
!(dialog.constrainCheckbox.checked && !dialog.constrainCheckbox.disabled))
|
||||
!(gDialog.constrainCheckbox.checked && !gDialog.constrainCheckbox.disabled))
|
||||
return;
|
||||
|
||||
// double-check that neither width nor height is in percent mode; bail if so!
|
||||
if ( (dialog.widthUnitsMenulist.selectedIndex != 0)
|
||||
|| (dialog.heightUnitsMenulist.selectedIndex != 0) )
|
||||
if ( (gDialog.widthUnitsMenulist.selectedIndex != 0)
|
||||
|| (gDialog.heightUnitsMenulist.selectedIndex != 0) )
|
||||
return;
|
||||
|
||||
// This always uses the actual width and height ratios
|
||||
@ -502,7 +498,7 @@ function removeImageMap()
|
||||
// accessible to AdvancedEdit() [in EdDialogCommon.js]
|
||||
function ValidateData()
|
||||
{
|
||||
if ( !IsValidImage(dialog.srcInput.value))
|
||||
if ( !IsValidImage(gDialog.srcInput.value))
|
||||
{
|
||||
AlertWithTitle(null, GetString("MissingImageError"));
|
||||
window.focus();
|
||||
@ -511,17 +507,17 @@ function ValidateData()
|
||||
|
||||
//TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.:
|
||||
// We must convert to "file:///" or "http://" format else image doesn't load!
|
||||
var src = dialog.srcInput.value.trimString();
|
||||
var src = gDialog.srcInput.value.trimString();
|
||||
globalElement.setAttribute("src", src);
|
||||
|
||||
// Note: allow typing spaces,
|
||||
// Warn user if empty string just once per dialog session
|
||||
// but don't consider this a failure
|
||||
var alt = dialog.altTextInput.value;
|
||||
var alt = gDialog.altTextInput.value;
|
||||
if (doAltTextError && !alt)
|
||||
{
|
||||
AlertWithTitle(null, GetString("NoAltText"));
|
||||
SetTextboxFocus(dialog.altTextInput);
|
||||
SetTextboxFocus(gDialog.altTextInput);
|
||||
doAltTextError = false;
|
||||
return false;
|
||||
}
|
||||
@ -530,15 +526,15 @@ function ValidateData()
|
||||
var width = "";
|
||||
var height = "";
|
||||
|
||||
if (!dialog.actualSizeRadio.checked)
|
||||
if (!gDialog.actualSizeRadio.checked)
|
||||
{
|
||||
// Get user values for width and height
|
||||
width = ValidateNumber(dialog.widthInput, dialog.widthUnitsMenulist, 1, maxPixels,
|
||||
width = ValidateNumber(gDialog.widthInput, gDialog.widthUnitsMenulist, 1, maxPixels,
|
||||
globalElement, "width", false, true);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
||||
height = ValidateNumber(dialog.heightInput, dialog.heightUnitsMenulist, 1, maxPixels,
|
||||
height = ValidateNumber(gDialog.heightInput, gDialog.heightUnitsMenulist, 1, maxPixels,
|
||||
globalElement, "height", false, true);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
@ -566,18 +562,18 @@ function ValidateData()
|
||||
|
||||
// spacing attributes
|
||||
|
||||
ValidateNumber(dialog.imagelrInput, null, 0, maxPixels,
|
||||
ValidateNumber(gDialog.imagelrInput, null, 0, maxPixels,
|
||||
globalElement, "hspace", false, true, true);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
||||
ValidateNumber(dialog.imagetbInput, null, 0, maxPixels,
|
||||
ValidateNumber(gDialog.imagetbInput, null, 0, maxPixels,
|
||||
globalElement, "vspace", false, true);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
||||
// note this is deprecated and should be converted to stylesheets
|
||||
ValidateNumber(dialog.border, null, 0, maxPixels,
|
||||
ValidateNumber(gDialog.border, null, 0, maxPixels,
|
||||
globalElement, "border", false, true);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
@ -586,13 +582,13 @@ function ValidateData()
|
||||
// Note that the attributes "left" and "right" are opposite
|
||||
// of what we use in the UI, which describes where the TEXT wraps,
|
||||
// not the image location (which is what the HTML describes)
|
||||
switch ( dialog.alignTypeSelect.value )
|
||||
switch ( gDialog.alignTypeSelect.value )
|
||||
{
|
||||
case "top":
|
||||
case "center":
|
||||
case "right":
|
||||
case "left":
|
||||
globalElement.setAttribute( "align", dialog.alignTypeSelect.value );
|
||||
globalElement.setAttribute( "align", gDialog.alignTypeSelect.value );
|
||||
break;
|
||||
default:
|
||||
globalElement.removeAttribute( "align" );
|
||||
|
@ -39,6 +39,7 @@
|
||||
xmlns ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical"
|
||||
id="imagedialog"
|
||||
>
|
||||
|
@ -34,6 +34,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical" flex="1">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -60,5 +61,5 @@
|
||||
<spacer class="spacer"/>
|
||||
<separator class="groove"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorInsertChars.dtd">
|
||||
|
||||
<window class="dialog" title="&windowTitle.label;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
|
@ -30,7 +30,6 @@ var maxColumns = 10000;
|
||||
var maxPixels = 10000;
|
||||
var rows;
|
||||
var columns;
|
||||
var dialog;
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
@ -47,13 +46,11 @@ function Startup()
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
dialog.rowsInput = document.getElementById("rowsInput");
|
||||
dialog.columnsInput = document.getElementById("columnsInput");
|
||||
dialog.widthInput = document.getElementById("widthInput");
|
||||
dialog.borderInput = document.getElementById("borderInput");
|
||||
dialog.widthPixelOrPercentMenulist = document.getElementById("widthPixelOrPercentMenulist");
|
||||
gDialog.rowsInput = document.getElementById("rowsInput");
|
||||
gDialog.columnsInput = document.getElementById("columnsInput");
|
||||
gDialog.widthInput = document.getElementById("widthInput");
|
||||
gDialog.borderInput = document.getElementById("borderInput");
|
||||
gDialog.widthPixelOrPercentMenulist = document.getElementById("widthPixelOrPercentMenulist");
|
||||
|
||||
// Make a copy to use for AdvancedEdit
|
||||
globalElement = tableElement.cloneNode(false);
|
||||
@ -66,14 +63,14 @@ function Startup()
|
||||
// so don't put them in InitDialog(),
|
||||
// else the user's values will be trashed when they use
|
||||
// the Advanced Edit dialog
|
||||
dialog.rowsInput.value = 2;
|
||||
dialog.columnsInput.value = 2;
|
||||
gDialog.rowsInput.value = 2;
|
||||
gDialog.columnsInput.value = 2;
|
||||
|
||||
// If no default value on the width, set to 100%
|
||||
if (dialog.widthInput.value.length == 0)
|
||||
if (gDialog.widthInput.value.length == 0)
|
||||
{
|
||||
dialog.widthInput.value = "100";
|
||||
dialog.widthPixelOrPercentMenulist.selectedIndex = 1;
|
||||
gDialog.widthInput.value = "100";
|
||||
gDialog.widthPixelOrPercentMenulist.selectedIndex = 1;
|
||||
}
|
||||
|
||||
SetTextboxFocusById("rowsInput");
|
||||
@ -89,8 +86,8 @@ function InitDialog()
|
||||
// Get default attributes set on the created table:
|
||||
// Get the width attribute of the element, stripping out "%"
|
||||
// This sets contents of menu combobox list
|
||||
dialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, tableElement, "width", "widthPixelOrPercentMenulist", gPercent);
|
||||
dialog.borderInput.value = globalElement.getAttribute("border");
|
||||
gDialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, tableElement, "width", "widthPixelOrPercentMenulist", gPercent);
|
||||
gDialog.borderInput.value = globalElement.getAttribute("border");
|
||||
}
|
||||
|
||||
function ChangeRowOrColumn(id)
|
||||
@ -99,10 +96,10 @@ function ChangeRowOrColumn(id)
|
||||
forceInteger(id);
|
||||
|
||||
// Enable OK only if both rows and columns have a value > 0
|
||||
SetElementEnabledById("ok", dialog.rowsInput.value.length > 0 &&
|
||||
dialog.rowsInput.value > 0 &&
|
||||
dialog.columnsInput.value.length > 0 &&
|
||||
dialog.columnsInput.value > 0);
|
||||
SetElementEnabledById("ok", gDialog.rowsInput.value.length > 0 &&
|
||||
gDialog.rowsInput.value > 0 &&
|
||||
gDialog.columnsInput.value.length > 0 &&
|
||||
gDialog.columnsInput.value > 0);
|
||||
}
|
||||
|
||||
|
||||
@ -110,20 +107,20 @@ function ChangeRowOrColumn(id)
|
||||
// Set attributes on globalElement so they can be accessed by AdvancedEdit()
|
||||
function ValidateData()
|
||||
{
|
||||
rows = ValidateNumber(dialog.rowsInput, null, 1, maxRows, null, null, true)
|
||||
rows = ValidateNumber(gDialog.rowsInput, null, 1, maxRows, null, null, true)
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
||||
columns = ValidateNumber(dialog.columnsInput, null, 1, maxColumns, null, null, true)
|
||||
columns = ValidateNumber(gDialog.columnsInput, null, 1, maxColumns, null, null, true)
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
||||
// Set attributes: NOTE: These may be empty strings (last param = false)
|
||||
ValidateNumber(dialog.borderInput, null, 0, maxPixels, globalElement, "border", false);
|
||||
ValidateNumber(gDialog.borderInput, null, 0, maxPixels, globalElement, "border", false);
|
||||
// TODO: Deal with "BORDER" without value issue
|
||||
if (gValidationError) return false;
|
||||
|
||||
ValidateNumber(dialog.widthInput, dialog.widthPixelOrPercentMenulist,
|
||||
ValidateNumber(gDialog.widthInput, gDialog.widthPixelOrPercentMenulist,
|
||||
1, maxPixels, globalElement, "width", false);
|
||||
if (gValidationError)
|
||||
return false;
|
||||
|
@ -36,6 +36,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
persist="screenX screenY"
|
||||
orient="vertical">
|
||||
|
||||
@ -50,19 +51,23 @@
|
||||
<popupset id="aTooltipSet" />
|
||||
<groupbox orient="vertical"><caption label="&size.label;"/>
|
||||
<grid>
|
||||
<columns><column/><column/><column/></columns>
|
||||
<columns>
|
||||
<column flex="1"/>
|
||||
<column flex="1"/>
|
||||
<column flex="6"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="middle" text-align="right" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label align-right" text-align="right" value="&numRowsEditField.label;" />
|
||||
<textbox class="narrow" id="rowsInput" oninput="ChangeRowOrColumn(this.id)" />
|
||||
<spacer/>
|
||||
</row>
|
||||
<row valign="middle" text-align="right" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label align-right" value="&numColumnsEditField.label;" />
|
||||
<textbox class="narrow" id="columnsInput" oninput="ChangeRowOrColumn(this.id)" />
|
||||
<spacer/>
|
||||
</row>
|
||||
<row valign="middle" text-align="right" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label align-right" value="&widthEditField.label;" />
|
||||
<textbox class="narrow" id="widthInput" oninput="forceInteger(this.id)" />
|
||||
<menulist id="widthPixelOrPercentMenulist"><menupopup/></menulist>
|
||||
@ -73,7 +78,7 @@
|
||||
<spacer class="spacer"/>
|
||||
</groupbox>
|
||||
<spacer class="spacer"/>
|
||||
<hbox valign="middle" autostretch="never">
|
||||
<hbox align="center">
|
||||
<text class="label align-right" text-align="right" value="&borderEditField.label;"
|
||||
tooltip="aTooltip" tooltiptext="&borderEditField.tooltip;" />
|
||||
<textbox class="narrow" id="borderInput" oninput="forceInteger(this.id)" />
|
||||
@ -82,5 +87,5 @@
|
||||
<!-- from EdDialogOverlay -->
|
||||
<vbox id="AdvancedEdit"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
@ -34,7 +34,6 @@ var gHaveHeadings = false;
|
||||
var gCanChangeHeadingSelected = true;
|
||||
var gCanChangeAnchorSelected = true;
|
||||
var gHaveDocumentUrl = false;
|
||||
var dialog;
|
||||
|
||||
// NOTE: Use "href" instead of "a" to distinguish from Named Anchor
|
||||
// The returned node is has an "a" tagName
|
||||
@ -48,24 +47,16 @@ function Startup()
|
||||
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Message was wrapped in a <label> or <div>, so actual text is a child text node
|
||||
dialog.linkTextCaption = document.getElementById("linkTextCaption");
|
||||
dialog.linkTextMessage = document.getElementById("linkTextMessage");
|
||||
dialog.linkTextInput = document.getElementById("linkTextInput");
|
||||
dialog.hrefInput = document.getElementById("hrefInput");
|
||||
dialog.NamedAnchorList = document.getElementById("NamedAnchorList");
|
||||
dialog.HeadingsList = document.getElementById("HeadingsList");
|
||||
dialog.MoreSection = document.getElementById("MoreSection");
|
||||
dialog.MoreFewerButton = document.getElementById("MoreFewerButton");
|
||||
dialog.AdvancedEditSection = document.getElementById("AdvancedEdit");
|
||||
gDialog.linkTextCaption = document.getElementById("linkTextCaption");
|
||||
gDialog.linkTextMessage = document.getElementById("linkTextMessage");
|
||||
gDialog.linkTextInput = document.getElementById("linkTextInput");
|
||||
gDialog.hrefInput = document.getElementById("hrefInput");
|
||||
gDialog.NamedAnchorList = document.getElementById("NamedAnchorList");
|
||||
gDialog.HeadingsList = document.getElementById("HeadingsList");
|
||||
gDialog.MoreSection = document.getElementById("MoreSection");
|
||||
gDialog.MoreFewerButton = document.getElementById("MoreFewerButton");
|
||||
gDialog.AdvancedEditSection = document.getElementById("AdvancedEdit");
|
||||
|
||||
var selection = editorShell.editorSelection;
|
||||
if (selection)
|
||||
@ -151,10 +142,10 @@ function Startup()
|
||||
if (insertLinkAtCaret)
|
||||
{
|
||||
// Groupbox caption:
|
||||
dialog.linkTextCaption.setAttribute("label", GetString("LinkText"));
|
||||
gDialog.linkTextCaption.setAttribute("label", GetString("LinkText"));
|
||||
|
||||
// Message above input field:
|
||||
dialog.linkTextMessage.setAttribute("label", GetString("EnterLinkText"));
|
||||
gDialog.linkTextMessage.setAttribute("value", GetString("EnterLinkText"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -184,18 +175,18 @@ function Startup()
|
||||
// Set "caption" for link source and the source text or image URL
|
||||
if (imageElement)
|
||||
{
|
||||
dialog.linkTextCaption.setAttribute("label",GetString("LinkImage"));
|
||||
gDialog.linkTextCaption.setAttribute("label", GetString("LinkImage"));
|
||||
// Link source string is the source URL of image
|
||||
// TODO: THIS DOESN'T HANDLE MULTIPLE SELECTED IMAGES!
|
||||
dialog.linkTextMessage.setAttribute("value",imageElement.src);
|
||||
gDialog.linkTextMessage.setAttribute("value", imageElement.src);
|
||||
} else {
|
||||
dialog.linkTextCaption.setAttribute("label",GetString("LinkText"));
|
||||
gDialog.linkTextCaption.setAttribute("label", GetString("LinkText"));
|
||||
if (selectedText)
|
||||
{
|
||||
// Use just the first 60 characters and add "..."
|
||||
dialog.linkTextMessage.setAttribute("value",TruncateStringAtWordEnd(ReplaceWhitespace(selectedText, " "), 60, true));
|
||||
gDialog.linkTextMessage.setAttribute("value", TruncateStringAtWordEnd(ReplaceWhitespace(selectedText, " "), 60, true));
|
||||
} else {
|
||||
dialog.linkTextMessage.setAttribute("value",GetString("MixedSelection"));
|
||||
gDialog.linkTextMessage.setAttribute("value", GetString("MixedSelection"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -215,19 +206,19 @@ function Startup()
|
||||
// Search for a URI pattern in the selected text
|
||||
// as candidate href
|
||||
selectedText = TrimString(selectedText);
|
||||
if (!dialog.hrefInput.value && TextIsURI(selectedText))
|
||||
dialog.hrefInput.value = selectedText;
|
||||
if (!gDialog.hrefInput.value && TextIsURI(selectedText))
|
||||
gDialog.hrefInput.value = selectedText;
|
||||
|
||||
// Set initial focus
|
||||
if (insertLinkAtCaret) {
|
||||
// We will be using the HREF inputbox, so text message
|
||||
SetTextboxFocus(dialog.linkTextInput);
|
||||
SetTextboxFocus(gDialog.linkTextInput);
|
||||
} else {
|
||||
SetTextboxFocus(dialog.hrefInput);
|
||||
SetTextboxFocus(gDialog.hrefInput);
|
||||
|
||||
// We will not insert a new link at caret, so remove link text input field
|
||||
dialog.linkTextInput.setAttribute("hidden","true");
|
||||
dialog.linkTextInput = null;
|
||||
gDialog.linkTextInput.setAttribute("hidden", "true");
|
||||
gDialog.linkTextInput = null;
|
||||
}
|
||||
|
||||
InitMoreFewer();
|
||||
@ -245,7 +236,7 @@ function InitDialog()
|
||||
{
|
||||
// Must use getAttribute, not "globalElement.href",
|
||||
// or foreign chars aren't coverted correctly!
|
||||
dialog.hrefInput.value = globalElement.getAttribute("href");
|
||||
gDialog.hrefInput.value = globalElement.getAttribute("href");
|
||||
|
||||
// Set "Relativize" checkbox according to current URL state
|
||||
SetRelativeCheckbox();
|
||||
@ -254,20 +245,20 @@ function InitDialog()
|
||||
function chooseFile()
|
||||
{
|
||||
// Get a local file, converted into URL format
|
||||
var fileName = GetLocalFileURL("html,img");
|
||||
var fileName = GetLocalFileURL("html, img");
|
||||
if (fileName)
|
||||
{
|
||||
// Always try to relativize local file URLs
|
||||
if (gHaveDocumentUrl)
|
||||
fileName = MakeRelativeUrl(fileName);
|
||||
|
||||
dialog.hrefInput.value = fileName;
|
||||
gDialog.hrefInput.value = fileName;
|
||||
|
||||
SetRelativeCheckbox();
|
||||
doEnabling();
|
||||
}
|
||||
// Put focus into the input field
|
||||
SetTextboxFocus(dialog.hrefInput);
|
||||
SetTextboxFocus(gDialog.hrefInput);
|
||||
}
|
||||
|
||||
function FillListboxes()
|
||||
@ -278,14 +269,14 @@ function FillListboxes()
|
||||
if (NamedAnchorCount > 0)
|
||||
{
|
||||
for (var i = 0; i < NamedAnchorCount; i++)
|
||||
AppendStringToTreelist(dialog.NamedAnchorList, NamedAnchorNodeList.item(i).name);
|
||||
AppendStringToTreelist(gDialog.NamedAnchorList, NamedAnchorNodeList.item(i).name);
|
||||
|
||||
gHaveNamedAnchors = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Message to tell user there are none
|
||||
item = AppendStringToTreelistById(dialog.NamedAnchorList, "NoNamedAnchors");
|
||||
item = AppendStringToTreelistById(gDialog.NamedAnchorList, "NoNamedAnchors");
|
||||
if (item) item.setAttribute("disabled", "true");
|
||||
}
|
||||
var firstHeading = true;
|
||||
@ -316,7 +307,7 @@ function FillListboxes()
|
||||
// Append "_" to any name already in the list
|
||||
if (GetExistingHeadingIndex(text) > -1)
|
||||
text += "_";
|
||||
AppendStringToTreelist(dialog.HeadingsList, text);
|
||||
AppendStringToTreelist(gDialog.HeadingsList, text);
|
||||
|
||||
// Save nodes in an array so we can create anchor node under it later
|
||||
if (!HNodeArray)
|
||||
@ -331,7 +322,7 @@ function FillListboxes()
|
||||
gHaveHeadings = true;
|
||||
} else {
|
||||
// Message to tell user there are none
|
||||
item = AppendStringToTreelistById(dialog.HeadingsList, "NoHeadings");
|
||||
item = AppendStringToTreelistById(gDialog.HeadingsList, "NoHeadings");
|
||||
if (item) item.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
@ -339,7 +330,7 @@ function FillListboxes()
|
||||
function doEnabling()
|
||||
{
|
||||
// We disable Ok button when there's no href text only if inserting a new link
|
||||
var enable = insertNew ? (dialog.hrefInput.value.trimString().length > 0) : true;
|
||||
var enable = insertNew ? (gDialog.hrefInput.value.trimString().length > 0) : true;
|
||||
|
||||
SetElementEnabledById( "ok", enable);
|
||||
}
|
||||
@ -363,10 +354,10 @@ function ChangeLocation()
|
||||
|
||||
function GetExistingHeadingIndex(text)
|
||||
{
|
||||
var len = dialog.HeadingsList.getAttribute("length");
|
||||
var len = gDialog.HeadingsList.getAttribute("length");
|
||||
for (var i=0; i < len; i++)
|
||||
{
|
||||
if (GetTreelistValueAt(dialog.HeadingsList, i) == text)
|
||||
if (GetTreelistValueAt(gDialog.HeadingsList, i) == text)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
@ -380,7 +371,7 @@ function SelectNamedAnchor()
|
||||
{
|
||||
// Prevent ChangeLocation() from unselecting the list
|
||||
gClearListSelections = false;
|
||||
dialog.hrefInput.value = "#"+GetSelectedTreelistValue(dialog.NamedAnchorList);
|
||||
gDialog.hrefInput.value = "#"+GetSelectedTreelistValue(gDialog.NamedAnchorList);
|
||||
gClearListSelections = true;
|
||||
|
||||
SetRelativeCheckbox();
|
||||
@ -402,7 +393,7 @@ function SelectHeading()
|
||||
if (gHaveHeadings)
|
||||
{
|
||||
gClearListSelections = false;
|
||||
dialog.hrefInput.value = "#"+GetSelectedTreelistValue(dialog.HeadingsList);
|
||||
gDialog.hrefInput.value = "#"+GetSelectedTreelistValue(gDialog.HeadingsList);
|
||||
gClearListSelections = true;
|
||||
|
||||
SetRelativeCheckbox();
|
||||
@ -419,7 +410,7 @@ function UnselectNamedAnchor()
|
||||
{
|
||||
// Prevent recursive calling of SelectNamedAnchor()
|
||||
gCanChangeAnchorSelected = false;
|
||||
dialog.NamedAnchorList.selectedIndex = -1;
|
||||
gDialog.NamedAnchorList.selectedIndex = -1;
|
||||
gCanChangeAnchorSelected = true;
|
||||
}
|
||||
|
||||
@ -427,7 +418,7 @@ function UnselectHeadings()
|
||||
{
|
||||
// Prevent recursive calling of SelectHeading()
|
||||
gCanChangeHeadingSelected = false;
|
||||
dialog.HeadingsList.selectedIndex = -1;
|
||||
gDialog.HeadingsList.selectedIndex = -1;
|
||||
gCanChangeHeadingSelected = true;
|
||||
}
|
||||
|
||||
@ -435,7 +426,7 @@ function UnselectHeadings()
|
||||
// Set attributes on globalElement so they can be accessed by AdvancedEdit()
|
||||
function ValidateData()
|
||||
{
|
||||
href = dialog.hrefInput.value.trimString();
|
||||
href = gDialog.hrefInput.value.trimString();
|
||||
if (href)
|
||||
{
|
||||
// Set the HREF directly on the editor document's anchor node
|
||||
@ -449,11 +440,11 @@ function ValidateData()
|
||||
ShowInputErrorMessage(GetString("EmptyHREFError"));
|
||||
return false;
|
||||
}
|
||||
if (dialog.linkTextInput)
|
||||
if (gDialog.linkTextInput)
|
||||
{
|
||||
// The text we will insert isn't really an attribute,
|
||||
// but it makes sense to validate it
|
||||
newLinkText = TrimString(dialog.linkTextInput.value);
|
||||
newLinkText = TrimString(gDialog.linkTextInput.value);
|
||||
if (!newLinkText)
|
||||
{
|
||||
if (href)
|
||||
@ -461,7 +452,7 @@ function ValidateData()
|
||||
else
|
||||
{
|
||||
ShowInputErrorMessage(GetString("EmptyLinkTextError"));
|
||||
SetTextboxFocus(dialog.linkTextInput);
|
||||
SetTextboxFocus(gDialog.linkTextInput);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -31,11 +31,11 @@
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorLinkProperties.dtd">
|
||||
|
||||
<window title="&windowTitle.label;"
|
||||
class="dialog"
|
||||
<window class="dialog" title="&windowTitle.label;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical" >
|
||||
|
||||
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
@ -56,19 +56,17 @@
|
||||
|
||||
<groupbox orient="vertical"><caption label="&LinkURLBox.label;"/>
|
||||
<text class="label" value="&LinkURLEditField.label;"/>
|
||||
<hbox autostretch="never" valign="middle">
|
||||
<textbox id="hrefInput" flex="1" style="min-width: 18em" oninput="ChangeLocation()"/>
|
||||
</hbox>
|
||||
<hbox autostretch="never" valign="middle">
|
||||
<textbox id="hrefInput" flex="1" style="min-width: 18em" oninput="ChangeLocation()"/>
|
||||
<hbox align="center">
|
||||
<!-- from EdDialogOverlay.xul 'for' identifies the textfield to get URL from -->
|
||||
<checkbox id="MakeRelativeCheckbox" for="hrefInput"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="dialog" id="ChooseFile"/>
|
||||
<button id="ChooseFile"/>
|
||||
</hbox>
|
||||
<html class="wrap" flex="1" id="RemoveLinkMsg" style="margin-bottom: 7px">&RemoveLinkMsg.label;</html>
|
||||
<spacer class="smallspacer"/>
|
||||
<hbox autostretch="never">
|
||||
<button class="dialog" id="MoreFewerButton" oncommand="onMoreFewer()" persist="more"/>
|
||||
<hbox align="start">
|
||||
<button id="MoreFewerButton" oncommand="onMoreFewer()" persist="more"/>
|
||||
</hbox>
|
||||
<spacer class="spacer"/>
|
||||
<vbox id="MoreSection">
|
||||
|
@ -28,29 +28,24 @@ var ListElement;
|
||||
var originalListType = "";
|
||||
var ListType = "";
|
||||
var MixedListSelection = false;
|
||||
var dialog;
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
{
|
||||
if (!InitEditorShell())
|
||||
return;
|
||||
dialog = new Object;
|
||||
if (!dialog) {
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
dialog.ListTypeList = document.getElementById("ListType");
|
||||
dialog.BulletStyleList = document.getElementById("BulletStyle");
|
||||
dialog.BulletStyleLabel = document.getElementById("BulletStyleLabel");
|
||||
dialog.StartingNumberInput = document.getElementById("StartingNumber");
|
||||
dialog.StartingNumberLabel = document.getElementById("StartingNumberLabel");
|
||||
dialog.AdvancedEditButton = document.getElementById("AdvancedEditButton1");
|
||||
dialog.RadioGroup = document.getElementById("RadioGroup");
|
||||
dialog.ChangeAllRadio = document.getElementById("ChangeAll");
|
||||
dialog.ChangeSelectedRadio = document.getElementById("ChangeSelected");
|
||||
gDialog.ListTypeList = document.getElementById("ListType");
|
||||
gDialog.BulletStyleList = document.getElementById("BulletStyle");
|
||||
gDialog.BulletStyleLabel = document.getElementById("BulletStyleLabel");
|
||||
gDialog.StartingNumberInput = document.getElementById("StartingNumber");
|
||||
gDialog.StartingNumberLabel = document.getElementById("StartingNumberLabel");
|
||||
gDialog.AdvancedEditButton = document.getElementById("AdvancedEditButton1");
|
||||
gDialog.RadioGroup = document.getElementById("RadioGroup");
|
||||
gDialog.ChangeAllRadio = document.getElementById("ChangeAll");
|
||||
gDialog.ChangeSelectedRadio = document.getElementById("ChangeSelected");
|
||||
|
||||
// Try to get an existing list(s)
|
||||
var mixedObj = new Object;
|
||||
@ -66,21 +61,21 @@ function Startup()
|
||||
globalElement = ListElement.cloneNode(false);
|
||||
|
||||
// Show extra options for changing entire list if we have one already.
|
||||
dialog.RadioGroup.setAttribute("collapsed", ListElement ? "false" : "true");
|
||||
gDialog.RadioGroup.setAttribute("collapsed", ListElement ? "false" : "true");
|
||||
if (ListElement)
|
||||
{
|
||||
// Radio button index is persistant
|
||||
if (dialog.RadioGroup.getAttribute("index") == "1")
|
||||
dialog.ChangeSelectedRadio.checked = true;
|
||||
if (gDialog.RadioGroup.getAttribute("index") == "1")
|
||||
gDialog.ChangeSelectedRadio.checked = true;
|
||||
else
|
||||
dialog.ChangeAllRadio.checked = true;
|
||||
gDialog.ChangeAllRadio.checked = true;
|
||||
}
|
||||
|
||||
InitDialog();
|
||||
|
||||
originalListType = ListType;
|
||||
|
||||
dialog.ListTypeList.focus();
|
||||
gDialog.ListTypeList.focus();
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
@ -96,9 +91,9 @@ function InitDialog()
|
||||
ListType = "";
|
||||
|
||||
BuildBulletStyleList();
|
||||
dialog.StartingNumberInput.value = "";
|
||||
gDialog.StartingNumberInput.value = "";
|
||||
|
||||
var type = globalElement.getAttribute("type");
|
||||
var type = globalElement ? globalElement.getAttribute("type") : null;
|
||||
|
||||
var index = 0;
|
||||
if (ListType == "ul")
|
||||
@ -134,90 +129,90 @@ function InitDialog()
|
||||
index = 5;
|
||||
break;
|
||||
}
|
||||
dialog.StartingNumberInput.value = globalElement.getAttribute("start");
|
||||
gDialog.StartingNumberInput.value = globalElement.getAttribute("start");
|
||||
}
|
||||
dialog.BulletStyleList.selectedIndex = index;
|
||||
gDialog.BulletStyleList.selectedIndex = index;
|
||||
}
|
||||
|
||||
function BuildBulletStyleList()
|
||||
{
|
||||
ClearMenulist(dialog.BulletStyleList);
|
||||
ClearMenulist(gDialog.BulletStyleList);
|
||||
var label;
|
||||
|
||||
if (ListType == "ul")
|
||||
{
|
||||
dialog.BulletStyleList.removeAttribute("disabled");
|
||||
dialog.BulletStyleLabel.removeAttribute("disabled");
|
||||
dialog.StartingNumberInput.setAttribute("disabled", "true");
|
||||
dialog.StartingNumberLabel.setAttribute("disabled", "true");
|
||||
gDialog.BulletStyleList.removeAttribute("disabled");
|
||||
gDialog.BulletStyleLabel.removeAttribute("disabled");
|
||||
gDialog.StartingNumberInput.setAttribute("disabled", "true");
|
||||
gDialog.StartingNumberLabel.setAttribute("disabled", "true");
|
||||
|
||||
label = GetString("BulletStyle");
|
||||
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"Automatic");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"SolidCircle");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"OpenCircle");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"SolidSquare");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"Automatic");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"SolidCircle");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"OpenCircle");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"SolidSquare");
|
||||
|
||||
dialog.BulletStyleList.selectedIndex = BulletStyleIndex;
|
||||
dialog.ListTypeList.selectedIndex = 1;
|
||||
gDialog.BulletStyleList.selectedIndex = BulletStyleIndex;
|
||||
gDialog.ListTypeList.selectedIndex = 1;
|
||||
}
|
||||
else if (ListType == "ol")
|
||||
{
|
||||
dialog.BulletStyleList.removeAttribute("disabled");
|
||||
dialog.BulletStyleLabel.removeAttribute("disabled");
|
||||
dialog.StartingNumberInput.removeAttribute("disabled");
|
||||
dialog.StartingNumberLabel.removeAttribute("disabled");
|
||||
gDialog.BulletStyleList.removeAttribute("disabled");
|
||||
gDialog.BulletStyleLabel.removeAttribute("disabled");
|
||||
gDialog.StartingNumberInput.removeAttribute("disabled");
|
||||
gDialog.StartingNumberLabel.removeAttribute("disabled");
|
||||
label = GetString("NumberStyle");
|
||||
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"Automatic");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"Style_1");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"Style_I");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"Style_i");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"Style_A");
|
||||
AppendStringToMenulistById(dialog.BulletStyleList,"Style_a");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"Automatic");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"Style_1");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"Style_I");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"Style_i");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"Style_A");
|
||||
AppendStringToMenulistById(gDialog.BulletStyleList,"Style_a");
|
||||
|
||||
dialog.BulletStyleList.selectedIndex = NumberStyleIndex;
|
||||
dialog.ListTypeList.selectedIndex = 2;
|
||||
gDialog.BulletStyleList.selectedIndex = NumberStyleIndex;
|
||||
gDialog.ListTypeList.selectedIndex = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.BulletStyleList.setAttribute("disabled", "true");
|
||||
dialog.BulletStyleLabel.setAttribute("disabled", "true");
|
||||
dialog.StartingNumberInput.setAttribute("disabled", "true");
|
||||
dialog.StartingNumberLabel.setAttribute("disabled", "true");
|
||||
gDialog.BulletStyleList.setAttribute("disabled", "true");
|
||||
gDialog.BulletStyleLabel.setAttribute("disabled", "true");
|
||||
gDialog.StartingNumberInput.setAttribute("disabled", "true");
|
||||
gDialog.StartingNumberLabel.setAttribute("disabled", "true");
|
||||
|
||||
if (ListType == "dl")
|
||||
dialog.ListTypeList.selectedIndex = 3;
|
||||
gDialog.ListTypeList.selectedIndex = 3;
|
||||
else
|
||||
{
|
||||
// No list or mixed selection that starts outside a list
|
||||
// ??? Setting index to 0 fails to draw menulist correctly!
|
||||
dialog.ListTypeList.selectedIndex = 1;
|
||||
dialog.ListTypeList.selectedIndex = 0;
|
||||
gDialog.ListTypeList.selectedIndex = 1;
|
||||
gDialog.ListTypeList.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable advanced edit button if changing to "normal"
|
||||
if (ListType)
|
||||
dialog.AdvancedEditButton.removeAttribute("disabled");
|
||||
gDialog.AdvancedEditButton.removeAttribute("disabled");
|
||||
else
|
||||
dialog.AdvancedEditButton.setAttribute("disabled","true");
|
||||
gDialog.AdvancedEditButton.setAttribute("disabled","true");
|
||||
|
||||
if (label)
|
||||
dialog.BulletStyleLabel.setAttribute("value",label);
|
||||
gDialog.BulletStyleLabel.setAttribute("value",label);
|
||||
}
|
||||
|
||||
function SelectListType()
|
||||
{
|
||||
var NewType;
|
||||
switch (dialog.ListTypeList.selectedIndex)
|
||||
switch (gDialog.ListTypeList.selectedIndex)
|
||||
{
|
||||
case 1:
|
||||
NewType = "ul";
|
||||
break;
|
||||
case 2:
|
||||
NewType = "ol";
|
||||
SetTextboxFocus(dialog.StartingNumberInput);
|
||||
SetTextboxFocus(gDialog.StartingNumberInput);
|
||||
break;
|
||||
case 3:
|
||||
NewType = "dl";
|
||||
@ -243,14 +238,14 @@ function SelectBulletStyle()
|
||||
// Save the selected index so when user changes
|
||||
// list style, restore index to associated list
|
||||
if (ListType == "ul")
|
||||
BulletStyleIndex = dialog.BulletStyleList.selectedIndex;
|
||||
BulletStyleIndex = gDialog.BulletStyleList.selectedIndex;
|
||||
else if (ListType == "ol")
|
||||
{
|
||||
var index = dialog.BulletStyleList.selectedIndex;
|
||||
var index = gDialog.BulletStyleList.selectedIndex;
|
||||
if (NumberStyleIndex != index)
|
||||
{
|
||||
NumberStyleIndex = index;
|
||||
SetTextboxFocus(dialog.StartingNumberInput);
|
||||
SetTextboxFocus(gDialog.StartingNumberInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,7 +259,7 @@ function ValidateData()
|
||||
{
|
||||
if (ListType == "ul")
|
||||
{
|
||||
switch (dialog.BulletStyleList.selectedIndex)
|
||||
switch (gDialog.BulletStyleList.selectedIndex)
|
||||
{
|
||||
// Index 0 = automatic, the default, so we don't set it explicitly
|
||||
case 1:
|
||||
@ -285,7 +280,7 @@ function ValidateData()
|
||||
}
|
||||
else if (ListType == "ol")
|
||||
{
|
||||
switch (dialog.BulletStyleList.selectedIndex)
|
||||
switch (gDialog.BulletStyleList.selectedIndex)
|
||||
{
|
||||
// Index 0 = automatic, the default, so we don't set it explicitly
|
||||
case 1:
|
||||
@ -309,7 +304,7 @@ function ValidateData()
|
||||
else
|
||||
globalElement.removeAttribute("type");
|
||||
|
||||
var startingNumber = dialog.StartingNumberInput.value.trimString();
|
||||
var startingNumber = gDialog.StartingNumberInput.value.trimString();
|
||||
if (startingNumber)
|
||||
globalElement.setAttribute("start",startingNumber);
|
||||
else
|
||||
@ -329,10 +324,10 @@ function onOK()
|
||||
|
||||
// Remember which radio button was checked
|
||||
if (ListElement)
|
||||
dialog.RadioGroup.setAttribute("index", dialog.ChangeAllRadio.checked ? "0" : "1");
|
||||
gDialog.RadioGroup.setAttribute("index", gDialog.ChangeAllRadio.checked ? "0" : "1");
|
||||
|
||||
var changeList;
|
||||
if (ListElement && dialog.ChangeAllRadio.checked)
|
||||
if (ListElement && gDialog.ChangeAllRadio.checked)
|
||||
{
|
||||
changeList = true;
|
||||
}
|
||||
@ -341,7 +336,7 @@ function onOK()
|
||||
|
||||
if (changeList)
|
||||
{
|
||||
editorShell.MakeOrChangeList(ListType, dialog.ChangeAllRadio.checked);
|
||||
editorShell.MakeOrChangeList(ListType, gDialog.ChangeAllRadio.checked);
|
||||
|
||||
if (ListType)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -75,6 +76,6 @@
|
||||
<!-- from EdDialogOverlay -->
|
||||
<vbox id="AdvancedEdit"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
|
||||
</window>
|
||||
|
@ -36,6 +36,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -54,6 +55,6 @@
|
||||
<!-- from EdDialogOverlay -->
|
||||
<vbox id="AdvancedEdit"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
|
||||
</window>
|
||||
|
@ -30,7 +30,6 @@ var insertNewDescription = false;
|
||||
var titleWasEdited = false;
|
||||
var authorWasEdited = false;
|
||||
var descWasEdited = false;
|
||||
var dialog;
|
||||
|
||||
//Cancel() is in EdDialogCommon.js
|
||||
// dialog initialization code
|
||||
@ -39,17 +38,10 @@ function Startup()
|
||||
if (!InitEditorShell())
|
||||
return;
|
||||
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
dialog.PageLocation = document.getElementById("PageLocation");
|
||||
dialog.TitleInput = document.getElementById("TitleInput");
|
||||
dialog.AuthorInput = document.getElementById("AuthorInput");
|
||||
dialog.DescriptionInput = document.getElementById("DescriptionInput");
|
||||
gDialog.PageLocation = document.getElementById("PageLocation");
|
||||
gDialog.TitleInput = document.getElementById("TitleInput");
|
||||
gDialog.AuthorInput = document.getElementById("AuthorInput");
|
||||
gDialog.DescriptionInput = document.getElementById("DescriptionInput");
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
// Default string for new page is set from DTD string in XUL,
|
||||
@ -59,7 +51,7 @@ function Startup()
|
||||
|
||||
if (location != "about:blank")
|
||||
{
|
||||
dialog.PageLocation.setAttribute("value", editorShell.editorDocument.location);
|
||||
gDialog.PageLocation.setAttribute("value", editorShell.editorDocument.location);
|
||||
|
||||
// Get last-modified file date+time
|
||||
// TODO: Convert this to local time?
|
||||
@ -95,14 +87,14 @@ function Startup()
|
||||
|
||||
InitDialog();
|
||||
|
||||
SetTextboxFocus(dialog.TitleInput);
|
||||
SetTextboxFocus(gDialog.TitleInput);
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
|
||||
function InitDialog()
|
||||
{
|
||||
dialog.TitleInput.value = editorShell.GetDocumentTitle();
|
||||
gDialog.TitleInput.value = editorShell.GetDocumentTitle();
|
||||
var author = authorElement.getAttribute("content").trimString();
|
||||
if (author.length == 0)
|
||||
{
|
||||
@ -111,8 +103,8 @@ function InitDialog()
|
||||
if (prefs)
|
||||
author = prefs.CopyCharPref("editor.author");
|
||||
}
|
||||
dialog.AuthorInput.value = author;
|
||||
dialog.DescriptionInput.value = descriptionElement.getAttribute("content");
|
||||
gDialog.AuthorInput.value = author;
|
||||
gDialog.DescriptionInput.value = descriptionElement.getAttribute("content");
|
||||
}
|
||||
|
||||
function TextboxChanged(ID)
|
||||
@ -133,9 +125,9 @@ function TextboxChanged(ID)
|
||||
|
||||
function ValidateData()
|
||||
{
|
||||
newTitle = dialog.TitleInput.value.trimString();
|
||||
author = dialog.AuthorInput.value.trimString();
|
||||
description = dialog.DescriptionInput.value.trimString();
|
||||
newTitle = gDialog.TitleInput.value.trimString();
|
||||
author = gDialog.AuthorInput.value.trimString();
|
||||
description = gDialog.DescriptionInput.value.trimString();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -56,15 +57,15 @@
|
||||
<text class="label" id="PageModDate" align="left"/>
|
||||
</row>
|
||||
<spacer class="spacer"/>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&titleInput.label;"/>
|
||||
<textbox class="MinWidth20em" id="TitleInput" oninput="TextboxChanged(this.id)"/>
|
||||
</row>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&authorInput.label;"/>
|
||||
<textbox class="MinWidth20em" id="AuthorInput" oninput="TextboxChanged(this.id)"/>
|
||||
</row>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&descriptionInput.label;"/>
|
||||
<textbox class="MinWidth20em" id="DescriptionInput" oninput="TextboxChanged(this.id)"/>
|
||||
</row>
|
||||
@ -73,5 +74,5 @@
|
||||
<spacer class="bigspacer"/>
|
||||
<html class="wrap" flex="1">&EditHEADSource.label;</html>
|
||||
<separator class="groove"/>
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
@ -54,45 +54,27 @@ function Startup()
|
||||
return;
|
||||
}
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
Close();
|
||||
}
|
||||
dialog.MisspelledWordLabel = document.getElementById("MisspelledWordLabel");
|
||||
dialog.MisspelledWord = document.getElementById("MisspelledWord");
|
||||
dialog.ReplaceButton = document.getElementById("Replace");
|
||||
dialog.IgnoreButton = document.getElementById("Ignore");
|
||||
dialog.CloseButton = document.getElementById("Close");
|
||||
dialog.ReplaceWordInput = document.getElementById("ReplaceWordInput");
|
||||
dialog.SuggestedList = document.getElementById("SuggestedList");
|
||||
dialog.LanguageMenulist = document.getElementById("LanguageMenulist");
|
||||
gDialog.MisspelledWordLabel = document.getElementById("MisspelledWordLabel");
|
||||
gDialog.MisspelledWord = document.getElementById("MisspelledWord");
|
||||
gDialog.ReplaceButton = document.getElementById("Replace");
|
||||
gDialog.IgnoreButton = document.getElementById("Ignore");
|
||||
gDialog.CloseButton = document.getElementById("Close");
|
||||
gDialog.ReplaceWordInput = document.getElementById("ReplaceWordInput");
|
||||
gDialog.SuggestedList = document.getElementById("SuggestedList");
|
||||
gDialog.LanguageMenulist = document.getElementById("LanguageMenulist");
|
||||
|
||||
if (!dialog.MisspelledWord ||
|
||||
!dialog.ReplaceWordInput ||
|
||||
!dialog.SuggestedList ||
|
||||
!dialog.LanguageMenulist )
|
||||
{
|
||||
return;
|
||||
// Fill in the language menulist and sync it up
|
||||
// with the spellchecker's current language.
|
||||
|
||||
var curLang;
|
||||
|
||||
try {
|
||||
curLang = spellChecker.GetCurrentDictionary();
|
||||
} catch(ex) {
|
||||
curLang = "";
|
||||
}
|
||||
|
||||
if (dialog.LanguageMenulist)
|
||||
{
|
||||
// Fill in the language menulist and sync it up
|
||||
// with the spellchecker's current language.
|
||||
|
||||
var curLang;
|
||||
|
||||
try {
|
||||
curLang = spellChecker.GetCurrentDictionary();
|
||||
} catch(ex) {
|
||||
curLang = "";
|
||||
}
|
||||
|
||||
InitLanguageMenu(curLang);
|
||||
}
|
||||
InitLanguageMenu(curLang);
|
||||
|
||||
SetWindowLocation();
|
||||
|
||||
@ -189,7 +171,7 @@ function InitLanguageMenu(curLang)
|
||||
|
||||
for (var i = 0; i < dictList.length; i++)
|
||||
{
|
||||
AppendLabelAndValueToMenulist(dialog.LanguageMenulist, dictList[i][0], dictList[i][1]);
|
||||
AppendLabelAndValueToMenulist(gDialog.LanguageMenulist, dictList[i][0], dictList[i][1]);
|
||||
if (curLang && dictList[i][1] == curLang)
|
||||
defaultIndex = i+2; //first two items are pre-populated and fixed
|
||||
}
|
||||
@ -197,7 +179,7 @@ function InitLanguageMenu(curLang)
|
||||
// Now make sure the correct item in the menu list is selected.
|
||||
|
||||
if (dictList.length > 0)
|
||||
dialog.LanguageMenulist.selectedIndex = defaultIndex;
|
||||
gDialog.LanguageMenulist.selectedIndex = defaultIndex;
|
||||
}
|
||||
|
||||
function DoEnabling()
|
||||
@ -205,14 +187,14 @@ function DoEnabling()
|
||||
if (!gMisspelledWord)
|
||||
{
|
||||
// No more misspelled words
|
||||
dialog.MisspelledWord.setAttribute("value",GetString( firstTime ? "NoMisspelledWord" : "CheckSpellingDone"));
|
||||
gDialog.MisspelledWord.setAttribute("value",GetString( firstTime ? "NoMisspelledWord" : "CheckSpellingDone"));
|
||||
|
||||
dialog.ReplaceButton.removeAttribute("default");
|
||||
dialog.IgnoreButton.removeAttribute("default");
|
||||
gDialog.ReplaceButton.removeAttribute("default");
|
||||
gDialog.IgnoreButton.removeAttribute("default");
|
||||
|
||||
dialog.CloseButton.setAttribute("default","true");
|
||||
gDialog.CloseButton.setAttribute("default","true");
|
||||
// Shouldn't have to do this if "default" is true?
|
||||
dialog.CloseButton.focus();
|
||||
gDialog.CloseButton.focus();
|
||||
|
||||
SetElementEnabledById("MisspelledWordLabel", false);
|
||||
SetElementEnabledById("ReplaceWordLabel", false);
|
||||
@ -236,7 +218,7 @@ function DoEnabling()
|
||||
SetElementEnabledById("IgnoreAll", true);
|
||||
SetElementEnabledById("AddToDictionary", true);
|
||||
|
||||
dialog.CloseButton.removeAttribute("default");
|
||||
gDialog.CloseButton.removeAttribute("default");
|
||||
SetReplaceEnable();
|
||||
}
|
||||
}
|
||||
@ -249,25 +231,25 @@ function NextWord()
|
||||
|
||||
function SetWidgetsForMisspelledWord()
|
||||
{
|
||||
dialog.MisspelledWord.setAttribute("value", gMisspelledWord);
|
||||
gDialog.MisspelledWord.setAttribute("value", gMisspelledWord);
|
||||
|
||||
|
||||
// Initial replace word is misspelled word
|
||||
dialog.ReplaceWordInput.value = gMisspelledWord;
|
||||
gDialog.ReplaceWordInput.value = gMisspelledWord;
|
||||
PreviousReplaceWord = gMisspelledWord;
|
||||
|
||||
// This sets dialog.ReplaceWordInput to first suggested word in list
|
||||
// This sets gDialog.ReplaceWordInput to first suggested word in list
|
||||
FillSuggestedList(gMisspelledWord);
|
||||
|
||||
DoEnabling();
|
||||
|
||||
if (gMisspelledWord)
|
||||
SetTextboxFocus(dialog.ReplaceWordInput);
|
||||
SetTextboxFocus(gDialog.ReplaceWordInput);
|
||||
}
|
||||
|
||||
function CheckWord()
|
||||
{
|
||||
word = dialog.ReplaceWordInput.value;
|
||||
word = gDialog.ReplaceWordInput.value;
|
||||
if (word)
|
||||
{
|
||||
isMisspelled = spellChecker.CheckCurrentWord(word);
|
||||
@ -278,8 +260,8 @@ function CheckWord()
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearTreelist(dialog.SuggestedList);
|
||||
var item = AppendStringToTreelistById(dialog.SuggestedList, "CorrectSpelling");
|
||||
ClearTreelist(gDialog.SuggestedList);
|
||||
var item = AppendStringToTreelistById(gDialog.SuggestedList, "CorrectSpelling");
|
||||
if (item) item.setAttribute("disabled", "true");
|
||||
// Suppress being able to select the message text
|
||||
allowSelectWord = false;
|
||||
@ -291,15 +273,15 @@ function SelectSuggestedWord()
|
||||
{
|
||||
if (allowSelectWord)
|
||||
{
|
||||
var index = dialog.SuggestedList.selectedIndex;
|
||||
var index = gDialog.SuggestedList.selectedIndex;
|
||||
if (index == -1)
|
||||
{
|
||||
dialog.ReplaceWordInput.value = PreviousReplaceWord;
|
||||
gDialog.ReplaceWordInput.value = PreviousReplaceWord;
|
||||
}
|
||||
else
|
||||
{
|
||||
var selValue = GetSelectedTreelistValue(dialog.SuggestedList);
|
||||
dialog.ReplaceWordInput.value = selValue;
|
||||
var selValue = GetSelectedTreelistValue(gDialog.SuggestedList);
|
||||
gDialog.ReplaceWordInput.value = selValue;
|
||||
PreviousReplaceWord = selValue;
|
||||
}
|
||||
SetReplaceEnable();
|
||||
@ -315,17 +297,17 @@ function ChangeReplaceWord()
|
||||
|
||||
// Select matching word in list
|
||||
var newIndex = -1;
|
||||
var replaceWord = TrimString(dialog.ReplaceWordInput.value);
|
||||
var replaceWord = TrimString(gDialog.ReplaceWordInput.value);
|
||||
if (replaceWord)
|
||||
{
|
||||
var count = 0;
|
||||
var treeChildren = dialog.SuggestedList.firstChild.nextSibling;
|
||||
var treeChildren = gDialog.SuggestedList.firstChild.nextSibling;
|
||||
if (treeChildren && treeChildren.childNodes)
|
||||
count = treeChildren.childNodes.length;
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var wordInList = GetTreelistValueAt(dialog.SuggestedList, i);
|
||||
var wordInList = GetTreelistValueAt(gDialog.SuggestedList, i);
|
||||
if (wordInList == replaceWord)
|
||||
{
|
||||
newIndex = i;
|
||||
@ -333,12 +315,12 @@ function ChangeReplaceWord()
|
||||
}
|
||||
}
|
||||
}
|
||||
dialog.SuggestedList.selectedIndex = newIndex;
|
||||
gDialog.SuggestedList.selectedIndex = newIndex;
|
||||
|
||||
allowSelectWord = saveAllow;
|
||||
|
||||
// Remember the new word
|
||||
PreviousReplaceWord = dialog.ReplaceWordInput.value;
|
||||
PreviousReplaceWord = gDialog.ReplaceWordInput.value;
|
||||
|
||||
SetReplaceEnable();
|
||||
}
|
||||
@ -358,7 +340,7 @@ function IgnoreAll()
|
||||
|
||||
function Replace()
|
||||
{
|
||||
newWord = dialog.ReplaceWordInput.value;
|
||||
newWord = gDialog.ReplaceWordInput.value;
|
||||
if (gMisspelledWord && gMisspelledWord != newWord)
|
||||
{
|
||||
editorShell.BeginBatchChanges();
|
||||
@ -370,7 +352,7 @@ function Replace()
|
||||
|
||||
function ReplaceAll()
|
||||
{
|
||||
newWord = dialog.ReplaceWordInput.value;
|
||||
newWord = gDialog.ReplaceWordInput.value;
|
||||
if (gMisspelledWord && gMisspelledWord != newWord)
|
||||
{
|
||||
editorShell.BeginBatchChanges();
|
||||
@ -396,7 +378,7 @@ function EditDictionary()
|
||||
function SelectLanguage()
|
||||
{
|
||||
try {
|
||||
var item = dialog.LanguageMenulist.selectedItem;
|
||||
var item = gDialog.LanguageMenulist.selectedItem;
|
||||
if (item.value != "more-cmd")
|
||||
spellChecker.SetCurrentDictionary(item.value);
|
||||
else
|
||||
@ -424,7 +406,7 @@ function Recheck()
|
||||
|
||||
function FillSuggestedList(misspelledWord)
|
||||
{
|
||||
var list = dialog.SuggestedList;
|
||||
var list = gDialog.SuggestedList;
|
||||
|
||||
// Clear the current contents of the list
|
||||
allowSelectWord = false;
|
||||
@ -436,7 +418,7 @@ function FillSuggestedList(misspelledWord)
|
||||
var count = 0;
|
||||
var firstWord = 0;
|
||||
do {
|
||||
word = spellChecker.GetSuggestedWord();
|
||||
var word = spellChecker.GetSuggestedWord();
|
||||
if (count==0)
|
||||
firstWord = word;
|
||||
if (word.length > 0) {
|
||||
@ -456,7 +438,7 @@ function FillSuggestedList(misspelledWord)
|
||||
} else {
|
||||
allowSelectWord = true;
|
||||
// Initialize with first suggested list by selecting it
|
||||
dialog.SuggestedList.selectedIndex = 0;
|
||||
gDialog.SuggestedList.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -470,29 +452,29 @@ function FillSuggestedList(misspelledWord)
|
||||
function SetReplaceEnable()
|
||||
{
|
||||
// Enable "Change..." buttons only if new word is different than misspelled
|
||||
var newWord = dialog.ReplaceWordInput.value;
|
||||
var newWord = gDialog.ReplaceWordInput.value;
|
||||
var enable = newWord.length > 0 && newWord != gMisspelledWord;
|
||||
SetElementEnabledById("Replace", enable);
|
||||
SetElementEnabledById("ReplaceAll", enable);
|
||||
if (enable)
|
||||
{
|
||||
dialog.ReplaceButton.setAttribute("default","true");
|
||||
dialog.IgnoreButton.removeAttribute("default");
|
||||
gDialog.ReplaceButton.setAttribute("default","true");
|
||||
gDialog.IgnoreButton.removeAttribute("default");
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.IgnoreButton.setAttribute("default","true");
|
||||
dialog.ReplaceButton.removeAttribute("default");
|
||||
gDialog.IgnoreButton.setAttribute("default","true");
|
||||
gDialog.ReplaceButton.removeAttribute("default");
|
||||
}
|
||||
}
|
||||
|
||||
function doDefault()
|
||||
{
|
||||
if (dialog.ReplaceButton.getAttribute("default") == "true")
|
||||
if (gDialog.ReplaceButton.getAttribute("default") == "true")
|
||||
Replace();
|
||||
else if (dialog.IgnoreButton.getAttribute("default") == "true")
|
||||
else if (gDialog.IgnoreButton.getAttribute("default") == "true")
|
||||
Ignore();
|
||||
else if (dialog.CloseButton.getAttribute("default") == "true")
|
||||
else if (gDialog.CloseButton.getAttribute("default") == "true")
|
||||
onClose();
|
||||
}
|
||||
|
||||
@ -502,6 +484,5 @@ function onClose()
|
||||
spellChecker.UninitSpellChecker();
|
||||
SaveWindowLocation();
|
||||
window.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload = "Startup()"
|
||||
onclose = "onClose()"
|
||||
onunload = "onClose()"
|
||||
orient="vertical">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
@ -54,16 +54,16 @@
|
||||
<column class="spell-check"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="MisspelledWordLabel" value="&misspelledWord.label;"/>
|
||||
<text class="label bold" id="MisspelledWord" crop="right"/>
|
||||
<spacer/>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" id="ReplaceWordLabel" value="&wordEditField.label;"/>
|
||||
<hbox valign="middle" autostretch="never" flex="1">
|
||||
<hbox align="center" flex="1">
|
||||
<textbox id="ReplaceWordInput" oninput="ChangeReplaceWord()"/>
|
||||
<button class="dialog" id="CheckWord" oncommand="CheckWord()" label="&checkwordButton.label;"/>
|
||||
<button id="CheckWord" oncommand="CheckWord()" label="&checkwordButton.label;"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
@ -80,24 +80,24 @@
|
||||
</treecolgroup>
|
||||
</tree>
|
||||
<vbox>
|
||||
<grid flex="1" autostretch="never">
|
||||
<grid flex="1">
|
||||
<columns><column class="spell-check" flex="1"/><column class="spell-check" flex="1"/></columns>
|
||||
<rows>
|
||||
<row>
|
||||
<button class="dialog" id="Ignore" oncommand="Ignore()" label="&ignoreButton.label;"/>
|
||||
<button class="dialog" id="IgnoreAll" oncommand="IgnoreAll()" label="&ignoreAllButton.label;"/>
|
||||
<button id="Ignore" oncommand="Ignore()" label="&ignoreButton.label;"/>
|
||||
<button id="IgnoreAll" oncommand="IgnoreAll()" label="&ignoreAllButton.label;"/>
|
||||
</row>
|
||||
<row>
|
||||
<button class="dialog" id="Replace" oncommand="Replace()" label="&changeButton.label;"/>
|
||||
<button class="dialog" id="ReplaceAll" oncommand="ReplaceAll()" label="&changeAllButton.label;"/>
|
||||
<button id="Replace" oncommand="Replace()" label="&changeButton.label;"/>
|
||||
<button id="ReplaceAll" oncommand="ReplaceAll()" label="&changeAllButton.label;"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<spacer flex="1"/>
|
||||
<text class="label" value="&userDictionary.label;"/>
|
||||
<hbox flex="1" autostretch="never">
|
||||
<button class="dialog spell-check" id="AddToDictionary" oncommand="AddToDictionary()" label="&addToUserDictionaryButton.label;" />
|
||||
<button class="dialog spell-check" id="EditDictionary" oncommand="EditDictionary()" label="&editUserDictionaryButton.label;" />
|
||||
<hbox flex="1" align="start">
|
||||
<button class="spell-check" id="AddToDictionary" oncommand="AddToDictionary()" label="&addToUserDictionaryButton.label;" />
|
||||
<button class="spell-check" id="EditDictionary" oncommand="EditDictionary()" label="&editUserDictionaryButton.label;" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
</row>
|
||||
@ -114,8 +114,8 @@
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<hbox flex="1">
|
||||
<button class="dialog spell-check" id="Recheck" label="&recheckButton.label;" oncommand="Recheck()"/>
|
||||
<button class="dialog spell-check" id="Close" label="&closeButton.label;" oncommand="onClose()"/>
|
||||
<button class="spell-check" id="Recheck" label="&recheckButton.label;" oncommand="Recheck()"/>
|
||||
<button class="spell-check" id="Close" label="&closeButton.label;" oncommand="onClose()"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
|
@ -27,7 +27,6 @@ var TableElement;
|
||||
var CellElement;
|
||||
var TableCaptionElement;
|
||||
var TabPanels;
|
||||
var dialog;
|
||||
var globalCellElement;
|
||||
var globalTableElement
|
||||
var TablePanel = 0;
|
||||
@ -92,53 +91,47 @@ function Startup()
|
||||
selection = editorShell.editorSelection;
|
||||
if (!selection) return;
|
||||
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
// Get dialog widgets - Table Panel
|
||||
dialog.TableRowsInput = document.getElementById("TableRowsInput");
|
||||
dialog.TableColumnsInput = document.getElementById("TableColumnsInput");
|
||||
dialog.TableWidthInput = document.getElementById("TableWidthInput");
|
||||
dialog.TableWidthUnits = document.getElementById("TableWidthUnits");
|
||||
dialog.BorderWidthInput = document.getElementById("BorderWidthInput");
|
||||
dialog.SpacingInput = document.getElementById("SpacingInput");
|
||||
dialog.PaddingInput = document.getElementById("PaddingInput");
|
||||
dialog.TableAlignList = document.getElementById("TableAlignList");
|
||||
dialog.TableCaptionList = document.getElementById("TableCaptionList");
|
||||
dialog.TableInheritColor = document.getElementById("TableInheritColor");
|
||||
gDialog.TableRowsInput = document.getElementById("TableRowsInput");
|
||||
gDialog.TableColumnsInput = document.getElementById("TableColumnsInput");
|
||||
gDialog.TableWidthInput = document.getElementById("TableWidthInput");
|
||||
gDialog.TableWidthUnits = document.getElementById("TableWidthUnits");
|
||||
gDialog.BorderWidthInput = document.getElementById("BorderWidthInput");
|
||||
gDialog.SpacingInput = document.getElementById("SpacingInput");
|
||||
gDialog.PaddingInput = document.getElementById("PaddingInput");
|
||||
gDialog.TableAlignList = document.getElementById("TableAlignList");
|
||||
gDialog.TableCaptionList = document.getElementById("TableCaptionList");
|
||||
gDialog.TableInheritColor = document.getElementById("TableInheritColor");
|
||||
|
||||
// Cell Panel
|
||||
dialog.SelectionList = document.getElementById("SelectionList");
|
||||
dialog.PreviousButton = document.getElementById("PreviousButton");
|
||||
dialog.NextButton = document.getElementById("NextButton");
|
||||
gDialog.SelectionList = document.getElementById("SelectionList");
|
||||
gDialog.PreviousButton = document.getElementById("PreviousButton");
|
||||
gDialog.NextButton = document.getElementById("NextButton");
|
||||
// Currently, we always apply changes and load new attributes when changing selection
|
||||
// (Let's keep this for possible future use)
|
||||
//dialog.ApplyBeforeMove = document.getElementById("ApplyBeforeMove");
|
||||
//dialog.KeepCurrentData = document.getElementById("KeepCurrentData");
|
||||
//gDialog.ApplyBeforeMove = document.getElementById("ApplyBeforeMove");
|
||||
//gDialog.KeepCurrentData = document.getElementById("KeepCurrentData");
|
||||
|
||||
dialog.CellHeightInput = document.getElementById("CellHeightInput");
|
||||
dialog.CellHeightUnits = document.getElementById("CellHeightUnits");
|
||||
dialog.CellWidthInput = document.getElementById("CellWidthInput");
|
||||
dialog.CellWidthUnits = document.getElementById("CellWidthUnits");
|
||||
dialog.CellHAlignList = document.getElementById("CellHAlignList");
|
||||
dialog.CellVAlignList = document.getElementById("CellVAlignList");
|
||||
dialog.CellInheritColor = document.getElementById("CellInheritColor");
|
||||
dialog.CellStyleList = document.getElementById("CellStyleList");
|
||||
dialog.TextWrapList = document.getElementById("TextWrapList");
|
||||
gDialog.CellHeightInput = document.getElementById("CellHeightInput");
|
||||
gDialog.CellHeightUnits = document.getElementById("CellHeightUnits");
|
||||
gDialog.CellWidthInput = document.getElementById("CellWidthInput");
|
||||
gDialog.CellWidthUnits = document.getElementById("CellWidthUnits");
|
||||
gDialog.CellHAlignList = document.getElementById("CellHAlignList");
|
||||
gDialog.CellVAlignList = document.getElementById("CellVAlignList");
|
||||
gDialog.CellInheritColor = document.getElementById("CellInheritColor");
|
||||
gDialog.CellStyleList = document.getElementById("CellStyleList");
|
||||
gDialog.TextWrapList = document.getElementById("TextWrapList");
|
||||
|
||||
// In cell panel, user must tell us which attributes to apply via checkboxes,
|
||||
// else we would apply values from one cell to ALL in selection
|
||||
// and that's probably not what they expect!
|
||||
dialog.CellHeightCheckbox = document.getElementById("CellHeightCheckbox");
|
||||
dialog.CellWidthCheckbox = document.getElementById("CellWidthCheckbox");
|
||||
dialog.CellHAlignCheckbox = document.getElementById("CellHAlignCheckbox");
|
||||
dialog.CellVAlignCheckbox = document.getElementById("CellVAlignCheckbox");
|
||||
dialog.CellStyleCheckbox = document.getElementById("CellStyleCheckbox");
|
||||
dialog.TextWrapCheckbox = document.getElementById("TextWrapCheckbox");
|
||||
dialog.CellColorCheckbox = document.getElementById("CellColorCheckbox");
|
||||
gDialog.CellHeightCheckbox = document.getElementById("CellHeightCheckbox");
|
||||
gDialog.CellWidthCheckbox = document.getElementById("CellWidthCheckbox");
|
||||
gDialog.CellHAlignCheckbox = document.getElementById("CellHAlignCheckbox");
|
||||
gDialog.CellVAlignCheckbox = document.getElementById("CellVAlignCheckbox");
|
||||
gDialog.CellStyleCheckbox = document.getElementById("CellStyleCheckbox");
|
||||
gDialog.TextWrapCheckbox = document.getElementById("TextWrapCheckbox");
|
||||
gDialog.CellColorCheckbox = document.getElementById("CellColorCheckbox");
|
||||
|
||||
TabPanels = document.getElementById("TabPanels");
|
||||
var TableTab = document.getElementById("TableTab");
|
||||
@ -234,7 +227,7 @@ function Startup()
|
||||
|
||||
// If only one cell in table, disable change-selection widgets
|
||||
if (rowCount == 1 && colCount == 1)
|
||||
dialog.SelectionList.setAttribute("disabled", "true");
|
||||
gDialog.SelectionList.setAttribute("disabled", "true");
|
||||
|
||||
// User can change these via textboxes
|
||||
newRowCount = rowCount;
|
||||
@ -251,9 +244,9 @@ function Startup()
|
||||
CellDataChanged = false;
|
||||
|
||||
if (currentPanel == CellPanel)
|
||||
dialog.SelectionList.focus();
|
||||
gDialog.SelectionList.focus();
|
||||
else
|
||||
SetTextboxFocus(dialog.TableRowsInput);
|
||||
SetTextboxFocus(gDialog.TableRowsInput);
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
@ -270,21 +263,21 @@ function InitDialog()
|
||||
}
|
||||
|
||||
// Get Table attributes
|
||||
dialog.TableRowsInput.value = rowCount;
|
||||
dialog.TableColumnsInput.value = colCount;
|
||||
dialog.TableWidthInput.value = InitPixelOrPercentMenulist(globalTableElement, TableElement, "width", "TableWidthUnits", gPercent);
|
||||
dialog.BorderWidthInput.value = globalTableElement.border;
|
||||
dialog.SpacingInput.value = globalTableElement.cellSpacing;
|
||||
dialog.PaddingInput.value = globalTableElement.cellPadding;
|
||||
gDialog.TableRowsInput.value = rowCount;
|
||||
gDialog.TableColumnsInput.value = colCount;
|
||||
gDialog.TableWidthInput.value = InitPixelOrPercentMenulist(globalTableElement, TableElement, "width", "TableWidthUnits", gPercent);
|
||||
gDialog.BorderWidthInput.value = globalTableElement.border;
|
||||
gDialog.SpacingInput.value = globalTableElement.cellSpacing;
|
||||
gDialog.PaddingInput.value = globalTableElement.cellPadding;
|
||||
|
||||
//BUG: The align strings are converted: e.g., "center" becomes "Center";
|
||||
var halign = globalTableElement.align.toLowerCase();
|
||||
if (halign == centerStr)
|
||||
dialog.TableAlignList.selectedIndex = 1;
|
||||
gDialog.TableAlignList.selectedIndex = 1;
|
||||
else if (halign == rightStr)
|
||||
dialog.TableAlignList.selectedIndex = 2;
|
||||
gDialog.TableAlignList.selectedIndex = 2;
|
||||
else // Default = left
|
||||
dialog.TableAlignList.selectedIndex = 0;
|
||||
gDialog.TableAlignList.selectedIndex = 0;
|
||||
|
||||
// Be sure to get caption from table in doc, not the copied "globalTableElement"
|
||||
TableCaptionElement = TableElement.caption;
|
||||
@ -298,7 +291,7 @@ function InitDialog()
|
||||
else
|
||||
index = 1;
|
||||
}
|
||||
dialog.TableCaptionList.selectedIndex = index;
|
||||
gDialog.TableCaptionList.selectedIndex = index;
|
||||
|
||||
TableColor = globalTableElement.bgColor;
|
||||
SetColor("tableBackgroundCW", TableColor);
|
||||
@ -312,29 +305,29 @@ function InitCellPanel()
|
||||
if (globalCellElement)
|
||||
{
|
||||
// This assumes order of items is Cell, Row, Column
|
||||
dialog.SelectionList.selectedIndex = SelectedCellsType-1;
|
||||
gDialog.SelectionList.selectedIndex = SelectedCellsType-1;
|
||||
|
||||
var previousValue = dialog.CellHeightInput.value;
|
||||
dialog.CellHeightInput.value = InitPixelOrPercentMenulist(globalCellElement, CellElement, "height", "CellHeightUnits", gPixel);
|
||||
dialog.CellHeightCheckbox.checked = AdvancedEditUsed && previousValue != dialog.CellHeightInput.value;
|
||||
var previousValue = gDialog.CellHeightInput.value;
|
||||
gDialog.CellHeightInput.value = InitPixelOrPercentMenulist(globalCellElement, CellElement, "height", "CellHeightUnits", gPixel);
|
||||
gDialog.CellHeightCheckbox.checked = AdvancedEditUsed && previousValue != gDialog.CellHeightInput.value;
|
||||
|
||||
previousValue= dialog.CellWidthInput.value;
|
||||
dialog.CellWidthInput.value = InitPixelOrPercentMenulist(globalCellElement, CellElement, "width", "CellWidthUnits", gPixel);
|
||||
dialog.CellWidthCheckbox.checked = AdvancedEditUsed && previousValue != dialog.CellWidthInput.value;
|
||||
previousValue= gDialog.CellWidthInput.value;
|
||||
gDialog.CellWidthInput.value = InitPixelOrPercentMenulist(globalCellElement, CellElement, "width", "CellWidthUnits", gPixel);
|
||||
gDialog.CellWidthCheckbox.checked = AdvancedEditUsed && previousValue != gDialog.CellWidthInput.value;
|
||||
|
||||
var previousIndex = dialog.CellVAlignList.selectedIndex;
|
||||
var previousIndex = gDialog.CellVAlignList.selectedIndex;
|
||||
var valign = globalCellElement.vAlign.toLowerCase();
|
||||
if (valign == topStr)
|
||||
dialog.CellVAlignList.selectedIndex = 0;
|
||||
gDialog.CellVAlignList.selectedIndex = 0;
|
||||
else if (valign == bottomStr)
|
||||
dialog.CellVAlignList.selectedIndex = 2;
|
||||
gDialog.CellVAlignList.selectedIndex = 2;
|
||||
else // Default = middle
|
||||
dialog.CellVAlignList.selectedIndex = 1;
|
||||
gDialog.CellVAlignList.selectedIndex = 1;
|
||||
|
||||
dialog.CellVAlignCheckbox.checked = AdvancedEditUsed && previousValue != dialog.CellVAlignList.selectedIndex;
|
||||
gDialog.CellVAlignCheckbox.checked = AdvancedEditUsed && previousValue != gDialog.CellVAlignList.selectedIndex;
|
||||
|
||||
|
||||
previousIndex = dialog.CellHAlignList.selectedIndex;
|
||||
previousIndex = gDialog.CellHAlignList.selectedIndex;
|
||||
|
||||
alignWasChar = false;
|
||||
|
||||
@ -342,13 +335,13 @@ function InitCellPanel()
|
||||
switch (halign)
|
||||
{
|
||||
case centerStr:
|
||||
dialog.CellHAlignList.selectedIndex = 1;
|
||||
gDialog.CellHAlignList.selectedIndex = 1;
|
||||
break;
|
||||
case rightStr:
|
||||
dialog.CellHAlignList.selectedIndex = 2;
|
||||
gDialog.CellHAlignList.selectedIndex = 2;
|
||||
break;
|
||||
case justifyStr:
|
||||
dialog.CellHAlignList.selectedIndex = 3;
|
||||
gDialog.CellHAlignList.selectedIndex = 3;
|
||||
break;
|
||||
case charStr:
|
||||
// We don't support UI for this because layout doesn't work: bug 2212.
|
||||
@ -358,25 +351,25 @@ function InitCellPanel()
|
||||
// Fall through to use show default alignment in menu
|
||||
default:
|
||||
// Default depends on cell type (TH is "center", TD is "left")
|
||||
dialog.CellHAlignList.selectedIndex =
|
||||
gDialog.CellHAlignList.selectedIndex =
|
||||
(globalCellElement.nodeName.toLowerCase() == "th") ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
dialog.CellHAlignCheckbox.checked = AdvancedEditUsed &&
|
||||
previousIndex != dialog.CellHAlignList.selectedIndex;
|
||||
gDialog.CellHAlignCheckbox.checked = AdvancedEditUsed &&
|
||||
previousIndex != gDialog.CellHAlignList.selectedIndex;
|
||||
|
||||
previousIndex = dialog.CellStyleList.selectedIndex;
|
||||
dialog.CellStyleList.selectedIndex = (globalCellElement.nodeName.toLowerCase() == "th") ? 1 : 0;
|
||||
dialog.CellStyleCheckbox.checked = AdvancedEditUsed && previousIndex != dialog.CellStyleList.selectedIndex;
|
||||
previousIndex = gDialog.CellStyleList.selectedIndex;
|
||||
gDialog.CellStyleList.selectedIndex = (globalCellElement.nodeName.toLowerCase() == "th") ? 1 : 0;
|
||||
gDialog.CellStyleCheckbox.checked = AdvancedEditUsed && previousIndex != gDialog.CellStyleList.selectedIndex;
|
||||
|
||||
previousIndex = dialog.TextWrapList.selectedIndex;
|
||||
dialog.TextWrapList.selectedIndex = globalCellElement.noWrap ? 1 : 0;
|
||||
dialog.TextWrapCheckbox.checked = AdvancedEditUsed && previousIndex != dialog.TextWrapList.selectedIndex;
|
||||
previousIndex = gDialog.TextWrapList.selectedIndex;
|
||||
gDialog.TextWrapList.selectedIndex = globalCellElement.noWrap ? 1 : 0;
|
||||
gDialog.TextWrapCheckbox.checked = AdvancedEditUsed && previousIndex != gDialog.TextWrapList.selectedIndex;
|
||||
|
||||
previousValue = CellColor;
|
||||
SetColor("cellBackgroundCW", globalCellElement.bgColor);
|
||||
dialog.CellColorCheckbox.checked = AdvancedEditUsed && CellColor != globalCellElement.bgColor;
|
||||
gDialog.CellColorCheckbox.checked = AdvancedEditUsed && CellColor != globalCellElement.bgColor;
|
||||
CellColor = globalCellElement.bgColor;
|
||||
|
||||
// We want to set this true in case changes came
|
||||
@ -489,13 +482,13 @@ function SetColor(ColorWellID, color)
|
||||
if (color)
|
||||
{
|
||||
globalCellElement.setAttribute(bgcolor, color);
|
||||
dialog.CellInheritColor.setAttribute("collapsed","true");
|
||||
gDialog.CellInheritColor.setAttribute("collapsed","true");
|
||||
}
|
||||
else
|
||||
{
|
||||
globalCellElement.removeAttribute(bgcolor);
|
||||
// Reveal addition message explaining "default" color
|
||||
dialog.CellInheritColor.removeAttribute("collapsed");
|
||||
gDialog.CellInheritColor.removeAttribute("collapsed");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -503,12 +496,12 @@ function SetColor(ColorWellID, color)
|
||||
if (color)
|
||||
{
|
||||
globalTableElement.setAttribute(bgcolor, color);
|
||||
dialog.TableInheritColor.setAttribute("collapsed","true");
|
||||
gDialog.TableInheritColor.setAttribute("collapsed","true");
|
||||
}
|
||||
else
|
||||
{
|
||||
globalTableElement.removeAttribute(bgcolor);
|
||||
dialog.TableInheritColor.removeAttribute("collapsed");
|
||||
gDialog.TableInheritColor.removeAttribute("collapsed");
|
||||
}
|
||||
SetCheckbox('CellColorCheckbox');
|
||||
}
|
||||
@ -663,7 +656,7 @@ function MoveSelection(forward)
|
||||
while(true);
|
||||
|
||||
// Save data for current selection before changing
|
||||
if (CellDataChanged) // && dialog.ApplyBeforeMove.checked)
|
||||
if (CellDataChanged) // && gDialog.ApplyBeforeMove.checked)
|
||||
{
|
||||
if (!ValidateCellData())
|
||||
return;
|
||||
@ -699,7 +692,7 @@ function MoveSelection(forward)
|
||||
selectionController.scrollSelectionIntoView(selectionController.SELECTION_NORMAL, selectionController.SELECTION_ANCHOR_REGION);
|
||||
|
||||
// Reinitialize dialog using new cell
|
||||
// if (!dialog.KeepCurrentData.checked)
|
||||
// if (!gDialog.KeepCurrentData.checked)
|
||||
// Setting this false unchecks all "set attributes" checkboxes
|
||||
AdvancedEditUsed = false;
|
||||
InitCellPanel();
|
||||
@ -745,14 +738,14 @@ function SetSelectionButtons()
|
||||
if (SelectedCellsType == SELECT_ROW)
|
||||
{
|
||||
// Trigger CSS to set images of up and down arrows
|
||||
dialog.PreviousButton.setAttribute("type","row");
|
||||
dialog.NextButton.setAttribute("type","row");
|
||||
gDialog.PreviousButton.setAttribute("type","row");
|
||||
gDialog.NextButton.setAttribute("type","row");
|
||||
}
|
||||
else
|
||||
{
|
||||
// or images of left and right arrows
|
||||
dialog.PreviousButton.setAttribute("type","col");
|
||||
dialog.NextButton.setAttribute("type","col");
|
||||
gDialog.PreviousButton.setAttribute("type","col");
|
||||
gDialog.NextButton.setAttribute("type","col");
|
||||
}
|
||||
DisableSelectionButtons((SelectedCellsType == SELECT_ROW && rowCount == 1) ||
|
||||
(SelectedCellsType == SELECT_COLUMN && colCount == 1) ||
|
||||
@ -761,8 +754,8 @@ function SetSelectionButtons()
|
||||
|
||||
function DisableSelectionButtons( disable )
|
||||
{
|
||||
dialog.PreviousButton.setAttribute("disabled", disable ? "true" : "false");
|
||||
dialog.NextButton.setAttribute("disabled", disable ? "true" : "false");
|
||||
gDialog.PreviousButton.setAttribute("disabled", disable ? "true" : "false");
|
||||
gDialog.NextButton.setAttribute("disabled", disable ? "true" : "false");
|
||||
}
|
||||
|
||||
function SwitchToValidatePanel()
|
||||
@ -796,10 +789,10 @@ function SetAlign(listID, defaultValue, element, attName)
|
||||
function ValidateTableData()
|
||||
{
|
||||
validatePanel = TablePanel;
|
||||
newRowCount = Number(ValidateNumber(dialog.TableRowsInput, null, 1, maxRows, null, null, true));
|
||||
newRowCount = Number(ValidateNumber(gDialog.TableRowsInput, null, 1, maxRows, null, null, true));
|
||||
if (gValidationError) return false;
|
||||
|
||||
newColCount = Number(ValidateNumber(dialog.TableColumnsInput, null, 1, maxColumns, null, null, true));
|
||||
newColCount = Number(ValidateNumber(gDialog.TableColumnsInput, null, 1, maxColumns, null, null, true));
|
||||
if (gValidationError) return false;
|
||||
|
||||
// If user is deleting any cells, get confirmation
|
||||
@ -816,23 +809,23 @@ function ValidateTableData()
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextboxFocus(newRowCount < rowCount ? dialog.TableRowsInput : dialog.TableColumnsInput);
|
||||
SetTextboxFocus(newRowCount < rowCount ? gDialog.TableRowsInput : gDialog.TableColumnsInput);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ValidateNumber(dialog.TableWidthInput, dialog.TableWidthUnits,
|
||||
ValidateNumber(gDialog.TableWidthInput, gDialog.TableWidthUnits,
|
||||
1, maxPixels, globalTableElement, "width");
|
||||
if (gValidationError) return false;
|
||||
|
||||
var border = ValidateNumber(dialog.BorderWidthInput, null, 0, maxPixels, globalTableElement, "border");
|
||||
var border = ValidateNumber(gDialog.BorderWidthInput, null, 0, maxPixels, globalTableElement, "border");
|
||||
// TODO: Deal with "BORDER" without value issue
|
||||
if (gValidationError) return false;
|
||||
|
||||
ValidateNumber(dialog.SpacingInput, null, 0, maxPixels, globalTableElement, "cellspacing");
|
||||
ValidateNumber(gDialog.SpacingInput, null, 0, maxPixels, globalTableElement, "cellspacing");
|
||||
if (gValidationError) return false;
|
||||
|
||||
ValidateNumber(dialog.PaddingInput, null, 0, maxPixels, globalTableElement, "cellpadding");
|
||||
ValidateNumber(gDialog.PaddingInput, null, 0, maxPixels, globalTableElement, "cellpadding");
|
||||
if (gValidationError) return false;
|
||||
|
||||
SetAlign("TableAlignList", defHAlign, globalTableElement, "align");
|
||||
@ -846,23 +839,23 @@ function ValidateCellData()
|
||||
|
||||
validatePanel = CellPanel;
|
||||
|
||||
if (dialog.CellHeightCheckbox.checked)
|
||||
if (gDialog.CellHeightCheckbox.checked)
|
||||
{
|
||||
ValidateNumber(dialog.CellHeightInput, dialog.CellHeightUnits,
|
||||
ValidateNumber(gDialog.CellHeightInput, gDialog.CellHeightUnits,
|
||||
1, maxPixels, globalCellElement, "height");
|
||||
if (gValidationError) return false;
|
||||
}
|
||||
|
||||
if (dialog.CellWidthCheckbox.checked)
|
||||
if (gDialog.CellWidthCheckbox.checked)
|
||||
{
|
||||
ValidateNumber(dialog.CellWidthInput, dialog.CellWidthUnits,
|
||||
ValidateNumber(gDialog.CellWidthInput, gDialog.CellWidthUnits,
|
||||
1, maxPixels, globalCellElement, "width");
|
||||
if (gValidationError) return false;
|
||||
}
|
||||
|
||||
if (dialog.CellHAlignCheckbox.checked)
|
||||
if (gDialog.CellHAlignCheckbox.checked)
|
||||
{
|
||||
var hAlign = dialog.CellHAlignList.selectedItem.value;
|
||||
var hAlign = gDialog.CellHAlignList.selectedItem.value;
|
||||
|
||||
// Horizontal alignment is complicated by "char" type
|
||||
// We don't change current values if user didn't edit alignment
|
||||
@ -877,7 +870,7 @@ function ValidateCellData()
|
||||
}
|
||||
}
|
||||
|
||||
if (dialog.CellVAlignCheckbox.checked)
|
||||
if (gDialog.CellVAlignCheckbox.checked)
|
||||
{
|
||||
// Always set valign (no default in 2nd param) so
|
||||
// the default "middle" is effective in a cell
|
||||
@ -885,9 +878,9 @@ function ValidateCellData()
|
||||
SetAlign("CellVAlignList", "", globalCellElement, "valign");
|
||||
}
|
||||
|
||||
if (dialog.TextWrapCheckbox.checked)
|
||||
if (gDialog.TextWrapCheckbox.checked)
|
||||
{
|
||||
if (dialog.TextWrapList.selectedIndex == 1)
|
||||
if (gDialog.TextWrapList.selectedIndex == 1)
|
||||
globalCellElement.setAttribute("nowrap","true");
|
||||
else
|
||||
globalCellElement.removeAttribute("nowrap");
|
||||
@ -971,7 +964,7 @@ function CloneAttribute(destElement, srcElement, attr)
|
||||
|
||||
function ApplyTableAttributes()
|
||||
{
|
||||
var newAlign = dialog.TableCaptionList.selectedItem.value;
|
||||
var newAlign = gDialog.TableCaptionList.selectedItem.value;
|
||||
if (!newAlign) newAlign = "";
|
||||
|
||||
if (TableCaptionElement)
|
||||
@ -1164,10 +1157,10 @@ function ApplyCellAttributes()
|
||||
// thus CSS and JS from Advanced edit is copied
|
||||
editorShell.CloneAttributes(selectedCell, globalCellElement);
|
||||
|
||||
if (dialog.CellStyleCheckbox.checked)
|
||||
if (gDialog.CellStyleCheckbox.checked)
|
||||
{
|
||||
var currentStyleIndex = (selectedCell.nodeName.toLowerCase() == "th") ? 1 : 0;
|
||||
if (dialog.CellStyleList.selectedIndex != currentStyleIndex)
|
||||
if (gDialog.CellStyleList.selectedIndex != currentStyleIndex)
|
||||
{
|
||||
// Switch cell types
|
||||
// (replaces with new cell and copies attributes and contents)
|
||||
@ -1190,27 +1183,27 @@ function ApplyCellAttributes()
|
||||
|
||||
function ApplyAttributesToOneCell(destElement)
|
||||
{
|
||||
if (dialog.CellHeightCheckbox.checked)
|
||||
if (gDialog.CellHeightCheckbox.checked)
|
||||
CloneAttribute(destElement, globalCellElement, "height");
|
||||
|
||||
if (dialog.CellWidthCheckbox.checked)
|
||||
if (gDialog.CellWidthCheckbox.checked)
|
||||
CloneAttribute(destElement, globalCellElement, "width");
|
||||
|
||||
if (dialog.CellHAlignCheckbox.checked)
|
||||
if (gDialog.CellHAlignCheckbox.checked)
|
||||
{
|
||||
CloneAttribute(destElement, globalCellElement, "align");
|
||||
CloneAttribute(destElement, globalCellElement, charStr);
|
||||
}
|
||||
|
||||
if (dialog.CellVAlignCheckbox.checked)
|
||||
if (gDialog.CellVAlignCheckbox.checked)
|
||||
CloneAttribute(destElement, globalCellElement, "valign");
|
||||
|
||||
if (dialog.TextWrapCheckbox.checked)
|
||||
if (gDialog.TextWrapCheckbox.checked)
|
||||
CloneAttribute(destElement, globalCellElement, "nowrap");
|
||||
|
||||
if (dialog.CellStyleCheckbox.checked)
|
||||
if (gDialog.CellStyleCheckbox.checked)
|
||||
{
|
||||
var newStyleIndex = dialog.CellStyleList.selectedIndex;
|
||||
var newStyleIndex = gDialog.CellStyleList.selectedIndex;
|
||||
var currentStyleIndex = (destElement.nodeName.toLowerCase() == "th") ? 1 : 0;
|
||||
|
||||
if (newStyleIndex != currentStyleIndex)
|
||||
@ -1221,7 +1214,7 @@ function ApplyAttributesToOneCell(destElement)
|
||||
}
|
||||
}
|
||||
|
||||
if (dialog.CellColorCheckbox.checked)
|
||||
if (gDialog.CellColorCheckbox.checked)
|
||||
CloneAttribute(destElement, globalCellElement, "bgcolor");
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -60,11 +61,11 @@
|
||||
<grid>
|
||||
<columns><column/><column/></columns>
|
||||
<rows>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&tableRows.label;"/>
|
||||
<textbox class="narrow" id="TableRowsInput" oninput="forceInteger(this.id);"/>
|
||||
</row>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&tableColumns.label;"/>
|
||||
<textbox class="narrow" id="TableColumnsInput" oninput="forceInteger(this.id);"/>
|
||||
</row>
|
||||
@ -74,7 +75,7 @@
|
||||
<grid>
|
||||
<columns><column/><column/><column flex="1"/></columns>
|
||||
<rows>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&tableWidth.label;"/>
|
||||
<textbox class="narrow" id="TableWidthInput" oninput="forceInteger(this.id);"/>
|
||||
<menulist id="TableWidthUnits"/>
|
||||
@ -86,17 +87,17 @@
|
||||
<grid>
|
||||
<columns><column/><column/><column/></columns>
|
||||
<rows>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&tableBorderWidth.label;"/>
|
||||
<textbox class="narrow" id="BorderWidthInput" oninput="forceInteger(this.id);"/>
|
||||
<text class="label" align="left" value="&pixels.label;"/>
|
||||
</row>
|
||||
<row valign="middle">
|
||||
<row align="center">
|
||||
<text class="label" value="&tableSpacing.label;"/>
|
||||
<textbox class="narrow" id="SpacingInput" oninput="forceInteger(this.id);"/>
|
||||
<text class="label" value="&tablePxBetwCells.label;"/>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<text class="label" value="&tablePadding.label;"/>
|
||||
<textbox class="narrow" id="PaddingInput" oninput="forceInteger(this.id);"/>
|
||||
<text class="label" value="&tablePxBetwBrdrCellContent.label;"/>
|
||||
@ -105,7 +106,7 @@
|
||||
</grid>
|
||||
</groupbox>
|
||||
<!-- Table Alignment and Caption -->
|
||||
<hbox flex="1" valign="middle" autostretch="never">
|
||||
<hbox flex="1" align="center">
|
||||
<text class="label" value="&tableAlignment.label;"/>
|
||||
<menulist id="TableAlignList">
|
||||
<menupopup>
|
||||
@ -125,7 +126,7 @@
|
||||
</menulist>
|
||||
</hbox>
|
||||
<separator class="groove"/>
|
||||
<hbox valign="middle" autostretch="never">
|
||||
<hbox align="center">
|
||||
<text class="label" value="&backgroundColor.label;"/>
|
||||
<button class="color-button" oncommand="GetColorAndUpdate('tableBackgroundCW');">
|
||||
<spacer id="tableBackgroundCW" class="color-well"/>
|
||||
@ -137,14 +138,14 @@
|
||||
<hbox flex="1" autostretch="never">
|
||||
<spacer flex="1"/>
|
||||
<!-- From EdDialogOvlerlay.xul -->
|
||||
<button class="dialog" id="AdvancedEditButton"/>
|
||||
<button id="AdvancedEditButton"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
</vbox><!-- Table Panel -->
|
||||
|
||||
<!-- CELL PANEL -->
|
||||
<vbox id="CellPanel">
|
||||
<groupbox autostretch="never" valign="middle">
|
||||
<groupbox align="center">
|
||||
<caption label="&cellSelection.label;"/>
|
||||
<vbox>
|
||||
<menulist id="SelectionList" oncommand="ChangeSelection(event.target.value)" flex="1">
|
||||
@ -156,8 +157,8 @@
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<hbox flex="1">
|
||||
<button id="PreviousButton" class="dialog" label="&cellSelectPrevious.label;" oncommand="MoveSelection(0)" flex="1"/>
|
||||
<button id="NextButton" class="dialog align-right" label="&cellSelectNext.label;" oncommand="MoveSelection(1)" flex="1"/>
|
||||
<button id="PreviousButton" label="&cellSelectPrevious.label;" oncommand="MoveSelection(0)" flex="1"/>
|
||||
<button id="NextButton" class="align-right" label="&cellSelectNext.label;" oncommand="MoveSelection(1)" flex="1"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<spacer class="bigspacer"/>
|
||||
@ -172,13 +173,13 @@
|
||||
<grid>
|
||||
<columns><column/><column/><column flex="1"/></columns>
|
||||
<rows>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<checkbox id="CellHeightCheckbox" label="&tableHeight.label;"/>
|
||||
<textbox class="narrow" id="CellHeightInput"
|
||||
oninput="ChangeIntTextbox(this.id,'CellHeightCheckbox');"/>
|
||||
<menulist id="CellHeightUnits" oncommand="SetCheckbox('CellHeightCheckbox');"/>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<checkbox id="CellWidthCheckbox" label="&tableWidth.label;"/>
|
||||
<textbox class="narrow" id="CellWidthInput"
|
||||
oninput="ChangeIntTextbox(this.id,'CellWidthCheckbox');"/>
|
||||
@ -193,7 +194,7 @@
|
||||
<grid>
|
||||
<columns><column/><column flex="1"/><column/></columns>
|
||||
<rows>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<checkbox id="CellVAlignCheckbox" label="&cellVertical.label;"/>
|
||||
<menulist id="CellVAlignList" oncommand="SetCheckbox('CellVAlignCheckbox');">
|
||||
<menupopup>
|
||||
@ -203,7 +204,7 @@
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row valign="middle" autostretch="never">
|
||||
<row align="center">
|
||||
<checkbox id="CellHAlignCheckbox" label="&cellHorizontal.label;"/>
|
||||
<menulist id="CellHAlignList" oncommand="SelectCellHAlign()">
|
||||
<menupopup>
|
||||
@ -219,7 +220,7 @@
|
||||
</groupbox>
|
||||
</hbox>
|
||||
<spacer class="spacer"/>
|
||||
<hbox valign="middle" autostretch="never">
|
||||
<hbox align="center">
|
||||
<checkbox id="CellStyleCheckbox" label="&cellStyle.label;"/>
|
||||
<menulist id="CellStyleList" oncommand="SetCheckbox('CellStyleCheckbox');">
|
||||
<menupopup>
|
||||
@ -237,7 +238,7 @@
|
||||
</menulist>
|
||||
</hbox>
|
||||
<separator class="groove"/>
|
||||
<hbox valign="middle" autostretch="never">
|
||||
<hbox align="center">
|
||||
<checkbox id="CellColorCheckbox" label="&backgroundColor.label;"/>
|
||||
<button class="color-button" oncommand="GetColorAndUpdate('cellBackgroundCW');">
|
||||
<spacer id="cellBackgroundCW" class="color-well"/>
|
||||
@ -249,17 +250,16 @@
|
||||
<hbox autostretch="never">
|
||||
<html class="wrap" flex="1" style="width: 1em">&cellUseCheckboxHelp.label;</html>
|
||||
<!-- From EdDialogOvlerlay.xul -->
|
||||
<button class="dialog" id="AdvancedEditButton2"/>
|
||||
<button id="AdvancedEditButton2"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
</vbox><!-- Cell Panel -->
|
||||
|
||||
</tabpanels>
|
||||
<spacer class="spacer"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<hbox id="okCancelHelpButtonsRight"/>
|
||||
</hbox>
|
||||
</tabbox>
|
||||
<spacer class="spacer"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<hbox id="okCancelHelpButtonsRight"/>
|
||||
</hbox>
|
||||
</window>
|
||||
|
@ -34,6 +34,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="PreventCancel()"
|
||||
orient="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
@ -51,13 +52,13 @@
|
||||
<spacer class="bigspacer"/>
|
||||
<hbox flex="1">
|
||||
<spacer class="bigspacer"/>
|
||||
<button class="dialog" label="&keepCurrentPageButton.label;"
|
||||
<button label="&keepCurrentPageButton.label;"
|
||||
flex="1" oncommand="KeepCurrentPage()"/>
|
||||
<spacer class="bigspacer"/>
|
||||
</hbox>
|
||||
<hbox flex="1">
|
||||
<spacer class="bigspacer"/>
|
||||
<button class="dialog" label="&useOtherPageButton.label;"
|
||||
<button label="&useOtherPageButton.label;"
|
||||
flex="1" oncommand="UseOtherPage()"/>
|
||||
<spacer class="bigspacer"/>
|
||||
</hbox>
|
||||
|
@ -29,7 +29,6 @@ var charsetWasChanged = false;
|
||||
var insertNewContentType = false;
|
||||
var contenttypeElement;
|
||||
var initDone = false;
|
||||
var dialog;
|
||||
|
||||
//Cancel() is in EdDialogCommon.js
|
||||
|
||||
@ -40,11 +39,9 @@ function Startup()
|
||||
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
dialog.TitleInput = document.getElementById("TitleInput");
|
||||
dialog.charsetTree = document.getElementById('CharsetTree');
|
||||
dialog.exportToText = document.getElementById('ExportToText');
|
||||
gDialog.TitleInput = document.getElementById("TitleInput");
|
||||
gDialog.charsetTree = document.getElementById('CharsetTree');
|
||||
gDialog.exportToText = document.getElementById('ExportToText');
|
||||
|
||||
contenttypeElement = GetHTTPEquivMetaElement("content-type");
|
||||
if(!contenttypeElement && (editorShell.contentsMIMEType != 'text/plain'))
|
||||
@ -69,7 +66,7 @@ function Startup()
|
||||
helpTextParent.appendChild(helpText);
|
||||
|
||||
// SET FOCUS TO FIRST CONTROL
|
||||
SetTextboxFocus(dialog.TitleInput);
|
||||
SetTextboxFocus(gDialog.TitleInput);
|
||||
LoadAvailableCharSets();
|
||||
initDone = true;
|
||||
|
||||
@ -79,7 +76,7 @@ function Startup()
|
||||
|
||||
function InitDialog()
|
||||
{
|
||||
dialog.TitleInput.value = editorShell.GetDocumentTitle();
|
||||
gDialog.TitleInput.value = editorShell.GetDocumentTitle();
|
||||
charset = editorShell.GetDocumentCharacterSet();
|
||||
}
|
||||
|
||||
@ -97,10 +94,10 @@ function onOK()
|
||||
editorShell.EndBatchChanges();
|
||||
|
||||
if(titleWasEdited)
|
||||
window.opener.newTitle = dialog.TitleInput.value.trimString();
|
||||
window.opener.newTitle = gDialog.TitleInput.value.trimString();
|
||||
|
||||
window.opener.ok = true;
|
||||
window.opener.exportToText = dialog.exportToText.checked;
|
||||
window.opener.exportToText = gDialog.exportToText.checked;
|
||||
SaveWindowLocation();
|
||||
return true;
|
||||
}
|
||||
@ -133,12 +130,12 @@ function LoadAvailableCharSets()
|
||||
var selectedItem;
|
||||
var item;
|
||||
|
||||
ClearTreelist(dialog.charsetTree);
|
||||
ClearTreelist(gDialog.charsetTree);
|
||||
|
||||
for (var i = 0; i < rdfContainer.GetCount(); i++)
|
||||
{
|
||||
charsetNode = availableCharsets.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
item = AppendStringToTreelist(dialog.charsetTree, readRDFString(rdfDataSource, charsetNode, kNC_name));
|
||||
item = AppendStringToTreelist(gDialog.charsetTree, readRDFString(rdfDataSource, charsetNode, kNC_name));
|
||||
item.firstChild.firstChild.setAttribute("value", charsetNode.Value);
|
||||
if(charset == charsetNode.Value)
|
||||
selectedItem = item;
|
||||
@ -146,8 +143,8 @@ function LoadAvailableCharSets()
|
||||
|
||||
if(selectedItem)
|
||||
{
|
||||
dialog.charsetTree.selectItem(selectedItem);
|
||||
dialog.charsetTree.ensureElementIsVisible(selectedItem);
|
||||
gDialog.charsetTree.selectItem(selectedItem);
|
||||
gDialog.charsetTree.ensureElementIsVisible(selectedItem);
|
||||
}
|
||||
}
|
||||
catch(e) {}
|
||||
@ -160,7 +157,7 @@ function SelectCharset()
|
||||
{
|
||||
try
|
||||
{
|
||||
charset = GetSelectedTreelistAttribute(dialog.charsetTree, "value");
|
||||
charset = GetSelectedTreelistAttribute(gDialog.charsetTree, "value");
|
||||
if(charset != "")
|
||||
charsetWasChanged = true;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload = "Startup()"
|
||||
onunload="onCancel()"
|
||||
orient="vertical"
|
||||
style="width: 32em;">
|
||||
|
||||
@ -66,5 +67,5 @@
|
||||
<separator class="groove"/>
|
||||
|
||||
<!-- from global dialogOverlay -->
|
||||
<hbox id="okCancelButtons"/>
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
Loading…
Reference in New Issue
Block a user