Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/fileman/light_editor/ |
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/fileman/light_editor/le_controls.min.js |
function LHEButton(e,t){if(!e.name)e.name=e.id;if(!e.title)e.title=e.name;this.disabled=false;this.pLEditor=t;this.oBut=e;if(this.oBut&&typeof this.oBut.OnBeforeCreate=="function")this.oBut=this.oBut.OnBeforeCreate(this.pLEditor,this.oBut);if(this.oBut)this.Create()}LHEButton.prototype={Create:function(){var e=this;this.pCont=BX.create("DIV",{props:{className:"lhe-button-cont"}});this.pWnd=this.pCont.appendChild(BX.create("IMG",{props:{src:this.oBut.src||this.pLEditor.oneGif,title:this.oBut.title,className:"lhe-button lhe-button-normal",id:"lhe_btn_"+this.oBut.id.toLowerCase()}}));if(this.oBut.disableOnCodeView)BX.addCustomEvent(this.pLEditor,"OnChangeView",BX.proxy(this.OnChangeView,this));if(this.oBut.width){this.pCont.style.width=parseInt(this.oBut.width)+5+"px";this.pWnd.style.width=parseInt(this.oBut.width)+"px"}this.pWnd.onmouseover=function(t){e.OnMouseOver(t,this)};this.pWnd.onmouseout=function(t){e.OnMouseOut(t,this)};this.pWnd.onmousedown=function(t){e.OnClick(t,this)}},OnMouseOver:function(e,t){if(this.disabled)return;t.className="lhe-button lhe-button-over"},OnMouseOut:function(e,t){if(this.disabled)return;if(this.checked)t.className="lhe-button lhe-button-checked";else t.className="lhe-button lhe-button-normal"},OnClick:function(e,t){if(this.disabled)return false;var i=false;if(this.pLEditor.sEditorMode=="code"&&this.pLEditor.bBBCode&&typeof this.oBut.bbHandler=="function"){i=this.oBut.bbHandler(this)!==false}else{if(typeof this.oBut.handler=="function")i=this.oBut.handler(this)!==false;if(this.pLEditor.sEditorMode!="code"&&!i&&this.oBut.cmd)i=this.pLEditor.executeCommand(this.oBut.cmd);this.pLEditor.SetFocus();BX.defer(this.pLEditor.SetFocus,this.pLEditor)()}return i},Check:function(e){if(e==this.checked||this.disabled)return;this.checked=e;if(this.checked)BX.addClass(this.pWnd,"lhe-button-checked");else BX.removeClass(this.pWnd,"lhe-button-checked")},Disable:function(e){if(e==this.disabled)return false;this.disabled=e;if(e)BX.addClass(this.pWnd,"lhe-button-disabled");else BX.removeClass(this.pWnd,"lhe-button-disabled")},OnChangeView:function(){if(this.oBut.disableOnCodeView)this.Disable(this.pLEditor.sEditorMode=="code")}};function LHEDialog(e,t){this.pSel=e.obj||false;this.pLEditor=t;this.id=e.id;this.arParams=e;this.Create()}LHEDialog.prototype={Create:function(){if(!window.LHEDailogs[this.id]||typeof window.LHEDailogs[this.id]!="function")return;var e=window.LHEDailogs[this.id](this);if(!e)return;this.prevTextSelection="";if(this.pLEditor.sEditorMode=="code")this.prevTextSelection=this.pLEditor.GetTextSelection();this.pLEditor.SaveSelectionRange();if(BX.browser.IsIE()&&!this.arParams.bCM&&this.pLEditor.sEditorMode!="code"){if(this.pLEditor.GetSelectedText(this.pLEditor.oPrevRange)==""){this.pLEditor.InsertHTML('<img id="bx_lhe_temp_bogus_node" src="'+this.pLEditor.oneGif+'" _moz_editor_bogus_node="on" style="border: 0px !important;"/>');this.pLEditor.oPrevRange=this.pLEditor.GetSelectionRange()}}var t={title:e.title||this.name||"",width:e.width||500,height:200,resizable:false};if(e.height)t.height=e.height;if(e.resizable){t.resizable=true;t.min_width=e.min_width;t.min_height=e.min_height;t.resize_id=e.resize_id}window.obLHEDialog=new BX.CDialog(t);var i=this;BX.addCustomEvent(obLHEDialog,"onWindowUnRegister",function(){i.pLEditor.bPopup=false;if(obLHEDialog.DIV&&obLHEDialog.DIV.parentNode)obLHEDialog.DIV.parentNode.removeChild(window.obLHEDialog.DIV);if(i.arParams.bEnterClose!==false)BX.unbind(window,"keydown",BX.proxy(i.OnKeyPress,i))});if(this.arParams.bEnterClose!==false)BX.bind(window,"keydown",BX.proxy(this.OnKeyPress,this));this.pLEditor.bPopup=true;obLHEDialog.Show();obLHEDialog.SetContent(e.innerHTML);if(e.OnLoad&&typeof e.OnLoad=="function")e.OnLoad();obLHEDialog.oDialog=e;obLHEDialog.SetButtons([new BX.CWindowButton({title:BX.message.DialogSave,action:function(){var t=true;if(e.OnSave&&typeof e.OnSave=="function"){i.pLEditor.RestoreSelectionRange();t=e.OnSave()}if(t!==false)window.obLHEDialog.Close()}}),obLHEDialog.btnCancel]);BX.addClass(obLHEDialog.PARTS.CONTENT,"lhe-dialog");obLHEDialog.adjustSizeEx();setTimeout(function(){obLHEDialog.Move(1,1)},100)},OnKeyPress:function(e){if(!e)e=window.event;if(e.keyCode==13)obLHEDialog.PARAMS.buttons[0].emulate()},Close:function(e){this.RemoveOverlay();if(!e)e=this.floatDiv;if(!e||!e.parentNode)return;this.pLEditor.bDialogOpened=false;jsFloatDiv.Close(e);e.parentNode.removeChild(e);if(window.jsPopup)jsPopup.AllowClose()},CreateOverlay:function(){var e=BX.GetWindowScrollSize();this.overlay=document.body.appendChild(BX.create("DIV",{props:{id:this.overlay_id,className:"lhe-overlay"},style:{zIndex:this.zIndex-5,width:e.scrollWidth+"px",height:e.scrollHeight+"px"}}));this.overlay.ondrag=BX.False;this.overlay.onselectstart=BX.False},RemoveOverlay:function(){if(this.overlay&&this.overlay.parentNode)this.overlay.parentNode.removeChild(this.overlay)}};function LHEList(e,t){if(!e.name)e.name=e.id;if(!e.title)e.title=e.name;this.disabled=false;this.zIndex=5e3;this.pLEditor=t;this.oBut=e;this.Create();this.bRunOnOpen=false;if(this.oBut&&typeof this.oBut.OnBeforeCreate=="function")this.oBut=this.oBut.OnBeforeCreate(this.pLEditor,this.oBut);if(this.oBut){if(e.OnCreate&&typeof e.OnCreate=="function")this.bRunOnOpen=true;if(this.oBut.disableOnCodeView)BX.addCustomEvent(this.pLEditor,"OnChangeView",BX.proxy(this.OnChangeView,this))}else{BX.defer(function(){BX.remove(this.pCont)},this)()}}LHEList.prototype={Create:function(){var e=this;this.pWnd=BX.create("IMG",{props:{src:this.pLEditor.oneGif,title:this.oBut.title,className:"lhe-button lhe-button-normal",id:"lhe_btn_"+this.oBut.id.toLowerCase()}});this.pWnd.onmouseover=function(t){e.OnMouseOver(t,this)};this.pWnd.onmouseout=function(t){e.OnMouseOut(t,this)};this.pWnd.onmousedown=function(t){e.OnClick(t,this)};this.pCont=BX.create("DIV",{props:{className:"lhe-button-cont"}});this.pCont.appendChild(this.pWnd);this.pValuesCont=BX.create("DIV",{props:{className:"lhe-list-val-cont"},style:{zIndex:this.zIndex}});if(this.oBut&&typeof this.oBut.OnAfterCreate=="function")this.oBut.OnAfterCreate(this.pLEditor,this)},OnChangeView:function(){if(this.oBut.disableOnCodeView)this.Disable(this.pLEditor.sEditorMode=="code")},Disable:function(e){if(e==this.disabled)return false;this.disabled=e;if(e)BX.addClass(this.pWnd,"lhe-button-disabled");else BX.removeClass(this.pWnd,"lhe-button-disabled")},OnMouseOver:function(e,t){if(this.disabled)return;BX.addClass(t,"lhe-button-over")},OnMouseOut:function(e,t){if(this.disabled)return;BX.removeClass(t,"lhe-button-over");if(this.checked)BX.addClass(t,"lhe-button-checked")},OnKeyPress:function(e){if(!e)e=window.event;if(e.keyCode==27)this.Close()},OnClick:function(e,t){this.pLEditor.SaveSelectionRange();if(this.disabled)return false;if(this.bOpened)return this.Close();this.Open()},Close:function(){this.pValuesCont.style.display="none";this.pLEditor.oTransOverlay.Hide();BX.unbind(window,"keypress",BX.proxy(this.OnKeyPress,this));BX.unbind(document,"mousedown",BX.proxy(this.CheckClose,this));this.bOpened=false},CheckClose:function(e){if(!this.bOpened)return BX.unbind(document,"mousedown",BX.proxy(this.CheckClose,this));var t;if(e.target)t=e.target;else if(e.srcElement)t=e.srcElement;if(t.nodeType==3)t=t.parentNode;if(!BX.findParent(t,{className:"lhe-colpick-cont"}))this.Close()},Open:function(){if(this.bRunOnOpen){if(this.oBut.OnCreate&&typeof this.oBut.OnCreate=="function")this.oBut.OnCreate(this);this.bRunOnOpen=false}var e=this.pValuesCont.parentNode===null;document.body.appendChild(this.pValuesCont);if(e){BX.ZIndexManager.register(this.pValuesCont)}var t=BX.ZIndexManager.bringToFront(this.pValuesCont);var i=t.getZIndex();this.pValuesCont.style.display="block";var o=this.pLEditor.oTransOverlay.Show({zIndex:i-1}),s=BX.align(BX.pos(this.pWnd),parseInt(this.pValuesCont.offsetWidth)||150,parseInt(this.pValuesCont.offsetHeight)||200),n=this;BX.bind(window,"keypress",BX.proxy(this.OnKeyPress,this));o.onclick=function(){n.Close()};this.pLEditor.oPrevRange=this.pLEditor.GetSelectionRange();if(this.oBut.OnOpen&&typeof this.oBut.OnOpen=="function")this.oBut.OnOpen(this);this.pValuesCont.style.top=s.top+"px";this.pValuesCont.style.left=s.left+"px";this.bOpened=true;setTimeout(function(){BX.bind(document,"mousedown",BX.proxy(n.CheckClose,n))},100)},SelectItem:function(e){var t=this.arItems[this.pSelectedItemId||0].pWnd;if(e){t.style.border="1px solid #4B4B6F";t.style.backgroundColor="#FFC678"}else{t.style.border="";t.style.backgroundColor=""}}};function LHETransOverlay(e,t){this.pLEditor=t;this.id="lhe_trans_overlay";this.zIndex=e.zIndex||100}LHETransOverlay.prototype={Create:function(){this.bCreated=true;this.bShowed=false;var e=BX.GetWindowScrollSize();this.pWnd=document.body.appendChild(BX.create("DIV",{props:{id:this.id,className:"lhe-trans-overlay"},style:{zIndex:this.zIndex,width:e.scrollWidth+"px",height:e.scrollHeight+"px"}}));this.pWnd.ondrag=BX.False;this.pWnd.onselectstart=BX.False},Show:function(e){if(!this.bCreated)this.Create();this.bShowed=true;this.pLEditor.bPopup=true;var t=BX.GetWindowScrollSize();this.pWnd.style.display="block";this.pWnd.style.width=t.scrollWidth+"px";this.pWnd.style.height=t.scrollHeight+"px";if(!e)e={};if(e.zIndex)this.pWnd.style.zIndex=e.zIndex;BX.bind(window,"resize",BX.proxy(this.Resize,this));return this.pWnd},Hide:function(){var e=this;setTimeout(function(){e.pLEditor.bPopup=false},50);if(!this.bShowed)return;this.bShowed=false;this.pWnd.style.display="none";BX.unbind(window,"resize",BX.proxy(this.Resize,this));this.pWnd.onclick=null},Resize:function(){if(this.bCreated)this.pWnd.style.width=BX.GetWindowScrollSize().scrollWidth+"px"}};function LHEColorPicker(e,t){if(!e.name)e.name=e.id;if(!e.title)e.title=e.name;this.disabled=false;this.bCreated=false;this.bOpened=false;this.zIndex=5e3;this.pLEditor=t;this.oPar=e;this.BeforeCreate()}LHEColorPicker.prototype={BeforeCreate:function(){var e=this;this.pWnd=BX.create("IMG",{props:{src:this.pLEditor.oneGif,title:this.oPar.title,className:"lhe-button lhe-button-normal",id:"lhe_btn_"+this.oPar.id.toLowerCase()}});this.pWnd.onmouseover=function(t){e.OnMouseOver(t,this)};this.pWnd.onmouseout=function(t){e.OnMouseOut(t,this)};this.pWnd.onmousedown=function(t){e.OnClick(t,this)};this.pCont=BX.create("DIV",{props:{className:"lhe-button-cont"}});this.pCont.appendChild(this.pWnd);if(this.oPar&&typeof this.oPar.OnBeforeCreate=="function")this.oPar=this.oPar.OnBeforeCreate(this.pLEditor,this.oPar);if(this.oPar.disableOnCodeView)BX.addCustomEvent(this.pLEditor,"OnChangeView",BX.proxy(this.OnChangeView,this))},Create:function(){var e=this;this.pColCont=document.body.appendChild(BX.create("DIV",{props:{className:"lhe-colpick-cont"},style:{zIndex:this.zIndex}}));BX.ZIndexManager.register(this.pColCont);var t=this.pLEditor.arColors,i,o,s,n=BX.create("TABLE",{props:{className:"lha-colpic-tbl"}}),r,d=t.length;i=n.insertRow(-1);o=i.insertCell(-1);o.colSpan=8;var l=o.appendChild(BX.create("SPAN",{props:{className:"lha-colpic-def-but"},text:BX.message.DefaultColor}));l.onmouseover=function(){this.className="lha-colpic-def-but lha-colpic-def-but-over";s.style.backgroundColor="transparent"};l.onmouseout=function(){this.className="lha-colpic-def-but"};l.onmousedown=function(t){e.Select(false)};s=i.insertCell(-1);s.colSpan=8;s.className="lha-color-inp-cell";s.style.backgroundColor=t[38];for(r=0;r<d;r++){if(Math.round(r/16)==r/16)i=n.insertRow(-1);o=i.insertCell(-1);o.innerHTML=" ";o.className="lha-col-cell";o.style.backgroundColor=t[r];o.id="lhe_color_id__"+r;o.onmouseover=function(e){this.className="lha-col-cell lha-col-cell-over";s.style.backgroundColor=t[this.id.substring("lhe_color_id__".length)]};o.onmouseout=function(e){this.className="lha-col-cell"};o.onmousedown=function(i){var o=this.id.substring("lhe_color_id__".length);e.Select(t[o])}}this.pColCont.appendChild(n);this.bCreated=true},OnChangeView:function(){if(this.oPar.disableOnCodeView)this.Disable(this.pLEditor.sEditorMode=="code")},Disable:function(e){if(e==this.disabled)return false;this.disabled=e;if(e)BX.addClass(this.pWnd,"lhe-button-disabled");else BX.removeClass(this.pWnd,"lhe-button-disabled")},OnClick:function(e,t){this.pLEditor.SaveSelectionRange();if(this.disabled)return false;if(!this.bCreated)this.Create();if(this.bOpened)return this.Close();this.Open()},Open:function(){var e=BX.align(BX.pos(this.pWnd),325,155),t=this;this.pLEditor.oPrevRange=this.pLEditor.GetSelectionRange();BX.bind(window,"keypress",BX.proxy(this.OnKeyPress,this));this.pColCont.style.display="block";this.pColCont.style.top=e.top+"px";this.pColCont.style.left=e.left+"px";this.bOpened=true;var i=BX.ZIndexManager.bringToFront(this.pColCont);var o=i.getZIndex();var s=this.pLEditor.oTransOverlay.Show({zIndex:o-1});s.onclick=function(){t.Close()};setTimeout(function(){BX.bind(document,"mousedown",BX.proxy(t.CheckClose,t))},100)},Close:function(){this.pColCont.style.display="none";this.pLEditor.oTransOverlay.Hide();BX.unbind(window,"keypress",BX.proxy(this.OnKeyPress,this));BX.unbind(document,"mousedown",BX.proxy(this.CheckClose,this));this.bOpened=false},CheckClose:function(e){if(!this.bOpened)return BX.unbind(document,"mousedown",BX.proxy(this.CheckClose,this));var t;if(e.target)t=e.target;else if(e.srcElement)t=e.srcElement;if(t.nodeType==3)t=t.parentNode;if(!BX.findParent(t,{className:"lhe-colpick-cont"}))this.Close()},OnMouseOver:function(e,t){if(this.disabled)return;t.className="lhe-button lhe-button-over"},OnMouseOut:function(e,t){if(this.disabled)return;t.className="lhe-button lhe-button-normal"},OnKeyPress:function(e){if(!e)e=window.event;if(e.keyCode==27)this.Close()},Select:function(e){this.pLEditor.RestoreSelectionRange();if(this.oPar.OnSelect&&typeof this.oPar.OnSelect=="function")this.oPar.OnSelect(e,this);this.Close()}};function LHEContextMenu(e,t){this.zIndex=e.zIndex;this.pLEditor=t;this.Create()}LHEContextMenu.prototype={Create:function(){this.pref="LHE_CM_"+this.pLEditor.id.toUpperCase()+"_";this.oDiv=document.body.appendChild(BX.create("DIV",{props:{className:"lhe-cm",id:this.pref+"_cont"},style:{zIndex:this.zIndex},html:'<table><tr><td class="lhepopup"><table id="'+this.pref+'_cont_items"><tr><td></td></tr></table></td></tr></table>'}));document.body.appendChild(BX.create("IFRAME",{props:{id:this.pref+"_frame",src:"javascript:void(0)"},style:{position:"absolute",zIndex:this.zIndex-5,left:"-1000px",top:"-1000px",visibility:"hidden"}}));this.menu=new PopupMenu(this.pref+"_cont")},Show:function(e){if(!e.pElement||!this.FetchAndBuildItems(e.pElement))return;try{this.pLEditor.SelectElement(e.pElement)}catch(e){}this.pLEditor.oPrevRange=this.pLEditor.GetSelectionRange();this.oDiv.style.width=parseInt(this.oDiv.firstChild.offsetWidth)+"px";var t=this,i=parseInt(this.oDiv.offsetWidth),o=parseInt(this.oDiv.offsetHeight);BX.bind(window,"keypress",BX.proxy(this.OnKeyPress,this));e.oPos.right=e.oPos.left+i;e.oPos.bottom=e.oPos.top;this.menu.PopupShow(e.oPos);var s=this.pLEditor.oTransOverlay.Show({zIndex:BX(this.pref+"_cont").style.zIndex-1});s.onclick=function(){t.Close()}},Close:function(){this.menu.PopupHide();this.pLEditor.oTransOverlay.Hide();BX.unbind(window,"keypress",BX.proxy(this.OnKeyPress,this))},FetchAndBuildItems:function(e){var t,i,o,s=[],n={},r,d,l=false;this.arSelectedElement={};while(e&&(t=e.parentNode)!=null){if(t.nodeType==1&&e.tagName&&(r=e.tagName.toUpperCase())&&r!="TBODY"&&!n[r]){d=r;if(e.getAttribute&&(l=e.getAttribute("__bxtagname")))d=l.toUpperCase();n[r]=e;if(LHEContMenu[d]){this.arSelectedElement[d]=e;if(s.length>0)s.push("separator");for(i=0,o=LHEContMenu[d].length;i<o;i++)s.push(LHEContMenu[d][i])}}else{e=t;continue}}if(s.length==0)return false;var a=document.getElementById(this.pref+"_cont_items");while(a.rows.length>0)a.deleteRow(0);return this.BuildItems(s,a)},BuildItems:function(e,t,i){var o=e.length;var s=this;var n={};this.subgroup_parent_id="";this.current_opened_id="";var r=function(){var e=document.getElementById("__curent_submenu");if(!e)return;d(e);s.current_opened_id="";s.subgroup_parent_id="";e.style.display="none";e.id=""};var d=function(e){if(!e)return;var t=e.parentNode.nextSibling;t.parentNode.className=""};var l=function(){setTimeout(function(){s.current_opened_id="";s.subgroup_parent_id=""},400)};var a,h,p,u,c,f,b;for(var a=0;a<o;a++){b=e[a];h=t.insertRow(-1);p=h.insertCell(-1);if(b=="separator"){p.innerHTML='<div class="popupseparator"></div>'}else{if(b.isgroup){var C=BX.browser.IsIE()?"arrow_ie":"arrow";p.innerHTML='<div id="_oSubMenuDiv_'+b.id+'" style="position: relative;"></div>'+'<table cellpadding="0" cellspacing="0" class="popupitem" id="'+b.id+'">'+"\t<tr>"+'\t\t<td class="gutter"></td>'+'\t\t<td class="item">'+b.name+"</td>"+'\t\t<td class="'+C+'"></td>'+"\t</tr>"+"</table>";var m=p.childNodes[1];var B={};n[b.id]=b.elements;m.onmouseover=function(e){var t=this;t.className="popupitem popupitemover";d(document.getElementById("__curent_submenu"));setTimeout(function(){if(s.current_opened_id&&s.current_opened_id==s.subgroup_parent_id){l();return}if(t.className=="popupitem")return;r();s.current_opened_id=t.id;var e=document.getElementById("_oSubMenuDiv_"+t.id);var i=parseInt(m.offsetWidth)+1+"px";var o=BX.create("DIV",{props:{className:"popupmenu"},style:{position:"absolute",zIndex:1500,left:i,top:"-1px"}});e.appendChild(o);o.onmouseover=function(){t.parentNode.className="popup_open_cell"};var d=o.appendChild(BX.create("TABLE",{props:{cellPadding:0,cellSpacing:0}}));s.BuildItems(n[t.id],d,t.id);o.style.display="block";o.id="__curent_submenu"},400)};m.onmouseout=function(e){this.className="popupitem"};continue}f='<table class="popupitem" id="lhe_cm__'+b.id+'"><tr>'+'\t<td class="gutter"><div class="lhe-button" id="lhe_btn_'+b.id.toLowerCase()+'"></div></td>'+'\t<td class="item">'+(b.name_edit||b.name)+"</td>"+"</tr></table>";p.innerHTML=f;var m=p.firstChild;m.onmouseover=function(e){this.className="popupitem popupitemover"};m.onmouseout=function(e){this.className="popupitem"};m.onmousedown=function(e){s.OnClick(this)}}}this.oDiv.style.width=t.parentNode.offsetWidth;return true},OnClick:function(e){var t=LHEButtons[e.id.substring("lhe_cm__".length)];if(!t||t.disabled)return false;this.pLEditor.RestoreSelectionRange();var i=false;if(t.handler)i=t.handler(this)!==false;if(!i&&t.cmd){this.pLEditor.executeCommand(t.cmd);this.pLEditor.SetFocus()}this.Close()},OnKeyPress:function(e){if(!e)e=window.event;if(e.keyCode==27)this.Close()}}; //# sourceMappingURL=le_controls.map.js