/*****************************************/ // Name: Javascript Textarea BBCode Markup Editor // Version: 1.3 // Author: Balakrishnan // Last Modified Date: 25/jan/2009 // License: Free // URL: http://www.corpocrat.com /******************************************/ var textarea; var content; document.write(""); function edToolbar(obj) { document.write("
','','" + obj + "')\">"); document.write("','','" + obj + "')\">"); document.write("','','" + obj + "')\">"); document.write(""); //document.write(""); //document.write(""); //document.write(""); document.write("','','" + obj + "')\">"); //document.write(""); //document.write("
"); /*document.write('
'); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write('
'); document.write('
');*/ //document.write(""); } function doImage(obj) { textarea = document.getElementById(obj); var url = prompt('Enter the Image URL:','http://'); var scrollTop = textarea.scrollTop; var scrollLeft = textarea.scrollLeft; if (document.selection) { textarea.focus(); var sel = document.selection.createRange(); sel.text = '[img]' + url + '[/img]'; } else { var len = textarea.value.length; var start = textarea.selectionStart; var end = textarea.selectionEnd; var sel = textarea.value.substring(start, end); //alert(sel); var rep = '[img]' + url + '[/img]'; textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); textarea.scrollTop = scrollTop; textarea.scrollLeft = scrollLeft; } } function doURL(obj) { textarea = document.getElementById(obj); var url = prompt('Enter the URL:','http://'); var scrollTop = textarea.scrollTop; var scrollLeft = textarea.scrollLeft; if (document.selection) { textarea.focus(); var sel = document.selection.createRange(); if(sel.text==""){ sel.text = '' + url + ''; } else { sel.text = '' + sel.text + ''; } //alert(sel.text); } else { var len = textarea.value.length; var start = textarea.selectionStart; var end = textarea.selectionEnd; var sel = textarea.value.substring(start, end); if(sel==""){ var rep = '' + url + ''; } else { var rep = '' + sel + ''; } //alert(sel); textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); textarea.scrollTop = scrollTop; textarea.scrollLeft = scrollLeft; } } function doAddTags(tag1,tag2,obj) { textarea = document.getElementById(obj); // Code for IE if (document.selection) { textarea.focus(); var sel = document.selection.createRange(); //alert(sel.text); sel.text = tag1 + sel.text + tag2; } else { // Code for Mozilla Firefox var len = textarea.value.length; var start = textarea.selectionStart; var end = textarea.selectionEnd; var scrollTop = textarea.scrollTop; var scrollLeft = textarea.scrollLeft; var sel = textarea.value.substring(start, end); //alert(sel); var rep = tag1 + sel + tag2; textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); textarea.scrollTop = scrollTop; textarea.scrollLeft = scrollLeft; } } function doList(tag1,tag2,obj){ textarea = document.getElementById(obj); // Code for IE if (document.selection) { textarea.focus(); var sel = document.selection.createRange(); var list = sel.text.split('\n'); for(i=0;i")); var rep = tag1 + '\n' + list.join("\n") + '\n' +tag2; textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); textarea.scrollTop = scrollTop; textarea.scrollLeft = scrollLeft; } } // NDK Loading /*var ie45,ns6,ns4,dom; if (navigator.appName=="Microsoft Internet Explorer") ie45=parseInt(navigator.appVersion)>=4; else if (navigator.appName=="Netscape"){ ns6=parseInt(navigator.appVersion)>=5; ns4=parseInt(navigator.appVersion)<5;} dom=ie45 || ns6; var timershow=false; var curx=-200; var cury=200; var win_w=window.innerWidth ? window.innerWidth : document.body.offsetWidth; var mid_w=win_w/2; var timershow1=window.setInterval("stayMiddle()",1); function getobj(id) { el = document.all ? document.all[id] : dom ? document.getElementById(id) : document.layers[id]; return el; } function show_edForm() { obj = getobj('edForm'); if (timershow) window.clearTimeout(timershow); timershow=window.setInterval("nshow()",1); } function hide_edForm() { obj = getobj('edForm'); if (timershow) window.clearTimeout(timershow); timershow=window.setInterval("nhide()",1); } function moveobj(obj,x,y) { obj.style.left=x + "px"; obj.style.top=y+ "px"; curx=x; cury=y; } function stayMiddle() { if (document.documentElement && document.documentElement.scrollTop) var pY = document.documentElement.scrollTop; else if (document.body) var pY = document.body.scrollTop; obj = getobj('edForm'); newy = cury+((pY-cury)/16)+12; moveobj(obj,curx, newy); } function nshow() { obj = getobj('edForm'); newx = curx+((mid_w-curx)/16)-7; moveobj(obj,newx, cury); } function nhide() { obj = getobj('edForm'); newx = curx+((0-curx)/16)-15; moveobj(obj,newx, cury); } // End */