123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- function getCSSFromForm()
- {
- var cssString = "";
-
- var fontFamily = document.f.fontFamily[document.f.fontFamily.selectedIndex].value;
- if (fontFamily != "" && fontFamily != null)
- {
- cssString += "font-family:" + fontFamily;
- }
-
- var fontSize = document.f.fontSize[document.f.fontSize.selectedIndex].value;
- if (fontSize != "" && fontSize != null)
- {
- cssString = addSeparator(cssString);
- cssString += "font-size:" + fontSize;
- }
-
- var fontStyle = document.f.fontStyle[document.f.fontStyle.selectedIndex].value;
- if (fontStyle != "" && fontStyle != null)
- {
- cssString = addSeparator(cssString);
- cssString += "font-style:" + fontStyle;
- }
-
-
- var fontWeight = document.f.fontWeight[document.f.fontWeight.selectedIndex].value;
- if (fontWeight != "" && fontWeight != null)
- {
- cssString = addSeparator(cssString);
- cssString += "font-weight:" + fontWeight;
- }
-
- var bEffect = false;
- var cssEffectsString = "text-decoration:";
- if (document.f.chkUnderline.checked)
- {
- cssEffectsString += "underline";
- bEffect = true;
- }
- if (document.f.chkOverline.checked)
- {
- cssEffectsString += (bEffect ? " " : "") + "overline";
- bEffect = true;
- }
- if (document.f.chkStrikeThrough.checked)
- {
- cssEffectsString += (bEffect ? " " : "") + "line-through";
- bEffect = true;
- }
-
- if (bEffect == true)
- {
- cssString = addSeparator(cssString);
- cssString += cssEffectsString;
- }
-
- var color = document.f.ForeColor.value;
- if (color != "" && color != null)
- {
- cssString = addSeparator(cssString);
- cssString += "color:" + color;
- }
-
- var backgroundColor = document.f.BackColor.value;
- if (backgroundColor != "" && backgroundColor != null)
- {
- cssString = addSeparator(cssString);
- cssString += "background-color:" + backgroundColor;
- }
-
-
- var textAlignment = document.f.textAlignment.value;
- if (textAlignment != "" && textAlignment != null)
- {
- cssString = addSeparator(cssString);
- cssString += getConfigFrame().alignStyleToCSS(textAlignment);
- }
- return cssString;
- };
- function processCSSForSubmission(cssString)
- {
- var rColon = new RegExp (':', 'gi');
- cssString = cssString.replace(rColon ,"\:");
- return cssString;
- };
- function updateColor(s)
- {
- cp.updateSwatch(s);
- updatePreview();
- };
- function updateBackgroundColor(s)
- {
- bcp.updateSwatch(s);
- updatePreview();
- };
- function updateAlignment(s)
- {
- var oDiv = document.getElementById('selectAlignment');
- while (oDiv.hasChildNodes())
- {
- oDiv.removeChild(oDiv.firstChild);
- }
- var newText = document.createTextNode(alignments[s]);
- oDiv.appendChild(newText);
- document.f.textAlignment.value = s;
- alp.setActiveAlignment(s);
- updatePreview();
- };
- function updatePreview()
- {
- var oPreview = document.getElementById("preview");
- if (typeof oPreview != "undefined" && oPreview != null)
- {
- var sPreview = '<table border="0" cellpadding="0" cellspacing="0" style="height:100%;width:100%;border:1px solid #999999;'
- + '"><tr><td style="text-align:center;height:56px;width:100%;'
- + getCSSFromForm()
- + '">'
- + previewString
- + '</td></tr></table>';
- oPreview.innerHTML = sPreview;
- }
- };
- function hidePickers()
- {
- if (typeof cp != 'undefined')
- {
- cp.hide();
- }
- if (typeof bcp != 'undefined')
- {
- bcp.hide();
- }
- if (typeof alp != 'undefined')
- {
- alp.hide();
- }
- };
|