File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/components/bitrix/main.post.list/templates/.default/scripts_for_form2.min.js
Back
(function(){if(!!window.UCForm)return;var t={};window.UCForm=function(t){this.formId=t;this.form=BX(this.formId);this.entities=new Map;this.xmls=new Map;if(t===""){}else{this.initialize()}this.startCheckWriting=this.startCheckWriting.bind(this);this.id=null;this.currentEntity=null;this.onSubmitSuccess=this.onSubmitSuccess.bind(this);this.onSubmitFailed=this.onSubmitFailed.bind(this)};window.UCForm.prototype={initialize:function(){this.bindWindowEvents();this.bindPrivateEvents();this.__bindLHEEvents=function(t,e){if(e===this.formId){this.handler=t;this.bindLHEEvents()}}.bind(this);BX.addCustomEvent(window,"onInitialized",this.__bindLHEEvents);if(this.getLHE())this.bindLHEEvents();BX.onCustomEvent(this.form,"OnUCFormInit",[this])},bindWindowEvents:function(){this.windowEvents={OnImageDataUriHandle:this.showWait.bind(this),OnImageDataUriCaughtUploaded:this.closeWait.bind(this),OnImageDataUriCaughtFailed:this.closeWait.bind(this)};for(var t in this.windowEvents){if(this.windowEvents.hasOwnProperty(t)){BX.addCustomEvent(window,t,this.windowEvents[t])}}},unbindWindowEvents:function(){for(var t in this.windowEvents){if(this.windowEvents.hasOwnProperty(t)){BX.removeCustomEvent(window,t,this.windowEvents[t])}}},bindPrivateEvents:function(){this.privateEvents={onQuote:this.onQuote.bind(this),onReply:this.onReply.bind(this),onEdit:this.onEdit.bind(this)};for(var t in this.privateEvents){if(this.privateEvents.hasOwnProperty(t)){BX.addCustomEvent(this,t,this.privateEvents[t])}}},bindLHEEvents:function(){if(!this.getLHE()){return}this.getLHE().exec(function(){BX.removeAllCustomEvents(this.getLHE().oEditor,"OnCtrlEnter");BX.addCustomEvent(this.getLHE().oEditor,"OnCtrlEnter",function(){this.getLHE().oEditor.SaveContent();BX.onCustomEvent(t,"OnButtonClick",["submit"])}.bind(this))}.bind(this));var t=this.getLHEEventNode();BX.addCustomEvent(t,"OnBeforeHideLHE",function(){BX.removeClass(document.documentElement,"bx-ios-fix-frame-focus");if(top&&top["document"]){BX.removeClass(top["document"]["documentElement"],"bx-ios-fix-frame-focus")}BX.onCustomEvent(this.form,"OnUCFormBeforeHide",[this,this.currentEntity])}.bind(this));BX.addCustomEvent(t,"OnAfterHideLHE",function(){if(this.currentEntity!==null){var t=this.currentEntity.getPlaceholder(this.currentEntity.messageId);if(t)BX.hide(t)}BX.onCustomEvent(this.form,"OnUCFormAfterHide",[this,this.currentEntity]);this.stopCheckWriting();this.clear();BX.onCustomEvent(window,"OnUCFeedChanged",[this.id])}.bind(this));BX.addCustomEvent(t,"OnBeforeShowLHE",function(){if(BX.browser.IsIOS()&&BX.browser.IsMobile()){BX.addClass(window["document"]["documentElement"],"bx-ios-fix-frame-focus");if(top&&top["document"])BX.addClass(top["document"]["documentElement"],"bx-ios-fix-frame-focus")}}.bind(this));BX.addCustomEvent(t,"OnAfterShowLHE",function(){this.startCheckWriting();BX.onCustomEvent(window,"OnUCFeedChanged",[this.id])}.bind(this));BX.addCustomEvent(t,"OnClickSubmit",this.submit.bind(this));BX.addCustomEvent(t,"OnClickCancel",this.cancel.bind(this));BX.removeCustomEvent(window,"onInitialized",this.__bindLHEEvents);delete this.__bindLHEEvents},getLHE:function(){if(!this.handler){this.handler=LHEPostForm.getHandlerByFormId(this.formId)}return this.handler},getLHEEventNode:function(){if(!this.handlerEventNode&&this.getLHE()){this.handlerEventNode=this.getLHE().eventNode}return this.handlerEventNode},bindEntity:function(t){if(this.entities.has(t.getId())){BX.onCustomEvent(this.form,"onUnbindEntity",[t]);this.entities.delete(t.getId())}this.entities.set(t.getId(),t);this.xmls.set(t.getXmlId(),t)},onInitEditorFrame:function(t){this.getLHE().exec(function(){BX.addCustomEvent(this.getLHE().oEditor,"OnAfterIframeInit",(()=>{t();BX.removeAllCustomEvents(this.getLHE().oEditor,"OnAfterIframeInit")}))}.bind(this))},onQuote:function(t,e,i,n,s){if(this.isFormOccupied(t)){return}const o=()=>{var t=BX.util.htmlspecialchars(i);if(!this.getLHE().oEditor.toolbar.controls.Quote){BX.DoNothing()}else if(!e&&!i){this.getLHE().oEditor.action.Exec("quote")}else{i=t;var n=e&&e.gender?BX.message("MPL_HAVE_WRITTEN_"+e.gender):BX.message("MPL_HAVE_WRITTEN");if(this.getLHE().oEditor.GetViewMode()=="wysiwyg"){i=i.replace(/\n/g,"<br/>");if(e){if(e.id>0){e='<span id="'+this.getLHE().oEditor.SetBxTag(false,{tag:"postuser",userId:e.id,userName:e.name})+'" class="bxhtmled-metion">'+e.name.replace(/</gi,"<").replace(/>/gi,">")+"</span>"}else{e="<span>"+e.name.replace(/</gi,"<").replace(/>/gi,">")+"</span>"}e=e!==""?e+n+"<br/>":"";i=e+i}}else if(this.getLHE().oEditor.bbCode){if(e){if(e.id>0){e="[USER="+e.id+"]"+e.name+"[/USER]"}else{e=e.name}e=e!==""?e+n+"\n":"";i=e+i}}if(this.getLHE().oEditor.action.actions.quote.setExternalSelectionFromRange){this.getLHE().oEditor.action.actions.quote.setExternalSelectionFromRange();var s=this.getLHE().oEditor.action.actions.quote.getExternalSelection();if(s===""&&t!==""){s=t}s=(BX.type.isNotEmptyString(e)?e:"")+s;if(BX.type.isNotEmptyString(s))this.getLHE().oEditor.action.actions.quote.setExternalSelection(s)}else{this.getLHE().oEditor.action.actions.quote.setExternalSelection(i)}this.getLHE().oEditor.action.Exec("quote")}};if(this.currentEntity){this.show(t);o()}else{this.show(t);this.onInitEditorFrame(o)}},onReply:function(t,e){if(this.isFormOccupied(t)){return}if(this.currentEntity){this.show(t);this.insertMention(e)}else{this.show(t);this.onInitEditorFrame(this.insertMention.bind(this,e))}},onEdit:function(t,e,i,n){if(n==="EDIT"){this.show(t,e,i["messageBBCode"],i["messageFields"]);return}this.hide(true);this.setCurrentEntity(t,e);if(i["errorMessage"]){this.showError(i["errorMessage"])}else if(i["okMessage"]){this.showNote(i["okMessage"]);this.nullCurrentEntity()}},isFormOccupied:function(t){if(this.currentEntity!==null&&this.currentEntity!==t&&this.isFormChanged()){return!window.confirm(BX.message("MPL_SAFE_EDIT"))}return false},isFormChanged:function(){if(this.getLHE()&&this.getLHE().editorIsLoaded&&this.getLHE().oEditor.IsContentChanged()){return true}return false},insertMention:function(t){if(t.id>0){this.getLHE().exec(window.BxInsertMention,[{item:{entityId:t.id,name:t.name},type:"user",formID:this.formId,editorId:this.getLHE().oEditorId,bNeedComa:true,insertHtml:true}])}},startCheckWriting:function(){if(!this.getLHE().editorIsLoaded||this._checkWriteTimeout===false){return}this.__content_length=this.__content_length>0?this.__content_length:0;var t=this.getLHE().oEditor.GetContent(),e=2e3;if(t.length>=4&&this.__content_length!==t.length&&this.id){BX.onCustomEvent(this.form,"OnUCUserIsWriting",[this.currentEntity,{sent:false}]);e=3e4}this._checkWriteTimeout=setTimeout(this.startCheckWriting,e);this.__content_length=t.length},stopCheckWriting:function(){clearTimeout(this._checkWriteTimeout);this._checkWriteTimeout=false;this.__content_length=0},setCurrentEntity:function(t,e){this.currentEntity=t;this.currentEntity.messageId=e;this.currentEntity.operationId=BX.util.getRandomString(20);this.id=[this.currentEntity.getXmlId(),e]},nullCurrentEntity:function(){delete this.currentEntity.messageId;this.currentEntity=null;this.id=null},hide:function(t){if(this.getLHEEventNode()&&this.getLHEEventNode().style.display!=="none"){BX.onCustomEvent(this.getLHEEventNode(),"OnShowLHE",[t===true?false:"hide"])}if(t){document.body.appendChild(this.form)}},clear:function(){var t=this.currentEntity?this.currentEntity.getPlaceholder(this.currentEntity.messageId):null;if(t){BX.hide(t);this.clearNotification(t,"feed-add-error")}BX.onCustomEvent(this.form,"OnUCFormClear",[this]);var e=BX.findChild(this.form,{className:"wduf-placeholder-tbody"},true,false);if(e!==null&&typeof e!="undefined")BX.cleanNode(e,false);e=BX.findChild(this.form,{className:"wduf-selectdialog"},true,false);if(e!==null&&typeof e!="undefined")BX.hide(e);e=BX.findChild(this.form,{className:"file-placeholder-tbody"},true,false);if(e!==null&&typeof e!="undefined")BX.cleanNode(e,false);this.nullCurrentEntity()},show:function(t,e,i,n){e=parseInt(e>0?e:0);var s=t.getPlaceholder(e);if(this.currentEntity===t&&this.currentEntity.messageId===e){this.getLHE().oEditor.Focus();setTimeout(function(){if(!this.isElementCompletelyVisibleOnScreen(s)){s.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})}}.bind(this),100);return true}if(this.getLHEEventNode()&&this.getLHEEventNode().style.display!=="none"&&BX.Dom.getPosition(s).y>BX.Dom.getPosition(this.getLHEEventNode()).y){window.scrollTo(window.scrollX,window.scrollY-this.getLHEEventNode().offsetHeight+10)}this.hide(true);this.setCurrentEntity(t,e);BX.removeClass(s,"feed-com-add-box-no-form");BX.removeClass(s,"feed-com-add-box-header");s.appendChild(this.form);BX.onCustomEvent(this.form,"OnUCFormBeforeShow",[this,i,n]);BX.show(s);BX.onCustomEvent(this.getLHEEventNode(),"OnShowLHE",["show",null,this.id]);BX.onCustomEvent(this.form,"OnUCFormAfterShow",[this,i,n]);return true},isElementCompletelyVisibleOnScreen:function(t){var e=BX.LazyLoad.getElementCoords(t);var i=window.pageYOffset||document.documentElement.scrollTop;var n=i+document.documentElement.clientHeight;e.bottom=e.top+t.offsetHeight;return e.top>i&&e.top<n&&e.bottom<n&&e.bottom>i},onSubmitSuccess:function(t){this.closeWait();var e=t,i=this.id[0];BX.onCustomEvent(this.form,"OnUCFormResponse",[this,t]);if(!!this.OnUCFormResponseData)t=this.OnUCFormResponseData;if(!!t){if(t["errorMessage"]){this.showError(t["errorMessage"])}else if(t["status"]=="error"){this.showError(BX.type.isNotEmptyString(t["message"])?t["message"]:"")}else{BX.onCustomEvent(this.form,"OnUCAfterRecordAdd",[this.id[0],t,e]);this.hide(true)}}this.busy=false;BX.onCustomEvent(window,"OnUCFormResponse",[i,t["messageId"],this,t])},onSubmitFailed:function(t){this.closeWait();if(BX.type.isPlainObject(t)){var e="Unknown error.";if(BX.type.isPlainObject(t["data"])&&BX.type.isPlainObject(t["data"]["ajaxRejectData"])&&BX.type.isNotEmptyString(t["data"]["ajaxRejectData"]["message"])){e=t["data"]["ajaxRejectData"]["message"]}else if(BX.type.isArray(t["errors"])){e=t["errors"].map((function(t){return t.message})).join("<br >")}this.showError(e)}this.busy=false;BX.onCustomEvent(window,"OnUCFormResponse",[this.id[0],this.id[1],this,[]])},submit:function(){if(this.busy===true){return"busy"}var t=this.getLHE().editorIsLoaded?this.getLHE().oEditor.GetContent():"";if(!t){this.showError(BX.message("JERROR_NO_MESSAGE"));return false}this.showWait();this.busy=true;var e={};convertFormToArray(this.form,e);e["REVIEW_TEXT"]=t;e["NOREDIRECT"]="Y";e["MODE"]="RECORD";e["AJAX_POST"]="Y";e["id"]=this.id;e["SITE_ID"]=BX.message("SITE_ID");e["LANGUAGE_ID"]=BX.message("LANGUAGE_ID");e["ACTION"]="ADD";if(this.currentEntity!==null&&this.currentEntity.messageId>0){e["REVIEW_ACTION"]="EDIT";e["FILTER"]={ID:this.id[1]};e["ACTION"]="EDIT";e["ID"]=this.id[1]}BX.onCustomEvent(this.form,"OnUCFormSubmit",[this,e]);BX.onCustomEvent(window,"OnUCFormSubmit",[this.id[0],this.id[1],this,e]);if(this.currentEntity!==null&&this.currentEntity.ajax["processComment"]===true){BX.ajax.runComponentAction(this.currentEntity.ajax.componentName,"processComment",{mode:"class",data:e,signedParameters:this.currentEntity.ajax.params}).then(this.onSubmitSuccess,this.onSubmitFailed)}else{var i=this.form.action;i=BX.util.remove_url_param(i,["b24statAction"]);i=BX.util.add_url_param(i,{b24statAction:this.id[1]>0?"editComment":"addComment"});this.form.action=i;BX.ajax({method:"POST",url:this.form.action,data:e,dataType:"json",onsuccess:this.onSubmitSuccess,onfailure:this.onSubmitFailed})}return false},cancel:function(){},clearNotification:function(t,e){var i=BX.findChildren(t,{tagName:"DIV",className:e},true);if(i){var n=i.pop();do{BX.remove(n)}while((n=i.pop())&&!!n)}},showError:function(t){if(!t||this.currentEntity===null)return;var e=this.currentEntity.getPlaceholder(this.currentEntity.messageId);this.clearNotification(e,"feed-add-error");BX.addClass(e,!e.firstChild?"feed-com-add-box-no-form":"feed-com-add-box-header");e.insertBefore(BX.create("div",{attrs:{class:"feed-add-error"},html:'<span class="feed-add-info-text"><span class="feed-add-info-icon"></span>'+"<b>"+BX.message("FC_ERROR")+"</b><br />"+t+"</span>"}),e.firstChild);BX.show(e)},showNote:function(t){if(!t||this.currentEntity===null)return;var e=this.currentEntity.getPlaceholder(this.currentEntity.messageId);this.clearNotification(e,"feed-add-error");this.clearNotification(e,"feed-add-successfully");BX.addClass(e,!e.firstChild?"feed-com-add-box-no-form":"feed-com-add-box-header");e.insertBefore(BX.create("div",{attrs:{class:"feed-add-successfully"},html:'<span class="feed-add-info-text"><span class="feed-add-info-icon"></span>'+t+"</span>"}),e.firstChild);BX.addClass(e,"comment-deleted");BX.show(e)},showWait:function(){var t=BX("lhe_button_submit_"+this.form.id);this.busy=true;if(!!t){BX.addClass(t,"ui-btn-clock");BX.defer((function(){t.disabled=true}))()}},closeWait:function(){var t=BX("lhe_button_submit_"+this.form.id);this.busy=false;if(!!t){t.disabled=false;BX.removeClass(t,"ui-btn-clock")}}};window.UCForm.bindFormToEntity=function(e,i){var n=t[e]||new UCForm(e);n.bindEntity(i);t[e]=n;return n};window.convertFormToArray=function(t,e){e=!!e?e:[];if(!!t){var i,n=[],s=t.elements.length;for(i=0;i<s;i++){var o=t.elements[i];if(o.disabled)continue;switch(o.type.toLowerCase()){case"text":case"textarea":case"password":case"hidden":case"select-one":n.push({name:o.name,value:o.value});break;case"radio":case"checkbox":if(o.checked)n.push({name:o.name,value:o.value});break;case"select-multiple":for(var r=0;r<o.options.length;r++){if(o.options[r].selected)n.push({name:o.name,value:o.options[r].value})}break;default:break}}var a=e;i=0;while(i<n.length){var d=n[i].name.indexOf("[");if(d==-1){a[n[i].name]=n[i].value;a=e;i++}else{var h=n[i].name.substring(0,d);var u=n[i].name.substring(d+1);if(!a[h])a[h]=[];var c=u.indexOf("]");if(c==-1){a=e;i++}else if(c===0){a=a[h];n[i].name=""+a.length}else{a=a[h];n[i].name=u.substring(0,c)+u.substring(c+1)}}}}return e};window["fRefreshCaptcha"]=function(t){var e=null,i=BX.findChild(t,{attr:{name:"captcha_code"}},true),n=BX.findChild(t,{attr:{name:"captcha_word"}},true),s=BX.findChild(t,{className:"comments-reply-field-captcha-image"},true);if(s)e=BX.findChild(s,{tag:"img"});if(i&&n&&e){n.value="";BX.ajax.getCaptcha((function(t){i.value=t["captcha_sid"];e.src="/bitrix/tools/captcha.php?captcha_code="+t["captcha_sid"]}))}}})(); //# sourceMappingURL=scripts_for_form2.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings