Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
HTMLEditor.js
Содержимое
flg_Hidden = 0; flg_Visible = 1; DECMD_CUT = 5003; DECMD_COPY = 5002; DECMD_PASTE = 5032; DECMD_UNDO = 5049; DECMD_REDO = 5033; DECMD_HYPERLINK = 5016; DECMD_UNLINK = 5050; DECMD_INSERTTABLE = 5022; DECMD_IMAGE = 5017; DECMD_REMOVEFORMAT = 5034; DECMD_SETSCALE = 1008; DECMD_FONT = 5009; DECMD_SETCLASSNAME = 1006; DECMD_GETFONTNAME = 5013; DECMD_GETFONTSIZE = 5014; DECMD_SETFONTNAME = 5044; DECMD_SETFONTSIZE = 5045; DECMD_BOLD = 5000; DECMD_ITALIC = 5023; DECMD_UNDERLINE = 5048; DECMD_JUSTIFYCENTER = 5024; DECMD_JUSTIFYLEFT = 5025; DECMD_JUSTIFYRIGHT = 5026; DECMD_ORDERLIST = 5030; DECMD_UNORDERLIST = 5051; DECMD_INDENT = 5018; DECMD_OUTDENT = 5031; DECMD_GETFORECOLOR = 5015; DECMD_SETFORECOLOR = 5046; DECMD_GETBACKCOLOR = 5010; DECMD_SETBACKCOLOR = 5042; DECMDF_DISABLED = 1; DECMDF_ENABLED = 3; DECMDF_LATCHED = 7; DECMD_SPECIAL = 999; DECMD_SUP = 1000; DECMD_SUB = 1001; DECMD_JUSTIFYWIDTH = 1002; DECMD_VERTMODE = 1003; DECMD_TABLE = 1004; DECMD_INSERTCOL = 5020; DECMD_DELETECOLS = 5006; DECMD_INSERTROWBELOW = 1005; DECMD_INSERTROW = 5021; DECMD_DELETEROWS = 5007; DECMD_INSERTCELL = 5019; DECMD_DELETECELLS = 5005; DECMD_MERGECELLS = 5029; DECMD_SPLITCELL = 5047; DECMD_CELLPROPS = 1007; // s_obj_name - имя экземпляра редактора // s_panels_list - список включеных панелей, допустимы следиющие значения // (через запятую или пробел): STANDARD,FORMAT,STYLE,TABLES или ALL // o_parent - объект-владелец экземпляра редактора (например, document.body) // s_lang - язык интерфейса редактора (EN,RU) // s_HTML - редактируемый HTML // s_path - путь к папке редактора // s_imgs_dir - путь к картинкам для вставки function HTMLEditor(s_obj_name,s_panels_list,o_parent,s_lang,s_HTML,s_path,s_imgs_dir) { this.version = "1.00.021"; this.relis_date = "04.08.2005"; this.css_path = "css/"; // путь к CSS-файлу редактора this.css_file = "HTMLEditor.css"; // CSS-файл редактора this.imgs_path = s_path+"imgs/"; // путь к иконкам this.current_mode = "Normal"; // режим редактора (Normal, HTML, Preview) // служебные переменные this.HTML = s_HTML; // редактируемый контент this.obj_name = s_obj_name; this.p_work_area; this.p_editor; this.p_toolbar; this.p_title; this.p_statusbar; this.panels = new Object; this.toolbars = new Object; this.color_table; this.breakFlag = false; this.completeFlag = true; eval(s_obj_name+"=this;"); s_lang = s_lang.toUpperCase(); this.css_file = this.css_path+this.css_file; document.createStyleSheet(s_path+this.css_file); // Функция getHTML - возвращает отредактированный HTML this.getHTML = function () { return this.HTML; }; // Функция showSplash - показывает заставку this.showSplash = function () { var params = new Object; params["s_lang"] = s_lang; params["css_file"] = "../"+this.css_file; params["version"] = this.version; params["date"] = this.relis_date; showModalDialog(s_path+"html/help.html",params,"center=1;dialogHeight=276px;dialogWidth=500px;help=0;resizable=0;status=0;border=thin;scroll=0"); }; // Функция newLine - вставляет перевод строки (в режиме редактирования HTML) this.newLine = function () { if (event.keyCode!=13) return; document.selection.createRange().pasteHTML("<BR>"); event.returnValue = false; }; // Функция colorCode - расцвечиватель кода // src - исходный HTML this.colorCode = function (src) { src = src.replace(/</g, '<'); src = src.replace(/>/g, '>'); src = src.replace(/(\s.[^\s]*(?==))/g,'<span class=SW_attr>$1</span>'); src = src.replace( /(".[^"]*")/g,'<span class=SW_txt_val>$1</span>'); src = src.replace( /("\d[^"]*")/g,'<span class=SW_digit_val>$1</span>'); src = src.replace(/(<\/?\w+\s*?.*?>)/gi,'<span class=SW_tag>$1</span>'); src = src.replace(/\n/g,"<BR>"); return src; }; // Функция light - подсветка ячейки окна выбора цвета // b_onflag подсветить/"разсветить" ячейку (0 или 1) // obj указатель на ячейку // o_ind указатель на ячейку-индикатор выбраного цвета this.light = function(b_onflag,obj,o_ind) { obj.style.borderColor = b_onflag?"blue":""; if (b_onflag) { o_ind.bgColor = obj.bgColor; o_ind.innerHTML = obj.bgColor?obj.bgColor.toUpperCase():obj.innerHTML; } }; // Функция init_color_table - инициализирует Popup окна выбора цвета // для ускорения работы this.init_color_table = function() { var item_per_str = 14; var colors = [ "000000","000080","006400","191970","696969","708090","778899","800000","800080","808000", "808080","688E23","00008B","0000CD","0000FF","008000","008080","008B8B","00BFFF","00CED1", "00FA9A","00FF00","00FF7F","00FFFF","00FFFF","1E90FF","20B2AA","228B22","2E8B57","2F4F4F", "32CD32","3CB371","40E0D0","4169E1","4682B4","483D8B","48D1CC","4B0082","556B2F","5F9EA0", "6495ED","66CDAA","6A5ACD","7B68EE","7CFC00","7FFF00","7FFFD4","87CEEB","87CEFA","8A2BE2", "8B0000","8B008B","8B4513","8FBC8F","90EE90","9370D8","9400D3","98FB98","9932CC","9ACD32", "A0522D","A52A2A","A9A9A9","ADD8E6","ADFF2F","AFEEEE","B0C4DE","B0E0E6","B22222","B8860B", "BA55D3","BC8F8F","BDB76B","C0C0C0","C71585","CD5C5C","CD853F","D2691E","D2B48C","D3D3D3", "D87093","D8BFD8","DA70D6","DAA520","DC143C","DCDCDC","DDA0DD","DEB887","E0FFFF","E6E6FA", "E9967A","EE82EE","EEE8AA","F08080","F0E68C","F0F8FF","F0FFF0","F0FFFF","F4A460","F5DEB3", "F5F5DC","F5F5F5","F5FFFA","F8F8FF","FA8072","FAEBD7","FAF0E6","FAFAD2","FDF5E6","FF0000", "FF00FF","FF00FF","FF1493","FF4500","FF6347","FF69B4","FF7F50","FF8C00","FFA07A","FFA500", "FFB6C1","FFC0CB","FFD700","FFDAB9","FFDEAD","FFE4B5","FFE4C4","FFE4E1","FFEBCD","FFEFD5", "FFF0F5","FFF5EE","FFF8DC","FFFACD","FFFAF0","FFFAFA","FFFF00","FFFFE0","FFFFF0","FFFFFF"]; var obj = document.createElement("TD"); var res = "<DIV style='height:100%;padding:5;' unselectable=on>\n"+ "<TABLE cellpadding=0 cellspacing=1 align=center unselectable=on>\n"; res += "<TR unselectable=on><TD unselectable=on class=HTMLEditor_color_ind colspan="+item_per_str+" id="+obj.uniqueID+"> </TD></TR>\n"; for (var i=0;i<colors.length;i++) { if (i%item_per_str==0) res += "<TR unselectable=on>\n"; res += "<TD unselectable=on class=HTMLEditor_color_item bgcolor=#"+colors[i]+" title="+colors[i]+" onMouseOver='parent."+this.obj_name+".light(1,this,"+obj.uniqueID+")' onMouseOut='parent."+this.obj_name+".light(0,this)' onClick='parent."+this.obj_name+".%handler%(this.bgColor);'>\n"+ "<IMG unselectable=on src='"+this.imgs_path+"/1x1.gif'></TD>"; } res += "<TR unselectable=on><TD unselectable=on class=HTMLEditor_color_ind colspan="+item_per_str+" onMouseOver='parent."+this.obj_name+".light(1,this,"+obj.uniqueID+")' onMouseOut='parent."+this.obj_name+".light(0,this)' onClick='parent."+this.obj_name+".%handler%(\"auto\");'>%text%</TD></TR>\n"; res += "</TABLE></DIV>\n"; return res; }; // Функция get_color - выкидывает Popup для выбора цвета // o_parent указатель на кнопку-владельца окна // s_tranp_txt текст для прозрачных элементов // s_handler_name имя вызываемой функции-обработчика (без параметров!) this.get_color = function(o_parent,s_tranp_txt,s_handler_name) { var width = 270; var height = 235; var e = event; oPopup = window.createPopup(); oPopup.document.createStyleSheet(s_path+this.css_file); var oPopupBody = oPopup.document.body; oPopupBody.className = "HTMLEditor_panel_switcher_body"; oPopupBody.style.border = "1px solid #666666"; oPopupBody.style.padding = "1px"; var res = this.color_table; res = res.replace("%text%",s_tranp_txt); res = res.replace(/%handler%/mg,s_handler_name); oPopupBody.innerHTML = res; oPopup.show(0,23,width,height,o_parent); e.returnValue = false; }; // Функция changeFontColor - обработчик смены цвета текста // s_color - цвет текста this.changeFontColor = function(s_color) { oPopup.hide(); s_color = s_color=="auto"?"#000000":s_color.toUpperCase(); this.execCommand(DECMD_SETFORECOLOR,s_color); this.toolbars["FORMAT"].buttonBgColor("font_color",s_color); }; // Функция changeBackColor - обработчик смены цвета фона // s_color - цвет фона this.changeBackColor = function(s_color) { oPopup.hide(); s_color = s_color=="auto"?"":s_color.toUpperCase(); this.execCommand(DECMD_SETBACKCOLOR,s_color); this.toolbars["FORMAT"].buttonBgColor("back_color",s_color); }; // Функция changeCellBackColor - обработчик смены цвета фона ячейки таблицы // s_color - цвет фона this.changeCellBackColor = function(s_color) { oPopup.hide(); s_color = s_color=="auto"?"":s_color.toUpperCase(); this.toolbars["TABLES"].buttonBgColor("color",s_color); var obj = this.p_editor.DOM.selection.createRange().parentElement(); while (obj.parentElement && obj.tagName!="TD") obj = obj.parentElement; obj.bgColor = s_color; // obj.style.backgroundColor = s_color; }; // Функция switch_panel_status - переключает состояние панелей (вкл/выкл) // b_num - номер панели в массиве this.panels this.switch_panel_status = function (b_num) { this.panels[b_num][2] = !this.panels[b_num][2]; if (this.panels[b_num][2]) this.panels[b_num][3].show(); else this.panels[b_num][3].hide(); oPopup.hide(); }; // Функция light_item - подсветки выделенойстроки в выключателе панелей // obj указатель на объект // b_light_flag флаг подсветки (0,1) this.light_item = function (obj,b_light_flag) { if (b_light_flag==0) b_light_flag = ""; obj.firstChild.firstChild.children[0].className = "HTMLEditor_panel_switcher_left"+b_light_flag; obj.firstChild.firstChild.children[1].className = "HTMLEditor_panel_switcher_right"+b_light_flag; }; // Функция panels_switcher - вывод Popup для отключения панелей this.panels_switcher = function() { var e = event; oPopup = window.createPopup(); oPopup.document.createStyleSheet(s_path+this.css_file); var oPopupBody = oPopup.document.body; oPopupBody.className = "HTMLEditor_panel_switcher_body"; oPopupBody.style.border = "1px solid #666666"; oPopupBody.style.padding = "1px"; var tmp = ""; for (var i in this.panels) { tmp += "<TABLE width=100% cellpadding=0 cellspacing=0 "+ "onMouseOver='parent."+this.obj_name+".light_item(this,1)' "+ "onMouseOut='parent."+this.obj_name+".light_item(this,0)' "+ "onClick='parent."+this.obj_name+".switch_panel_status("+i+")'>"; tmp += "<TR><TD class=HTMLEditor_panel_switcher_left>"+ (this.panels[i][2]?"<DIV><IMG src="+this.imgs_path+"checked.gif></DIV>":" ")+ "<TD class=HTMLEditor_panel_switcher_right> "+this.panels[i][1]; tmp += "</TABLE>"; } oPopupBody.innerHTML = tmp; var width = 140; var height = i*31-1; oPopup.show(e.clientX-1,e.clientY-1,width,height,document.body); e.returnValue = false; }; this.fillClassesField = function () { var classes = new Array(); classes[""] = 0; this.toolbars["STYLE"].items[this.toolbars["STYLE"].findElement("class")].items = new Array(); for (var i=0;i<this.p_editor.DOM.styleSheets.length;i++) with (this.p_editor.DOM.styleSheets[i]) { for (var j=0;j<rules.length;j++) if (rules[j].selectorText.substr(0,1)==".") classes[rules[j].selectorText.substr(1)] = 0; } // classes = classes.sort(); for (var i in classes) this.toolbars["STYLE"].insertOption("class",i,"Times",i); if (this.toolbars["STYLE"].o_panel.style.display!="none") this.toolbars["STYLE"].init(); } // Функция DocumentComplete - вызывается событием DocumentComplete // ActiveX-редактора по окончании обработки документа this.DocumentComplete = function () { this.HTML = this.p_editor.DocumentHTML; if (this.current_mode!="Normal") this.p_editor.style.zIndex = 50; // this.p_editor.style.display = "none"; else this.p_editor.focus(); this.changeMode(this.current_mode); this.fillClassesField(); }; // Функция insertBR - вставляет тег BR в текущую позицию // редактируемого текста this.insertBR = function () { if (this.p_editor.DOM.selection.type!="Control") this.p_editor.DOM.selection.createRange().pasteHTML("<BR>"); }; // Функция insertHR - вставляет тег HR в текущую позицию // редактируемого текста this.insertHR = function () { if (this.p_editor.DOM.selection.type!="Control") this.p_editor.DOM.selection.createRange().pasteHTML("<HR>"); }; // Функция execCommand - выполняет команды ActiveX // w_cmd - команда (константа) // a_prm - дполнительные параметры команды this.execCommand = function (w_cmd,a_prm) { var ed = this.p_editor; switch (w_cmd) { case DECMD_SETSCALE: ed.DOM.body.style.zoom = a_prm; return; case DECMD_SETCLASSNAME: with (ed.DOM.selection) var obj = type=="Control"?createRange().item(0):createRange().parentElement(); for (var i in obj.all) obj.all[i].className = a_prm; obj.className = a_prm; return; case DECMD_VERTMODE: var obj = ed.DOM.selection.createRange().parentElement(); obj.style.writingMode = obj.style.writingMode=="tb-rl"?"":"tb-rl"; return; case DECMD_SUB: ed.DOM.selection.createRange().execCommand("SubScript"); return; case DECMD_SUP: ed.DOM.selection.createRange().execCommand("SuperScript"); return; case DECMD_JUSTIFYWIDTH: var obj = ed.DOM.selection.createRange().parentElement(); if (obj.align=="justify") obj.removeAttribute("align"); else obj.align = "justify"; return; case DECMD_CELLPROPS: var obj = ed.DOM.selection.createRange().parentElement(); while (obj.parentElement && obj.tagName!="TD") obj = obj.parentElement; if (obj.tagName=="TD"); { var params = new Object; params["s_lang"] = s_lang; params["css_file"] = "../"+this.css_file; params["width"] = obj.style.width?obj.style.width:obj.width; params["height"] = obj.style.height?obj.style.height:obj.height; params["colspan"] = obj.colSpan; params["rowspan"] = obj.rowSpan; params["align"] = obj.align; params["valign"] = obj.vAlign; params["title"] = obj.title; params["bgcolor"] = obj.bgColor; params["wrap"] = !obj.noWrap; params["background"] = obj.background; params["images_dir"] = s_imgs_dir; params["parent_WHE_dir"] = s_path.replace(/[^\/]*\/$/i,""); var results = showModalDialog(s_path+"html/cell.html",params,"center=1;dialogHeight=194px;dialogWidth=490px;help=0;resizable=0;status=0;border=thin;scroll=0"); if (results) { if (results["width"]) obj.width = results["width"]+results["widht_units"]; else obj.removeAttribute("width"); if (results["height"]) obj.height = results["height"]+results["height_units"]; else obj.removeAttribute("height"); obj.align = results["h_align"]; obj.vAlign = results["v_align"]; obj.colSpan = results["col_span"]; obj.rowSpan = results["row_span"]; if (results["cell_title"]) obj.title = results["cell_title"]; else obj.removeAttribute("title"); obj.bgColor = results["bgcolor"]; if (results["wrap_text"]=="on") { obj.noWrap = false; obj.removeAttribute("noWrap"); } else obj.noWrap = true; if (results["cell_back"]) obj.background = results["cell_back"]; else obj.removeAttribute("background"); } } return; } var flag,res; if (w_cmd==DECMD_INSERTROWBELOW) res = ed.QueryStatus(DECMD_INSERTROW); else res = ed.QueryStatus(w_cmd); if (ed.DOM.selection.type=="Control" && (ed.DOM.selection.createRange().item(0).tagName=="TABLE" || ed.DOM.selection.createRange().item(0).tagName=="IMG")) flag = 1; if (res==DECMDF_ENABLED||res==DECMDF_LATCHED||flag) switch (w_cmd) { case DECMD_IMAGE: var params = new Object; params["s_lang"] = s_lang; params["css_file"] = "../"+this.css_file; if (!flag) params["src"] = params["alt"] = params["align"] = params["border"] = params["hspace"] = params["vspace"] = params["width"] = params["height"] = ""; else { var o_img = ed.DOM.selection.createRange().item(0); params["src"] = o_img.src; params["alt"] = o_img.alt; params["align"] = o_img.align; params["border"] = o_img.border; params["hspace"] = o_img.hspace; params["vspace"] = o_img.vspace; params["width"] = o_img.width; params["height"] = o_img.height; params["edit"] = 1; } params["parent_WHE_dir"] = s_path.replace(/[^\/]*\/$/i,""); params["images_dir"] = s_imgs_dir; var results = showModalDialog(s_path+"html/image.html",params,"center=1;dialogHeight=210px;dialogWidth=520px;help=0;resizable=0;status=0;border=thin;scroll=0"); if (results) { if (!flag) { ed.ExecCommand(w_cmd,2,params["src"]); o_img = ed.DOM.selection.createRange().item(0); } o_img.src = results["src"]; if (results["alt"]) o_img.alt = results["alt"]; else o_img.removeAttribute("alt"); if (results["align"]) o_img.align = results["align"]; else o_img.removeAttribute("align"); if (results["border"]) o_img.border = results["border"]; else o_img.removeAttribute("border"); if (results["hspace"]) o_img.hspace = results["hspace"]; else o_img.removeAttribute("hspace"); if (results["vspace"]) o_img.vspace = results["vspace"]; else o_img.removeAttribute("vspace"); if (results["width"]) o_img.width = results["width"]; else o_img.removeAttribute("width"); if (results["height"]) o_img.height = results["height"]; else o_img.removeAttribute("height"); } break; case DECMD_INSERTTABLE: var params = new Object; params["s_lang"] = s_lang; params["css_file"] = "../"+this.css_file; if (!flag) { params["caption"] = ""; params["rows"] = 3; params["cols"] = 3; params["width"] = "100%"; params["height"] = ""; params["background"] = ""; params["border"] = 1; params["cellpadding"] = ""; params["cellspacing"] = ""; params["bordercolor"] = ""; params["bgcolor"] = ""; params["align"] = ""; } else { var o_table = ed.DOM.selection.createRange().item(0); params["caption"] = o_table.caption; params["rows"] = o_table.rows.length; params["cols"] = o_table.cells.length/o_table.rows.length; params["width"] = o_table.width; params["height"] = o_table.height; params["background"] = o_table.background; params["border"] = o_table.border; params["cellpadding"] = o_table.cellPadding; params["cellspacing"] = o_table.cellSpacing; params["bordercolor"] = o_table.borderColor; params["bgcolor"] = o_table.bgColor; params["align"] = o_table.align; params["edit"] = 1; } params["images_dir"] = s_imgs_dir; params["parent_WHE_dir"] = s_path.replace(/[^\/]*\/$/i,""); var results = showModalDialog(s_path+"html/table.html",params,"center=1;dialogHeight=275px;dialogWidth=375px;help=0;resizable=0;status=0;border=thin;scroll=0"); if (results) if (flag) { if (results["width"]) o_table.width = results["width"]+results["width_units"]; else o_table.removeAttribute("width"); if (results["height"]) o_table.height = results["height"]+results["height_units"]; else o_table.removeAttribute("height"); if (results["background"]) o_table.background = results["background"]; else o_table.removeAttribute("background"); if (results["border"]) o_table.border = results["border"]; else o_table.removeAttribute("border"); if (results["cellpadding"]) o_table.cellPadding = results["cellpadding"]; else o_table.removeAttribute("cellPadding"); if (results["cellspacing"]) o_table.cellSpacing = results["cellspacing"]; else o_table.removeAttribute("cellSpacing"); if (results["bordercolor"]!="") o_table.borderColor = "#"+results["bordercolor"]; else o_table.removeAttribute("borderColor"); if (results["bgcolor"]!="") o_table.bgColor = "#"+results["bgcolor"]; else o_table.removeAttribute("bgColor"); if (results["align"]) o_table.align = results["align"]; else o_table.removeAttribute("align"); } else { a_prm = new ActiveXObject("DEInsertTableParam.DEInsertTableParam"); a_prm.NumRows = results["rows"]; a_prm.NumCols = results["cols"]; var tmp = ""; if (results["border"]) tmp += "border="+results["border"]; if (results["width"]) tmp += " width="+results["width"]+results["width_units"]; if (results["height"]) tmp += " height="+results["height"]+results["height_units"]; if (results["cellspacing"]) tmp += " cellspacing="+results["cellspacing"]; if (results["cellpadding"]) tmp += " cellpadding="+results["cellpadding"]; if (results["background"]) tmp += " background='"+results["background"]+"'"; if (results["bgcolor"]) tmp += " bgcolor="+results["bgcolor"]; if (results["bordercolor"]) tmp += " bordercolor="+results["bordercolor"]; if (results["align"]) tmp += " align="+results["align"]; a_prm.TableAttrs = tmp; ed.execCommand(w_cmd,0,a_prm); } break; case DECMD_SETFORECOLOR: case DECMD_SETBACKCOLOR: case DECMD_SETFONTNAME: case DECMD_SETFONTSIZE: if (ed.DOM.selection.type!="Control") ed.execCommand(w_cmd,0,a_prm); break; default: if (w_cmd==DECMD_INSERTROWBELOW) { ed.execCommand(DECMD_INSERTROW); ed.DOM.selection.createRange().parentElement().parentElement.swapNode(ed.DOM.selection.createRange().parentElement().parentElement.previousSibling); } else ed.execCommand(w_cmd); } }; // Функция processState - определяет и подсвечивает кнопки согласно // форматированию выделенного фрагмента // w_state - команда ActiveX this.processState = function (w_state) { var ed = this.p_editor; if (ed.Busy) return; var sel_type = ed.DOM.selection.type; if (w_state==DECMD_HYPERLINK) { var st = 0; if (sel_type!="Control") st = ed.DOM.selection.createRange().parentElement().tagName=="A"?1:0; else st = ed.DOM.selection.createRange().item(0).parentElement.tagName=="A"?1:0; this.toolbars["STANDARD"].setPressedAttribute("link",st); return; } if (w_state==DECMD_TABLE) { var st = st1 = 0; if (sel_type=="Control") { st = ed.DOM.selection.createRange().item(0).tagName=="TABLE"?1:0; st1 = !st; } this.toolbars["STANDARD"].changeButtonStatus("table",st1); this.toolbars["STANDARD"].setPressedAttribute("table",st); return; } if (w_state==DECMD_SPECIAL) { var st = 0; if (sel_type!="Control") { this.toolbars["FORMAT"].changeButtonStatus("direction",0); var obj = ed.DOM.selection.createRange().parentElement(); st = obj.style.writingMode=="tb-rl"?1:0; } else this.toolbars["FORMAT"].changeButtonStatus("direction",1); this.toolbars["FORMAT"].setPressedAttribute("direction",st); st = 0; if (sel_type!="Control") { this.toolbars["FORMAT"].changeButtonStatus("justify",0); var obj = ed.DOM.selection.createRange().parentElement(); while (obj.parentElement && obj.align==undefined) obj = obj.parentElement; st = obj.align=="justify"?1:0; } else this.toolbars["FORMAT"].changeButtonStatus("justify",1); this.toolbars["FORMAT"].setPressedAttribute("justify",st); st = 0; if (sel_type!="Control") { this.toolbars["FORMAT"].changeButtonStatus("sup",0); st = ed.DOM.selection.createRange().parentElement().tagName=="SUP"?1:0; } else this.toolbars["FORMAT"].changeButtonStatus("sup",1); this.toolbars["FORMAT"].setPressedAttribute("sup",st); st = 0; if (sel_type!="Control") { this.toolbars["FORMAT"].changeButtonStatus("sub",0); st = ed.DOM.selection.createRange().parentElement().tagName=="SUB"?1:0; } else this.toolbars["FORMAT"].changeButtonStatus("sub",1); this.toolbars["FORMAT"].setPressedAttribute("sub",st); return; } var res = ed.QueryStatus(w_state); switch (w_state) { case DECMD_INSERTCOL: this.toolbars["TABLES"].changeButtonStatus("ins_col_left",res==DECMDF_DISABLED?1:0); return; case DECMD_DELETECOLS: this.toolbars["TABLES"].changeButtonStatus("delete_col",res==DECMDF_DISABLED?1:0); return; case DECMD_INSERTROW: this.toolbars["TABLES"].changeButtonStatus("ins_row_above",res==DECMDF_DISABLED?1:0); this.toolbars["TABLES"].changeButtonStatus("ins_row_below",res==DECMDF_DISABLED?1:0); return; case DECMD_DELETEROWS: this.toolbars["TABLES"].changeButtonStatus("delete_row",res==DECMDF_DISABLED?1:0); return; case DECMD_INSERTCELL: this.toolbars["TABLES"].changeButtonStatus("insert_cell",res==DECMDF_DISABLED?1:0); return; case DECMD_DELETECELLS: this.toolbars["TABLES"].changeButtonStatus("delete_cell",res==DECMDF_DISABLED?1:0); return; case DECMD_MERGECELLS: this.toolbars["TABLES"].changeButtonStatus("merge",res==DECMDF_DISABLED?1:0); return; case DECMD_SPLITCELL: this.toolbars["TABLES"].changeButtonStatus("split",res==DECMDF_DISABLED?1:0); this.toolbars["TABLES"].changeButtonStatus("color",res==DECMDF_DISABLED?1:0); this.toolbars["TABLES"].changeButtonStatus("cell_props",res==DECMDF_DISABLED?1:0); if (res==DECMDF_ENABLED) { var obj = this.p_editor.DOM.selection.createRange().parentElement(); while (obj.parentElement && obj.tagName!="TD") obj = obj.parentElement; this.toolbars["TABLES"].buttonBgColor("color",obj.style.backgroundColor); this.toolbars["TABLES"].buttonBgColor("color",obj.bgColor); } return; case DECMD_BOLD: this.toolbars["FORMAT"].changeButtonStatus("bold",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("bold",res==DECMDF_LATCHED?1:0); return; case DECMD_ITALIC: this.toolbars["FORMAT"].changeButtonStatus("italic",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("italic",res==DECMDF_LATCHED?1:0); return; case DECMD_UNDERLINE: this.toolbars["FORMAT"].changeButtonStatus("underline",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("underline",res==DECMDF_LATCHED?1:0); return; case DECMD_JUSTIFYLEFT: this.toolbars["FORMAT"].changeButtonStatus("left",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("left",res==DECMDF_LATCHED?1:0); return; case DECMD_JUSTIFYCENTER: this.toolbars["FORMAT"].changeButtonStatus("center",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("center",res==DECMDF_LATCHED?1:0); return; case DECMD_JUSTIFYRIGHT: this.toolbars["FORMAT"].changeButtonStatus("right",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("right",res==DECMDF_LATCHED?1:0); return; case DECMD_ORDERLIST: this.toolbars["FORMAT"].changeButtonStatus("num_list",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("num_list",res==DECMDF_LATCHED?1:0); return; case DECMD_UNORDERLIST: this.toolbars["FORMAT"].changeButtonStatus("mark_list",res==DECMDF_DISABLED?1:0); this.toolbars["FORMAT"].setPressedAttribute("mark_list",res==DECMDF_LATCHED?1:0); return; case DECMD_INDENT: this.toolbars["FORMAT"].changeButtonStatus("indent",res==DECMDF_DISABLED?1:0); return; case DECMD_OUTDENT: this.toolbars["FORMAT"].changeButtonStatus("outdent",res==DECMDF_DISABLED?1:0); return; case DECMD_GETFORECOLOR: this.toolbars["FORMAT"].changeButtonStatus("font_color",res==DECMDF_ENABLED?0:1); if (res==DECMDF_ENABLED) this.toolbars["FORMAT"].buttonBgColor("font_color",ed.ExecCommand(w_state)); return; case DECMD_GETBACKCOLOR: this.toolbars["FORMAT"].changeButtonStatus("back_color",res==DECMDF_ENABLED?0:1); if (res==DECMDF_ENABLED) this.toolbars["FORMAT"].buttonBgColor("back_color",ed.ExecCommand(w_state)); return; case DECMD_IMAGE: var st = st1 = 0; if (sel_type=="Control") { st = ed.DOM.selection.createRange().item(0).tagName=="IMG"?1:0; st1 = !st; } this.toolbars["STANDARD"].changeButtonStatus("image",st1); this.toolbars["STANDARD"].setPressedAttribute("image",st); return; case DECMD_CUT: this.toolbars["STANDARD"].changeButtonStatus("cut",res==DECMDF_DISABLED?1:0); return; case DECMD_COPY: this.toolbars["STANDARD"].changeButtonStatus("copy",res==DECMDF_DISABLED?1:0); return; case DECMD_PASTE: this.toolbars["STANDARD"].changeButtonStatus("past",res==DECMDF_DISABLED?1:0); return; case DECMD_UNDO: this.toolbars["STANDARD"].changeButtonStatus("undo",res==DECMDF_DISABLED?1:0); return; case DECMD_REDO: this.toolbars["STANDARD"].changeButtonStatus("redo",res==DECMDF_DISABLED?1:0); return; case DECMD_HYPERLINK: this.toolbars["STANDARD"].changeButtonStatus("link",res==DECMDF_DISABLED?1:0); return; case DECMD_UNLINK: this.toolbars["STANDARD"].changeButtonStatus("unlink",res==DECMDF_DISABLED?1:0); return; case DECMD_REMOVEFORMAT: this.toolbars["STANDARD"].changeButtonStatus("rm_format",res==DECMDF_DISABLED?1:0); return; case DECMD_FONT: this.toolbars["STYLE"].changeButtonStatus("fonts",res==DECMDF_DISABLED?1:0); return; case DECMD_GETFONTNAME: var str = ""; if (res==DECMDF_ENABLED) str = ed.ExecCommand(w_state); this.toolbars["STYLE"].modifySelectText("font",str,str); with (ed.DOM.selection) var obj = type=="Control"?createRange().item(0):createRange().parentElement(); this.toolbars["STYLE"].modifySelectText("class",obj.className,"Times"); return; case DECMD_GETFONTSIZE: var str = ""; if (res==DECMDF_ENABLED) str = ed.ExecCommand(w_state); this.toolbars["STYLE"].modifySelectText("size",str,str); return; } }; // Функция panelStatus - возвращает состояние панели (видима или нет) // s_name - имя панели this.panelStatus = function (s_name) { return this.toolbars[s_name].o_panel.style.display!="none"; }; // Функция verifyText_State - подсветка форматирования выделенного фрагмента this.verifyText_State = function () { // return; if (this.panelStatus("FORMAT")) { this.processState(DECMD_SPECIAL); this.processState(DECMD_BOLD); this.processState(DECMD_ITALIC); this.processState(DECMD_UNDERLINE); this.processState(DECMD_JUSTIFYLEFT); this.processState(DECMD_JUSTIFYCENTER); this.processState(DECMD_JUSTIFYRIGHT); this.processState(DECMD_ORDERLIST); this.processState(DECMD_UNORDERLIST); this.processState(DECMD_INDENT); this.processState(DECMD_OUTDENT); this.processState(DECMD_GETFORECOLOR); this.processState(DECMD_GETBACKCOLOR); } if (this.panelStatus("STANDARD")) { this.processState(DECMD_TABLE); this.processState(DECMD_CUT); this.processState(DECMD_COPY); this.processState(DECMD_PASTE); this.processState(DECMD_UNDO); this.processState(DECMD_REDO); this.processState(DECMD_UNLINK); this.processState(DECMD_IMAGE); this.processState(DECMD_HYPERLINK); this.processState(DECMD_REMOVEFORMAT); } if (this.panelStatus("STYLE")) { this.processState(DECMD_FONT); this.processState(DECMD_GETFONTNAME); this.processState(DECMD_GETFONTSIZE); } if (this.panelStatus("TABLES")) { this.processState(DECMD_INSERTCOL); this.processState(DECMD_DELETECOLS); this.processState(DECMD_INSERTROW); this.processState(DECMD_DELETEROWS); this.processState(DECMD_INSERTCELL); this.processState(DECMD_DELETECELLS); this.processState(DECMD_MERGECELLS); this.processState(DECMD_SPLITCELL); } }; // Функция switchGlyphsMode - переключает режим отображение спецсимволов this.switchGlyphsMode = function () { this.p_editor.ShowDetails=!this.p_editor.ShowDetails; this.toolbars["STANDARD"].setPressedAttribute("pi",this.p_editor.ShowDetails?1:0); }; this.setBreakpoint = function () { if (this.breakFlag) this.clearTimeout(this.breakFlag); this.breakFlag = false; }; // Функция DisplayChanged - вызывается собтытием DisplayChanged // ActiveX-редактора при изменении документа this.DisplayChanged = function () { if (this.breakFlag) return; this.breakFlag = window.setTimeout(s_obj_name+".setBreakpoint()",300); if (!this.p_editor.Busy) { this.HTML = this.p_editor.FilterSourceCode(this.p_editor.DOM.documentElement.outerHTML); this.verifyText_State(); } }; // Функция init_ActiveX - инициализация ActiveX-редактора this.init_ActiveX = function () { var obj = document.createElement("OBJECT"); obj.className = "HTMLEditor_ActiveX"; obj.classid = "CLSID:2D360201-FFF5-11D1-8D03-00A0C959BC0A"; obj.ActivateApplets = 0; obj.ActivateActiveXControls = -1; obj.ActivateDTCs = -1; obj.ShowDetails = 0; obj.ShowBorders = 0; obj.Appearance = 0; obj.Scrollbars = -1; obj.ScrollbarAppearance = 1; obj.SourceCodePreservation = 1; obj.AbsoluteDropMode = 0; obj.SnapToGrid = 0; obj.SnapToGridX = 50; obj.SnapToGridY = 50; obj.UseDivOnCarriageReturn = 1; obj.style.position = "absolute"; obj.style.zIndex = 100; this.p_work_area.appendChild(obj); obj.BaseURL = document.location; obj.attachEvent("DisplayChanged",this.DisplayChanged); obj.attachEvent("DocumentComplete",this.DocumentComplete); this.p_editor = obj; obj = document.createElement("SPAN"); obj.style.overflow="scroll"; obj.attachEvent("onkeypress",this.newLine); obj.contentEditable = true; obj.className = "HTMLEditor_ActiveX"; obj.style.position = "absolute"; obj.style.zIndex = 50; if (this.current_mode=="HTML") obj.value = s_HTML; this.p_work_area.appendChild(obj); obj = document.createElement("IFRAME"); obj.id = "IFRAME_"+(new Date).getTime(); obj.className = "HTMLEditor_ActiveX"; obj.style.overflow = "auto"; obj.style.position = "absolute"; obj.style.zIndex = 50; this.p_work_area.appendChild(obj); if (this.current_mode=="Preview") obj.document.write(s_HTML); }; // Функция changeMode - переключение режимов редактора // s_mode - требуемый режим (Normal,HTML,Preview) this.changeMode = function(s_mode) { var tags = new Object; tags["Normal"] = ["OBJECT","normal"]; tags["HTML"] = ["SPAN","HTML"]; tags["Preview"] = ["IFRAME","preview"]; var cur = (this.p_work_area.getElementsByTagName(tags[this.current_mode][0])).item(0); if (this.current_mode!=s_mode) cur.style.zIndex = 50; if (tags[this.current_mode][0]=="SPAN") { if (cur.innerText=="") cur.innerText = "<HTML>\n<BODY>\n</BODY>\n</HTML>"; this.HTML = cur.innerText; this.p_editor.DocumentHTML = cur.innerText; this.p_editor.BaseURL = document.location; } this.p_statusbar.setPressedAttribute(tags[this.current_mode][1],0); this.p_statusbar.changeButtonStatus(tags[this.current_mode][1],flg_ButtonEnabled); var res = (this.p_work_area.getElementsByTagName(tags[s_mode][0])).item(0); if (s_mode!="Normal") { this.p_title.style.display = "inline"; for (var i in panels) this.panels[i][3].hide(); } switch (s_mode) { case "Normal": for (var i in panels) if (this.panels[i][2]) this.panels[i][3].show(); this.p_title.style.display = "none"; this.breakFlag = false; break; case "HTML": res.innerHTML = this.colorCode(this.HTML); this.p_title.innerHTML = "<IMG hspace=4 src="+this.p_statusbar.imgs_path+"UI_html.gif> "+txts[s_lang]["modes"][0]; break; case "Preview": eval("obj="+res.id); obj.document.body.innerHTML = ""; obj.document.write(this.HTML); this.p_title.innerHTML = "<IMG hspace=4 src="+this.p_statusbar.imgs_path+"UI_preview.gif> "+txts[s_lang]["modes"][1]; break; } res.style.zIndex = 100; this.p_statusbar.setPressedAttribute(tags[s_mode][1],1); this.p_statusbar.changeButtonStatus(tags[s_mode][1],flg_ButtonDisabled); this.current_mode = s_mode; res.focus(); }; // Функция init_statusbar - инициализация статусбара this.init_statusbar = function () { eval("this.p_statusbar.oncontextmenu = function() {"+s_obj_name+".panels_switcher();}"); var statusbar = new ControlPanel(); statusbar.width = "100%"; statusbar.btn_hspace = 4; statusbar.o_owner = this.p_statusbar; statusbar.path = s_path; with (txts[s_lang]) { statusbar.insertButton("normal","UI_editor.gif",status[0][0],status[0][1],this.obj_name+".changeMode('Normal');",flg_CaptionEnabled+flg_CaptionRight,1,75); statusbar.insertButton("HTML","UI_html.gif",status[1][0],status[1][1],this.obj_name+".changeMode('HTML');",flg_CaptionEnabled+flg_CaptionRight,2,75); statusbar.insertButton("preview","UI_preview.gif",status[2][0],status[2][1],this.obj_name+".changeMode('Preview');",flg_CaptionEnabled+flg_CaptionRight,2,76); } statusbar.show(); this.p_statusbar = statusbar; }; // Функция init_toolbar - инициализация тулбара this.init_toolbar = function() { var toolbars_data = new Array; with (txts[s_lang]) { toolbars_data["standart"] = [ ["button","cut","UI_cut.gif",standart[0],s_obj_name+".execCommand(DECMD_CUT)",0], ["button","copy","UI_copy.gif",standart[1],s_obj_name+".execCommand(DECMD_COPY)",0], ["button","past","UI_past.gif",standart[2],s_obj_name+".execCommand(DECMD_PASTE)",0], [], ["button","undo","UI_undo.gif",standart[3],s_obj_name+".execCommand(DECMD_UNDO)",0], ["button","redo","UI_redo.gif",standart[4],s_obj_name+".execCommand(DECMD_REDO)",0], [], ["button","link","UI_link.gif",standart[5],s_obj_name+".execCommand(DECMD_HYPERLINK)",0], ["button","unlink","UI_unlink.gif",standart[6],s_obj_name+".execCommand(DECMD_UNLINK)",0], // ["button","anchor","UI_anchor.gif",standart[7],"alert()",0], [], ["button","table","UI_table.gif",standart[8],s_obj_name+".execCommand(DECMD_INSERTTABLE)",0], ["button","image","UI_image.gif",standart[9],s_obj_name+".execCommand(DECMD_IMAGE)",0], [], ["button","br","UI_br.gif",standart[11],s_obj_name+".insertBR()",0], ["button","hr","UI_hr.gif",standart[15],s_obj_name+".insertHR()",0], [], ["button","rm_format","UI_del_format.gif",standart[10],s_obj_name+".execCommand(DECMD_REMOVEFORMAT)",0], ["button","pi","UI_pi.gif",standart[12],s_obj_name+".switchGlyphsMode();",0], [], ["select","scale","100%","Arial",standart[14],"parent."+s_obj_name+".execCommand("+DECMD_SETSCALE+",'%res%');",0,60], ["option","scale","10%","Arial","10%"], ["option","scale","25%","Arial","25%"], ["option","scale","50%","Arial","50%"], ["option","scale","75%","Arial","75%"], ["option","scale","100%","Arial","100%"], ["option","scale","150%","Arial","150%"], ["option","scale","200%","Arial","200%"], ["option","scale","500%","Arial","500%"], [], ["button","help","UI_help.gif",standart[13],s_obj_name+".showSplash()",0] ]; toolbars_data["formating"] = [ ["button","bold","UI_bold.gif",formating[0],s_obj_name+".execCommand(DECMD_BOLD)",0], ["button","italic","UI_italic.gif",formating[1],s_obj_name+".execCommand(DECMD_ITALIC)",0], ["button","underline","UI_underline.gif",formating[2],s_obj_name+".execCommand(DECMD_UNDERLINE)",0], [], ["button","sup","UI_superscript.gif",formating[3],s_obj_name+".execCommand(DECMD_SUP)",0], ["button","sub","UI_subscript.gif",formating[4],s_obj_name+".execCommand(DECMD_SUB)",0], [], ["button","left","UI_left.gif",formating[5],s_obj_name+".execCommand(DECMD_JUSTIFYLEFT)",0], ["button","center","UI_center.gif",formating[6],s_obj_name+".execCommand(DECMD_JUSTIFYCENTER)",0], ["button","right","UI_right.gif",formating[7],s_obj_name+".execCommand(DECMD_JUSTIFYRIGHT)",0], ["button","justify","UI_justify.gif",formating[8],s_obj_name+".execCommand(DECMD_JUSTIFYWIDTH)",0], [], ["button","direction","UI_direction.gif",formating[9],s_obj_name+".execCommand(DECMD_VERTMODE)",0], [], ["button","num_list","UI_num_list.gif",formating[10],s_obj_name+".execCommand(DECMD_ORDERLIST)",0], ["button","mark_list","UI_mark_list.gif",formating[11],s_obj_name+".execCommand(DECMD_UNORDERLIST)",0], [], ["button","outdent","UI_outdent.gif",formating[12],s_obj_name+".execCommand(DECMD_OUTDENT)",0], ["button","indent","UI_indent.gif",formating[13],s_obj_name+".execCommand(DECMD_INDENT)",0], [], ["button","font_color","UI_font_color.gif",formating[14],"",0], ["button","back_color","UI_back_color.gif",formating[15],"",0] ]; toolbars_data["tables"] = [ ["button","ins_col_left","UI_ins_col_left.gif",tables[0],s_obj_name+".execCommand(DECMD_INSERTCOL)",0], // ["button","ins_col_right","UI_ins_col_right.gif",tables[1],"",0], ["button","delete_col","UI_delete_col.gif",tables[2],s_obj_name+".execCommand(DECMD_DELETECOLS)",0], [], ["button","ins_row_above","UI_ins_row_above.gif",tables[3],s_obj_name+".execCommand(DECMD_INSERTROW)",0], ["button","ins_row_below","UI_ins_row_below.gif",tables[4],s_obj_name+".execCommand(DECMD_INSERTROWBELOW)",0], ["button","delete_row","UI_delete_row.gif",tables[5],s_obj_name+".execCommand(DECMD_DELETEROWS)",0], [], ["button","insert_cell","UI_insert_cell.gif",tables[6],s_obj_name+".execCommand(DECMD_INSERTCELL)",0], ["button","delete_cell","UI_delete_cell.gif",tables[7],s_obj_name+".execCommand(DECMD_DELETECELLS)",0], [], ["button","merge","UI_merge.gif",tables[8],s_obj_name+".execCommand(DECMD_MERGECELLS)",0], ["button","split","UI_split.gif",tables[9],s_obj_name+".execCommand(DECMD_SPLITCELL)",0], [], ["button","color","UI_cell_color.gif",tables[10],"",0], ["button","cell_props","UI_cell_edit.gif",tables[11],s_obj_name+".execCommand(DECMD_CELLPROPS)",0] ]; var tmp = s_path.substr(0,s_path.length-1); var ttf = "<IMG align=middle hspace=3 src="+s_path.replace(/[^\/]*\/$/i,"")+tmp.replace(/.*\//,"")+"/imgs/tt.gif>"; var nottf = "<IMG width=11 hspace=3 src="+s_path.replace(/[^\/]*\/$/i,"")+tmp.replace(/.*\//,"")+"/imgs/1x1.gif>"; toolbars_data["font"] = [ ["button","fonts","UI_fonts.gif",font[0],s_obj_name+".execCommand(DECMD_FONT)",0], ["select","class","","Arial",font[1],"parent."+s_obj_name+".execCommand("+DECMD_SETCLASSNAME+",'%res%')",0,120], ["select","font","Arial","Arial",font[2],"parent."+s_obj_name+".execCommand("+DECMD_SETFONTNAME+",'%res%')",0,165], ["option","font",ttf+"Arial","Arial","Arial"], ["option","font",ttf+"Arial Black","Arial Black","Arial Black"], ["option","font",ttf+"Arial Narrow","Arial Narrow","Arial Narrow"], ["option","font",ttf+"Bookman Old Style","Bookman Old Style","Bookman Old Style"], ["option","font",ttf+"Courier New","Courier New","Courier New"], ["option","font",ttf+"Helvetica","Helvetica","Helvetica"], ["option","font",ttf+"Sans-Serif","Sans-Serif","Sans-Serif"], ["option","font",nottf+"System","System","System"], ["option","font",ttf+"Tahoma","Tahoma","Tahoma"], ["option","font",ttf+"Times New Roman","Times New Roman","Times New Roman"], ["option","font",ttf+"Verdana","Verdana","Verdana"], ["select","size","3","Arial",font[3],"parent."+s_obj_name+".execCommand("+DECMD_SETFONTSIZE+",%res%);",0,35], ["option","size","1","Arial","1"], ["option","size","2","Arial","2"], ["option","size","3","Arial","3"], ["option","size","4","Arial","4"], ["option","size","5","Arial","5"], ["option","size","6","Arial","6"], ["option","size","7","Arial","7"] ]; var standart = new ControlPanel(); standart.o_owner = this.p_toolbar; standart.path = s_path; standart.inserData(toolbars_data["standart"]); standart.show(); var tables = new ControlPanel(); tables.o_owner = this.p_toolbar; tables.path = s_path; tables.inserData(toolbars_data["tables"]); tables.show(); var obj = document.createElement("DIV"); this.p_toolbar.appendChild(obj); var font = new ControlPanel(); font.o_owner = obj; font.path = s_path; font.inserData(toolbars_data["font"]); font.show(); var formating = new ControlPanel(); formating.o_owner = obj; formating.path = s_path; formating.inserData(toolbars_data["formating"]); formating.show(); formating.buttonBgColor("font_color","black"); for (var i in panels) { this.panels[i] = [panels[i][0],panels[i][1],flg_Visible]; eval("this.panels[i][3] = "+panels[i][2]); if (s_panels_list.indexOf(panels[i][0])<0 && s_panels_list!="" && s_panels_list!="ALL") { this.panels[i][2] = flg_Hidden; this.panels[i][3].hide(); } this.toolbars[panels[i][0]] = this.panels[i][3]; } } eval("this.p_toolbar.oncontextmenu = function() {"+s_obj_name+".panels_switcher();}"); }; // Функция init - инифиализация редактора this.init = function() { var o_tbody,o_tr,obj; o_tbody = document.createElement("TBODY"); o_tr = document.createElement("TR"); obj = document.createElement("TD"); obj.className = "HTMLEditor_toolbar"; obj.unselectable = "on"; this.p_toolbar = obj; o_tr.appendChild(obj); o_tbody.appendChild(o_tr); obj = document.createElement("DIV"); obj.unselectable = "on"; obj.className = "HTMLEditor_toolbar_title"; this.p_toolbar.appendChild(obj); this.p_title = obj; o_tr = document.createElement("TR"); obj = document.createElement("TD"); this.p_work_area = obj; o_tr.appendChild(obj); o_tbody.appendChild(o_tr); o_tr = document.createElement("TR"); obj = document.createElement("TD"); obj.className = "HTMLEditor_statusbar"; obj.unselectable = "on"; this.p_statusbar = obj; o_tr.appendChild(obj); o_tbody.appendChild(o_tr); obj = document.createElement("TABLE"); obj.appendChild(o_tbody); obj.border = "1"; obj.className = "HTMLEditor"; obj.cellSpacing = 0; obj.cellPadding = 0; this.color_table = this.init_color_table(); this.init_toolbar(); this.init_statusbar(); this.init_ActiveX(); if (o_parent!=null && o_parent!=undefined) { o_parent.appendChild(obj); obj = this.toolbars["FORMAT"].getButtonId("font_color"); this.toolbars["FORMAT"].setButtonAttribute("font_color","cmd",s_obj_name+".get_color(parent."+obj+",'<IMG class=HTMLEditor_color_auto src="+this.imgs_path+"/1x1.gif> "+txts[s_lang]["colors"][0]+"','changeFontColor');"); obj = this.toolbars["FORMAT"].getButtonId("back_color"); this.toolbars["FORMAT"].setButtonAttribute("back_color","cmd",s_obj_name+".get_color(parent."+obj+",'"+txts[s_lang]["colors"][1]+"','changeBackColor');"); obj = this.toolbars["TABLES"].getButtonId("color"); this.toolbars["TABLES"].setButtonAttribute("color","cmd",s_obj_name+".get_color(parent."+obj+",'"+txts[s_lang]["colors"][1]+"','changeCellBackColor');"); } }; this.PutHTML = function(arg) { if (arg) s_HTML = arg; if (this.current_mode=="Normal") this.p_editor.DocumentHTML = s_HTML; }; this.init(); }
/admin/whe/
Имя
Дата
Размер
..
2026-10-02
css
2013-04-27
html
2015-04-08
icons
2013-04-27
imgs
2013-04-27
HTMLEditor.js
2006-01-04
56 кб.
functions.js
2006-01-04
1 кб.
labels.js
2006-01-04
5 кб.
panel.js
2006-01-04
21 кб.
/admin/whe
Загрузить файлы
Файл 1
Файл 2
Файл 3