1// rich editor js 2 var ua = navigator.userAgent.toLowerCase(); 3 var isIE = (((ua.indexOf("msie") != -1) || (ua.search(/trident\//i) != -1)) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)); 4 5 var isMobile = window.matchMedia("(max-width: 760px)").matches; 6 if (location.href.indexOf("dhtmlnews") != -1) { 7 isMobile = false; 8 } 9// isMobile = true; 10 var rng = null; 11 var flvPlayerCode = '<script src="/htm-webaxy/flowplayer/flowplayer-3.0.0-rc5.min.js"></script><script src="/htm-webaxy/flowplayer/webaxySetup.js"></script>'; 12 if (typeof rte_lang == "undefined") { 13 rte_lang = new Object(); 14 rte_lang.fonts = new Array(); 15 } 16 var postEditorsCode = '<script>webaxyHiddenProperties = "'+rte_lang.webaxyHiddenProperties+'";</script><script src="/htm-webaxy/editor/postEditors.js"></script>'; 17 18 var editor_min_width = 753; 19 var editor_def_height = 220; 20 var editor_msg = ""; 21 // ===== EDITOR CODE (full) =========== 22 var editor_code = ""; 23 editor_code += '<div class="bg_editor" id="bg_editor_EDITOR_NAME">'; 24 editor_code += '<table editor="full" cellpadding="0" cellspacing="0" style="direction:'+rte_lang.direction+';">'; 25 editor_code += '<tr id="EDITOR_NAME_rteMenu1">'; 26 editor_code += '<td class="rte_td" style="color:#000000;" >'; 27 editor_code += 'EDITOR_TITLE'; 28 editor_code += '<input type="radio" name="type_EDITOR_NAME" id="type0_EDITOR_NAME" value="div_editor_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE0><label for="type0_EDITOR_NAME">'+rte_lang.editor+'</label> '; 29 editor_code += '<input type="radio" name="type_EDITOR_NAME" id="type1_EDITOR_NAME" value="div_text_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE1><label for="type1_EDITOR_NAME">'+rte_lang.text+'</label> '; 30 editor_code += '<input type="checkbox" name="lockEditor_EDITOR_NAME" id="lockEditor_EDITOR_NAME" value="1" onclick="lockEditor(this);"><label for="lockEditor_EDITOR_NAME">'+rte_lang.lockEditor+'</label> '; 31 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/clear.png" id="clean_EDITOR_NAME" title="'+rte_lang.alt_clear_styles+'" class="rte_buttons" onclick="cleanAll(\'EDITOR_NAME\');" style="cursor:pointer"> '; 32 editor_code += '</td>'; 33 editor_code += '</tr>'; 34 35 editor_code += '<tr>'; 36 editor_code += '<td style="padding:0px 0px 0px 0px;">'; 37 38 editor_code += '<div id="cell_EDITOR_NAME">'; 39 editor_code += '<div id="div_editor_EDITOR_NAME">'; 40 editor_code += '<table cellpadding="0" cellspacing="0" >'; 41 editor_code += '<tr>'; 42 editor_code += '<td class="rte_td">'; 43 44 editor_code += '<table cellpadding="0" cellspacing="0" id="EDITOR_NAME_rteMenu2">'; 45 editor_code += '<tr>'; 46 editor_code += '<td class="rte_td">'; 47 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/fgcolor.png" title="'+rte_lang.alt_color+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setColor(\\\'EDITOR_NAME\\\',\\\'forecolor\\\',%%color%%) \', \' '+rte_lang.alt_color+' \'); moveCP(30,event.clientY);"> '; 48 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/bgfcolor.png" title="'+rte_lang.alt_hilite+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setColor(\\\'EDITOR_NAME\\\',\\\'hilitecolor\\\',%%color%%) \', \' '+rte_lang.alt_hilite+' \'); moveCP(30,event.clientY);"> '; 49 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 50 editor_code += '<select onchange="if (this.value) setCssFontSize(\'EDITOR_NAME\',this.value); this.selectedIndex=0;">'; 51 editor_code += '<option value="">'+rte_lang.font_size+'</option><option value="8px">8</option><option value="10px">10</option><option value="11px">11</option><option value="12px">12</option><option value="13px">13</option><option value="14px">14</option><option value="15px">15</option><option value="16px">16</option><option value="18px">18</option><option value="20px">20</option><option value="22px">22</option><option value="24px">24</option><option value="26px">26</option><option value="28px">28</option><option value="30px">30</option><option value="36px">36</option><option value="45px">45</option><option value="60px">60</option><option value="70px">70</option><option value="80px">80</option><option value="100px">100</option><option value="110px">110</option><option value="120px">120</option><option value="140px">140</option><option value="150px">150</option>'; 52 editor_code += '</select> '; 53 editor_code += '<select onchange="if (this.value) RTEdo(\'EDITOR_NAME\',\'fontname\',this.value); this.selectedIndex=0;">'; 54 editor_code += '<option value="">'+rte_lang.font_face; 55 for (f=0;f<rte_lang.fonts.length;f++) { 56 editor_code += '<option value="'+rte_lang.fonts[f].toLowerCase()+'">'+rte_lang.fonts[f]+''; 57 } 58 editor_code += '</select>'; 59 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 60 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/b.png" title="'+rte_lang.alt_bold+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'bold\',\'\');"> '; 61 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/i.png" title="'+rte_lang.alt_italic+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'italic\',\'\');"> '; 62 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/u.png" title="'+rte_lang.alt_under+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'underline\',\'\');"> '; 63 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 64 65 editor_code += '<table cellpadding="0" cellspacing="0" border="0" style="direction:ltr; display:inline-table; margin:0px;" >'; 66 editor_code += '<tr>'; 67 editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-left.png" title="'+rte_lang.alt_align_left+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyleft\',\'\');"></td>'; 68 editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-center.png" title="'+rte_lang.alt_align_center+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifycenter\',\'\');"></td>'; 69 editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-right.png" title="'+rte_lang.alt_align_right+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyright\',\'\');"></td>'; 70 editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-full.png" title="'+rte_lang.alt_align_just+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyfull\',\'\');"></td>'; 71 editor_code += '</tr>'; 72 editor_code += '</table>'; 73 74 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 75 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/list123.png" title="'+rte_lang.alt_list_n+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'insertorderedlist\',\'\');"> '; 76 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/list.png" title="'+rte_lang.alt_list_b+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'insertunorderedlist\',\'\');"> '; 77 editor_code += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 78 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/undo.png" title="'+rte_lang.alt_undo+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'undo\',\'\');"> '; 79 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/redo.png" title="'+rte_lang.alt_redo+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'redo\',\'\');"> '; 80 81 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 82 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/link.png" title="'+rte_lang.alt_link+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'link\',event.clientX+300,event.clientY)"> '; 83 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/img.png" title="'+rte_lang.alt_insert_image+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'img\',event.clientX+300,event.clientY)"> '; 84 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/flv.png" title="'+rte_lang.alt_insert_flv+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'flv\',event.clientX+300,event.clientY)"> '; 85 //editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/code.png" title="'+rte_lang.alt_insert_code+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'code\',event.clientX+400,event.clientY)"> '; 86 87 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/addObject.png" title="'+rte_lang.add+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'addMenu\',event.clientX+400,event.clientY)"> '; 88 89 //editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/contact.png" title="'+rte_lang.add_contact+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'contact\',event.clientX+300,event.clientY)"> '; 90 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/table.png" title="'+rte_lang.alt_insert_table+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'table\',event.clientX+300,event.clientY)"> '; 91 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/tdbgcolor.png" title="'+rte_lang.alt_table_cell+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setBgcolor(\\\'EDITOR_NAME\\\',%%color%%) \', \' '+rte_lang.alt_table_cell+' \'); moveCP(30,event.clientY);"> '; 92 editor_code += '</td>'; 93 editor_code += '</tr>'; 94 editor_code += '</table>'; 95 96 editor_code += '</td>'; 97 editor_code += '</tr>'; 98 editor_code += '<tr>'; 99 editor_code += '<td style="background-color:#ffffff;">'; 100 editor_code += '<input type="hidden" name="style_EDITOR_NAME" id="style_EDITOR_NAME" value="EDITOR_CSS">'; 101 editor_code += '<iframe id="editor_EDITOR_NAME" name="editor_EDITOR_NAME" src="'+rte_lang.htm_webaxy+'/editor/blank.htm" frameborder="0" scrolling="auto" style="border-right:1px solid #d6d8e1;border-left:1px solid #d6d8e1;
101 height:EDITOR_HEIGHT; max-width:100%; width:EDITOR_WIDTH;"></iframe>'; 102 editor_code += '</td></tr>'; 103 104 editor_code += '<tr>'; 105 editor_code += '<td class="rte_td">'; 106 107 editor_code += '<table cellpadding="0" cellspacing="0" border="0" id="EDITOR_NAME_rteMenu3" style="width:100%">'; 108 editor_code += '<tr>'; 109 editor_code += '<td class="rte_td" style="width:30%"><img src="'+rte_lang.htm_webaxy+'/editor/buttons/enlarge.png" title="'+rte_lang.alt_enlarge+'" class="rte_buttons" onclick="enlargeRTE(\'EDITOR_NAME\')"></td>'; 110 editor_code += '<td class="rte_td">'; 111 112 editor_code += '<div>'; 113 114 editor_code += '<b>'+rte_lang.cell+':</b> '; 115 editor_code += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 116 editor_code += '<table cellpadding="0" cellspacing="0" border="0" style="direction:ltr;display:inline-table;">'; 117 editor_code += '<tr>'; 118 editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/ltr.png" title="'+rte_lang.alt_ltr+'" class="rte_buttons" onclick="addStyle(\'EDITOR_NAME\',\'direction\',\'ltr\')"></td>'; 119 editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/rtl.png" title="'+rte_lang.alt_rtl+'" class="rte_buttons" onclick="addStyle(\'EDITOR_NAME\',\'direction\',\'rtl\')"></td>'; 120 editor_code += '</tr>'; 121 editor_code += '</table>'; 122 123 editor_code += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 124 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/font.png" title="'+rte_lang.insert_fontProperties+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'fontProperties\',event.clientX,event.clientY - 300)"> '; 125 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/fgcolor.png" title="'+rte_lang.alt_cell_font_color+'" class="rte_buttons" onclick="window.frames[\'colorPicker\'].getColor(30,document.body.scrollTop+event.clientY+20, getStyle(\'EDITOR_NAME\',\'color\'), \'addStyle(\\\'EDITOR_NAME\\\',\\\'color\\\',%%color%%) \', \' '+rte_lang.alt_cell_font_color+' \'); moveCP(event.clientX,event.clientY - 300);"> '; 126 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/bgcolor.png" title="'+rte_lang.alt_cell_bgcolor+'" class="rte_buttons" onclick="window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, getStyle(\'EDITOR_NAME\',\'background-color\'), \'addStyle(\\\'EDITOR_NAME\\\',\\\'background-color\\\',%%color%%) \', \' '+rte_lang.alt_cell_bgcolor+' \'); moveCP(event.clientX,event.clientY - 300);"> '; 127 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/bgimg.png" title="'+rte_lang.alt_cel_bgimg+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'bgimg\',event.clientX,event.clientY - 300)"> '; 128 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 129 130 editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/border.png" title="'+rte_lang.alt_border_padding+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'cell\',event.clientX,event.clientY - 300)">'; 131 editor_code += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 132 //editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/clear.png" title="'+rte_lang.alt_clear_styles+'" class="rte_buttons" onclick="cleanAll(\'EDITOR_NAME\');"> '; 133 //editor_code += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 134 135 editor_code += '<span id="setFrameColor0_EDITOR_NAME">'; 136 editor_code += rte_lang.alt_show_bgcolor; 137 editor_code += '</span> '; 138 editor_code += '<span id="setFrameColor1_EDITOR_NAME">'; 139 editor_code += '<table style="display:inline-table; border:1px solid #000000;" cellpadding="0" cellspacing="0" border="0" title="'+rte_lang.alt_show_bgcolor+'">'; 140 editor_code += '<tr>'; 141 editor_code += '<td style="background-color:#ffffff; width:8px;height:8px; cursor:pointer;" onclick="setFrameColor(\'EDITOR_NAME\',this.style.backgroundColor);"></td>'; 142 editor_code += '<td style="background-color:#dddddd;width:8px;height:8px; cursor:pointer;" onclick="setFrameColor(\'EDITOR_NAME\',this.style.backgroundColor);"></td>'; 143 editor_code += '<td style="background-color:#888888;width:8px;height:8px; cursor:pointer;" onclick="setFrameColor(\'EDITOR_NAME\',this.style.backgroundColor);"></td>'; 144 editor_code += '</tr></table>'; 145 editor_code += '</span>'; 146 editor_code += '</td>'; 147 editor_code += '</tr>'; 148 149 150 editor_code += '</table>'; 151 editor_code += '</div>'; 152 153 editor_code += '</td>'; 154 editor_code += '</tr>'; 155 editor_code += '</table>'; 156 editor_code += '</div>'; // editor end 157 158 editor_code += '<div id="div_text_EDITOR_NAME" style="display:none;">'; 159 editor_code += '<table border="0" cellpadding="0" cellspacing="0"><tr><td style="direction:ltr;">'; 160 editor_code += '<textarea id="EDITOR_NAME" name="EDITOR_NAME" wrap="virtual" style="direction:ltr;
160 height:EDITOR_HEIGHT; max-width:100%; width:EDITOR_WIDTH;"></textarea>'; 161 editor_code += '</td>'; 162 editor_code += '</tr>'; 163 editor_code += '</table>'; 164 editor_code += '</div>';// text end 165 166 editor_code += '</div>'; // cell end 167 editor_code += '</td>'; 168 editor_code += '</tr>'; 169 editor_code += '</table>'; 170 // ====== FULL NARROW CODE ============= 171 var editor_code_narrow = ""; 172 editor_code_narrow += '<table editor="narrow" cellpadding="0" cellspacing="0" style="direction:'+rte_lang.direction+'; ">'; 173 editor_code_narrow += '<tr id="EDITOR_NAME_rteMenu1">'; 174 editor_code_narrow += '<td class="rte_td">'; 175 editor_code_narrow += 'EDITOR_TITLE'; 176 editor_code_narrow += '<input type="radio" name="type_EDITOR_NAME" id="type0_EDITOR_NAME" value="div_editor_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE0><label for="type0_EDITOR_NAME">'+rte_lang.editor+'</label> '; 177 editor_code_narrow += '<input type="radio" name="type_EDITOR_NAME" id="type1_EDITOR_NAME" value="div_text_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE1><label for="type1_EDITOR_NAME">'+rte_lang.text+'</label> '; 178 editor_code_narrow += '<input type="checkbox" name="lockEditor_EDITOR_NAME" id="lockEditor_EDITOR_NAME" value="1" onclick="lockEditor(this);"><label for="lockEditor_EDITOR_NAME">'+rte_lang.lockEditor+'</label> '; 179 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/clear.png" id="clean_EDITOR_NAME" title="'+rte_lang.alt_clear_styles+'" class="rte_buttons" onclick="cleanAll(\'EDITOR_NAME\');"> '; 180 // editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/enlarge.png" title="'+rte_lang.alt_enlarge+'" class="rte_buttons" onclick="enlargeRTE(\'EDITOR_NAME\')">'; 181 editor_code_narrow += '</td>'; 182 editor_code_narrow += '</tr>'; 183 184 editor_code_narrow += '<tr>'; 185 editor_code_narrow += '<td style="padding:0px 0px 0px 0px;">'; 186 187 editor_code_narrow += '<div id="cell_EDITOR_NAME">'; 188 editor_code_narrow += '<div id="div_editor_EDITOR_NAME" class="bg_editor">'; 189 editor_code_narrow += '<table cellpadding="0" cellspacing="0">'; 190 editor_code_narrow += '<tr>'; 191 editor_code_narrow += '<td class="rte_td">'; 192 193 editor_code_narrow += '<table cellpadding="0" cellspacing="0" id="EDITOR_NAME_rteMenu2">'; 194 editor_code_narrow += '<tr>'; 195 editor_code_narrow += '<td class="rte_td">'; 196 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/fgcolor.png" title="'+rte_lang.alt_color+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setColor(\\\'EDITOR_NAME\\\',\\\'forecolor\\\',%%color%%) \', \' '+rte_lang.alt_color+' \'); moveCP(30,event.clientY);"> '; 197 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/bgfcolor.png" title="'+rte_lang.alt_hilite+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setColor(\\\'EDITOR_NAME\\\',\\\'hilitecolor\\\',%%color%%) \', \' '+rte_lang.alt_hilite+' \'); moveCP(30,event.clientY);"> '; 198 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 199 editor_code_narrow += '<select onchange="if (this.value) setCssFontSize(\'EDITOR_NAME\',this.value); this.selectedIndex=0;">'; 200 editor_code_narrow += '<option value="">'+rte_lang.font_size+'</option><option value="8px">8</option><option value="10px">10</option><option value="11px">11</option><option value="12px">12</option><option value="13px">13</option><option value="14px">14</option><option value="15px">15</option><option value="16px">16</option><option value="18px">18</option><option value="20px">20</option><option value="22px">22</option><option value="24px">24</option><option value="26px">26</option><option value="28px">28</option><option value="30px">30</option><option value="36px">36</option><option value="45px">45</option><option value="60px">60</option><option value="70px">70</option><option value="80px">80</option><option value="100px">100</option><option value="110px">110</option><option value="120px">120</option><option value="140px">140</option><option value="150px">150</option>'; 201 editor_code_narrow += '</select> '; 202 editor_code_narrow += '<select onchange="if (this.value) RTEdo(\'EDITOR_NAME\',\'fontname\',this.value); this.selectedIndex=0;">'; 203 editor_code_narrow += '<option value="">'+rte_lang.font_face; 204 for (f=0;f<rte_lang.fonts.length;f++) { 205 editor_code_narrow += '<option value="'+rte_lang.fonts[f].toLowerCase()+'">'+rte_lang.fonts[f]+''; 206 } 207 editor_code_narrow += '</select>'; 208 editor_code_narrow += '</td>'; 209 210 editor_code_narrow += '</tr>'; 211 212 editor_code_narrow += '<tr>'; 213 editor_code_narrow += '<td class="rte_td">'; 214 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/b.png" title="'+rte_lang.alt_bold+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'bold\',\'\');"> '; 215 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/i.png" title="'+rte_lang.alt_italic+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'italic\',\'\');"> '; 216 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/u.png" title="'+rte_lang.alt_under+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'underline\',\'\');"> '; 217 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 218 219 editor_code_narrow += '<table cellpadding="0" cellspacing="0" border="0" style="direction:ltr; display:inline-table; margin:0px;" >'; 220 editor_code_narrow += '<tr>'; 221 editor_code_narrow += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-left.png" title="'+rte_lang.alt_align_left+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyleft\',\'\');"></td>'; 222 editor_code_narrow += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-center.png" title="'+rte_lang.alt_align_center+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifycenter\',\'\');"></td>'; 223 editor_code_narrow += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-right.png" title="'+rte_lang.alt_align_right+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyright\',\'\');"></td>'; 224 editor_code_narrow += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-full.png" title="'+rte_lang.alt_align_just+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyfull\',\'\');"></td>'; 225 editor_code_narrow += '</tr>'; 226 editor_code_narrow += '</table>'; 227 editor_code_narrow += '</td>'; 228 editor_code_narrow += '</tr>'; 229 230 editor_code_narrow += '<tr>'; 231 editor_code_narrow += '<td class="rte_td">'; 232 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/list123.png" title="'+rte_lang.alt_list_n+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'insertorderedlist\',\'\');"> '; 233 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/list.png" title="'+rte_lang.alt_list_b+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'insertunorderedlist\',\'\');"> '; 234 editor_code_narrow += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 235 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/undo.png" title="'+rte_lang.alt_undo+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'undo\',\'\');"> '; 236 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/redo.png" title="'+rte_lang.alt_redo+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'redo\',\'\');"> '; 237 editor_code_narrow += '</td>'; 238 editor_code_narrow += '</tr>'; 239 240 editor_code_narrow += '<tr>'; 241 editor_code_narrow += '<td class="rte_td">'; 242 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/link.png" title="'+rte_lang.alt_link+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'link\',event.clientX+300,event.clientY)"> '; 243 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/img.png" title="'+rte_lang.alt_insert_image+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'img\',event.clientX+300,event.clientY)"> '; 244 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/flv.png" title="'+rte_lang.alt_insert_flv+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'flv\',event.clientX+300,event.clientY)"> '; 245 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/contact.png" title="'+rte_lang.add_contact+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'contact\',event.clientX+300,event.clientY)"> '; 246 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/table.png" title="'+rte_lang.alt_insert_table+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'table\',event.clientX+300,event.clientY)"> '; 247 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/tdbgcolor.png" title="'+rte_lang.alt_table_cell+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setBgcolor(\\\'EDITOR_NAME\\\',%%color%%) \', \' '+rte_lang.alt_table_cell+' \'); moveCP(30,event.clientY);"> '; 248 editor_code_narrow += '</td>'; 249 editor_code_narrow += '</tr>'; 250 editor_code_narrow += '</table>'; 251 252 editor_code_narrow += '</td>'; 253 editor_code_narrow += '</tr>'; 254 editor_code_narrow += '<tr>'; 255 editor_code_narrow += '<td style="background-color:#ffffff;">'; 256 editor_code_narrow += '<input type="hidden" name="style_EDITOR_NAME" id="style_EDITOR_NAME" value="EDITOR_CSS">'; 257 editor_code_narrow += '<iframe id="editor_EDITOR_NAME" name="editor_EDITOR_NAME" src="'+rte_lang.htm_webaxy+'/editor/blank.htm" frameborder="0" scrolling="auto" style=" height:ED
257ITOR_HEIGHT; max-width:100%; width:EDITOR_WIDTH; "></iframe>'; 258 editor_code_narrow += '</td></tr>'; 259 260 editor_code_narrow += '<tr>'; 261 editor_code_narrow += '<td class="rte_td">'; 262 263 editor_code_narrow += '<table cellpadding="0" cellspacing="0" id="EDITOR_NAME_rteMenu3">'; 264 editor_code_narrow += '<tr>'; 265 editor_code_narrow += '<td class="rte_td" style="width:20%"> </td>'; 266 editor_code_narrow += '<td class="rte_td">'; 267 //editor_code_narrow += '<b>'+rte_lang.cell+':</b> '; 268 269 editor_code_narrow += '<table cellpadding="0" cellspacing="0" border="0" style="direction:ltr; display:inline-table;">'; 270 editor_code_narrow += '<tr>'; 271 editor_code_narrow += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/ltr.png" title="'+rte_lang.alt_ltr+'" class="rte_buttons" onclick="addStyle(\'EDITOR_NAME\',\'direction\',\'ltr\')"></td>'; 272 editor_code_narrow += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/rtl.png" title="'+rte_lang.alt_rtl+'" class="rte_buttons" onclick="addStyle(\'EDITOR_NAME\',\'direction\',\'rtl\')"></td>'; 273 editor_code_narrow += '</tr>'; 274 editor_code_narrow += '</table>'; 275 editor_code_narrow += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 276 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/font.png" title="'+rte_lang.insert_fontProperties+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'fontProperties\',event.clientX,event.clientY - 300)"> '; 277 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/fgcolor.png" title="'+rte_lang.alt_cell_font_color+'" class="rte_buttons" onclick="window.frames[\'colorPicker\'].getColor(30,document.body.scrollTop+event.clientY+20, getStyle(\'EDITOR_NAME\',\'color\'), \'addStyle(\\\'EDITOR_NAME\\\',\\\'color\\\',%%color%%) \', \' '+rte_lang.alt_cell_font_color+' \'); moveCP(event.clientX,event.clientY - 300);"> '; 278 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/bgcolor.png" title="'+rte_lang.alt_cell_bgcolor+'" class="rte_buttons" onclick="window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, getStyle(\'EDITOR_NAME\',\'background-color\'), \'addStyle(\\\'EDITOR_NAME\\\',\\\'background-color\\\',%%color%%) \', \' '+rte_lang.alt_cell_bgcolor+' \'); moveCP(event.clientX,event.clientY - 300);"> '; 279 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/bgimg.png" title="'+rte_lang.alt_cel_bgimg+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'bgimg\',event.clientX,event.clientY - 300)"> '; 280 editor_code_narrow += '</td>'; 281 editor_code_narrow += '</tr>'; 282 283 editor_code_narrow += '<tr>'; 284 editor_code_narrow += '<td></td>'; 285 editor_code_narrow += '<td class="rte_td">'; 286 editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/border.png" title="'+rte_lang.alt_border_padding+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'cell\',event.clientX,event.clientY - 300)">'; 287 editor_code_narrow += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 288 //editor_code_narrow += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/clear.png" title="'+rte_lang.alt_clear_styles+'" class="rte_buttons" onclick="cleanAll(\'EDITOR_NAME\');"> '; 289 //editor_code_narrow += ' <img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 290 291 editor_code_narrow += '<span id="setFrameColor0_EDITOR_NAME">'; 292 editor_code_narrow += rte_lang.alt_show_bgcolor; 293 editor_code_narrow += '</span>'; 294 editor_code_narrow += '<span id="setFrameColor1_EDITOR_NAME">'; 295 editor_code_narrow += '<table style="width:26px; margin:0px 3px 0px 3px; border:solid 1px #000000; display:inline-table; " cellpadding="0" cellspacing="0" border="0" title="'+rte_lang.alt_show_bgcolor+'"><tr><td style="background-color:#ffffff;width:8px;height:8px;cursor:pointer;" onclick="setFrameColor(\'EDITOR_NAME\',this.style.backgroundColor);"></td><td style="background-color:#dddddd;width:8px;height:8px;cursor:pointer" onclick="setFrameColor(\'EDITOR_NAME\',this.style.backgroundColor);"></td><td style="background-color:#888888;width:8px;height:8px;
295cursor:pointer;" onclick="setFrameColor(\'EDITOR_NAME\',this.style.backgroundColor);"></td></tr></table>'; 296 editor_code_narrow += '</span>'; 297 editor_code_narrow += '</td>'; 298 editor_code_narrow += '</tr>'; 299 editor_code_narrow += '</table>'; 300 301 editor_code_narrow += '</td>'; 302 editor_code_narrow += '</tr>'; 303 editor_code_narrow += '</table>'; 304 editor_code_narrow += '</div>'; // editor end 305 306 editor_code_narrow += '<div id="div_text_EDITOR_NAME" style="display:none;">'; 307 editor_code_narrow += '<table border="0" cellpadding="0" cellspacing="0"><tr><td style="direction:ltr;">'; 308 editor_code_narrow += '<textarea id="EDITOR_NAME" name="EDITOR_NAME" wrap="virtual" style="direction:ltr; height:EDITOR_HEIGHT; max-width:100%; width:EDITOR_WIDTH;"></textarea>'; 309 editor_code_narrow += '</td>'; 310 editor_code_narrow += '</tr>'; 311 editor_code_narrow += '</table>'; 312 editor_code_narrow += '</div>';// text end 313 314 editor_code_narrow += '</div>'; // cell end 315 editor_code_narrow += '</td>'; 316 editor_code_narrow += '</tr>'; 317 editor_code_narrow += '</table>'; 318 // ===== THIN CODE =========== 319 320 var thin_editor_code = ""; 321 thin_editor_code += '<table editor="thin" cellpadding="0" cellspacing="0" style="direction:'+rte_lang.direction+'; >'; 322 thin_editor_code += '<tr id="EDITOR_NAME_rteMenu1">'; 323 thin_editor_code += '<td class="rte_td" style="color:#000000;background-color:#c0c0c0; padding:1px 0px 1px 0px;" >'; 324 thin_editor_code += 'EDITOR_TITLE'; 325 thin_editor_code += '<div style="display:none">'; 326 thin_editor_code += '<input type="radio" name="type_EDITOR_NAME" id="type0_EDITOR_NAME" value="div_editor_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE0><label for="type0_EDITOR_NAME">'+rte_lang.editor+'</label> '; 327 thin_editor_code += '<input type="radio" name="type_EDITOR_NAME" id="type1_EDITOR_NAME" value="div_text_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE1><label for="type1_EDITOR_NAME">'+rte_lang.text+'</label> '; 328 thin_editor_code += '<input type="checkbox" name="lockEditor_EDITOR_NAME" id="lockEditor_EDITOR_NAME" value="1" onclick="lockEditor(this);"><label for="lockEditor_EDITOR_NAME">'+rte_lang.lockEditor+'</label> '; 329 thin_editor_code += '</div>'; 330 thin_editor_code += '</td>'; 331 thin_editor_code += '</tr>'; 332 333 thin_editor_code += '<tr>'; 334 thin_editor_code += '<td style="padding:0px 0px 0px 0px;">'; 335 336 thin_editor_code += '<div id="cell_EDITOR_NAME">'; 337 thin_editor_code += '<div id="div_editor_EDITOR_NAME" class="bg_editor">'; 338 thin_editor_code += '<table cellpadding="0" cellspacing="0">'; 339 thin_editor_code += '<tr>'; 340 thin_editor_code += '<td class="rte_td">'; 341 342 thin_editor_code += '<table cellpadding="0" cellspacing="0" id="EDITOR_NAME_rteMenu2">'; 343 thin_editor_code += '<tr>'; 344 thin_editor_code += '<td class="rte_td">'; 345 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/fgcolor.png" title="'+rte_lang.alt_color+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setColor(\\\'EDITOR_NAME\\\',\\\'forecolor\\\',%%color%%) \', \' '+rte_lang.alt_color+' \'); moveCP(30,event.clientY);"> '; 346 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/bgfcolor.png" title="'+rte_lang.alt_hilite+'" class="rte_buttons" onclick="setRange(\'EDITOR_NAME\'); window.frames[\'colorPicker\'].getColor(30, document.body.scrollTop+event.clientY+20, \'\', \'setColor(\\\'EDITOR_NAME\\\',\\\'hilitecolor\\\',%%color%%) \', \' '+rte_lang.alt_hilite+' \'); moveCP(30,event.clientY);"> '; 347 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 348 thin_editor_code += '<select onchange="if (this.value) setCssFontSize(\'EDITOR_NAME\',this.value); this.selectedIndex=0;">'; 349 thin_editor_code += '<option value="">'+rte_lang.font_size+'</option><option value="8px">8</option><option value="10px">10</option><option value="11px">11</option><option value="12px">12</option><option value="13px">13</option><option value="14px">14</option><option value="15px">15</option><option value="16px">16</option><option value="18px">18</option><option value="20px">20</option><option value="22px">22</option><option value="24px">24</option><option value="26px">26</option><option value="28px">28</option><option value="30px">30</option><option value="36px">36</option><option value="45px">45</option><option value="60px">60</option><option value="70px">70</option><option value="80px">80</option><option value="100px">100</option><option value="110px">110</option><option value="120px">120</option><option value="140px">140</option><option value="150px">150</option>'; 350 thin_editor_code += '</select> '; 351 thin_editor_code += '<select onchange="if (this.value) RTEdo(\'EDITOR_NAME\',\'fontname\',this.value); this.selectedIndex=0;">'; 352 thin_editor_code += '<option value="">'+rte_lang.font_face; 353 for (f=0;f<rte_lang.fonts.length;f++) { 354 thin_editor_code += '<option value="'+rte_lang.fonts[f].toLowerCase()+'">'+rte_lang.fonts[f]+''; 355 } 356 thin_editor_code += '</select>'; 357 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 358 359 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/b.png" title="'+rte_lang.alt_bold+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'bold\',\'\');"> '; 360 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/i.png" title="'+rte_lang.alt_italic+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'italic\',\'\');"> '; 361 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/u.png" title="'+rte_lang.alt_under+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'underline\',\'\');"> '; 362 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 363 364 thin_editor_code += '<table cellpadding="0" cellspacing="0" border="0" style="direction:ltr; display:inline-table; margin:0px;" >'; 365 thin_editor_code += '<tr>'; 366 thin_editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-left.png" title="'+rte_lang.alt_align_left+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyleft\',\'\');"></td>'; 367 thin_editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-center.png" title="'+rte_lang.alt_align_center+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifycenter\',\'\');"></td>'; 368 thin_editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/align-right.png" title="'+rte_lang.alt_align_right+'" class="rte_buttons" onclick="RTEdo(\'EDITOR_NAME\',\'justifyright\',\'\');"></td>'; 369 thin_editor_code += '</tr>'; 370 thin_editor_code += '</table>'; 371 372 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 373 374 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/link.png" title="'+rte_lang.alt_link+'" class="rte_buttons" onclick="openAdd(\'EDITOR_NAME\',\'link\',event.clientX+300,event.clientY)"> '; 375 376 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif"> '; 377 thin_editor_code += '<table cellpadding="0" cellspacing="0" border="0" style="direction:ltr; display:inline-table;">'; 378 thin_editor_code += '<tr>'; 379 thin_editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/ltr.png" title="'+rte_lang.alt_ltr+'" class="rte_buttons" onclick="addStyle(\'EDITOR_NAME\',\'direction\',\'ltr\')"></td>'; 380 thin_editor_code += '<td><img src="'+rte_lang.htm_webaxy+'/editor/buttons/rtl.png" title="'+rte_lang.alt_rtl+'" class="rte_buttons" onclick="addStyle(\'EDITOR_NAME\',\'direction\',\'rtl\')"></td>'; 381 thin_editor_code += '</tr>'; 382 thin_editor_code += '</table>'; 383 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/sep.gif">'; 384 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/clear.png" title="'+rte_lang.alt_clear_styles+'" class="rte_buttons" onclick="cleanAll(\'EDITOR_NAME\');"> '; 385 thin_editor_code += '<img src="'+rte_lang.htm_webaxy+'/editor/buttons/enlarge.png" title="'+rte_lang.alt_enlarge+'" class="rte_buttons" onclick="enlargeRTE(\'EDITOR_NAME\')">'; 386 387 388 thin_editor_code += '</td>'; 389 thin_editor_code += '</tr>'; 390 thin_editor_code += '</table>'; 391 392 thin_editor_code += '</td>'; 393 thin_editor_code += '</tr>'; 394 thin_editor_code += '<tr>'; 395 thin_editor_code += '<td style="background-color:#ffffff;">'; 396 thin_editor_code += '<input type="hidden" name="style_EDITOR_NAME" id="style_EDITOR_NAME" value="EDITOR_CSS">'; 397 thin_editor_code += '<iframe id="editor_EDITOR_NAME" name="editor_EDITOR_NAME" src="'+rte_lang.htm_webaxy+'/editor/blank.htm" frameborder="0" scrolling="auto" style=" height:ED
397ITOR_HEIGHT; max-width:100%; width:EDITOR_WIDTH;"></iframe>'; 398 thin_editor_code += '</td></tr>'; 399 400 thin_editor_code += '</table>'; 401 thin_editor_code += '</div>'; // editor end 402 thin_editor_code += '</div>'; 403 thin_editor_code += '<div id="div_text_EDITOR_NAME" style="display:none;">'; 404 thin_editor_code += '<table border="0" cellpadding="0" cellspacing="0"><tr><td style="direction:ltr;">'; 405 thin_editor_code += '<textarea id="EDITOR_NAME" name="EDITOR_NAME" wrap="virtual" style="direction:ltr; height:EDITOR_HEIGHT; max-width:100%; width:EDITOR_WIDTH;"></textarea>'; 406 thin_editor_code += '</td>'; 407 thin_editor_code += '</tr>'; 408 thin_editor_code += '</table>'; 409 thin_editor_code += '</div>';// text end 410 411 thin_editor_code += '</div>'; // cell end 412 thin_editor_code += '</td>'; 413 thin_editor_code += '</tr>'; 414 thin_editor_code += '</table>'; 415 // ===== BLANK CODE =========== 416 var blank_editor_code = ""; 417 418 blank_editor_code += '<table editor="blank" style="direction:'+rte_lang.direction+'; " cellpadding="0" cellspacing="0">'; 419 blank_editor_code += '<tr><td class="rte_td" style="background-color:#c0c0c0;color:#000000;">EDITOR_TITLE'; 420 blank_editor_code += '<div style="display:none;">'; 421 blank_editor_code += '<input type="radio" name="type_EDITOR_NAME" value="div_editor_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE0><a href="javascript:void(0)" style="color:#000000; text-decoration:none;" onclick="this.previousSibling.click(); return false;"> '+rte_lang.editor+'</a> '; 422 blank_editor_code += '<input type="radio" name="type_EDITOR_NAME" value="div_text_EDITOR_NAME" onclick="setCellType(this);" EDITOR_TYPE1><a href="javascript:void(0)" style="color:#000000; text-decoration:none;" onclick="this.previousSibling.click(); return false;"> '+rte_lang.text+'</a> '; 423 blank_editor_code += '</div>'; 424 blank_editor_code += '</td></tr>'; 425 blank_editor_code += '<tr><td style="padding:0px 0px 0px 0px;">'; 426 427 blank_editor_code += '<div id="cell_EDITOR_NAME">'; 428 blank_editor_code += '<div id="div_editor_EDITOR_NAME" class="bg_editor">'; 429 blank_editor_code += '<table bgcolor="#dadada" cellpadding="0" cellspacing="0">'; 430 431 432 blank_editor_code += '<tr>'; 433 blank_editor_code += '<td style="background-color:#ffffff;">'; 434 blank_editor_code += '<input type="hidden" name="style_EDITOR_NAME" id="style_EDITOR_NAME" value="EDITOR_CSS">'; 435 blank_editor_code += '<iframe id="editor_EDITOR_NAME" name="editor_EDITOR_NAME" src="'+rte_lang.htm_webaxy+'/editor/blank.htm" frameborder="0" scrolling="auto" style=" height:EDITOR_HEIGHT; max-width:100%; width:EDITOR_WIDTH;"></iframe>'; 436 blank_editor_code += '</td></tr>'; 437 438 blank_editor_code += '</table>'; 439 blank_editor_code += '</div>'; 440 441 blank_editor_code += '<div id="div_text_EDITOR_NAME" style="display:none;">'; 442 blank_editor_code += '<textarea id="EDITOR_NAME" name="EDITOR_NAME" wrap="virtual"></textarea>'; 443 blank_editor_code += '</div>'; 444 blank_editor_code += '</div>'; 445 blank_editor_code += '</td></tr>'; 446 blank_editor_code += '</table>'; 447//=================================================================== 448// 449// name: do 450// 451//=================================================================== 452function extraButtonsCode(code,extraButtons) { 453 extraButtons = ","+extraButtons+","; 454 if (extraButtons.indexOf(",contact,") == -1) { 455 code = code.replace(/<img [^>]+contact.png[^>]+>/,""); 456 } 457 458 return code; 459 460} 461 462//=================================================================== 463// 464// createEditor: create HTML editor from textarea field 465// 466//=================================================================== 467function createEditor(field,ftitle,ftype,editor_type,ewidth,extraButtons) { 468 if (isMobile) { 469 if (field.defaultValue.search(/\S/) == -1) { 470 return; 471 } 472 } 473 if (!ftitle) { 474 ftitle=""; 475 } 476 if (!ewidth) { 477 ewidth = 0; 478 } 479 if (!editor_type) { 480 editor_type="full"; 481 } 482 var code = ""; 483 var cssText = field.style.cssText; 484 485 if (editor_type=="full") { 486 var actualWidth = editor_min_width; 487 if ((parseInt(field.style.width) > 0) && (field.style.width.search(/p[xt]$/i) != -1)) { 488 actualWidth = parseInt(field.style.width); 489 } 490 else if (((field.style.width == "100%") || (field.style.width == "")) && (field.parentNode.clientWidth > 0)) { 491 actualWidth = field.parentNode.clientWidth; 492 field.style.width = (actualWidth - 20) + "px"; 493 } 494 else if (field.clientWidth > 0) { 495 actualWidth = field.clientWidth; 496 } 497 498 if (actualWidth < 300) { 499 code = editor_code_narrow; 500 editor_min_width = actualWidth; 501 } 502 else {
503 code = editor_code; 504 } 505 } 506 else if (editor_type=="thin") { 507 ftype = "editor"; 508 code = thin_editor_code; 509 editor_min_width = 450; 510 var actualWidth = editor_min_width; 511 if ((parseInt(field.style.width) > 0) && (field.style.width.search(/p[xt]$/i) != -1)) { 512 actualWidth = parseInt(field.style.width); 513 } 514 else if (((field.style.width == "100%") || (field.style.width == "")) && (field.parentNode.clientWidth > 0)) { 515 actualWidth = field.parentNode.clientWidth; 516 field.style.width = (actualWidth - 20) + "px"; 517 } 518 else if (field.clientWidth > 0) { 519 actualWidth = field.clientWidth; 520 } 521 if (actualWidth > editor_min_width) { 522 editor_min_width = actualWidth; 523 } 524 } 525 else if (editor_type=="blank") { 526 ftype = "editor"; 527 code = blank_editor_code; 528 editor_min_width = 450; 529 var actualWidth = editor_min_width; 530 if ((parseInt(field.style.width) > 0) && (field.style.width.search(/p[xt]$/i) != -1)) { 531 actualWidth = parseInt(field.style.width); 532 } 533 else if (((field.style.width == "100%") || (field.style.width == "")) && (field.parentNode.clientWidth > 0)) { 534 actualWidth = field.parentNode.clientWidth; 535 field.style.width = (actualWidth - 20) + "px"; 536 } 537 else if (field.clientWidth > 0) { 538 actualWidth = field.clientWidth; 539 } 540 if (actualWidth > editor_min_width) { 541 editor_min_width = actualWidth; 542 } 543 } 544 if (!extraButtons) { 545 extraButtons =""; 546 } 547 code = extraButtonsCode(code,extraButtons); 548 549 var originalValue = field.getAttribute("originalValue"); 550 if (!originalValue) { 551 originalValue = field.defaultValue; 552 } 553 field.value = originalValue; 554 555 var fname = field.name; 556 var meta_re = /<\!\-\-\sRTE\s(.+)\sRTE -->/; 557 field.value.search(meta_re); 558 var meta = RegExp.$1; 559 field.value = field.value.replace(meta_re,""); 560 561 var css = ""; 562 var lockEditorValue = 0; 563 564 if (meta) { // value contains meta comment 565 meta.search(/css=([^&]+)/); 566 css = RegExp.$1; 567 if (!css) { 568 css = ""; 569 } 570 571 572 if (meta.search(/ftype=([^&]+)/) != -1) { 573 ftype = RegExp.$1; 574 } 575 if (!ftype) { 576 ftype = "editor"; 577 } 578 579 if (meta.search(/lockEditor=([^&]+)/) != -1) { 580 lockEditorValue = RegExp.$1; 581 } 582 } 583 else if (field.value != "") { 584 css = ""; 585 if (!ftype) { 586 ftype = "text"; 587 } 588 } 589 else { 590 css = ""; 591 if (!ftype) { 592 ftype = "editor"; 593 } 594 } 595 596 // alert(field.id+" css="+css); 597 var cssPairs = css.split(/\s*\;\s*/); 598 var cssKeys = ","; 599 for (var p=0; p<cssPairs.length; p++) { 600 if (cssPairs[p].search(/([^:]+):/) != -1) { 601 cssKeys += RegExp.$1 + ","; 602 } 603 } 604 605 cssKeys = cssKeys.toLowerCase(); 606 css += ";"; 607 if ((cssKeys.search(/,background\-color,/) == -1) && field.style.backgroundColor) { 608 css += "background-color:"+field.style.backgroundColor+";"; 609 } 610 if ((cssKeys.search(/,color,/) == -1) && field.style.color) { 611 css += "color:"+field.style.color+";"; 612 } 613 614 css = css.replace(/^[; ]+/,""); 615 css = css.replace(/;+/,";"); 616 css = css.replace(/;+$/,""); 617 css = css.replace(/\"/g,"'"); 618 css = css.replace(/[<>]/g,""); 619 620 if (field.value.search(/<iframe/i) != -1) { 621 ftype = "text"; 622 } 623 624 if (!field.id) { 625 field.id = fname; 626 } 627 if (ftitle.search(/\S/) != -1) { 628 ftitle = " "+ftitle+" "; 629 } 630 code = code.replace(/EDITOR_TITLE/g,ftitle); 631 code = code.replace(/EDITOR_NAME/g,fname); 632 //code = code.replace(/EDITOR_VALUE/g,field.value); 633 634 var hgt = editor_def_height; 635 if (parseInt(field.style.height) > 0) { 636 hgt = parseInt(field.style.height); 637 } 638 else if (field.clientHeight > editor_def_height) { 639 hgt = field.clientHeight; 640 } 641 642 code = code.replace(/EDITOR_HEIGHT/g,hgt+"px"); 643 644 if (!ewidth && (parseInt(field.style.width) > editor_min_width)) { 645 ewidth = parseInt(field.style.width); 646 } 647 if (!ewidth) { 648 ewidth = field.clientWidth; 649 } 650 if (editor_type != "full") { 651 if (ewidth < editor_min_width) { 652 ewidth = editor_min_width; 653 } 654 } 655 656 if (ewidth == 0) { 657 ewidth = editor_min_width; 658 } 659 660 code = code.replace(/EDITOR_WIDTH/g,ewidth+"px"); 661 //code = code.replace(/EDITOR_WIDTH/g,"auto"); 662 if (ftype=="text") { 663 code = code.replace(/EDITOR_TYPE1/g,'checked'); 664 } 665 else { 666 code = code.replace(/EDITOR_TYPE0/g,'checked'); 667 } 668 code = code.replace(/EDITOR_TYPE\d/g,''); 669 code = code.replace(/EDITOR_CSS/g,css); 670 671 if (isIE) { 672 code = code.replace(/inline\-table;/g,"inline;"); 673 } 674 var editor = document.createElement("span"); 675 editor.innerHTML = code; 676 677 var field_form = field.form; 678 679 680 field.parentNode.replaceChild(editor,field); 681 682 var rte_ta = document.getElementById(fname); 683 rte_ta.setAttribute("editor_type",editor_type); 684 rte_ta.setAttribute("originalValue",originalValue); 685 if (cssText) { 686 rte_ta.setAttribute("cssText",cssText); 687 } 688 var rte_rad = document.getElementsByName('type_'+fname); 689 var rte_css = document.getElementById('style_'+fname); 690 691 692 var lockEditorField = document.getElementById('lockEditor_'+fname); 693 694 rte_ta.value = field.value; 695 if (ftype != "text") { 696 copyData(fname,"editor_"+fname); 697 } 698 699 if (rte_ta.form == null) { // FF 700 if (isIE) { 701 rte_ta.form = field_form; 702 } 703 else { 704 field_form.appendChild(rte_rad[0]); 705 field_form.appendChild(rte_rad[1]); 706 field_form.appendChild(rte_css); 707 field_form.appendChild(rte_ta); 708 if (lockEditorField) { 709 field_form.appendChild(lockEditorField); 710 } 711 } 712 } 713 if (lockEditorField && (lockEditorValue == 1)) { 714 lockEditorField.checked = true; 715 if (isIE) { 716 //copyData(fname,"editor_"+fname); 717 setTimeout("lockEditor('"+lockEditorField.id+"')",200); 718 } 719 else { 720 //copyData(fname,"editor_"+fname); 721 lockEditor(lockEditorField); 722 } 723 } 724 725 if (document.getElementById("bg_editor_"+fname)) { 726 var bgdiv = document.getElementById("bg_editor_"+fname); 727 var w = document.getElementById(fname+"_rteMenu2").clientWidth; 728 if (w < document.getElementById("editor_"+fname).parentNode.clientWidth) {
729 if (screen.availWidth > document.getElementById("editor_"+fname).parentNode.clientWidth) { 730 w = document.getElementById("editor_"+fname).parentNode.clientWidth; 731 } 732 } 733 if (ewidth > w) { 734 if (screen.availWidth > ewidth) { 735 w = ewidth; 736 } 737 } 738 if (!isIE) { 739 w += 40; 740 } 741 bgdiv.style.width = w + "px"; 742 } 743 744 return; 745} 746 747//----------------------------------------------------------------------------------- 748function initRTE(fname) { 749 var ifr = window.frames["editor_"+fname]; 750 if (!ifr) { 751 alert("none initRTE"); 752 return; 753 } 754 755 try { 756 if (document.getElementById(fname).form.elements['ID'].value == "179101_mh") { 757 let cssText = ` 758 body { font-size:12pt;} 759 td { font-size:12pt;} 760 `; 761 762 let styleSheet = ifr.document.createElement("style"); 763 styleSheet.type = "text/css"; 764 styleSheet.innerText = cssText; 765 ifr.document.head.appendChild(styleSheet); 766 } 767 //-- 768 if (rte_lang.editorFontSize) { 769 let cssText = "body { font-size:"+ rte_lang.editorFontSize +";}\n td { font-size:"+ rte_lang.editorFontSize +";}\n"; 770 let styleSheet = ifr.document.createElement("style"); 771 styleSheet.type = "text/css"; 772 styleSheet.innerText = cssText; 773 ifr.document.head.appendChild(styleSheet); 774 } 775 } catch(err) {} 776 var cssText = document.getElementById(fname).getAttribute("cssText"); 777 if (cssText) { 778 ifr.document.body.style.cssText += cssText; 779 } 780 var lockEditorField = document.getElementById("lockEditor_"+fname); 781 if (lockEditorField && lockEditorField.checked) { 782 return; 783 } 784 785 if (!ifr.document) { 786 alert("initRTE Error: no document on_"+fname); 787 return; 788 } 789 790 ifr.document.designMode = "On"; 791 if (isIE) { 792 try { 793 ifr.document.body.contentEditable = true; 794 //document.getElementById("editor_"+fname).contentDocument.designMode="on"; 795 } 796 catch(e) {} 797 } 798 799 800} 801//=================================================================== 802// 803// initEditors: Init all editors 804// 805//=================================================================== 806 807function initEditors(fname0) { 808 var ifrs = document.getElementsByTagName("iframe"); 809 if (!ifrs) { 810 return; 811 } 812 var fname = ""; 813 var ta = null; 814 var rad = null; 815 var css = null; 816 for (i=0;i<ifrs.length;i++) { 817 if (ifrs[i].id.indexOf("editor_") != 0) { 818 continue; 819 } 820 fname = ifrs[i].id.slice(7); 821 822 if (fname0 && ('editor_'+fname != fname0) && (fname != fname0)) { 823 continue; 824 } 825 ta = document.getElementById(fname); 826 ta.value = ta.value.replace(flvPlayerCode,""); // remove video code if exists 827 ta.value = ta.value.replace(postEditorsCode,""); // remove postEditorsCode code if exists 828 // set iframe height 829 if (parseInt(ifrs[i].style.height) < 100) {// need to change dimensions 830 831 var iframeTable = ifrs[i].parentNode; 832 while (iframeTable && iframeTable.tagName && (iframeTable.tagName != "TABLE")) { 833 iframeTable = iframeTable.parentNode; 834 } 835 var cell_div = document.getElementById("cell_"+fname); 836 837 } 838 initRTE(fname); 839 840 841 rad = ta.form.elements["type_"+fname]; 842 css = ta.form.elements["style_"+fname]; 843 844 css.value = defaultCss(css.value); 845 css.defaultValue = css.value; 846 847 848 setStyle(fname,css.value); 849 850 if (rad[1].checked == false) { 851 copyData(ta,ifrs[i]); 852 } 853 var ortext = "self.setTimeout('resetEditors()',500);"; 854 855 if (!ta.form.onreset) { 856 ta.form.onreset = new Function(ortext); 857 } 858 else if (ta.form.onreset.toString().indexOf(ortext)==-1) { 859 var orbody = ta.form.onreset.toString(); 860 orbody = orbody.replace(/\{/,"{ "+ortext+" \n"); 861 ta.form.onreset = new Function(orbody); 862 } 863 864 var ostext = "submitEditors();"; 865 if (!ta.form.onsubmit) { 866 ta.form.onsubmit = new Function(ostext); 867 } 868 else if (ta.form.onsubmit.toString().indexOf(ostext)==-1) { 869 var osbody = ta.form.onsubmit.toString(); 870 osbody = osbody.replace(/\{/,"{ "+ostext+" \n"); 871 872 osbody = osbody.replace(/\s/mg," ").replace(/^\s*function [^\{]+\{(.+)\}\s*$/,"$1"); 873 ta.form.onsubmit = new Function(osbody); 874 } 875 876 for (r=0;r<rad.length;r++) { 877 if (rad[r].checked) { 878 setCellType(rad[r]); 879 break; 880 } 881 } 882 ta.setAttribute("initEditor","1"); 883 } 884 885 // place addcode iframe inside body element in order to open it on the right place 886 var adc = document.getElementById("addcode"); 887 if (adc) { 888 if (adc.parentNode.tagName != "BODY") { 889 adc.parentNode.removeChild(adc); 890 document.body.appendChild(adc); 891 } 892 } 893 894 self.setTimeout('hideRTEComments(); editor_msg = "initEditors done" ',2000); 895} 896//=================================================================== 897//
898// hideRTEComments: hide all RTE comments from page. comment= <!-- RTE css=...&ftype=...&lockEditor=... RTE --> 899// 900//=================================================================== 901function hideRTEComments() { 902 var ifrs = document.getElementsByTagName("iframe"); 903 if (!ifrs) { 904 return; 905 } 906 for (i=0;i<ifrs.length;i++) { 907 if (ifrs[i].id.indexOf("editor_") != 0) { 908 continue; 909 } 910 var ta = document.getElementById(ifrs[i].id.slice(7)); 911 if (ta) { 912 ta.value = ta.value.replace(/<\!\-\- RTE[^>]+>/g,""); 913 ta.value = ta.value.replace(flvPlayerCode,""); 914 ta.value = ta.value.replace(postEditorsCode,""); 915 } 916 } 917} 918 919//=================================================================== 920// 921// submitEditors: make all editors ready to submit (copy innerHTML to textarea field) 922// 923//=================================================================== 924function submitEditors(tool) { 925 if (!tool) { 926 tool = self.location.href; 927 } 928 var ifrs = document.getElementsByTagName("iframe"); 929 if (!ifrs) { 930 return; 931 } 932 var fname = ""; 933 var ta = null; 934 var last_ta = null; 935 var rad = null; 936 var meta = ""; 937 //var hasFLV = ""; 938 939 940 for (i=0;i<ifrs.length;i++) { 941 if (ifrs[i].id.indexOf("editor_") != 0) { 942 continue; 943 } 944 945 fname = ifrs[i].id.slice(7); 946 947 ta = document.getElementById(fname); 948 rad = ta.form.elements["type_"+fname]; 949 css = ta.form.elements["style_"+fname]; 950 var lockEditorField = document.getElementById("lockEditor_"+fname); 951 meta = '<!-- RTE css='+css.value+'&ftype='+(rad[0].checked ? "editor" : "text")+'&lockEditor='+((lockEditorField && lockEditorField.checked) ? "1" : "0")+' RTE -->'; 952 ta.value = ta.value.replace(/<\!\-\- RTE[^>]+>/g,""); 953 if (rad[0].checked) { 954 copyData(ifrs[i],ta); 955 ta.value = ta.value.replace(/ $/,'');// for blank value in IE 956 if ((ta.value.search(/\S/) == -1) && (css.value.search(/background\-?image\s*\:\s*[^;]/i) != -1) && (css.value.search(/background\-?image\s*\:\s*none/i) == -1)) { // background image with no text 957 ta.value = "<p><br></p>"; 958 } 959 if (ta.value.search(/\S/) != -1) { 960 ta.value=meta+ta.value; 961 } 962 } 963 else { 964 if (ta.value.search(/\S/) != -1) { 965 ta.value=meta+ta.value; 966 } 967 } 968 ta.value = ta.value.replace(/http\S+\/editor\/blank\.htm\#/ig,"#"); // internal references 969 ta.value = ta.value.replace(flvPlayerCode,""); 970 ta.value = ta.value.replace(postEditorsCode,""); 971 972 if (ta.value.search(/\S/) != -1) {// not empty editor 973 last_ta = ta; 974 } 975 //alert(ta.value); 976 } 977 if (last_ta) { 978 if ((tool.search(/dhtmlnews\.pl/) == -1) && (tool.search(/mig\-forum\.pl/) == -1)) { 979 if (last_ta.value.indexOf("postEditors.js") == -1) { 980 last_ta.value += postEditorsCode; // insert postEditorsCode to last editor code 981 } 982 } 983 } 984 self.setTimeout("hideRTEComments()",500); 985} 986//----------------------------------------------------------------------------------- 987function RTEdo(fname,command,val) { 988 if (command != "createlink") { 989 setRange(fname); 990 } 991 992 var ifr = window.frames["editor_"+fname]; 993 if (!ifr) { 994 alert("none RTEdo"); 995 return; 996 } 997 try { 998 ifr.self.focus(); 999 if (isIE) { 1000 if (!rng) { 1001 rng = ifr.document.selection.createRange().duplicate(); 1002 rng.fname = fname; 1003 } 1004 rng.select(); 1005 1006 if ((rng.htmlText == undefined) || (rng.htmlText == "")) { // no selection 1007 if (command == 'fontsize') { 1008 rng.collapse(false); 1009 rng = null; 1010 return; 1011 } 1012 } 1013 } 1014 else { 1015 if ((rng.toString() == undefined) || (rng.toString() == "")) { // no selection 1016 if (command == 'fontsize') { 1017 rng.collapse(false); 1018 rng = null; 1019 return; 1020 } 1021 } 1022 1023 } 1024 ifr.self.document.execCommand(command, false, val); 1025 } 1026 catch(e) { 1027 //alert(command+" not suppotred"); 1028 } 1029 try { 1030 ifr.focus(); 1031 } 1032 catch(e) {} 1033} 1034 1035//----------------------------------------------------------------------------------- 1036 1037function setColor(fname,command,color) { 1038 if (isIE) { 1039 if (command == "hilitecolor") { 1040 command = "backcolor"; 1041 } 1042 rng.select(); 1043 } 1044 1045 RTEdo(fname, command, color); 1046} 1047 1048 1049//----------------------------------------------------------------------------------- 1050function setRange(fname) { 1051 var ifr = window.frames["editor_"+fname]; 1052 if (!ifr) { 1053 alert("none setRange"); 1054 return; 1055 } 1056 rng = null; 1057 //function to store range of current selection 1058 if (isIE) { 1059 ifr.focus(); 1060 var selection = ifr.document.selection; 1061 if (selection != null) { 1062 try { 1063 rng = selection.createRange().duplicate(); 1064 } 1065 catch(e) { 1066 rng = selection.createRange(); 1067 } 1068 if (rng.htmlText) { 1069 while (rng.htmlText.search(/^\s*<br\/?\s*>/i) != -1) { 1070 rng.moveStart('character',1); 1071 } 1072 while (rng.htmlText.search(/\s*<br\/?\s*>$/i) != -1) { 1073 rng.moveEnd('character',-1); 1074 } 1075 } 1076 1077 } 1078 } 1079 else { 1080 try { 1081 var selection = ifr.getSelection(); 1082 if (selection) { 1083 if (selection.rangeCount - 1 >= 0) { 1084 rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange(); 1085 } 1086 else { 1087 rng = selection.getRangeAt(0).cloneRange(); 1088 } 1089 1090 } 1091 } catch(e) {} 1092 } 1093 1094 if (rng) { 1095 rng.fname = fname; 1096 } 1097 return rng; 1098} 1099 1100//----------------------------------------------------------------------------------- 1101function getSelectedObject(fname,act) { 1102 var ifr = window.frames["editor_"+fname]; 1103 if (!ifr) { 1104 alert("none getSelectedObject"); 1105 return; 1106 } 1107 if (!act) { 1108 act = ""; 1109 } 1110 1111 //setRange(fname); 1112 var ob0 = null; 1113 if (isIE) { 1114 if (rng.htmlText == undefined) { // control (selection is an object like image) 1115 ob0 = rng.item(0); 1116 } 1117 else { // text node
1118 if (act == "node") { 1119 ob0 = rng.parentElement(); 1120 } 1121 else { 1122 ob0 = rng.htmlText; 1123 } 1124 } 1125 } 1126 else { 1127 var container = rng.startContainer; 1128 var pos = rng.startOffset; 1129 if ((container.nodeType == 3) || (container.childNodes[pos].tagName=="BR")) { // text 1130 if (act == "node") { 1131 ob0 = container.parentNode; 1132 } 1133 else { 1134 ob0 = rng.toString(); 1135 } 1136 } 1137 else { 1138 ob0 = container.childNodes[pos]; 1139 } 1140 } 1141 1142 1143 return ob0; 1144} 1145//----------------------------------------------------------------------------------- 1146function collapseRange(fname) { 1147 var ifr = window.frames["editor_"+fname]; 1148 if (!ifr) { 1149 alert("none collapseRange"); 1150 return; 1151 } 1152 //function to collapse range of current selection 1153 try { 1154 rng.collapse(true); 1155 } 1156 catch (e) { 1157 rng = null; 1158 } 1159 try { 1160 if (!isIE) { 1161 var selection = ifr.getSelection(); 1162 if (selection) { 1163 selection.getRangeAt(selection.rangeCount - 1).collapse(true); 1164 } 1165 } 1166 } catch(e) {} 1167 1168} 1169//----------------------------------------------------------------------------------- 1170function setCssFontSize(fname,font_size) { 1171 var ifr = window.frames["editor_"+fname]; 1172 if (!ifr) { 1173 alert("none setCssFontSize"); 1174 return; 1175 } 1176 RTEdo(fname,'fontsize',1); 1177 1178 var fonts = ifr.document.getElementsByTagName("font"); 1179 if (!fonts || (fonts.length==0)) { // no font tags 1180 if (ifr.document.body.innerHTML != "") { 1181 return; 1182 } 1183 var foo = ifr.document.createElement("font"); 1184 foo.size = 1; 1185 insertNode(fname,foo); 1186 fonts = ifr.document.getElementsByTagName("font"); 1187 //insertCode(fname,'<font size="1"></font>'); 1188 if (isIE) { 1189 var ctr = "create"; 1190 ctr += "Text" + "Range()"; 1191 eval("rng = ifr.document.body."+ctr); 1192 rng.fname = fname; 1193 rng.select(); 1194 } 1195 else { 1196 return; 1197 //rng = document.createRange(); 1198 //rng.selectNode(fonts[0]); 1199 } 1200 1201 } 1202 1203 for (f=0;f<fonts.length;f++) { 1204 if (fonts[f].size==1) { 1205 fonts[f].style.fontSize = font_size; 1206 fonts[f].size=3; 1207 } 1208 else if (!fonts[f].size && fonts[f].style.fontSize) { // pasted from ms-word 1209 fonts[f].style.fontSize = font_size; 1210 fonts[f].size=3; 1211 } 1212 /* 1213 if ( fonts[f].style.fontSize) { 1214 fonts[f].removeAttribute("size"); 1215 alert('ok'); 1216 } 1217 */ 1218 } 1219} 1220 1221 1222//----------------------------------------------------------------------------------- 1223function insertCode(fname,code) { 1224 var ifr = window.frames["editor_"+fname]; 1225 if (!ifr) { 1226 alert("none insertCode"); 1227 return; 1228 } 1229 1230 if (rng && rng.fname && (rng.fname!=fname)) { 1231 rng = null; 1232 } 1233 1234 ifr.focus(); 1235 if (isIE) { 1236 if (!rng) { 1237 rng = ifr.document.selection.createRange(); 1238 } 1239 try { 1240 rng.select(); 1241 } 1242 catch(e) {} 1243 if (!rng.pasteHTML) { 1244 rng.execCommand("delete",false,null); 1245 rng = ifr.document.selection.createRange(); 1246 try { 1247 rng.select(); 1248 } 1249 catch(e) {} 1250 } 1251 1252 rng.pasteHTML(code); 1253 rng.collapse(false); 1254 1255 } 1256 else { 1257 if (code != "") { 1258 // ifr.document.execCommand('inserthtml', false, code); 1259 if (ifr.getSelection) { 1260 // IE9 and non-IE 1261 var sel = ifr.getSelection(); 1262 1263 var range; 1264 if (sel.rangeCount - 1 >= 0) { 1265 range = sel.getRangeAt(sel.rangeCount - 1); 1266 } 1267 else { 1268 range = sel.getRangeAt(0); 1269 } 1270 1271 // var range = sel.getRangeAt(0); 1272 range.deleteContents(); 1273 1274 var el = document.createElement("div"); 1275 el.innerHTML = code; 1276 var frag = el.firstChild; 1277 1278 range.insertNode(frag); 1279 1280 } 1281 } 1282 } 1283 rng = null; 1284} 1285 1286//----------------------------------------------------------------------------------- 1287function insertNode(fname,node) { 1288 var ifr = window.frames["editor_"+fname]; 1289 if (!ifr) { 1290 alert("none insertNode"); 1291 return; 1292 } 1293 1294 insertCode(fname,'<span id="temp_span_element"></span>'); 1295 var span_element = ifr.document.getElementById("temp_span_element"); 1296 if (span_element) { 1297 span_element.parentNode.replaceChild(node,span_element); 1298 } 1299 else { 1300 alert("Fail to insert object on this location"); 1301 return; 1302 } 1303 1304} 1305 1306//----------------------------------------------------------------------------------- 1307function cleanAll(fname) { 1308 1309 var ifr = window.frames["editor_"+fname]; 1310 if (!ifr) { 1311 alert("none cleanAll"); 1312 return; 1313 } 1314 var css = document.getElementById("style_"+fname); 1315 var pairs = css.value.split(/\s*;\s*/); 1316 if (pairs) { 1317 for (var p=0;p<pairs.length;p++) { 1318 if (pairs[p].indexOf(":")==-1) { 1319 continue; 1320 } 1321 key_data = pairs[p].split(/:/); 1322 k = cssKey2JS(key_data[0]); 1323 1324 try { 1325 eval('ifr.document.body.style.'+k+' = "" '); 1326 } 1327 catch(e) { 1328 //alert('Error on '+ k); 1329 } 1330 } 1331 } 1332 css.value = ""; 1333 /* 1334 if (css.value.search(/font\-?family/i) == -1) { 1335 // let bodyFont = window.getComputedStyle(document.body,null).getPropertyValue("font-family"); 1336 // alert(bodyFont); 1337 // css.value = "font-family:"+bodyFont+";"+css.value; 1338 css.value = "font-family:inherit;"+css.value; 1339 } 1340 */ 1341 if (css.value.search(/direction/i) == -1) { 1342 css.value = "direction:"+rte_lang.direction+";"+css.value; 1343 } 1344 if (css.value.search(/background\-color/i) == -1) { 1345 css.value = "background-color:transparent;"+css.value; 1346 } 1347 if ((css.value.search(/^color/i) == -1) && (css.value.search(/[^a-zA-Z0-9_\-]color/i) == -1)) { 1348 css.value = "color:#000000;"+css.value; 1349 } 1350 css.defaultValue = css.value; 1351 setStyle(fname,css.value); 1352 1353 var ta = document.getElementById(fname); 1354 var ftype = "editor"; 1355 try { 1356 ftype = document.getElementById("type1_"+fname).checked ? "text" : "editor"; 1357 } 1358 catch(e) {} 1359 var page = ""; 1360 if (ftype == "text") { 1361 page = ta.value; 1362 } 1363 else { 1364 page = ifr.document.body.innerHTML; 1365 } 1366 1367 var re = ""; 1368 page = page.replace(/<\!\-\-\[if [^\]]*\]>[\s\S]*?<\!\[endif\]\-\->/ig,""); 1369 page = page.replace(/<\!\-\-[\s\S]+?\-\->/ig,""); // remove html comments 1370 page = page.replace(/<xml[^>]*>[\s\S]*?<\/xml>/ig,""); 1371// page = page.replace(/<p\s[^>]*>/ig,"<p>"); 1372 // remove 1373// page = page.replace(/\ \;?/ig," "); 1374// remove span tags 1375 page = page.replace(/<span[^>]*>/ig,""); 1376 page = page.replace(/<\/span[^>]*>/ig,""); 1377 // multiple sup tags 1378 page = page.replace(/(<sup>\s*){2,}/ig,"<sup>"); 1379 page = page.replace(/(<\/sup>\s*){2,}/ig,"</sup>"); 1380 // remove styles 1381 page = page.replace(/;\s+\">/ig,";\">"); 1382 // page = page.replace(/mso\-[^:]+\:\s*(")?[^;\"]+(")?;?/ig,""); 1383 page = page.replace(/mso\-[^:]+\:[^;\"]+;?\s*/ig,""); // style="mso-table-lspace:0;mso-table-rspace:0; margin:0" 1384 page = page.replace(/=\"mso[^;\" ]+\s*/ig,"=\""); // class="msoNormal" 1385 1386 page = page.replace(/[^:\"\;]+\:\s*0(in|pt|px);?/ig,""); 1387 page = page.replace(/[^:\"\;]+\:\s*\-?.0[0-9]*(in|pt|px);?/ig,""); 1388 page = page.replace(/font\-size:\s*1[2-3](\.[0-9]*)?(pt|px);?/ig,""); 1389 // page = page.replace(/font\-family:\s*(")?Arial(")?(,(")?sans\-serif(")?)?;?/ig,""); 1390 page = page.replace(/font\-family:\s*"[^ \"]+Arial[^ \"]+";?/ig,""); 1391 page = page.replace(/text\-autospace:\s*none;?/ig,""); 1392 page = page.replace(/unicode\-bidi:\s*embed;?/ig,""); 1393 page = page.replace(/[^:\"\;]+\:\s*normal;?/ig,""); 1394 page = page.replace(/background(\-color)?:\s*transparent;?/ig,""); 1395 re = new RegExp("direction:\\s*"+rte_lang.direction+";?","ig"); 1396 page = page.replace(re,""); 1397 // more properties 1398 re = new RegExp(" dir=\""+rte_lang.direction+"\"","ig"); 1399 page = page.replace(re,""); 1400 page = page.replace(/ style=\"\s*\"/ig,""); 1401 page = page.replace(/ title=\"\s*\"/ig,""); 1402 page = page.replace(/ alt=\"\s*\"/ig,""); 1403 page = page.replace(/ lang=\"[a-z]+\"/ig,""); 1404// page = page.replace(/ class=\"\[^\"]*\"/ig,""); 1405 1406 // table and td class 1407 page = page.replace(/<table /ig,'<table class="rte_table" '); 1408 page = page.replace(/<td/ig,'<td class="rte_td" '); 1409 1410 if (ftype == "text") { 1411 ta.value = page; 1412 } 1413 else { 1414 ifr.document.body.innerHTML = page; 1415 } 1416} 1417 //============================================================================= 1418 // Function Name: Name 1419 // Function Parameter: <Parameter Name>:<parameter description> 1420 // Function Parameter: 1421 // Function Description: <description> 1422 // Function Results: <return value if any> 1423 //============================================================================= 1424 function enlargeRTE(fname) { 1425 var ifr = window.frames["editor_"+fname]; 1426 if (!ifr) { 1427 alert("none enlargeRTE"); 1428 return; 1429 } 1430 var bodyElement = ifr.document.body; 1431 var myHeight = parseInt(bodyElement.scrollHeight); 1432 if ((myHeight == 0) && ifr.document.documentElement && ifr.document.documentElement.scrollHeight) { 1433 bodyElement = ifr.document.documentElement; 1434 myHeight = parseInt(bodyElement.scrollHeight); 1435 } 1436 1437 var ifrHeight = parseInt(ifr.frameElement.style.height); 1438 var ta = document.getElementById(fname); 1439 if (ifrHeight < myHeight) { 1440 ifr.frameElement.style.height = (myHeight+5) + "px"; 1441 ta.style.height = (myHeight+5) + "px"; 1442 } 1443 else { 1444 ifr.frameElement.style.height = (ifrHeight+50) + "px"; 1445 ta.style.height = (ifrHeight+50) + "px"; 1446 } 1447 } 1448 1449 1450//----------------------------------------------------------------------------------- 1451function addStyle(fname,field,val) { 1452 var ifr = window.frames["editor_"+fname]; 1453 if (!ifr) { 1454 alert("none addStyle"); 1455 return; 1456 } 1457 // alert(field+":"+val); 1458 var css = document.getElementById("style_"+fname); 1459 var pairs = css.value.split(/\s*;\s*/); 1460 if (pairs) { 1461 for (var p=0;p<pairs.length;p++) { 1462 re = new RegExp("^"+field+":","i"); 1463 if (pairs[p].search(re) == 0) { 1464 pairs[p] = ""; 1465 break; 1466 } 1467 } 1468 css.value = pairs.join(";"); 1469 } 1470 if (val.search(/\S/) != -1) { 1471 css.value += ";"+field+":"+val+";"; 1472 } 1473 css.value = css.value.replace(/^;+/,""); 1474 css.value = css.value.replace(/;;+/g,";"); 1475 setStyle(fname,css.value); 1476 1477} 1478 1479//----------------------------------------------------------------------------------- 1480function getStyle(fname,field) { 1481 var ifr = window.frames["editor_"+fname]; 1482 if (!ifr) { 1483 alert("none getStyle"); 1484 return; 1485 } 1486 var css = document.getElementById("style_"+fname); 1487 var pairs = css.value.split(/\s*;\s*/); 1488 var re = null; 1489 if (pairs) { 1490 for (var p=0;p<pairs.length;p++) { 1491 re = new RegExp("^"+field+":","i"); 1492 if (pairs[p].search(re) == 0) { 1493 pairs[p].search(/:(.*)/); 1494 return RegExp.$1; 1495 } 1496 } 1497 } 1498 return ""; 1499} 1500 1501//----------------------------------------------------------------------------------- 1502function setStyle(fname,css) { 1503 //alert(css); 1504 var ifr = window.frames["editor_"+fname]; 1505 if (!ifr) { 1506 alert("none setStyle"); 1507 return; 1508 } 1509 1510 if (css.indexOf(":") == -1) { 1511 css = "color:#000000;background-color:transparent;" 1512 } 1513 1514 if (!ifr.document || !ifr.document.body) { 1515 setTimeout(" setStyle('"+fname+"','"+css+"')",50); // loop until loaded 1516 return; 1517 } 1518 1519 var pairs = css.split(/\s*;\s*/); 1520 if (!pairs) { 1521 return; 1522 } 1523 1524 var k = null; 1525 var v = null; 1526 for (var p=0;p<pairs.length;p++) { 1527 if (pairs[p].search(/:/) < 1) { 1528 continue; 1529 } 1530 pairs[p].search(/([^:]+):(.*)/); 1531 k = RegExp.$1; 1532 v = RegExp.$2; 1533 // k = k.replace(/^\s+/,""); 1534// k = k.replace(\s+$/,""); 1535 1536// replaceing field name background-color => backgroundColor 1537 k = cssKey2JS(k); 1538 1539 1540 try { 1541 eval('ifr.document.body.style.'+k+' = "'+v+'" '); 1542 } 1543 catch(e) { 1544 //alert('Error on '+ k); 1545 } 1546 } 1547 // we dont want to set with of the body 1548 ifr.document.body.style.width = null; 1549 1550 var icolor = ifr.document.body.style.color; 1551 if (!icolor) { 1552 icolor = "#000000"; 1553 } 1554 else { 1555 icolor = icolor.toLowerCase(); 1556 } 1557 var ibgcolor = ifr.document.body.style.backgroundColor; 1558 if (!ibgcolor) { 1559 ibgcolor = "transparent";
1560 } 1561 else { 1562 ibgcolor = ibgcolor.toLowerCase(); 1563 } 1564 1565 var td0 = document.getElementById("setFrameColor0_"+fname); 1566 var td1 = document.getElementById("setFrameColor1_"+fname); 1567 1568 if (ibgcolor == "transparent") { // need to change show bgcolor 1569 1570 if (isBright(icolor)) { 1571 setFrameColor(fname,"#888888"); 1572 } 1573 if (td0) { 1574 td0.style.display = "inline"; 1575 } 1576 if (td1) { 1577 td1.style.display = "inline"; 1578 } 1579 } 1580 else { 1581 if (td0) { 1582 td0.style.display = "none"; 1583 } 1584 if (td1) { 1585 td1.style.display = "none"; 1586 } 1587 } 1588 1589} 1590 1591//----------------------------------------------------------------------------------- 1592function setCellType(radio) { 1593 var fname = radio.name.slice(5); 1594 var maindiv = document.getElementById("cell_"+fname); 1595 if (!maindiv) { 1596 return; 1597 } 1598 1599 var val = radio.value; 1600 var editor_div = document.getElementById("div_editor_"+fname); 1601 var editor_ifr = document.getElementById("editor_"+fname); 1602 var ta_div = document.getElementById("div_text_"+fname); 1603 var ta = document.getElementById(fname); 1604 1605 var first = false; 1606 if (!maindiv.lastChecked) { 1607 first = true; 1608 maindiv.lastChecked = val; 1609 } 1610 if (val.indexOf("div_editor")==0) { 1611 editor_div.style.display = ""; 1612 ta_div.style.display = "none"; 1613 } 1614 else { 1615 editor_div.style.display = "none"; 1616 ta_div.style.display = ""; 1617 } 1618 1619 1620 if (!first && (val == maindiv.lastChecked)) { 1621 return; 1622 } 1623 1624 if (first || (maindiv.lastChecked.indexOf('div_text') == 0)) { // if lastCheck is textarea - copy value to iframe 1625 copyData(ta,editor_ifr); 1626 } 1627 else if (maindiv.lastChecked.indexOf('div_editor') == 0) { // if lastCheck is editor - copy to textarea 1628 copyData(editor_ifr,ta); 1629 } 1630 1631 maindiv.lastChecked = val; 1632} 1633 1634//----------------------------------------------------------------------------------- 1635function copyData(src_obj,target_obj) { 1636 if ((typeof src_obj) == "string") { 1637 src_obj = document.getElementById(src_obj); 1638 } 1639 if ((typeof target_obj) == "string") { 1640 target_obj = document.getElementById(target_obj); 1641 } 1642 1643 if (src_obj.tagName.toLowerCase()=="iframe") { 1644 1645 var ifr = window.frames[src_obj.id]; 1646 if (!ifr) { 1647 alert("none copyData"); 1648 return; 1649 } 1650 1651 target_obj.value = ""; 1652 if (ifr.document.body) { 1653 target_obj.value = clearEmptyTags(ifr.document.body.innerHTML); 1654 } 1655 1656 if ((target_obj.value.search(/^\s*<p>\ \;<\/p>\s*$/i) != -1) || (target_obj.value.search(/^\s*<p [^>]*>\s*<\/p>\s*$/i) != -1) || (target_obj.value.search(/^\s*<br>\s*$/i) != -1)) { 1657 target_obj.value = ""; 1658 } 1659 1660 } 1661 1662 else { // src is textarea 1663 var ifr = window.frames[target_obj.id]; 1664 if (!ifr) { 1665 alert("none copyData2"); 1666 return; 1667 } 1668 if (!ifr.document.body) { // loop until loaded 1669 setTimeout("copyData('" + src_obj.id + "' , '" + target_obj.id +"') ",50); 1670 return; 1671 } 1672 1673 var val = src_obj.value; 1674 1675 if (val.search(/<[a-zA-Z]/) == -1) { // plain text value 1676 val = val.replace(/\s*\n/g,"<br>"); 1677 } 1678 else { 1679 var code_img_src = "/htm-webaxy/editor/buttons/scode.gif"; 1680 var pagebreak_img_src = "/htm-webaxy/editor/buttons/pagebreak.png"; 1681 1682 var codeSpanRe = /(<span\s[^>]*name=[\'\"]?codeSpan[\'\"]?[^>]*>(\s|\S)*?<\/span>)/i; // not greedy *? 1683 while (val.search(codeSpanRe) != -1) { 1684 codeSpan = RegExp.$1; 1685 1686 code_title = ""; 1687 if ( codeSpan.search(/^<span[^>]*\scode_title=([^\"\' >]+)/i) != -1) { 1688 code_title = RegExp.$1; 1689 } 1690 else if (codeSpan.search(/^<span[^>]*\scode_title=\"([^\"]+)\"/i) != -1) { 1691 code_title = RegExp.$1; 1692 } 1693 code_title = code_title.replace(/\"/g,"``"); 1694 1695 code_type = ""; 1696 if ( codeSpan.search(/^<span[^>]*\scode_type=([^\"\' >]+)/i) != -1) { 1697 code_type = RegExp.$1; 1698 } 1699 else if (codeSpan.search(/^<span[^>]*\scode_type=\"([^\"]+)\"/i) != -1) { 1700 code_type = RegExp.$1; 1701 } 1702 code_type = code_type.replace(/\"/g,"``"); 1703 1704 codeSpan.search(/<span[^>]*>((\s|\S)*)<\/span>/i); 1705 code_src = encodeURIComponent(RegExp.$1); 1706 if (code_type == "pageBreak") { 1707 codeImage = "<img src=\""+pagebreak_img_src+"\" style=\"display:block;\" name=\"codeImage\" title=\""+code_title+"\" code_type=\""+code_type+"\" code_src=\""+code_src+"\">"; 1708 } 1709 else { 1710 codeImage = "<img src=\""+code_img_src+"\" name=\"codeImage\" title=\""+code_title+"\" code_type=\""+code_type+"\" code_src=\""+code_src+"\">"; 1711 } 1712 1713 val = val.replace(codeSpanRe,codeImage); 1714 } 1715 // external 1716 var codeTags = new Array("script","style","link"); 1717 for (var c=0; c < codeTags.length; c++) { 1718 var codeRe0 = new RegExp("(<"+codeTags[c]+"[^>]*\/>)","i"); // match <link ..... /> 1719 while (val.search(codeRe0) != -1) { 1720 code_src = encodeURIComponent(RegExp.$1); 1721 code_title = codeTags[c]+" "+c; 1722 code_type = "external"; 1723 codeImage = "<img src=\""+code_img_src+"\" name=\"codeImage\" title=\""+code_title+"\" code_type=\""+code_type+"\" code_src=\""+code_src+"\">"; 1724 val = val.replace(codeRe0,codeImage); 1725 } 1726 var codeRe1 = new RegExp("(<"+codeTags[c]+"[^>]*>(\\s|\\S)*?<\/"+codeTags[c]+"\\s*>)","i"); // not greedy *? 1727 while (val.search(codeRe1) != -1) { 1728 code_src = encodeURIComponent(RegExp.$1); 1729 code_title = codeTags[c]+" "+c; 1730 code_type = "external"; 1731 codeImage = "<img src=\""+code_img_src+"\" name=\"codeImage\" title=\""+code_title+"\" code_type=\""+code_type+"\" code_src=\""+code_src+"\">"; 1732 val = val.replace(codeRe1,codeImage); 1733 } 1734 1735 } 1736 } 1737 1738 /* fix url("...") problem */ 1739 var re = /(:\s*url\s*\(\"[^\)]+\"\s*\))/i; 1740 while (val.search(re) != -1) { 1741 var urlMatch = RegExp.$1.replace(/\"/g,""); 1742 val = val.replace(re,urlMatch); 1743 } 1744 1745 ifr.document.body.innerHTML = val; 1746 1747 1748 } 1749 1750} 1751//---------------------------------------------------------------------------- 1752function openAdd(fname,act,x,y) { 1753 x = x - 500; 1754 if (x < 0) { 1755 x = 10; 1756 } 1757 y = y - 0; // convert to number
1758 if (self.innerHeight) { // Everyone but IE 1759 y += window.pageYOffset; 1760 } 1761 else if (document.documentElement && document.documentElement.clientHeight && document.documentElement.scrollTop) { // IE6 Strict 1762 y += document.documentElement.scrollTop; 1763 } 1764 else if (document.body) { // Other IE, such as IE7 1765 y += document.body.scrollTop; 1766 } 1767 y += 20; 1768 1769 setRange(fname); 1770 var adc = document.getElementById("addcode"); 1771 adc.style.visibility = "visible"; 1772 1773 adc.style.left = x + 'px'; 1774 adc.style.top = y+'px';// + document.body.scrollTop; 1775 adc.style.zIndex = 3000; 1776 1777 frames['addcode'].selectDiv(fname,act); 1778} 1779//---------------------------------------------------------------------------- 1780function reloadAdd() { 1781 var adc = document.getElementById("addcode"); 1782 adc.contentWindow.location.reload(); 1783} 1784//---------------------------------------------------------------------------- 1785function closeAdd() { 1786 var adc = document.getElementById("addcode"); 1787 adc.style.visibility = "hidden"; 1788 adc.style.left = "0px"; 1789 adc.style.top = "0px"; 1790 adc.style.zIndex = -1; 1791 1792} 1793//---------------------------------------------------------------------------- 1794function setBgcolor(fname,color) { 1795 1796 collapseRange(fname); 1797 insertCode(fname,"<span id=\"here\"></span>"); 1798 var ifr = window.frames["editor_"+fname]; 1799 if (!ifr) { 1800 alert("none setBgcolor"); 1801 return; 1802 } 1803 var here = ifr.document.getElementById("here"); 1804 par = here.parentNode; 1805 par.removeChild(here); 1806 var pasMax=10; 1807 while( (par.tagName.toLowerCase() != "td") && (par.tagName.toLowerCase() != "body") && (pasMax > 0) ){ 1808 par = par.parentNode; 1809 while(!par.nodeType){par = par.parentNode;} 1810 pasMax--; 1811 } 1812 if (par.tagName.toLowerCase() == "td") { 1813 par.style.backgroundColor = color; 1814 } 1815 1816 if (!isIE) { 1817 Refresh(fname); 1818 } 1819} 1820//=================================================================== 1821// 1822// resizeEditor: change size of editor 1823// 1824//=================================================================== 1825function resizeEditor(fname,width,height,border) { 1826 if (width && ((typeof(width) == 'string' && width.indexOf("%") == -1) || typeof(width) == 'number')) { 1827 width = parseInt(width)+5; 1828 width += "px"; 1829 } 1830 if (!width || (width < 0)) { 1831 width = 0; 1832 } 1833 1834 height = parseInt(height)+5; 1835 if (!height || (height < 0)) { 1836 height = 0; 1837 } 1838 var editorIframe = document.getElementById("editor_"+fname); 1839 try { 1840 if (border) { 1841 borderA = border.split(' '); 1842 editorIframe.style.borderStyle = borderA[0]; 1843 editorIframe.style.borderWidth = borderA[1]; 1844 editorIframe.style.borderColor = borderA[2]; 1845 } 1846 //editorIframe.style.border = border ? border : ""; 1847 var ta = document.getElementById(fname); 1848 var cell_div = document.getElementById("cell_"+fname); 1849 1850 if (width) { 1851 editorIframe.style.width = width; 1852 editorIframe.contentWindow.document.body.style.margin = "0px"; 1853 //ta.style.width = width; 1854 //cell_div.style.width = (parseInt(width) + 20) + "px"; 1855 } 1856 if (height) { 1857 editorIframe.style.height = height + "px"; 1858 editorIframe.contentWindow.document.body.style.margin = "0px"; 1859 ta.style.height = (height + 20) + "px"; 1860 cell_div.style.height = (height + 110) + "px"; 1861 } 1862 } catch (e) {} 1863} 1864 1865//------------------------------------------------------------------------------ 1866function Refresh(fname) { // in firefox we need to refresh the code of the page (bug bypass) 1867 var ifr = window.frames["editor_"+fname]; 1868 if (!ifr) { 1869 alert("none Refresh"); 1870 return; 1871 } 1872 var pos = ifr.document.body.scrollTop; 1873 var inner = ifr.document.body.innerHTML; 1874 ifr.focus(); 1875 ifr.document.execCommand('selectall',false,null); 1876 ifr.document.execCommand('delete',false,null); 1877 1878 insertCode(fname,inner); 1879 // keep old scroll position 1880 ifr.scrollTo(0,pos); 1881 ifr.parent.focus(); 1882} 1883 1884//=================================================================== 1885// 1886// clearEmptyTags: delete empty tags from html code 1887//
1888//=================================================================== 1889function clearEmptyTags(html) { 1890 // remove 1891// html = html.replace(/\ \;?/ig," "); 1892 while ((html.search(/<font[^>]*><\/font>/i) != -1) || (html.search(/<p><\/p>/i) != -1) || (html.search(/<p [^>]*>\s*<\/p>/i) != -1) || (html.search(/<span[^>]*><\/span>/i) != -1)) { 1893 html = html.replace(/<font[^>]*><\/font>/ig,""); 1894 html = html.replace(/<p><\/p>/ig,""); 1895 html = html.replace(/<p [^>]*>\s*<\/p>/ig,""); 1896 html = html.replace(/<p[^>]*> <\/p>/ig,""); 1897 html = html.replace(/<span[^>]*><\/span>/ig,""); 1898 } 1899 1900 while ((html.search(/^\s*<p>/i) != -1) && (html.search(/<\/p>\s*$/i) != -1)) { 1901 html = html.replace(/^\s*<p>/i,""); 1902 html = html.replace(/<\/p>\s*$/i,""); 1903 } 1904 html = html.replace(/<br>[\r\n]*/ig,"<br>\n"); 1905 // codes handling 1906 var codeImageRe = /(<img\s+[^>]*name=[\'\"]?codeImage[\'\"]?[^>]*>)/i; 1907 while (html.search(codeImageRe) != -1) { 1908 codeImage = RegExp.$1; 1909 1910 code_title = ""; 1911 if ( codeImage.search(/\stitle=([^\"\' >]+)/i) != -1) { 1912 code_title = RegExp.$1; 1913 } 1914 else if (codeImage.search(/\stitle=\"([^\"]+)\"/i) != -1) { 1915 code_title = RegExp.$1; 1916 } 1917 code_title = code_title.replace(/\"/g,"``"); 1918 1919 code_type = ""; 1920 if ( codeImage.search(/\scode_type=([^\"\' >]+)/i) != -1) { 1921 code_type = RegExp.$1; 1922 } 1923 else if (codeImage.search(/\scode_type=\"([^\"]+)\"/i) != -1) { 1924 code_type = RegExp.$1; 1925 } 1926 code_type = code_type.replace(/\"/g,"``"); 1927 1928 code_src = ""; 1929 if ( codeImage.search(/\scode_src=([^\"\' >]+)/i) != -1) { 1930 code_src = RegExp.$1; 1931 } 1932 else if (codeImage.search(/\scode_src=\"([^\"]+)\"/i) != -1) { 1933 code_src = RegExp.$1; 1934 } 1935 code_src = decodeURIComponent(code_src); 1936 1937 if (code_type == "external") { 1938 codeSpan = code_src; 1939 } 1940 else { 1941 codeSpan = "<span name=\"codeSpan\" code_title=\""+code_title+"\" code_type=\""+code_type+"\">"+code_src+"</span>"; 1942 } 1943 html = html.replace(codeImageRe,codeSpan); 1944 } 1945 1946 // fix for auto white background color <span> and <a> in chrome 1947 var re = new RegExp("(<(span|a|b)\\s[^>]+)background\\-color\\s*\\:\\s*rgb\\s*\\(\\s*255,\\s*255,\\s*255\\s*\\)","i"); 1948 while (html.search(re) != -1) { 1949 var rep = RegExp.$1+"background-color: transparent"; 1950 html = html.replace(re,rep); 1951 } 1952 1953 // remove span tags with no parameters 1954 re = new RegExp("<span>(.*?)<\/span>","i"); 1955 1956 while (html.search(re) != -1) { 1957 var rep = RegExp.$1; 1958 html = html.replace(re,rep); 1959 } 1960 1961 return html; 1962} 1963 1964//=================================================================== 1965// 1966// setVisibilityRTE: hide or show RTE (visibility is optional) 1967// 1968//=================================================================== 1969function setVisibilityRTE(fname,visibility) { 1970 1971 var maindiv = document.getElementById("cell_"+fname); 1972 var table = maindiv.parentNode.parentNode.parentNode.parentNode; 1973 var editorDiv = document.getElementById("editor_"+fname); 1974 if (!visibility) { 1975 visibility = (maindiv.style.visibility=="hidden") ? "visible" : "hidden"; 1976 } 1977 if (visibility==maindiv.style.visibility) { 1978 return; 1979 } 1980 if (visibility=="hidden") { 1981 maindiv.style.visibility = "hidden"; 1982 maindiv.setAttribute("real_height",maindiv.style.height); 1983 maindiv.style.height = 0; 1984 table.style.visibility = "hidden"; 1985 1986 } 1987 else { 1988 table.style.visibility = "visible"; 1989 maindiv.style.visibility = "visible"; 1990 maindiv.style.height = maindiv.getAttribute("real_height"); 1991 editorDiv.style.height = editorDiv.parentNode.clientHeight; 1992 1993 } 1994 1995} 1996//=================================================================== 1997// 1998// resetEditors: reset all editors 1999// 2000//=================================================================== 2001function resetEditors() { 2002 2003 var ifrs = document.getElementsByTagName("iframe"); 2004 if (!ifrs) { 2005 return; 2006 } 2007 2008 var fname = ""; 2009 var ta = null; 2010 var rad = null; 2011 var css = null; 2012 for (i=0;i<ifrs.length;i++) { 2013 if (ifrs[i].id.indexOf("editor_") != 0) { 2014 continue; 2015 } 2016 fname = ifrs[i].id.slice(7); 2017 var field = document.getElementById(fname); 2018 field.value = field.value.replace(flvPlayerCode,""); // remove video code if exists 2019 field.value = field.value.replace(postEditorsCode,""); // remove postEditorsCode code if exists 2020 2021 var rad = field.form.elements["type_"+fname]; 2022 var css = field.form.elements["style_"+fname];
2023 css.value = ""; 2024 var lockEditorField = document.getElementById("lockEditor_"+fname); 2025 var lockEditorValue = 0; 2026 var ftype = "editor"; 2027 //** 2028 var meta_re = /<\!\-\-\sRTE\s(.+)\sRTE -->/; 2029 if ( field.value.search(meta_re) != -1) { 2030 var meta = RegExp.$1; 2031 field.value = field.value.replace(meta_re,""); 2032 if (meta.search(/css=([^&]+)/) != -1) { 2033 css.value = RegExp.$1; 2034 } 2035 else { 2036 css.value = ""; 2037 } 2038 2039 2040 if (meta.search(/ftype=([^&]+)/) != -1) { 2041 ftype = RegExp.$1; 2042 } 2043 2044 if (meta.search(/lockEditor=([^&]+)/) != -1) { 2045 lockEditorValue = RegExp.$1; 2046 } 2047 } 2048 //** 2049 2050 2051 css.value = defaultCss(css.value); 2052 css.defaultValue = css.value; 2053 2054 setStyle(fname,css.value); 2055 copyData(field,ifrs[i]); 2056 2057 if (field.value.search(/<iframe/i) != -1) { 2058 ftype = "text"; 2059 } 2060 if (ftype == "text") { 2061 rad[1].checked = true; 2062 } 2063 else { 2064 rad[0].checked = true; 2065 } 2066 for (r=0;r<rad.length;r++) { 2067 if (rad[r].checked) { 2068 setCellType(rad[r]); 2069 } 2070 } 2071 2072 if (lockEditorField && (lockEditorValue == 1)) { 2073 lockEditorField.checked = true; 2074 if (isIE) { 2075 setTimeout("lockEditor('"+lockEditorField.id+"')",200); 2076 } 2077 else { 2078 lockEditor(lockEditorField); 2079 } 2080 } 2081 } 2082} 2083//=================================================================== 2084// 2085// name: do 2086// 2087//=================================================================== 2088function defaultCss(cssValue) { 2089 if (typeof(cssValue) == "undefined") { 2090 cssValue = ""; 2091 } 2092 2093 cssValue = cssValue.replace(/\s*:\s*/g,":"); 2094 var cssPairs = cssValue.split(/\s*\;\s*/); 2095 var cssKeys = ","; 2096 for (var p=0; p<cssPairs.length; p++) { 2097 if (cssPairs[p].search(/([^:]+):/) != -1) { 2098 cssKeys += RegExp.$1 + ","; 2099 } 2100 } 2101 cssKeys = cssKeys.toLowerCase(); 2102 /* 2103 if (cssKeys.search(/,font\-family,/) == -1) { 2104 let bodyFont = window.getComputedStyle(document.body,null).getPropertyValue("font-family"); 2105 // alert(bodyFont); 2106 cssValue = "font-family:"+bodyFont+";"+cssValue; 2107 } 2108 */ 2109 if (cssKeys.search(/,direction,/) == -1) { 2110 cssValue = "direction:"+rte_lang.direction+";"+cssValue; 2111 } 2112 if (cssKeys.search(/,background\-color,/) == -1) { 2113 cssValue = "background-color:transparent;"+cssValue; 2114 } 2115 if (cssKeys.search(/,background\-image,/) == -1) { 2116 cssValue = "background-image:;"+cssValue; 2117 } 2118 if (cssKeys.search(/,color,/) == -1) { 2119 cssValue = "color:#000000;"+cssValue; 2120 } 2121 return cssValue; 2122} 2123 2124//=================================================================== 2125// 2126// setFrameColor: set show background-color 2127// 2128//=================================================================== 2129function setFrameColor(fname,color) { 2130 var ifr = window.frames["editor_"+fname]; 2131 if (!ifr) { 2132 alert("none setFrameColor"); 2133 return; 2134 } 2135 ifr.document.body.style.backgroundColor = color; 2136} 2137//=================================================================== 2138// 2139// isBright: true if color is bright 2140// 2141//=================================================================== 2142function isBright(color) { 2143 var limit = ""; 2144 var RR = ""; 2145 var GG = ""; 2146 var BB = ""; 2147 if (color.toLowerCase().search(/rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)/) != -1) { // FF rgb(12, 45, 225) 2148 limit = 238; 2149 RR = RegExp.$1 - 0; 2150 GG = RegExp.$2 - 0; 2151 BB = RegExp.$3 - 0; 2152 } 2153 else if (color.toLowerCase().replace(/[^0-9a-f]+/g,"").search(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/) != -1) { // IE (#fe33ed) 2154 limit = "ee"; 2155 RR = RegExp.$1; 2156 GG = RegExp.$2; 2157 BB = RegExp.$3; 2158 } 2159 else { 2160 return false; 2161 } 2162 //alert("RR="+RR+" GG="+GG+" BB="+BB); 2163 var count = 0; 2164 if (limit <= RR) { 2165 count++; 2166 } 2167 if (limit <= GG) { 2168 count++; 2169 } 2170 2171 if (limit <= BB) { 2172 count++; 2173 } 2174 return (count > 1); 2175 2176 2177} 2178//=================================================================== 2179// 2180// hideRteMenu: hide menus 2181// 2182//=================================================================== 2183function hideRteMenu(fname,menu) { 2184 if (!menu) { 2185 menu = "all"; 2186 } 2187 var menu1 = document.getElementById(fname+"_rteMenu1"); 2188 var menu2 = document.getElementById(fname+"_rteMenu2"); 2189 var menu3 = document.getElementById(fname+"_rteMenu3"); 2190
2191 if (menu1 && ((menu == "all") || (menu == 1))) { 2192 menu1.style.display = "none"; 2193 } 2194 if (menu2 && ((menu == "all") || (menu == 2))) { 2195 menu2.style.display = "none"; 2196 } 2197 if (menu3 && ((menu == "all") || (menu == 3))) { 2198 menu3.style.display = "none"; 2199 } 2200} 2201 2202//=================================================================== 2203// 2204// mySleep: wait until time 2205// 2206//=================================================================== 2207function mySleep(stopTime) { 2208 var D = new Date(); 2209 if (stopTime <= 60) { 2210 stopTime = D.getTime() + stopTime * 1000; 2211 } 2212 while (D.getTime() < stopTime) { 2213 D = new Date(); 2214 } 2215} 2216//=================================================================== 2217// 2218// cssKey2JS: convert css key to javascript key background-color ==> backgroundColor 2219// 2220//=================================================================== 2221function cssKey2JS(key) { 2222 key = key.toLowerCase(); 2223 if (key.search(/\-([a-z])/) != -1) { 2224 var uc = RegExp.$1.toUpperCase(); 2225 key = key.replace(/\-[a-z]/,uc); 2226 } 2227 return key; 2228} 2229//=================================================================== 2230// 2231// moveCP: put colorPicker iframe in position 2232// 2233//=================================================================== 2234function moveCP(x,y) { 2235 var cp = document.getElementById('colorPicker'); 2236 //alert('ready?'); 2237 x = x - 500; 2238 if (x < 0) { 2239 x = 10; 2240 } 2241 y = y - 0; // convert to number 2242 if (self.innerHeight) { // Everyone but IE 2243 y += window.pageYOffset; 2244 } 2245 else if (document.documentElement && document.documentElement.clientHeight && document.documentElement.scrollTop) { // IE6 Strict 2246 y += document.documentElement.scrollTop; 2247 } 2248 else if (document.body) { // Other IE, such as IE7 2249 y += document.body.scrollTop; 2250 } 2251 y += 20; 2252 2253 cp.style.left = x + 'px'; 2254 cp.style.top = y+'px';// + document.body.scrollTop; 2255 if (!cp.style.zIndex || (cp.style.zIndex < 1)) { 2256 cp.style.zIndex = 1; 2257 } 2258} 2259//=================================================================== 2260// 2261// lockEditor: click on "lock ediror" button 2262// 2263//=================================================================== 2264function lockEditor(cb) { 2265 if (typeof cb == "string") { 2266 cb = document.getElementById(cb); 2267 } 2268 if (cb.checked == false) { 2269 if (!confirm(rte_lang.confirm_unlockEditor)) { 2270 cb.checked = true; 2271 return; 2272 } 2273 } 2274 var fname = cb.name.replace("lockEditor_",""); 2275 var rte_rad = document.getElementsByName('type_'+fname); 2276 2277 2278 var ifr = window.frames["editor_"+fname]; 2279 if (!ifr) { 2280 alert("none lockEditor"); 2281 return; 2282 } 2283 var ta = document.getElementById(fname); 2284 2285 var cleanButton = document.getElementById('clean_'+fname); 2286 if (cleanButton) { 2287 cleanButton.style.display = (cb.checked ? "none" : ""); 2288 } 2289 2290 if (rte_rad[0].checked) { 2291 rte_rad[0].disabled = false; 2292 rte_rad[1].disabled = cb.checked; 2293 2294 copyData("editor_"+fname,fname); 2295 ifr.document.designMode = (cb.checked ? "Off" : "On"); 2296 2297 if (isIE) { 2298 initEditors(fname); 2299 try { 2300 ifr.document.body.contentEditable = !cb.checked; 2301 //document.getElementById("editor_"+fname).contentDocument.designMode="on"; 2302 } 2303 catch(e) {} 2304 } 2305 2306 var menu1 = document.getElementById(fname+"_rteMenu1"); 2307 var menu2 = document.getElementById(fname+"_rteMenu2"); 2308 var menu3 = document.getElementById(fname+"_rteMenu3"); 2309 2310// if (menu1) { 2311// menu1.style.display = "none"; 2312// } 2313 if (menu2) { 2314 menu2.style.visibility = (cb.checked ? "hidden" : "visible"); 2315 } 2316 if (menu3) { 2317 menu3.style.visibility = (cb.checked ? "hidden" : "visible"); 2318 } 2319 } 2320 else { 2321 rte_rad[0].disabled = cb.checked; 2322 rte_rad[1].disabled = false; 2323 2324 if (cb.checked) { 2325 ta.onfocus = new Function("this.blur()"); 2326 ta.contentEditable = false; 2327 } 2328 else { 2329 ta.onfocus = new Function("void(0);"); 2330 ta.contentEditable = true; 2331 } 2332 } 2333}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.