1 var defaultFonts = "" +
\r
2 "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" +
\r
3 "Times New Roman, Times, serif=Times New Roman, Times, serif;" +
\r
4 "Courier New, Courier, mono=Courier New, Courier, mono;" +
\r
5 "Times New Roman, Times, serif=Times New Roman, Times, serif;" +
\r
6 "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" +
\r
7 "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" +
\r
8 "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif";
\r
10 var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger";
\r
11 var defaultMeasurement = "+pixels=px;points=pt;in;cm;mm;picas;ems;exs;%";
\r
12 var defaultSpacingMeasurement = "pixels=px;points=pt;in;cm;mm;picas;+ems;exs;%";
\r
13 var defaultIndentMeasurement = "pixels=px;+points=pt;in;cm;mm;picas;ems;exs;%";
\r
14 var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900";
\r
15 var defaultTextStyle = "normal;italic;oblique";
\r
16 var defaultVariant = "normal;small-caps";
\r
17 var defaultLineHeight = "normal";
\r
18 var defaultAttachment = "fixed;scroll";
\r
19 var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y";
\r
20 var defaultPosH = "left;center;right";
\r
21 var defaultPosV = "top;center;bottom";
\r
22 var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom";
\r
23 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";
\r
24 var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset";
\r
25 var defaultBorderWidth = "thin;medium;thick";
\r
26 var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none";
\r
29 var ce = document.getElementById('container'), h;
\r
31 ce.style.cssText = tinyMCEPopup.getWindowArg('style_text');
\r
33 h = getBrowserHTML('background_image_browser','background_image','image','advimage');
\r
34 document.getElementById("background_image_browser").innerHTML = h;
\r
36 tinyMCEPopup.resizeToInnerSize();
\r
38 document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color');
\r
39 document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color');
\r
40 document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top');
\r
41 document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right');
\r
42 document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom');
\r
43 document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left');
\r
45 fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true);
\r
46 fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true);
\r
47 fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true);
\r
48 fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true);
\r
49 fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true);
\r
50 fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true);
\r
51 fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true);
\r
52 fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true);
\r
53 fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true);
\r
55 fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true);
\r
56 fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true);
\r
58 fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true);
\r
59 fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true);
\r
61 fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true);
\r
62 fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true);
\r
64 fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true);
\r
65 fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true);
\r
66 fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true);
\r
67 fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true);
\r
68 fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true);
\r
69 fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true);
\r
70 fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true);
\r
71 fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true);
\r
72 fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true);
\r
74 fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true);
\r
75 fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true);
\r
76 fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true);
\r
77 fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true);
\r
78 fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true);
\r
79 fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true);
\r
80 fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true);
\r
81 fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true);
\r
82 fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true);
\r
83 fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true);
\r
84 fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true);
\r
85 fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true);
\r
87 fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true);
\r
88 fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true);
\r
89 fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true);
\r
90 fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true);
\r
92 fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true);
\r
93 fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true);
\r
94 fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true);
\r
95 fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true);
\r
97 fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true);
\r
98 fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true);
\r
99 fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true);
\r
100 fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true);
\r
102 fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true);
\r
103 fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true);
\r
105 fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true);
\r
106 fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true);
\r
108 fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true);
\r
109 fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true);
\r
110 fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true);
\r
112 fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true);
\r
113 fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true);
\r
114 fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true);
\r
115 fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true);
\r
117 fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true);
\r
118 fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true);
\r
119 fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true);
\r
120 fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true);
\r
122 TinyMCE_EditableSelects.init();
\r
124 showDisabledControls();
\r
127 function setupFormData() {
\r
128 var ce = document.getElementById('container'), f = document.forms[0], s, b, i;
\r
130 // Setup text fields
\r
132 selectByValue(f, 'text_font', ce.style.fontFamily, true, true);
\r
133 selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true);
\r
134 selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize));
\r
135 selectByValue(f, 'text_weight', ce.style.fontWeight, true, true);
\r
136 selectByValue(f, 'text_style', ce.style.fontStyle, true, true);
\r
137 selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true);
\r
138 selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight));
\r
139 selectByValue(f, 'text_case', ce.style.textTransform, true, true);
\r
140 selectByValue(f, 'text_variant', ce.style.fontVariant, true, true);
\r
141 f.text_color.value = ce.style.color;
\r
142 updateColor('text_color_pick', 'text_color');
\r
143 f.text_underline.checked = inStr(ce.style.textDecoration, 'underline');
\r
144 f.text_overline.checked = inStr(ce.style.textDecoration, 'overline');
\r
145 f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through');
\r
146 f.text_blink.checked = inStr(ce.style.textDecoration, 'blink');
\r
148 // Setup background fields
\r
150 f.background_color.value = ce.style.backgroundColor;
\r
151 updateColor('background_color_pick', 'background_color');
\r
152 f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
\r
153 selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true);
\r
154 selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true);
\r
155 selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true);
\r
156 selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0)));
\r
157 selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true);
\r
158 selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1)));
\r
160 // Setup block fields
\r
162 selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true);
\r
163 selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing));
\r
164 selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true);
\r
165 selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing));
\r
166 selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true);
\r
167 selectByValue(f, 'block_text_align', ce.style.textAlign, true, true);
\r
168 f.block_text_indent.value = getNum(ce.style.textIndent);
\r
169 selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent));
\r
170 selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true);
\r
171 selectByValue(f, 'block_display', ce.style.display, true, true);
\r
173 // Setup box fields
\r
175 f.box_width.value = getNum(ce.style.width);
\r
176 selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width));
\r
178 f.box_height.value = getNum(ce.style.height);
\r
179 selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height));
\r
181 if (tinyMCE.isGecko)
\r
182 selectByValue(f, 'box_float', ce.style.cssFloat, true, true);
\r
184 selectByValue(f, 'box_float', ce.style.styleFloat, true, true);
\r
186 selectByValue(f, 'box_clear', ce.style.clear, true, true);
\r
188 setupBox(f, ce, 'box_padding', 'padding', '');
\r
189 setupBox(f, ce, 'box_margin', 'margin', '');
\r
191 // Setup border fields
\r
193 setupBox(f, ce, 'border_style', 'border', 'Style');
\r
194 setupBox(f, ce, 'border_width', 'border', 'Width');
\r
195 setupBox(f, ce, 'border_color', 'border', 'Color');
\r
197 updateColor('border_color_top_pick', 'border_color_top');
\r
198 updateColor('border_color_right_pick', 'border_color_right');
\r
199 updateColor('border_color_bottom_pick', 'border_color_bottom');
\r
200 updateColor('border_color_left_pick', 'border_color_left');
\r
202 // Setup list fields
\r
204 selectByValue(f, 'list_type', ce.style.listStyleType, true, true);
\r
205 selectByValue(f, 'list_position', ce.style.listStylePosition, true, true);
\r
206 f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
\r
208 // Setup box fields
\r
210 selectByValue(f, 'positioning_type', ce.style.position, true, true);
\r
211 selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true);
\r
212 selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true);
\r
213 f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : "";
\r
215 f.positioning_width.value = getNum(ce.style.width);
\r
216 selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width));
\r
218 f.positioning_height.value = getNum(ce.style.height);
\r
219 selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height));
\r
221 setupBox(f, ce, 'positioning_placement', '', '', new Array('top', 'right', 'bottom', 'left'));
\r
223 s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1");
\r
224 s = s.replace(/,/g, ' ');
\r
226 if (!hasEqualValues(new Array(getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)))) {
\r
227 f.positioning_clip_top.value = getNum(getVal(s, 0));
\r
228 selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));
\r
229 f.positioning_clip_right.value = getNum(getVal(s, 1));
\r
230 selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1)));
\r
231 f.positioning_clip_bottom.value = getNum(getVal(s, 2));
\r
232 selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2)));
\r
233 f.positioning_clip_left.value = getNum(getVal(s, 3));
\r
234 selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3)));
\r
236 f.positioning_clip_top.value = getNum(getVal(s, 0));
\r
237 selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));
\r
238 f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value;
\r
241 // setupBox(f, ce, '', 'border', 'Color');
\r
244 function getMeasurement(s) {
\r
245 return s.replace(/^([0-9]+)(.*)$/, "$2");
\r
248 function getNum(s) {
\r
249 if (new RegExp('^[0-9]+[a-z%]+$', 'gi').test(s))
\r
250 return s.replace(/[^0-9]/g, '');
\r
255 function inStr(s, n) {
\r
256 return new RegExp(n, 'gi').test(s);
\r
259 function getVal(s, i) {
\r
260 var a = tinyMCE.explode(' ', s);
\r
268 function setValue(f, n, v) {
\r
269 if (f.elements[n].type == "text")
\r
270 f.elements[n].value = v;
\r
272 selectByValue(f, n, v, true, true);
\r
275 function setupBox(f, ce, fp, pr, sf, b) {
\r
276 if (typeof(b) == "undefined")
\r
277 b = new Array('Top', 'Right', 'Bottom', 'Left');
\r
279 if (isSame(ce, pr, sf, b)) {
\r
280 f.elements[fp + "_same"].checked = true;
\r
282 setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));
\r
283 f.elements[fp + "_top"].disabled = false;
\r
285 f.elements[fp + "_right"].value = "";
\r
286 f.elements[fp + "_right"].disabled = true;
\r
287 f.elements[fp + "_bottom"].value = "";
\r
288 f.elements[fp + "_bottom"].disabled = true;
\r
289 f.elements[fp + "_left"].value = "";
\r
290 f.elements[fp + "_left"].disabled = true;
\r
292 if (f.elements[fp + "_top_measurement"]) {
\r
293 selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));
\r
294 f.elements[fp + "_left_measurement"].disabled = true;
\r
295 f.elements[fp + "_bottom_measurement"].disabled = true;
\r
296 f.elements[fp + "_right_measurement"].disabled = true;
\r
299 f.elements[fp + "_same"].checked = false;
\r
301 setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));
\r
302 f.elements[fp + "_top"].disabled = false;
\r
304 setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf]));
\r
305 f.elements[fp + "_right"].disabled = false;
\r
307 setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf]));
\r
308 f.elements[fp + "_bottom"].disabled = false;
\r
310 setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf]));
\r
311 f.elements[fp + "_left"].disabled = false;
\r
313 if (f.elements[fp + "_top_measurement"]) {
\r
314 selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));
\r
315 selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf]));
\r
316 selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf]));
\r
317 selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf]));
\r
318 f.elements[fp + "_left_measurement"].disabled = false;
\r
319 f.elements[fp + "_bottom_measurement"].disabled = false;
\r
320 f.elements[fp + "_right_measurement"].disabled = false;
\r
325 function isSame(e, pr, sf, b) {
\r
326 var a = new Array(), i, x;
\r
328 if (typeof(b) == "undefined")
\r
329 b = new Array('Top', 'Right', 'Bottom', 'Left');
\r
331 if (typeof(sf) == "undefined" || sf == null)
\r
334 a[0] = e.style[pr + b[0] + sf];
\r
335 a[1] = e.style[pr + b[1] + sf];
\r
336 a[2] = e.style[pr + b[2] + sf];
\r
337 a[3] = e.style[pr + b[3] + sf];
\r
339 for (i=0; i<a.length; i++) {
\r
343 for (x=0; x<a.length; x++) {
\r
352 function hasEqualValues(a) {
\r
355 for (i=0; i<a.length; i++) {
\r
359 for (x=0; x<a.length; x++) {
\r
368 function applyAction() {
\r
369 var ce = document.getElementById('container');
\r
373 tinyMCEPopup.execCommand('mceSetElementStyle', false, tinyMCE.serializeStyle(tinyMCE.parseStyle(ce.style.cssText)));
\r
376 function updateAction() {
\r
378 tinyMCEPopup.close();
\r
381 function generateCSS() {
\r
382 var ce = document.getElementById('container'), f = document.forms[0], num = new RegExp('[0-9]+', 'g'), s, t;
\r
384 ce.style.cssText = "";
\r
386 // Build text styles
\r
387 ce.style.fontFamily = f.text_font.value;
\r
388 ce.style.fontSize = f.text_size.value + (isNum(f.text_size.value) ? f.text_size_measurement.value : "");
\r
389 ce.style.fontStyle = f.text_style.value;
\r
390 ce.style.lineHeight = f.text_lineheight.value + (isNum(f.text_lineheight.value) ? f.text_lineheight_measurement.value : "");
\r
391 ce.style.textTransform = f.text_case.value;
\r
392 ce.style.fontWeight = f.text_weight.value;
\r
393 ce.style.fontVariant = f.text_variant.value;
\r
394 ce.style.color = f.text_color.value;
\r
397 s += f.text_underline.checked ? " underline" : "";
\r
398 s += f.text_overline.checked ? " overline" : "";
\r
399 s += f.text_linethrough.checked ? " line-through" : "";
\r
400 s += f.text_blink.checked ? " blink" : "";
\r
401 s = s.length > 0 ? s.substring(1) : s;
\r
403 if (f.text_none.checked)
\r
406 ce.style.textDecoration = s;
\r
408 // Build background styles
\r
410 ce.style.backgroundColor = f.background_color.value;
\r
411 ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : "";
\r
412 ce.style.backgroundRepeat = f.background_repeat.value;
\r
413 ce.style.backgroundAttachment = f.background_attachment.value;
\r
415 if (f.background_hpos.value != "") {
\r
417 s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " ";
\r
418 s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : "");
\r
419 ce.style.backgroundPosition = s;
\r
422 // Build block styles
\r
424 ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : "");
\r
425 ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : "");
\r
426 ce.style.verticalAlign = f.block_vertical_alignment.value;
\r
427 ce.style.textAlign = f.block_text_align.value;
\r
428 ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : "");
\r
429 ce.style.whiteSpace = f.block_whitespace.value;
\r
430 ce.style.display = f.block_display.value;
\r
432 // Build box styles
\r
434 ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : "");
\r
435 ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : "");
\r
436 ce.style.styleFloat = f.box_float.value;
\r
438 if (tinyMCE.isGecko)
\r
439 ce.style.cssFloat = f.box_float.value;
\r
441 ce.style.clear = f.box_clear.value;
\r
443 if (!f.box_padding_same.checked) {
\r
444 ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");
\r
445 ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : "");
\r
446 ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : "");
\r
447 ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : "");
\r
449 ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");
\r
451 if (!f.box_margin_same.checked) {
\r
452 ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");
\r
453 ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : "");
\r
454 ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : "");
\r
455 ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : "");
\r
457 ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");
\r
459 // Build border styles
\r
461 if (!f.border_style_same.checked) {
\r
462 ce.style.borderTopStyle = f.border_style_top.value;
\r
463 ce.style.borderRightStyle = f.border_style_right.value;
\r
464 ce.style.borderBottomStyle = f.border_style_bottom.value;
\r
465 ce.style.borderLeftStyle = f.border_style_left.value;
\r
467 ce.style.borderStyle = f.border_style_top.value;
\r
469 if (!f.border_width_same.checked) {
\r
470 ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : "");
\r
471 ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : "");
\r
472 ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : "");
\r
473 ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : "");
\r
475 ce.style.borderWidth = f.border_width_top.value;
\r
477 if (!f.border_color_same.checked) {
\r
478 ce.style.borderTopColor = f.border_color_top.value;
\r
479 ce.style.borderRightColor = f.border_color_right.value;
\r
480 ce.style.borderBottomColor = f.border_color_bottom.value;
\r
481 ce.style.borderLeftColor = f.border_color_left.value;
\r
483 ce.style.borderColor = f.border_color_top.value;
\r
485 // Build list styles
\r
487 ce.style.listStyleType = f.list_type.value;
\r
488 ce.style.listStylePosition = f.list_position.value;
\r
489 ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : "";
\r
491 // Build positioning styles
\r
493 ce.style.position = f.positioning_type.value;
\r
494 ce.style.visibility = f.positioning_visibility.value;
\r
496 if (ce.style.width == "")
\r
497 ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : "");
\r
499 if (ce.style.height == "")
\r
500 ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : "");
\r
502 ce.style.zIndex = f.positioning_zindex.value;
\r
503 ce.style.overflow = f.positioning_overflow.value;
\r
505 if (!f.positioning_placement_same.checked) {
\r
506 ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");
\r
507 ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : "");
\r
508 ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : "");
\r
509 ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : "");
\r
511 s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");
\r
513 ce.style.right = s;
\r
514 ce.style.bottom = s;
\r
518 if (!f.positioning_clip_same.checked) {
\r
520 s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " ";
\r
521 s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " ";
\r
522 s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " ";
\r
523 s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto");
\r
526 if (s != "rect(auto auto auto auto)")
\r
530 t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto";
\r
536 if (s != "rect(auto auto auto auto)")
\r
540 ce.style.cssText = tinyMCE.serializeStyle(tinyMCE.parseStyle(ce.style.cssText));
\r
543 function isNum(s) {
\r
544 return new RegExp('[0-9]+', 'g').test(s);
\r
547 function showDisabledControls() {
\r
548 var f = document.forms, i, a;
\r
550 for (i=0; i<f.length; i++) {
\r
551 for (a=0; a<f[i].elements.length; a++) {
\r
552 if (f[i].elements[a].disabled)
\r
553 tinyMCE.addCSSClass(f[i].elements[a], "disabled");
\r
555 tinyMCE.removeCSSClass(f[i].elements[a], "disabled");
\r
560 function fillSelect(f, s, param, dval, sep, em) {
\r
563 f = document.forms[f];
\r
564 sep = typeof(sep) == "undefined" ? ";" : sep;
\r
567 addSelectValue(f, s, "", "");
\r
569 ar = tinyMCE.getParam(param, dval).split(sep);
\r
570 for (i=0; i<ar.length; i++) {
\r
573 if (ar[i].charAt(0) == '+') {
\r
574 ar[i] = ar[i].substring(1);
\r
578 p = ar[i].split('=');
\r
580 if (p.length > 1) {
\r
581 addSelectValue(f, s, p[0], p[1]);
\r
584 selectByValue(f, s, p[1]);
\r
586 addSelectValue(f, s, p[0], p[0]);
\r
589 selectByValue(f, s, p[0]);
\r
594 function toggleSame(ce, pre) {
\r
595 var el = document.forms[0].elements, i;
\r
598 el[pre + "_top"].disabled = false;
\r
599 el[pre + "_right"].disabled = true;
\r
600 el[pre + "_bottom"].disabled = true;
\r
601 el[pre + "_left"].disabled = true;
\r
603 if (el[pre + "_top_measurement"]) {
\r
604 el[pre + "_top_measurement"].disabled = false;
\r
605 el[pre + "_right_measurement"].disabled = true;
\r
606 el[pre + "_bottom_measurement"].disabled = true;
\r
607 el[pre + "_left_measurement"].disabled = true;
\r
610 el[pre + "_top"].disabled = false;
\r
611 el[pre + "_right"].disabled = false;
\r
612 el[pre + "_bottom"].disabled = false;
\r
613 el[pre + "_left"].disabled = false;
\r
615 if (el[pre + "_top_measurement"]) {
\r
616 el[pre + "_top_measurement"].disabled = false;
\r
617 el[pre + "_right_measurement"].disabled = false;
\r
618 el[pre + "_bottom_measurement"].disabled = false;
\r
619 el[pre + "_left_measurement"].disabled = false;
\r
623 showDisabledControls();
\r
626 function synch(fr, to) {
\r
627 var f = document.forms[0];
\r
629 f.elements[to].value = f.elements[fr].value;
\r
631 if (f.elements[fr + "_measurement"])
\r
632 selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value);
\r