var whizzywig_version='Whizzywig 63'; var sel = ''; //fixed 62 link>new window Chrome bug //link an image //td border hint //insHTML deletes selection in Chrome //fixed 63 IE9 breaks whereAmI() //Copyright © 2005-2011 John Goodman - www.unverse.net *date 110623 //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. var btn=[]; //object containing button strip information btn._w=16; btn._h=16; //btn._f=getDir()+"icons.png"; //set to path to toolbar image btn._f=wfPluginUrl + 'img/icons.png' ; var buttonPath, //path to custom toolbar button images; "textbuttons" means don't use images buttonExt, //extension (e.g. .png) for toolbar button images; default '.gif' cssFile, //url of CSS stylesheet to attach to edit area jsFile, imageBrowse, //path to page for image browser linkBrowse, //path to page for link browser idTa, //id of the textarea (param to makeWhizzyWig) //OTHER GLOBALS //Whizzy contentWindow, current sel, range, parent, DOM path, popwindow, window, IE?; oW, sel, rng, papa, trail, ppw, wn=window, msIE=("Microsoft Internet Explorer"==navigator.appName) sels='',buts='',vals=[],opts=[],dobut=[],whizzies=[],taOrigSize=[]; cssFile = wfPluginUrl + 'css/lib/textedit/whizzywing.css' ; function makeWhizzyWig(txtArea, controls){ // make a WhizzyWig from the textarea idTa=txtArea; whizzies[whizzies.length]=idTa; if (!document.designMode) { if (idTa.nodeName=="TEXTAREA"){tagButs();} alert("Whizzywig "+whizzyTranslate("editor not available for your browser")); return; } var taContent=whizzyGetId(idTa).defaultValue ? whizzyGetId(idTa).defaultValue : whizzyGetId(idTa).innerHTML ? whizzyGetId(idTa).innerHTML: ''; //anything in the textarea? if (!whizzyGetId(idTa).rows < 5){whizzyGetId(idTa).rows='15';}//IE won't use % from style taWidth=whizzyGetId(idTa).style.width ? whizzyGetId(idTa).style.width : whizzyGetId(idTa).cols + "ex"; //grab the width and... taHeight=whizzyGetId(idTa).style.height ? whizzyGetId(idTa).style.height : whizzyGetId(idTa).rows + "em"; //...height from the textarea taOrigSize[idTa] = {w:taWidth,h:taHeight}; //Create whizzy container var wContainer = document.createElement('div'); wContainer.id = 'CONTAINER'+idTa+''; wContainer.style.width = taWidth; var taObject = whizzyGetId(idTa); whizzyGetId(idTa).parentNode.replaceChild(wContainer, whizzyGetId(idTa)); whizzyGetId("CONTAINER"+idTa).appendChild(taObject); //End whizzy container if (whizzyGetId(idTa).nodeName=="TEXTAREA"){ whizzyGetId(idTa).style.color='#060'; whizzyGetId(idTa).style.zIndex='2'; }else{writeToWhizzy('')} whizzyHideElement(idTa); var frm=whizzyGetId(idTa).parentNode; while(frm.nodeName != 'FORM'){frm=frm.parentNode}//if not form, keep trying addEvt(frm,"submit",syncTextarea); writeToWhizzy(''); var dsels='formatblock fontname fontsize'; var dbuts=' bold italic underline | left center right justify | number bullet indent outdent | undo redo | color hilite rule | link image table | clean html spellcheck fullscreen '; var tbuts=' tstart add_row_above add_row_below delete_row | add_column_before add_column_after delete_column | table_in_cell'; var t_end=''; //table controls end, if needed btns=(dbuts+tbuts).split(' '); for (var i=0,pos=0;i
'); writeToWhizzy('
'); gizmos=controls.split(' '); for (i=0;i
'; } else if(gizmos[i]=='|'){writeToWhizzy(' | ')} else if(gizmos[i] == 'newline'){writeToWhizzy('
')} else if((dsels+sels).indexOf(gizmos[i]) != -1){makeSelect(gizmos[i])} else if((dbuts+buts+tbuts).indexOf(gizmos[i]) != -1){makeButton(gizmos[i])} } } writeToWhizzy(t_end)//table controls end writeToWhizzy('. '); writeToWhizzy(fGo('LINK')); if (linkBrowse){writeToWhizzy(' ')} writeToWhizzy(whizzyTranslate('Link address (URL)')+':
'+whizzyTranslate("Open link in new window")+fNo(whizzyTranslate("OK"),"insertLink()"));//LINK_FORM end writeToWhizzy(fGo('IMAGE')); if(imageBrowse){writeToWhizzy(' ')} writeToWhizzy(whizzyTranslate('Image address (URL)')+':
'+whizzyTranslate("Align")+': '+whizzyTranslate("Border")+': '+whizzyTranslate("Margin")+':'+fNo(whizzyTranslate("Insert Image"),"insertImage()"));//IMAGE_FORM end writeToWhizzy(fGo('TABLE')+whizzyTranslate("Rows")+': '+whizzyTranslate("Columns")+': '+whizzyTranslate("Border width")+': '+fNo(whizzyTranslate("Insert Table"),"makeTable()"));//TABLE_FORM end writeToWhizzy(fGo('COLOR')+'

'+whizzyTranslate("click below or enter a")+' '+whizzyTranslate("color name")+'
'+"\n"); var wC=new Array("00","33","66","99","CC","FF") //color table for (i=0; i"); for (j=0; j'+"\n"); } } writeToWhizzy(''); } writeToWhizzy("
\n"); //end color table,COLOR_FORM writeToWhizzy("
\n"); //controls end writeToWhizzy(''+"\n"); writeToWhizzy(''+"\n", true); //finally write content to whizzy container var startHTML="\n\n\n"; if(cssFile){startHTML += '\n'} if(jsFile){startHTML += '\n'} startHTML += '\n\n'+tidyD(taContent)+'\n'; oW=whizzyGetId("whizzy"+idTa).contentWindow; var d=oW.document; try{d.designMode="on";} catch(e){ setTimeout('oW.designMode="on";', 100);} d.open(); d.write(startHTML); d.close(); if(oW.addEventListener){oW.addEventListener("keypress", kb_handler, true)}//keyboard shortcuts for Moz else{d.body.attachEvent("onpaste",function(){setTimeout('cleanUp()',10)})} addEvt(d,"mouseup", whereAmI); addEvt(d,"keyup", whereAmI); addEvt(d,"dblclick", doDbl); //addEvt(d,"click", clickWhizzywig); //move textarea so html menu appears on top taObject = whizzyGetId(idTa); whizzyGetId("CONTAINER"+idTa).removeChild(whizzyGetId(idTa)); whizzyGetId("CONTAINER"+idTa).appendChild(taObject); //end move idTa=null; } //end makeWhizzyWig function whizzywig(controls){ var i,ta=document.getElementsByTagName('TEXTAREA'); for (i=0;i'+ucBut+"\n"} else{butHTML='\n'} writeToWhizzy(butHTML) } function fGo(id){return '