bgneal@312: tinyMCEPopup.requireLangPack(); bgneal@312: bgneal@312: var defaultFonts = "" + bgneal@312: "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" + bgneal@312: "Times New Roman, Times, serif=Times New Roman, Times, serif;" + bgneal@312: "Courier New, Courier, mono=Courier New, Courier, mono;" + bgneal@312: "Times New Roman, Times, serif=Times New Roman, Times, serif;" + bgneal@312: "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" + bgneal@312: "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + bgneal@312: "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif"; bgneal@312: bgneal@312: var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger"; bgneal@312: var defaultMeasurement = "+pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%"; bgneal@312: var defaultSpacingMeasurement = "pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;+ems=em;exs=ex;%"; bgneal@312: var defaultIndentMeasurement = "pixels=px;+points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%"; bgneal@312: var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900"; bgneal@312: var defaultTextStyle = "normal;italic;oblique"; bgneal@312: var defaultVariant = "normal;small-caps"; bgneal@312: var defaultLineHeight = "normal"; bgneal@312: var defaultAttachment = "fixed;scroll"; bgneal@312: var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y"; bgneal@312: var defaultPosH = "left;center;right"; bgneal@312: var defaultPosV = "top;center;bottom"; bgneal@312: var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom"; bgneal@312: var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none"; bgneal@312: var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset"; bgneal@312: var defaultBorderWidth = "thin;medium;thick"; bgneal@312: var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none"; bgneal@312: bgneal@312: function init() { bgneal@312: var ce = document.getElementById('container'), h; bgneal@312: bgneal@312: ce.style.cssText = tinyMCEPopup.getWindowArg('style_text'); bgneal@312: bgneal@312: h = getBrowserHTML('background_image_browser','background_image','image','advimage'); bgneal@312: document.getElementById("background_image_browser").innerHTML = h; bgneal@312: bgneal@312: document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color'); bgneal@312: document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color'); bgneal@312: document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top'); bgneal@312: document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right'); bgneal@312: document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom'); bgneal@312: document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left'); bgneal@312: bgneal@312: fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true); bgneal@312: fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true); bgneal@312: fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true); bgneal@312: fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true); bgneal@312: fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true); bgneal@312: fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true); bgneal@312: fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true); bgneal@312: fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true); bgneal@312: fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true); bgneal@312: fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true); bgneal@312: fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true); bgneal@312: fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true); bgneal@312: fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true); bgneal@312: fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true); bgneal@312: fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true); bgneal@312: fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true); bgneal@312: fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true); bgneal@312: fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true); bgneal@312: fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true); bgneal@312: fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true); bgneal@312: fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true); bgneal@312: fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true); bgneal@312: fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true); bgneal@312: fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true); bgneal@312: fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true); bgneal@312: fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true); bgneal@312: fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true); bgneal@312: bgneal@312: fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true); bgneal@312: fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true); bgneal@312: bgneal@312: fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true); bgneal@312: bgneal@312: fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true); bgneal@312: bgneal@312: fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true); bgneal@312: fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true); bgneal@312: bgneal@312: TinyMCE_EditableSelects.init(); bgneal@312: setupFormData(); bgneal@312: showDisabledControls(); bgneal@312: } bgneal@312: bgneal@312: function setupFormData() { bgneal@312: var ce = document.getElementById('container'), f = document.forms[0], s, b, i; bgneal@312: bgneal@312: // Setup text fields bgneal@312: bgneal@312: selectByValue(f, 'text_font', ce.style.fontFamily, true, true); bgneal@312: selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true); bgneal@312: selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize)); bgneal@312: selectByValue(f, 'text_weight', ce.style.fontWeight, true, true); bgneal@312: selectByValue(f, 'text_style', ce.style.fontStyle, true, true); bgneal@312: selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true); bgneal@312: selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight)); bgneal@312: selectByValue(f, 'text_case', ce.style.textTransform, true, true); bgneal@312: selectByValue(f, 'text_variant', ce.style.fontVariant, true, true); bgneal@312: f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color); bgneal@312: updateColor('text_color_pick', 'text_color'); bgneal@312: f.text_underline.checked = inStr(ce.style.textDecoration, 'underline'); bgneal@312: f.text_overline.checked = inStr(ce.style.textDecoration, 'overline'); bgneal@312: f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through'); bgneal@312: f.text_blink.checked = inStr(ce.style.textDecoration, 'blink'); bgneal@312: bgneal@312: // Setup background fields bgneal@312: bgneal@312: f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor); bgneal@312: updateColor('background_color_pick', 'background_color'); bgneal@312: f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); bgneal@312: selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true); bgneal@312: selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true); bgneal@312: selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true); bgneal@312: selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0))); bgneal@312: selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true); bgneal@312: selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1))); bgneal@312: bgneal@312: // Setup block fields bgneal@312: bgneal@312: selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true); bgneal@312: selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing)); bgneal@312: selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true); bgneal@312: selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing)); bgneal@312: selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true); bgneal@312: selectByValue(f, 'block_text_align', ce.style.textAlign, true, true); bgneal@312: f.block_text_indent.value = getNum(ce.style.textIndent); bgneal@312: selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent)); bgneal@312: selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true); bgneal@312: selectByValue(f, 'block_display', ce.style.display, true, true); bgneal@312: bgneal@312: // Setup box fields bgneal@312: bgneal@312: f.box_width.value = getNum(ce.style.width); bgneal@312: selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width)); bgneal@312: bgneal@312: f.box_height.value = getNum(ce.style.height); bgneal@312: selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height)); bgneal@442: selectByValue(f, 'box_float', ce.style.cssFloat || ce.style.styleFloat, true, true); bgneal@312: bgneal@312: selectByValue(f, 'box_clear', ce.style.clear, true, true); bgneal@312: bgneal@312: setupBox(f, ce, 'box_padding', 'padding', ''); bgneal@312: setupBox(f, ce, 'box_margin', 'margin', ''); bgneal@312: bgneal@312: // Setup border fields bgneal@312: bgneal@312: setupBox(f, ce, 'border_style', 'border', 'Style'); bgneal@312: setupBox(f, ce, 'border_width', 'border', 'Width'); bgneal@312: setupBox(f, ce, 'border_color', 'border', 'Color'); bgneal@312: bgneal@312: updateColor('border_color_top_pick', 'border_color_top'); bgneal@312: updateColor('border_color_right_pick', 'border_color_right'); bgneal@312: updateColor('border_color_bottom_pick', 'border_color_bottom'); bgneal@312: updateColor('border_color_left_pick', 'border_color_left'); bgneal@312: bgneal@312: f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value); bgneal@312: f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value); bgneal@312: f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value); bgneal@312: f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value); bgneal@312: bgneal@312: // Setup list fields bgneal@312: bgneal@312: selectByValue(f, 'list_type', ce.style.listStyleType, true, true); bgneal@312: selectByValue(f, 'list_position', ce.style.listStylePosition, true, true); bgneal@312: f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); bgneal@312: bgneal@312: // Setup box fields bgneal@312: bgneal@312: selectByValue(f, 'positioning_type', ce.style.position, true, true); bgneal@312: selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true); bgneal@312: selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true); bgneal@312: f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : ""; bgneal@312: bgneal@312: f.positioning_width.value = getNum(ce.style.width); bgneal@312: selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width)); bgneal@312: bgneal@312: f.positioning_height.value = getNum(ce.style.height); bgneal@312: selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height)); bgneal@312: bgneal@312: setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']); bgneal@312: bgneal@312: s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1"); bgneal@312: s = s.replace(/,/g, ' '); bgneal@312: bgneal@312: if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) { bgneal@312: f.positioning_clip_top.value = getNum(getVal(s, 0)); bgneal@312: selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); bgneal@312: f.positioning_clip_right.value = getNum(getVal(s, 1)); bgneal@312: selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1))); bgneal@312: f.positioning_clip_bottom.value = getNum(getVal(s, 2)); bgneal@312: selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2))); bgneal@312: f.positioning_clip_left.value = getNum(getVal(s, 3)); bgneal@312: selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3))); bgneal@312: } else { bgneal@312: f.positioning_clip_top.value = getNum(getVal(s, 0)); bgneal@312: selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); bgneal@312: f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value; bgneal@312: } bgneal@312: bgneal@312: // setupBox(f, ce, '', 'border', 'Color'); bgneal@312: } bgneal@312: bgneal@312: function getMeasurement(s) { bgneal@312: return s.replace(/^([0-9.]+)(.*)$/, "$2"); bgneal@312: } bgneal@312: bgneal@312: function getNum(s) { bgneal@312: if (new RegExp('^(?:[0-9.]+)(?:[a-z%]+)$', 'gi').test(s)) bgneal@312: return s.replace(/[^0-9.]/g, ''); bgneal@312: bgneal@312: return s; bgneal@312: } bgneal@312: bgneal@312: function inStr(s, n) { bgneal@312: return new RegExp(n, 'gi').test(s); bgneal@312: } bgneal@312: bgneal@312: function getVal(s, i) { bgneal@312: var a = s.split(' '); bgneal@312: bgneal@312: if (a.length > 1) bgneal@312: return a[i]; bgneal@312: bgneal@312: return ""; bgneal@312: } bgneal@312: bgneal@312: function setValue(f, n, v) { bgneal@312: if (f.elements[n].type == "text") bgneal@312: f.elements[n].value = v; bgneal@312: else bgneal@312: selectByValue(f, n, v, true, true); bgneal@312: } bgneal@312: bgneal@312: function setupBox(f, ce, fp, pr, sf, b) { bgneal@312: if (typeof(b) == "undefined") bgneal@312: b = ['Top', 'Right', 'Bottom', 'Left']; bgneal@312: bgneal@312: if (isSame(ce, pr, sf, b)) { bgneal@312: f.elements[fp + "_same"].checked = true; bgneal@312: bgneal@312: setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); bgneal@312: f.elements[fp + "_top"].disabled = false; bgneal@312: bgneal@312: f.elements[fp + "_right"].value = ""; bgneal@312: f.elements[fp + "_right"].disabled = true; bgneal@312: f.elements[fp + "_bottom"].value = ""; bgneal@312: f.elements[fp + "_bottom"].disabled = true; bgneal@312: f.elements[fp + "_left"].value = ""; bgneal@312: f.elements[fp + "_left"].disabled = true; bgneal@312: bgneal@312: if (f.elements[fp + "_top_measurement"]) { bgneal@312: selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); bgneal@312: f.elements[fp + "_left_measurement"].disabled = true; bgneal@312: f.elements[fp + "_bottom_measurement"].disabled = true; bgneal@312: f.elements[fp + "_right_measurement"].disabled = true; bgneal@312: } bgneal@312: } else { bgneal@312: f.elements[fp + "_same"].checked = false; bgneal@312: bgneal@312: setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); bgneal@312: f.elements[fp + "_top"].disabled = false; bgneal@312: bgneal@312: setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf])); bgneal@312: f.elements[fp + "_right"].disabled = false; bgneal@312: bgneal@312: setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf])); bgneal@312: f.elements[fp + "_bottom"].disabled = false; bgneal@312: bgneal@312: setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf])); bgneal@312: f.elements[fp + "_left"].disabled = false; bgneal@312: bgneal@312: if (f.elements[fp + "_top_measurement"]) { bgneal@312: selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); bgneal@312: selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf])); bgneal@312: selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf])); bgneal@312: selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf])); bgneal@312: f.elements[fp + "_left_measurement"].disabled = false; bgneal@312: f.elements[fp + "_bottom_measurement"].disabled = false; bgneal@312: f.elements[fp + "_right_measurement"].disabled = false; bgneal@312: } bgneal@312: } bgneal@312: } bgneal@312: bgneal@312: function isSame(e, pr, sf, b) { bgneal@312: var a = [], i, x; bgneal@312: bgneal@312: if (typeof(b) == "undefined") bgneal@312: b = ['Top', 'Right', 'Bottom', 'Left']; bgneal@312: bgneal@312: if (typeof(sf) == "undefined" || sf == null) bgneal@312: sf = ""; bgneal@312: bgneal@312: a[0] = e.style[pr + b[0] + sf]; bgneal@312: a[1] = e.style[pr + b[1] + sf]; bgneal@312: a[2] = e.style[pr + b[2] + sf]; bgneal@312: a[3] = e.style[pr + b[3] + sf]; bgneal@312: bgneal@312: for (i=0; i 0 ? s.substring(1) : s; bgneal@312: bgneal@312: if (f.text_none.checked) bgneal@312: s = "none"; bgneal@312: bgneal@312: ce.style.textDecoration = s; bgneal@312: bgneal@312: // Build background styles bgneal@312: bgneal@312: ce.style.backgroundColor = f.background_color.value; bgneal@312: ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : ""; bgneal@312: ce.style.backgroundRepeat = f.background_repeat.value; bgneal@312: ce.style.backgroundAttachment = f.background_attachment.value; bgneal@312: bgneal@312: if (f.background_hpos.value != "") { bgneal@312: s = ""; bgneal@312: s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " "; bgneal@312: s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : ""); bgneal@312: ce.style.backgroundPosition = s; bgneal@312: } bgneal@312: bgneal@312: // Build block styles bgneal@312: bgneal@312: ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : ""); bgneal@312: ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : ""); bgneal@312: ce.style.verticalAlign = f.block_vertical_alignment.value; bgneal@312: ce.style.textAlign = f.block_text_align.value; bgneal@312: ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : ""); bgneal@312: ce.style.whiteSpace = f.block_whitespace.value; bgneal@312: ce.style.display = f.block_display.value; bgneal@312: bgneal@312: // Build box styles bgneal@312: bgneal@312: ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : ""); bgneal@312: ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : ""); bgneal@312: ce.style.styleFloat = f.box_float.value; bgneal@442: ce.style.cssFloat = f.box_float.value; bgneal@312: bgneal@312: ce.style.clear = f.box_clear.value; bgneal@312: bgneal@312: if (!f.box_padding_same.checked) { bgneal@312: ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); bgneal@312: ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : ""); bgneal@312: ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : ""); bgneal@312: ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : ""); bgneal@312: } else bgneal@312: ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); bgneal@312: bgneal@312: if (!f.box_margin_same.checked) { bgneal@312: ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); bgneal@312: ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : ""); bgneal@312: ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : ""); bgneal@312: ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : ""); bgneal@312: } else bgneal@312: ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); bgneal@312: bgneal@312: // Build border styles bgneal@312: bgneal@312: if (!f.border_style_same.checked) { bgneal@312: ce.style.borderTopStyle = f.border_style_top.value; bgneal@312: ce.style.borderRightStyle = f.border_style_right.value; bgneal@312: ce.style.borderBottomStyle = f.border_style_bottom.value; bgneal@312: ce.style.borderLeftStyle = f.border_style_left.value; bgneal@312: } else bgneal@312: ce.style.borderStyle = f.border_style_top.value; bgneal@312: bgneal@312: if (!f.border_width_same.checked) { bgneal@312: ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); bgneal@312: ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : ""); bgneal@312: ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : ""); bgneal@312: ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : ""); bgneal@312: } else bgneal@312: ce.style.borderWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); bgneal@312: bgneal@312: if (!f.border_color_same.checked) { bgneal@312: ce.style.borderTopColor = f.border_color_top.value; bgneal@312: ce.style.borderRightColor = f.border_color_right.value; bgneal@312: ce.style.borderBottomColor = f.border_color_bottom.value; bgneal@312: ce.style.borderLeftColor = f.border_color_left.value; bgneal@312: } else bgneal@312: ce.style.borderColor = f.border_color_top.value; bgneal@312: bgneal@312: // Build list styles bgneal@312: bgneal@312: ce.style.listStyleType = f.list_type.value; bgneal@312: ce.style.listStylePosition = f.list_position.value; bgneal@312: ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : ""; bgneal@312: bgneal@312: // Build positioning styles bgneal@312: bgneal@312: ce.style.position = f.positioning_type.value; bgneal@312: ce.style.visibility = f.positioning_visibility.value; bgneal@312: bgneal@312: if (ce.style.width == "") bgneal@312: ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : ""); bgneal@312: bgneal@312: if (ce.style.height == "") bgneal@312: ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : ""); bgneal@312: bgneal@312: ce.style.zIndex = f.positioning_zindex.value; bgneal@312: ce.style.overflow = f.positioning_overflow.value; bgneal@312: bgneal@312: if (!f.positioning_placement_same.checked) { bgneal@312: ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); bgneal@312: ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : ""); bgneal@312: ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : ""); bgneal@312: ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : ""); bgneal@312: } else { bgneal@312: s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); bgneal@312: ce.style.top = s; bgneal@312: ce.style.right = s; bgneal@312: ce.style.bottom = s; bgneal@312: ce.style.left = s; bgneal@312: } bgneal@312: bgneal@312: if (!f.positioning_clip_same.checked) { bgneal@312: s = "rect("; bgneal@312: s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " "; bgneal@312: s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " "; bgneal@312: s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " "; bgneal@312: s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto"); bgneal@312: s += ")"; bgneal@312: bgneal@312: if (s != "rect(auto auto auto auto)") bgneal@312: ce.style.clip = s; bgneal@312: } else { bgneal@312: s = "rect("; bgneal@312: t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto"; bgneal@312: s += t + " "; bgneal@312: s += t + " "; bgneal@312: s += t + " "; bgneal@312: s += t + ")"; bgneal@312: bgneal@312: if (s != "rect(auto auto auto auto)") bgneal@312: ce.style.clip = s; bgneal@312: } bgneal@312: bgneal@312: ce.style.cssText = ce.style.cssText; bgneal@312: } bgneal@312: bgneal@312: function isNum(s) { bgneal@312: return new RegExp('[0-9]+', 'g').test(s); bgneal@312: } bgneal@312: bgneal@312: function showDisabledControls() { bgneal@312: var f = document.forms, i, a; bgneal@312: bgneal@312: for (i=0; i 1) { bgneal@312: addSelectValue(f, s, p[0], p[1]); bgneal@312: bgneal@312: if (se) bgneal@312: selectByValue(f, s, p[1]); bgneal@312: } else { bgneal@312: addSelectValue(f, s, p[0], p[0]); bgneal@312: bgneal@312: if (se) bgneal@312: selectByValue(f, s, p[0]); bgneal@312: } bgneal@312: } bgneal@312: } bgneal@312: bgneal@312: function toggleSame(ce, pre) { bgneal@312: var el = document.forms[0].elements, i; bgneal@312: bgneal@312: if (ce.checked) { bgneal@312: el[pre + "_top"].disabled = false; bgneal@312: el[pre + "_right"].disabled = true; bgneal@312: el[pre + "_bottom"].disabled = true; bgneal@312: el[pre + "_left"].disabled = true; bgneal@312: bgneal@312: if (el[pre + "_top_measurement"]) { bgneal@312: el[pre + "_top_measurement"].disabled = false; bgneal@312: el[pre + "_right_measurement"].disabled = true; bgneal@312: el[pre + "_bottom_measurement"].disabled = true; bgneal@312: el[pre + "_left_measurement"].disabled = true; bgneal@312: } bgneal@312: } else { bgneal@312: el[pre + "_top"].disabled = false; bgneal@312: el[pre + "_right"].disabled = false; bgneal@312: el[pre + "_bottom"].disabled = false; bgneal@312: el[pre + "_left"].disabled = false; bgneal@312: bgneal@312: if (el[pre + "_top_measurement"]) { bgneal@312: el[pre + "_top_measurement"].disabled = false; bgneal@312: el[pre + "_right_measurement"].disabled = false; bgneal@312: el[pre + "_bottom_measurement"].disabled = false; bgneal@312: el[pre + "_left_measurement"].disabled = false; bgneal@312: } bgneal@312: } bgneal@312: bgneal@312: showDisabledControls(); bgneal@312: } bgneal@312: bgneal@312: function synch(fr, to) { bgneal@312: var f = document.forms[0]; bgneal@312: bgneal@312: f.elements[to].value = f.elements[fr].value; bgneal@312: bgneal@312: if (f.elements[fr + "_measurement"]) bgneal@312: selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value); bgneal@312: } bgneal@312: bgneal@312: tinyMCEPopup.onInit.add(init);