Your IP : 3.142.249.163


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/fileman/html_editor/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/fileman/html_editor/html-snippets.min.js

(function(){function t(){function t(t){this.editor=t;this.listLoaded=false;this.snippets=this.editor.config.snippets;this.HandleList();this.Init()}t.prototype={Init:function(){BX.addCustomEvent(this.editor,"OnApplySiteTemplate",BX.proxy(this.OnTemplateChanged,this))},SetSnippets:function(t){this.snippets=this.editor.config.snippets=this.editor.snippetsTaskbar.snippets=t;this.HandleList()},GetList:function(){return this.snippets[this.editor.GetTemplateId()]},HandleList:function(){var t,e=this.GetList().items;if(e){for(t in e){if(e.hasOwnProperty(t)){e[t].key=e[t].path.replace("/",",")}}}},ReloadList:function(t){this.editor.snippetsTaskbar.ClearSearchResult();var e=this;this.editor.Request({getData:this.editor.GetReqData("load_snippets_list",{site_template:this.editor.GetTemplateId(),clear_cache:t?"Y":"N"}),handler:function(t){if(t.result){e.SetSnippets(t.snippets);e.RebuildAll()}}})},FetchPlainListOfCategories:function(t,e,i){var s,a=t.length;for(s=0;s<a;s++){i.push({level:e,key:t[s].key,section:t[s].section});if(t[s].children&&t[s].children.length>0){this.FetchPlainListOfCategories(t[s].children,e+1,i)}}},AddNewCategory:function(t){var e=this;this.editor.Request({getData:this.editor.GetReqData("snippet_add_category",{site_template:this.editor.GetTemplateId(),category_name:t.name,category_parent:t.parent}),handler:function(t){if(t.result){e.SetSnippets(t.snippets);e.RebuildAll()}}})},RemoveCategory:function(t){var e=this;this.editor.Request({getData:this.editor.GetReqData("snippet_remove_category",{site_template:this.editor.GetTemplateId(),category_path:t.path}),handler:function(t){if(t.result){e.SetSnippets(t.snippets);e.RebuildAll()}}})},RenameCategory:function(t){var e=this;this.editor.Request({getData:this.editor.GetReqData("snippet_rename_category",{site_template:this.editor.GetTemplateId(),category_path:t.path,category_new_name:t.newName}),handler:function(t){if(t.result){e.SetSnippets(t.snippets);e.RebuildAll()}}})},SaveSnippet:function(t){var e=this;this.editor.Request({postData:this.editor.GetReqData("edit_snippet",{site_template:this.editor.GetTemplateId(),path:t.path.replace(",","/"),name:t.name,code:t.code,description:t.description,current_path:t.currentPath}),handler:function(t){if(t.result){e.SetSnippets(t.snippets);e.RebuildAll()}}})},RemoveSnippet:function(t){var e=this;this.editor.Request({getData:this.editor.GetReqData("remove_snippet",{site_template:this.editor.GetTemplateId(),path:t.path.replace(",","/")}),handler:function(t){if(t.result){e.SetSnippets(t.snippets);e.RebuildAll()}}})},RebuildAll:function(){var t=this.editor.GetDialog("snippetsCategories");if(t&&t.IsOpen()){t.DisplayAddForm(false);t.BuildTree(this.GetList().groups)}if(this.snippets[this.editor.GetTemplateId()]&&this.editor.snippetsTaskbar){this.editor.snippetsTaskbar.BuildTree(this.snippets[this.editor.GetTemplateId()].groups,this.snippets[this.editor.GetTemplateId()].items)}var e=this.editor.GetDialog("editSnippet");if(e&&e.IsOpen()){e.SetCategories()}},OnTemplateChanged:function(){this.ReloadList(false)}};function e(t){e.superclass.constructor.apply(this,arguments);this.id="snippets";this.snippets=this.editor.config.snippets;this.templateId=this.editor.templateId;this.title=BX.message("BXEdSnippetsTitle");this.searchPlaceholder=BX.message("BXEdSnipSearchPlaceHolder");this.uniqueId="taskbar_"+this.editor.id+"_"+this.id;this.Init()}BX.extend(e,window.BXHtmlEditor.Taskbar);e.prototype.Init=function(){this.BuildSceleton();if(this.snippets[this.templateId]){this.BuildTree(this.snippets[this.templateId].groups,this.snippets[this.templateId].items)}var t=this;t.editor.phpParser.AddBxNode("snippet_icon",{Parse:function(t){return t.code||""}})};e.prototype.GetMenuItems=function(){var t=this;return[{text:BX.message("BXEdAddSnippet"),title:BX.message("BXEdAddSnippet"),className:"",onclick:function(){t.editor.GetDialog("editSnippet").Show();BX.PopupMenu.destroy(t.uniqueId+"_menu")}},{text:BX.message("RefreshTaskbar"),title:BX.message("RefreshTaskbar"),className:"",onclick:function(){t.editor.snippets.ReloadList(true);BX.PopupMenu.destroy(t.uniqueId+"_menu")}},{text:BX.message("BXEdManageCategories"),title:BX.message("BXEdManageCategories"),className:"",onclick:function(){t.editor.GetDialog("snippetsCategories").Show();BX.PopupMenu.destroy(t.uniqueId+"_menu")}}]};e.prototype.HandleElementEx=function(t,e,i){this.editor.SetBxTag(e,{tag:"snippet_icon",params:i});t.title=i.description||i.title;var s=t.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-right-side-item-edit-btn",title:BX.message("BXEdSnipEdit")}}));this.editor.SetBxTag(s,{tag:"_snippet",params:i});BX.bind(s,"mousedown",BX.proxy(this.EditSnippet,this))};e.prototype.EditSnippet=function(t){var e=t.target||t.srcElement;function i(){BX.removeClass(e,"bxhtmled-right-side-item-edit-btn-active");BX.unbind(document,"mouseup",i)}BX.addClass(e,"bxhtmled-right-side-item-edit-btn-active");BX.bind(document,"mouseup",i);this.editor.GetDialog("editSnippet").Show(e);return BX.PreventDefault(t)};e.prototype.BuildTree=function(t,i){e.superclass.BuildTree.apply(this,arguments);if((!t||t.length==0)&&(!i||i.length==0)){this.pTreeCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-no-snip"},text:BX.message("BXEdSnipNoSnippets")}))}};function i(t,e){e=e||{};e.id="bx_edit_snippet";e.width=600;this.zIndex=3007;this.id="edit_snippet";i.superclass.constructor.apply(this,[t,e]);this.SetContent(this.Build());BX.addClass(this.oDialog.DIV,"bx-edit-snip-dialog");BX.addCustomEvent(this,"OnDialogSave",BX.proxy(this.Save,this))}BX.extend(i,window.BXHtmlEditor.Dialog);i.prototype.Save=function(){this.editor.snippets.SaveSnippet({path:this.pCatSelect.value,name:this.pName.value,code:this.pCode.value,description:this.pDesc.value,currentPath:this.currentPath})};i.prototype.Build=function(){this.pCont=BX.create("DIV",{props:{className:"bxhtmled-edit-snip-cnt"}});function t(t,e,i){var s,a,n;s=t.insertRow(-1);if(i){s.className="bxhtmled-add-row"}a=s.insertCell(-1);a.className="bxhtmled-left-c";if(e&&e.label){a.appendChild(BX.create("LABEL",{props:{className:e.required?"bxhtmled-req":""},text:e.label})).setAttribute("for",e.id)}n=s.insertCell(-1);n.className="bxhtmled-right-c";return{row:s,leftCell:a,rightCell:n}}this.arTabs=[{id:"base",name:BX.message("BXEdSnipBaseSettings")},{id:"additional",name:BX.message("BXEdSnipAddSettings")}];var e=this.BuildTabControl(this.pCont,this.arTabs);this.arTabs=e.tabs;var i=this,s,a,n=BX.create("TABLE",{props:{className:"bxhtmled-dialog-tbl"}}),p=BX.create("TABLE",{props:{className:"bxhtmled-dialog-tbl"}});s=t(n,{label:BX.message("BXEdSnipName")+":",id:this.id+"-name",required:true});this.pName=s.rightCell.appendChild(BX.create("INPUT",{props:{type:"text",id:this.id+"-name",placeholder:BX.message("BXEdSnipNamePlaceHolder")}}));s=t(n,{label:BX.message("BXEdSnipCode")+":",id:this.id+"-code",required:true});this.pCode=s.rightCell.appendChild(BX.create("TEXTAREA",{props:{id:this.id+"-code",placeholder:BX.message("BXEdSnipCodePlaceHolder")},style:{height:"250px"}}));this.arTabs[0].cont.appendChild(n);s=t(p,{label:BX.message("BXEdSnipCategory")+":",id:this.id+"-category"});this.pCatSelect=s.rightCell.appendChild(BX.create("SELECT",{props:{id:this.id+"-category"},style:{maxWidth:"280px"}}));this.pCatManageBut=s.rightCell.appendChild(BX.create("INPUT",{props:{className:"bxhtmled-manage-cat",type:"button",value:"...",title:BX.message("BXEdManageCategories")}}));this.pCatManageBut.onclick=function(){i.editor.GetDialog("snippetsCategories").Show()};s=t(p,{label:BX.message("BXEdSnipDescription")+":",id:this.id+"-hint"});this.pDesc=s.rightCell.appendChild(BX.create("TEXTAREA",{props:{id:this.id+"-hint",placeholder:BX.message("BXEdSnipDescriptionPlaceholder")}}));this.arTabs[1].cont.appendChild(p);s=BX.adjust(p.insertRow(-1),{style:{display:"none"}});a=BX.adjust(s.insertCell(-1),{props:{className:"bxhtmled--centr-c"},attrs:{colsPan:2}});a.appendChild(BX.create("INPUT",{props:{className:"",type:"button",value:BX.message("BXEdSnipRemove")},events:{click:function(){if(confirm(BX.message("BXEdSnipRemoveConfirm"))){i.editor.snippets.RemoveSnippet({path:i.currentPath});i.Close()}}}}));this.delSnipRow=s;return this.pCont};i.prototype.Show=function(t){this.SetTitle(BX.message("BXEdEditSnippetDialogTitle"));this.SetCategories();var e={},s=this.editor.GetBxTag(t),a=!s||!s.tag;if(!a){e=s.params;this.currentPath=(e.path==""?"":e.path.replace(",","/")+"/")+e.name;this.delSnipRow.style.display=""}else{this.currentPath="";this.delSnipRow.style.display="none"}this.pName.value=e.title||"";this.pCode.value=e.code||"";this.pDesc.value=e.description||"";this.pCatSelect.value=e.key||"";i.superclass.Show.apply(this,arguments)};i.prototype.SetCategories=function(){this.pCatSelect.options.length=0;this.pCatSelect.options.add(new Option(BX.message("BXEdSnippetsTitle"),"",true,true));var t,e=" . ",i,s,a=[],n=this.editor.snippetsTaskbar.GetSectionsTreeInfo();this.editor.snippets.FetchPlainListOfCategories(n,1,a);for(s=0;s<a.length;s++){t="";for(i=0;i<a[s].level;i++){t+=e}t+=a[s].section.name;this.pCatSelect.options.add(new Option(t,a[s].key,false,false))}};function s(t,e){e=e||{};e.id="bx_snippets_cats";e.width=400;e.zIndex=3010;this.id="snippet_categories";s.superclass.constructor.apply(this,[t,e]);this.SetContent(this.Build());this.oDialog.ClearButtons();this.oDialog.SetButtons([this.oDialog.btnClose]);BX.addClass(this.oDialog.DIV,"bx-edit-snip-cat-dialog")}BX.extend(s,window.BXHtmlEditor.Dialog);s.prototype.Save=function(){};s.prototype.Build=function(){this.pCont=BX.create("DIV",{props:{className:"bxhtmled-snip-cat-cnt"}});this.pAddCatWrap=this.pCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-snip-cat-add-wrap"}}));this.pAddCatBut=this.pAddCatWrap.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-snip-cat-add-but"},text:BX.message("BXEdSnipCatAdd")}));BX.bind(this.pAddCatBut,"click",BX.proxy(this.DisplayAddForm,this));var t=this.pAddCatWrap.appendChild(BX.create("TABLE",{props:{className:"bxhtmled-snip-cat-add-tbl"}}));var e,i;e=t.insertRow(-1);i=e.insertCell(-1);i.className="bxhtmled-left-c";i.appendChild(BX.create("LABEL",{props:{className:"bxhtmled-req"},attrs:{for:this.id+"-cat-name"},text:BX.message("BXEdSnipCatAddName")+":"}));i=e.insertCell(-1);i.className="bxhtmled-right-c";this.pCatName=i.appendChild(BX.create("INPUT",{props:{type:"text",id:this.id+"-cat-name"}}));e=t.insertRow(-1);i=e.insertCell(-1);i.className="bxhtmled-left-c";i.appendChild(BX.create("LABEL",{props:{className:"bxhtmled-req"},attrs:{for:this.id+"-cat-par"},text:BX.message("BXEdSnipParCategory")+":"}));i=e.insertCell(-1);i.className="bxhtmled-right-c";this.pCatPar=i.appendChild(BX.create("SELECT",{props:{id:this.id+"-cat-par"}}));e=t.insertRow(-1);i=e.insertCell(-1);i.colSpan=2;i.style.textAlign="center";this.pSaveCat=i.appendChild(BX.create("INPUT",{props:{type:"button",className:"adm-btn-save bxhtmled-snip-save-but",value:BX.message("BXEdSnipCatAddBut")}}));BX.bind(this.pSaveCat,"click",BX.proxy(this.AddNewCategory,this));this.pCatListWrap=this.pCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-snip-cat-list-wrap"}}));return this.pCont};s.prototype.AddNewCategory=function(){this.editor.snippets.AddNewCategory({name:this.pCatName.value,parent:this.pCatPar.value,siteTemplate:""})};s.prototype.DisplayAddForm=function(t){if(this.animation)this.animation.stop();if(t!==true&&t!==false)t=!this.bAddCatOpened;t=t!==false;if(this.bAddCatOpened!==t){if(t){this.DisableKeyCheck();BX.bind(this.pCatName,"keydown",BX.proxy(this.AddCatKeydown,this));this.SetParentCategories();this.animationStartHeight=25;this.animationEndHeight=160;BX.focus(this.pCatName)}else{this.EnableKeyCheck();BX.unbind(this.pCatName,"keydown",BX.proxy(this.AddCatKeydown,this));this.animationStartHeight=160;this.animationEndHeight=25}var e=this;this.animation=new BX.easing({duration:300,start:{height:this.animationStartHeight},finish:{height:this.animationEndHeight},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(t){e.pAddCatWrap.style.height=t.height+"px"},complete:BX.proxy(function(){this.animation=null},this)});this.animation.animate();this.bAddCatOpened=t}this.ResetAddCategoryForm()};s.prototype.SetParentCategories=function(){this.pCatPar.options.length=0;this.pCatPar.options.add(new Option(BX.message("BXEdSnippetsTitle"),"",true,true));var t,e=" . ",i,s,a=[],n=this.editor.snippetsTaskbar.GetSectionsTreeInfo();this.editor.snippets.FetchPlainListOfCategories(n,1,a);for(s=0;s<a.length;s++){if(a[s].level<2){t="";for(i=0;i<a[s].level;i++){t+=e}t+=a[s].section.name;this.pCatPar.options.add(new Option(t,a[s].key,false,false))}}};s.prototype.Show=function(){this.SetTitle(BX.message("BXEdManageCategoriesTitle"));this.BuildTree(this.editor.snippets.GetList().groups);this.bAddCatOpened=false;this.pAddCatWrap.style.height="";s.superclass.Show.apply(this,arguments)};s.prototype.BuildTree=function(t){BX.cleanNode(this.pCatListWrap);this.catIndex={};for(var e=0;e<t.length;e++){this.BuildCategory(t[e])}};s.prototype.BuildCategory=function(t){var e=this,i=this.GetCategoryContByPath(t.path),s=BX.create("DIV",{props:{className:"bxhtmled-tskbr-sect-outer"}}),a=s.appendChild(BX.create("DIV",{props:{className:"bxhtmled-tskbr-sect"}})),n=a.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-tskbr-sect-icon bxhtmled-tskbr-sect-icon-open"}})),p=a.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-tskbr-sect-title"},text:t.title||t.name})),o=a.appendChild(BX.create("INPUT",{props:{type:"text",className:"bxhtmled-tskbr-name-input"}})),d=s.appendChild(BX.create("DIV",{props:{className:"bxhtmled-tskb-child"},style:{display:"block"}})),r=a.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-right-side-item-edit-btn",title:BX.message("BXEdSnipCatEdit")}})),l=a.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-right-side-item-del-btn",title:BX.message("BXEdSnipCatDelete")}}));BX.bind(l,"mousedown",BX.proxy(this.DisableDD(),this));BX.bind(r,"mousedown",BX.proxy(this.DisableDD(),this));BX.bind(o,"mousedown",BX.proxy(this.DisableDD(),this));BX.bind(l,"click",function(){if(confirm(BX.message("BXEdDropCatConfirm"))){var i=t.path==""?t.name:t.path+"/"+t.name;e.editor.snippets.RemoveCategory({path:i})}});BX.bind(r,"click",function(){e.ShowRename(true,t,o,a)});d.style.display="block";var h=t.path==""?t.name:t.path+","+t.name;var c=t.path==""?0:1;var m={key:h,children:[],section:t};this.catIndex[h]={icon:n,outerCont:s,cont:a,childCont:d,sect:m};if(c>0){BX.addClass(a,"bxhtmled-tskbr-sect-"+c);BX.addClass(n,"bxhtmled-tskbr-sect-icon-"+c)}i.appendChild(s)};s.prototype.ShowRename=function(t,e,i,s){t=t!==false;if(t){BX.addClass(s,"bxhtmled-tskbr-sect-rename");this.currentRenamedCat={section:e,renameInput:i,pGroupTitle:s};i.value=e.name;this.DisableKeyCheck();BX.bind(i,"keydown",BX.proxy(this.RenameKeydown,this));BX.focus(i);i.select()}else{BX.removeClass(s,"bxhtmled-tskbr-sect-rename");BX.unbind(i,"keydown",BX.proxy(this.RenameKeydown,this));this.EnableKeyCheck();this.currentRenamedCat=false}};s.prototype.RenameKeydown=function(t){if(t&&this.currentRenamedCat){if(t.keyCode==this.editor.KEY_CODES["escape"]){this.ShowRename(false,this.currentRenamedCat.section,this.currentRenamedCat.renameInput,this.currentRenamedCat.pGroupTitle);BX.PreventDefault(t)}else if(t.keyCode==this.editor.KEY_CODES["enter"]){var e=BX.util.trim(this.currentRenamedCat.renameInput.value),i=this.currentRenamedCat.section,s=i.path==""?i.name:i.path+"/"+i.name;if(e!==""){this.editor.snippets.RenameCategory({path:s,newName:e})}this.ShowRename(false,this.currentRenamedCat.section,this.currentRenamedCat.renameInput,this.currentRenamedCat.pGroupTitle);BX.PreventDefault(t)}}};s.prototype.AddCatKeydown=function(t){if(t&&this.bAddCatOpened){if(t.keyCode==this.editor.KEY_CODES["escape"]){this.DisplayAddForm(false);BX.PreventDefault(t)}else if(t.keyCode==this.editor.KEY_CODES["enter"]){this.AddNewCategory();BX.PreventDefault(t)}}};s.prototype.DisableDD=function(){jsDD.Disable();BX.bind(document,"mouseup",BX.proxy(this.EnableDD,this))};s.prototype.EnableDD=function(){jsDD.Enable();BX.unbind(document,"mouseup",BX.proxy(this.EnableDD,this))};s.prototype.OnDragFinish=function(){};s.prototype.GetCategoryContByPath=function(t){if(t==""||!this.catIndex[t]){return this.pCatListWrap}else{return this.catIndex[t].childCont}};s.prototype.ResetAddCategoryForm=function(t){this.pCatName.value="";this.pCatPar.value=""};window.BXHtmlEditor.SnippetsControl=e;window.BXHtmlEditor.BXEditorSnippets=t;window.BXHtmlEditor.dialogs.editSnippet=i;window.BXHtmlEditor.dialogs.snippetsCategories=s}if(window.BXHtmlEditor&&window.BXHtmlEditor.dialogs)t();else BX.addCustomEvent(window,"OnEditorBaseControlsDefined",t)})();
//# sourceMappingURL=html-snippets.map.js