FTB_FreeTextBox.prototype.InsertDiv = function() { var div = window.document.createElement("div"); div.style.width = "200px"; div.style.height = "200px"; div.style.border = "dotted 1px gray"; this.InsertElement(div); }; FTB_FreeTextBox.prototype.EditStyle = function() { // custom implimentation of GetParentElement() and GetSelection() and GetRange() el = this.GetParentElement(); this.EditElementStyle(el); }; FTB_FreeTextBox.prototype.EditElementStyle = function(el) { var styleWin = window.open("","propWin","width=530,height=420,status=0,toolbars=0"); if (styleWin) { styleWin.focus(); } else { alert("Please turn off your PopUp blocking software"); return; } //return; html = FTB_StyleEditorHtml; styleWin.document.body.innerHTML = ''; styleWin.document.open(); styleWin.document.write( html ); styleWin.document.close(); launchParameters = new Object(); launchParameters['ftb'] = this; launchParameters['element'] = el; styleWin.launchParameters = launchParameters; styleWin.load(); }; /* START: Table Functions These functions are derived from HTMLAREA who gave permission for them to be used in FreeTextBox - Thanks HTMLAREA!! ----------------------------------------------- */ FTB_FreeTextBox.prototype.InsertTableColumnBefore = function() { this.InsertTableColumn(false); }; FTB_FreeTextBox.prototype.InsertTableColumnAfter = function() { this.InsertTableColumn(true); }; FTB_FreeTextBox.prototype.InsertTableColumn = function(after) { var td = this.GetNearest("td"); if (!td) { return; } var rows = td.parentNode.parentNode.rows; var index = td.cellIndex; for (var i = rows.length; --i >= 0;) { var tr = rows[i]; var otd = this.designEditor.document.createElement("td"); otd.innerHTML = (FTB_Browser.isIE) ? "" : "
"; //if last column and insert column after is select append child if (index==tr.cells.length-1 && after) { tr.appendChild(otd); } else { var ref = tr.cells[index + ((after) ? 1 : 0)]; // 0 tr.insertBefore(otd, ref); } } }; FTB_FreeTextBox.prototype.InsertTableRowBefore = function() { this.InsertTableRow(false); }; FTB_FreeTextBox.prototype.InsertTableRowAfter = function() { this.InsertTableRow(true); }; FTB_FreeTextBox.prototype.InsertTableRow = function(after) { var tr = this.GetNearest("tr"); if (!tr) return; var otr = tr.cloneNode(true); this.ClearRow(otr); tr.parentNode.insertBefore(otr, ((after) ? tr.nextSibling : tr)); }; FTB_FreeTextBox.prototype.DeleteTableColumn = function() { var td = this.GetNearest("td"); if (!td) { return; } var index = td.cellIndex; if (td.parentNode.cells.length == 1) { return; } // set the caret first to a position that doesn't disappear this.SelectNextNode(td); var rows = td.parentNode.parentNode.rows; for (var i = rows.length; --i >= 0;) { var tr = rows[i]; tr.removeChild(tr.cells[index]); } }; FTB_FreeTextBox.prototype.DeleteTableRow = function() { var tr = this.GetNearest("tr"); if (!tr) { return; } var par = tr.parentNode; if (par.rows.length == 1) { return; } // set the caret first to a position that doesn't disappear. this.SelectNextNode(tr); par.removeChild(tr); }; // helper table FTB_FreeTextBox.prototype.ClearRow = function(tr) { var tds = tr.getElementsByTagName("td"); for (var i = tds.length; --i >= 0;) { var td = tds[i]; td.rowSpan = 1; td.innerHTML = (FTB_Browser.isIE) ? "" : "
"; } }; FTB_FreeTextBox.prototype.SplitRow = function(td) { var n = parseInt("" + td.rowSpan); var nc = parseInt("" + td.colSpan); td.rowSpan = 1; tr = td.parentNode; var itr = tr.rowIndex; var trs = tr.parentNode.rows; var index = td.cellIndex; while (--n > 0) { tr = trs[++itr]; var otd = editor._doc.createElement("td"); otd.colSpan = td.colSpan; otd.innerHTML = mozbr; tr.insertBefore(otd, tr.cells[index]); } }; FTB_FreeTextBox.prototype.SplitCol = function(td) { var nc = parseInt("" + td.colSpan); td.colSpan = 1; tr = td.parentNode; var ref = td.nextSibling; while (--nc > 0) { var otd = editor._doc.createElement("td"); otd.rowSpan = td.rowSpan; otd.innerHTML = mozbr; tr.insertBefore(otd, ref); } } FTB_FreeTextBox.prototype.SplitCell = function(td) { var nc = parseInt("" + td.colSpan); splitCol(td); var items = td.parentNode.cells; var index = td.cellIndex; while (nc-- > 0) { this.SplitRow(items[index++]); } }; /* FORM Functions -------------------------------------- */ FTB_FreeTextBox.prototype.IsInForm = function() { return (this.GetNearest("form")) ? true : false ; }; FTB_FreeTextBox.prototype.InsertForm = function() { var form = window.document.createElement("form"); this.InsertElement(form); }; FTB_FreeTextBox.prototype.InsertCheckBox = function() { this.InsertInputElement("","checkbox"); }; FTB_FreeTextBox.prototype.InsertTextBox = function() { this.InsertInputElement("","text"); }; FTB_FreeTextBox.prototype.InsertRadioButton = function() { this.InsertInputElement("","radio"); }; FTB_FreeTextBox.prototype.InsertButton = function() { this.InsertInputElement("","button"); }; FTB_FreeTextBox.prototype.InsertDropDownList = function() { var select = window.document.createElement("select"); this.InsertElement(select); }; FTB_FreeTextBox.prototype.InsertTextArea = function() { var textarea = window.document.createElement("textarea"); this.InsertElement(textarea); }; FTB_FreeTextBox.prototype.InsertInputElement = function(id,type) { var input = window.document.createElement("input"); input.id = id; input.type = type; this.InsertElement(input); } /* Color picker Functions -------------------------------------- */ FTB_FreeTextBox.prototype.FontForeColorPicker = function() { this.LaunchColorPickerWindow('forecolor'); }; FTB_FreeTextBox.prototype.FontBackColorPicker = function() { this.LaunchColorPickerWindow('backcolor'); }; FTB_FreeTextBox.prototype.LaunchColorPickerWindow = function(commandName, startValue) { var pickerWin = window.open("","colorPickerWin","width=290,height=180"); if (pickerWin) { pickerWin.focus(); } else { alert("Please turn off your PopUp blocking software"); return; } pickerWin.document.body.innerHTML = ''; pickerWin.document.open(); pickerWin.document.write(FTB_ColorPickerHtml); pickerWin.document.close(); launchParameters = new Object(); launchParameters['ftb'] = this; launchParameters['commandName'] = commandName; pickerWin.launchParameters = launchParameters; pickerWin.load(); }; FTB_FreeTextBox.prototype.InsertImage = function() { var imageWin = window.open("","imageWin","width=500,height=310"); if (imageWin) { imageWin.focus(); } else { alert("Please turn off your PopUp blocking software"); return; } //imageWin.document.body.innerHTML = ''; imageWin.document.open(); imageWin.document.write(FTB_ImagePopUpHtml); imageWin.document.close(); launchParameters = new Object(); launchParameters['ftb'] = this; imageWin.launchParameters = launchParameters; imageWin.load(); }; /* Misc Pro features --------------------------------------- */ FTB_FreeTextBox.prototype.WordClean = function() { var text = this.designEditor.document.body.innerHTML; text=text.replace(/]*>/gi,""); text=text.replace(/<\/FONT>/gi,""); text=text.replace(//gi,""); text=text.replace(/<\/U>/gi,""); text=text.replace(/]*>/gi,""); text=text.replace(/<\/H[^>]*>/gi,""); // save BRs text=text.replace(/]*>/gi,"&linebreak"); // Change these tags. text=text.replace(/]*>/gi,"&bold"); text=text.replace(/<\/B[^>]*>/gi,"&cbold"); text=text.replace(/]*>/gi,"&bold"); text=text.replace(/<\/STRONG[^>]*>/gi,"&cbold"); text=text.replace(/]*>/gi,"&ital"); text=text.replace(/<\/I[^>]*>/gi,"&cital"); text=text.replace(/]*>/gi,"&ital"); text=text.replace(/<\/EM[^>]*>/gi,"&cital"); text=text.replace(/]*>/gi,"&ultag"); text=text.replace(/]*>/gi,"&litag"); text=text.replace(/]*>/gi,"&oltag"); text=text.replace(/<\/OL>/gi,"&olctag"); text=text.replace(/<\/LI>/gi,"&lictag"); text=text.replace(/<\/UL>/gi,"&ulctag"); text=text.replace(/]*>/gi,"¶g"); text=text.replace(/<\/P>/gi,""); /* text=text.replace(/”/gi,'\"'); text=text.replace(/“/gi,'\"'); text=text.replace(/„/gi,'\"'); text=text.replace(/mailto:/gi,'\"'); text=text.replace(/Ä/g,"Ä"); text=text.replace(/Ö/g,"Ö"); text=text.replace(/Ü/g,"Ü"); text=text.replace(/ä/g,"ä"); text=text.replace(/ö/g,"ö"); text=text.replace(/ü/g,"ü"); text=text.replace(/ß/gi,"ß"); */ text=text.replace(/<[^>]>*;/gi,""); text=text.replace(/<\/[^>]>*;/gi," "); text=text.replace(/]*>/gi,""); text=text.replace(/<\/o:[^>]*>/gi,""); text=text.replace(/<\?xml:[^>]*>/gi,""); text=text.replace(/<\/?st[^>]*>/gi,""); text=text.replace(/<[^>]*]*>/gi,""); text=text.replace(//gi,""); text=text.replace(/<\/SPAN>/gi,""); //text=text.replace(/<\/A>/gi,""); // Clear the inner parts of other tags. text=text.replace(/style=[^>]*"/g,' '); text=text.replace(/style=[^>]*'/g," "); text=text.replace(/style=[^>]*>/g,">"); text=text.replace(/lang=[^>]*>/g,">"); text=text.replace(/name=[^>]* /g,""); text=text.replace(/name=[^>]*>/g,">"); text=text.replace(/]*>/g,""); //text=text.replace(/]*>/gi,"

"); // Put the tags back text=text.replace(/&linebreak/g,"
"); text=text.replace(/&bold/g,""); text=text.replace(/&cbold/g,""); text=text.replace(/&ital/g,""); text=text.replace(/&cital/g,""); text=text.replace(/&ultag/g,"

    "); text=text.replace(/&litag/g,"
  • "); text=text.replace(/&oltag/g,"
      "); text=text.replace(/&olctag/g,"<\/OL>"); text=text.replace(/&lictag/g,"<\/LI>"); text=text.replace(/&ulctag/g,"<\/UL>"); text=text.replace(/¶g/g,"
      "); this.designEditor.document.body.innerHTML = text; }; /* FTB_FreeTextBox.prototype.CreateLink = function() { // impliment pro feature of PopUp window var sel = this.GetSelection(); var text = ''; if (FTB_Browser.isIE) { text = sel.createRange().text; } else { text = new String(sel); } if (text == '') { alert('Please select some text'); return; } var linkWin = window.open("","linkWin","width=350,height=155"); if (linkWin) { linkWin.focus(); } else { alert("Please turn off your PopUp blocking software"); return; } linkWin.document.body.innerHTML = ''; linkWin.document.open(); linkWin.document.write(FTB_LinkPopUpHtml); linkWin.document.close(); launchParameters = new Object(); launchParameters['ftb'] = this; linkWin.launchParameters = launchParameters; linkWin.load(); }; */ /* PopUpScripts ---------------------------------------- */ var FTB_ImagePopUpHtml = new String("\ \ \ Image Editor\ \ \ \ \
      \

      Image Editor

      \
      \ \ \ \ \ \
      Image Source:
      Alternate Text:
      \
      \
      Preview\
      \

      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum accumsan, ipsum ut dapibus dapibus, nunc arcu congue velit, sit amet pretium est felis ut libero. Suspendisse hendrerit vestibulum pede.

      \
      \
      \
      \
      Layout\ \ \ \ \
      Alignment: \
      Border Thickness:
      \
      \
      \
      \
      Spacing\ \ \ \ \
      Horizontal:
      Vertical:
      \
      \
      \
      Dimensions\ \ \ \ \
      Width:
      Height:
      \
      \
      \
      \ \ \
      \ \ "); var FTB_LinkPopUpHtml = new String("\ \ \ Link Editor\ \ \ \ \
      \

      Link Editor

      \
      Link Properties\ \ \ \ \ \ \ \ \
      URL
      Title
      Target \ \
      Class
      \
      \ \ \
      \ \ "); /* ColorPicker ---------------------------------------- */ var FTB_ColorPickerHtml = new String("\ \ \ Image Editor\ \ \ \ \
      \

      Image Editor

      \ \
      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
      \
      \
       

      \ \
      \ \
      \ \ \ "); var FTB_StyleEditorHtml = "\ \ \ \ \ \

      Style Editor

      \ \
      \ \ \
      \
      \

      Font

      \
      \ Properties\ \ \ \ \ \ \ \ \ \ \ \ \ \
      Family
      Color
      Size\ \ \
      Capitalization\ \
      \
      \
      \ Effects\ \
      \
      \
      \
      \
      \
      \
      \
      \
      \
      \
      \ \ \ \ \
      \
      \
      \ Sample\
      \
      \ \
      \
      \
      \
      \
      \ \ \
      \
      \ \ \ "; if (typeof(Sys) != "undefined") { if (typeof(Sys.Application) != "undefined") { Sys.Application.notifyScriptLoaded(); }}