File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/components/bitrix/main.post.list/templates/.default/scripts_for_form.min.js
Back
(function(){window["UC"]=window["UC"]||{};if(!!window["FCForm"])return;window.FCForm=function(e){this.url="";this.lhe="";this.entitiesId={};this.form=BX(e["formId"]);this.handler=window.LHEPostForm.getHandler(e["editorId"]);this.editorName=e["editorName"];this.editorId=e["editorId"];this.windowEvents={OnUCUnlinkForm:BX.delegate(function(e){if(!!e&&!!this.entitiesId[e]){var t={},i=true;for(var s in this.entitiesId){if(this.entitiesId.hasOwnProperty(s)&&s!=e){i=false;t[s]=this.entitiesId[s]}}this.entitiesId=t;if(i&&!!this.windowEvents){for(s in this.windowEvents){if(this.windowEvents.hasOwnProperty(s)&&s)BX.removeCustomEvent(window,s,this.windowEvents[s])}this.windowEventsSet=false}}},this),OnUCQuote:BX.delegate(function(e,t,i){if(!this.entitiesId[e]||!this._checkTextSafety([e,0])){return}this.show([e,0]);var s=0;var n=function(){s++;if(s>10){return}if(!this.handler.oEditor||!this.handler.oEditor.action){return setTimeout(n,10)}if(!this.handler.oEditor.toolbar.controls.Quote){return}if(!t&&!i){return this.handler.oEditor.action.Exec("quote")}var e="";if(t){e=t.gender?BX.message("MPL_HAVE_WRITTEN_"+t.gender):BX.message("MPL_HAVE_WRITTEN");if(this.handler.oEditor.GetViewMode()==="wysiwyg"){if(t.id>0){t='<span id="'+this.handler.oEditor.SetBxTag(false,{tag:"postuser",userId:t.id,userName:t.name})+'" class="bxhtmled-metion">'+t.name.replace(/</gi,"<").replace(/>/gi,">")+"</span>"}else{t="<span>"+t.name.replace(/</gi,"<").replace(/>/gi,">")+"</span>"}e=t+e+"<br/>"}else if(this.handler.oEditor.bbCode){if(t.id>0){t="[USER="+t.id+"]"+t.name+"[/USER]"}else{t=t.name}e=t!==""?t+e+"\n":""}}if(this.handler.oEditor.action.actions.quote.setExternalSelectionFromRange){this.handler.oEditor.action.actions.quote.setExternalSelectionFromRange();var o=this.handler.oEditor.action.actions.quote.getExternalSelection();if(o===""&&i!==""){o=i}o=e+o;if(BX.type.isNotEmptyString(o)){this.handler.oEditor.action.actions.quote.setExternalSelection(o)}}else{this.handler.oEditor.action.actions.quote.setExternalSelection(i)}this.handler.oEditor.action.Exec("quote")}.bind(this);this.handler.exec(n)},this),OnUCReply:function(e,t,i,s,n){if(!this.entitiesId[e]||!this._checkTextSafety([e,0])||n.caught===true){return false}n.caught=true;this.show([e,0]);if(t>0){this.handler.exec(window.BxInsertMention,[{item:{entityId:t,name:i},type:"user",formID:this.form.id,editorId:this.editorId,bNeedComa:true,insertHtml:true}])}}.bind(this),OnUCAfterRecordEdit:BX.delegate(function(e,t,i,s){if(!!this.entitiesId[e]){if(s==="EDIT"){this.show([e,t],i["messageBBCode"],i["messageFields"]);this.editing=true}else{this.hide(true);if(!!i["errorMessage"]){this.id=[e,t];this.showError(i["errorMessage"])}else if(!!i["okMessage"]){this.id=[e,t];this.showNote(i["okMessage"]);this.id=null}}}},this)};this.linkEntity(e["entitiesId"]);BX.remove(BX("micro"+e["editorName"]));BX.remove(BX("micro"+e["editorId"]));this.eventNode=this.handler.eventNode;if(this.eventNode){BX.addCustomEvent(this.eventNode,"OnBeforeHideLHE",BX.delegate(function(){BX.removeClass(document.documentElement,"bx-ios-fix-frame-focus");if(top&&top["document"])BX.removeClass(top["document"]["documentElement"],"bx-ios-fix-frame-focus");if(!!this.id&&!!BX("uc-writing-"+this.form.id+"-"+this.id[0]+"-area")){BX.hide(BX("uc-writing-"+this.form.id+"-"+this.id[0]+"-area"))}},this));BX.addCustomEvent(this.eventNode,"OnAfterHideLHE",BX.delegate(function(){var e=this._getPlacehoder();if(e){BX.hide(e)}e=this._getSwitcher();if(e){BX.show(e);BX.focus(e.firstChild)}this.__content_length=0;if(!!this.id){BX.onCustomEvent(this.eventNode,"OnUCFormAfterHide",[this])}clearTimeout(this._checkWriteTimeout);this._checkWriteTimeout=0;this.clear();BX.onCustomEvent(window,"OnUCFeedChanged",[this.id])},this));BX.addCustomEvent(this.eventNode,"OnBeforeShowLHE",BX.delegate(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")}var e=this._getPlacehoder();if(e){BX.removeClass(e,"feed-com-add-box-no-form");BX.removeClass(e,"feed-com-add-box-header");BX.show(e)}e=this._getSwitcher();if(e){BX.hide(e)}if(!!this.id&&!!BX("uc-writing-"+this.form.id+"-"+this.id[0]+"-area")){BX.hide(BX("uc-writing-"+this.form.id+"-"+this.id[0]+"-area"))}},this));BX.addCustomEvent(this.eventNode,"OnAfterShowLHE",function(e,t){this._checkWrite(e,t);BX.onCustomEvent(window,"OnUCFeedChanged",[this.id])}.bind(this));BX.addCustomEvent(this.eventNode,"OnClickSubmit",BX.delegate(this.submit,this));BX.addCustomEvent(this.eventNode,"OnClickCancel",BX.delegate(this.cancel,this));BX.onCustomEvent(this.eventNode,"OnUCFormInit",[this])}this.id=null;this.jsCommentId=null;BX.addCustomEvent(window,"OnImageDataUriHandle",BX.delegate(this.showWait,this));BX.addCustomEvent(window,"OnImageDataUriCaughtUploaded",BX.delegate(this.closeWait,this));BX.addCustomEvent(window,"OnImageDataUriCaughtFailed",BX.delegate(this.closeWait,this))};window.FCForm.prototype={linkEntity:function(e){if(!!e){for(var t in e){if(e.hasOwnProperty(t)){BX.onCustomEvent(window,"OnUCUnlinkForm",[t]);this.entitiesId[t]=e[t]}}}if(!this.windowEventsSet&&!!this.entitiesId){BX.addCustomEvent(window,"OnUCUnlinkForm",this.windowEvents.OnUCUnlinkForm);BX.addCustomEvent(window,"OnUCReply",BX.debounce(this.windowEvents.OnUCReply,10));BX.addCustomEvent(window,"OnUCQuote",BX.debounce(this.windowEvents.OnUCQuote,10));BX.addCustomEvent(window,"OnUCAfterRecordEdit",this.windowEvents.OnUCAfterRecordEdit);this.windowEventsSet=true}},_checkTextSafety:function(e){if(this.id&&this.id.join("-")!==e.join("-")&&this.handler.editorIsLoaded&&this.handler.oEditor.IsContentChanged()){return window.confirm(BX.message("MPL_SAFE_EDIT"))}return true},_checkWrite:function(){if(this.handler.editorIsLoaded&&this._checkWriteTimeout!==false){this.__content_length=this.__content_length>0?this.__content_length:0;var e=this.handler.oEditor.GetContent(),t=2e3;if(e.length>=4&&this.__content_length!=e.length&&!!this.id){BX.onCustomEvent(window,"OnUCUserIsWriting",[this.id[0],{sent:false}]);t=3e4}this._checkWriteTimeout=setTimeout(this._checkWrite.bind(this),t);this.__content_length=e.length}},_getPlacehoder:function(e){e=!!e?e:this.id;return!!e?BX("record-"+e.join("-")+"-placeholder"):null},_getSwitcher:function(e){e=!!e?e:this.id;return!!e?BX("record-"+e[0]+"-switcher"):null},hide:function(e){if(this.eventNode.style.display!="none"){BX.onCustomEvent(this.eventNode,"OnShowLHE",[e===true?false:"hide"])}if(e){document.body.appendChild(this.form)}},clear:function(){this.editing=false;var e=this._getPlacehoder();if(!!e)BX.hide(e);this.clearNotification(e,"feed-add-error");BX.onCustomEvent(this.eventNode,"OnUCFormClear",[this]);var t=BX.findChild(this.form,{className:"wduf-placeholder-tbody"},true,false);if(t!==null&&typeof t!="undefined")BX.cleanNode(t,false);t=BX.findChild(this.form,{className:"wduf-selectdialog"},true,false);if(t!==null&&typeof t!="undefined")BX.hide(t);t=BX.findChild(this.form,{className:"file-placeholder-tbody"},true,false);if(t!==null&&typeof t!="undefined")BX.cleanNode(t,false);this.id=null;this.jsCommentId=null},show:function(e,t,i){if(this.id&&!!e&&this.id.join("-")==e.join("-")){var s=this._getPlacehoder(e);this.handler.oEditor.Focus();setTimeout(function(){var e=BX.pos(s);var t=BX.GetWindowSize(document);if(t.scrollTop>e.top){s.scrollIntoView()}else if(t.scrollTop+t.innerHeight<e.top){s.scrollIntoView(false)}},100);return true}else{this.hide(true)}this.id=e;this.jsCommentId=BX.util.getRandomString(20);var n=this._getPlacehoder();BX.removeClass(n,"feed-com-add-box-no-form");BX.removeClass(n,"feed-com-add-box-header");n.appendChild(this.form);BX.onCustomEvent(this.eventNode,"OnUCFormBeforeShow",[this,t,i]);BX.onCustomEvent(this.eventNode,"OnShowLHE",["show",null,this.id]);BX.onCustomEvent(this.eventNode,"OnUCFormAfterShow",[this,t,i]);return true},submit:function(){if(this.busy===true)return"busy";var e=this.handler.editorIsLoaded?this.handler.oEditor.GetContent():"";if(!e){this.showError(BX.message("JERROR_NO_MESSAGE"));return false}this.showWait();this.busy=true;var t={};window.convertFormToArray(this.form,t);t["REVIEW_TEXT"]=e;t["NOREDIRECT"]="Y";t["MODE"]="RECORD";t["AJAX_POST"]="Y";t["id"]=this.id;if(this.jsCommentId!==null)t["COMMENT_EXEMPLAR_ID"]=this.jsCommentId;t["SITE_ID"]=BX.message("SITE_ID");t["LANGUAGE_ID"]=BX.message("LANGUAGE_ID");t["ACTION"]="ADD";if(this.editing===true){t["REVIEW_ACTION"]="EDIT";t["FILTER"]={ID:this.id[1]};t["ACTION"]="EDIT";t["ID"]=this.id[1]}BX.onCustomEvent(this.eventNode,"OnUCFormSubmit",[this,t]);BX.onCustomEvent(window,"OnUCFormSubmit",[this.id[0],this.id[1],this,t]);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:t,dataType:"json",onsuccess:BX.proxy(function(e){this.closeWait();var t=e,i=this.id[0];BX.onCustomEvent(this.eventNode,"OnUCFormResponse",[this,e]);if(!!this.OnUCFormResponseData)e=this.OnUCFormResponseData;if(!!e){if(e["errorMessage"]){this.showError(e["errorMessage"])}else if(e["status"]=="error"){this.showError(BX.type.isNotEmptyString(e["message"])?e["message"]:"")}else{BX.onCustomEvent(window,"OnUCAfterRecordAdd",[this.id[0],e,t]);this.hide(true)}}this.busy=false;BX.onCustomEvent(window,"OnUCFormResponse",[i,e["messageId"],this,e])},this),onfailure:BX.delegate(function(){this.closeWait();this.busy=false;BX.onCustomEvent(window,"OnUCFormResponse",[this.id[0],this.id[1],this,[]])},this)})},cancel:function(){},clearNotification:function(e,t){var i=BX.findChildren(e,{tagName:"DIV",className:t},true);if(!!i){var s=i.pop();do{BX.remove(s);BX.remove(s)}while((s=i.pop())&&!!s)}},showError:function(e){if(!e)return;var t=this._getPlacehoder();this.clearNotification(t,"feed-add-error");BX.addClass(t,!t.firstChild?"feed-com-add-box-no-form":"feed-com-add-box-header");t.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 />"+e+"</span>"}),t.firstChild);BX.show(t)},showNote:function(e){if(!e)return;var t=this._getPlacehoder();this.clearNotification(t,"feed-add-error");this.clearNotification(t,"feed-add-successfully");BX.addClass(t,!t.firstChild?"feed-com-add-box-no-form":"feed-com-add-box-header");t.insertBefore(BX.create("div",{attrs:{class:"feed-add-successfully"},html:'<span class="feed-add-info-text"><span class="feed-add-info-icon"></span>'+e+"</span>"}),t.firstChild);BX.addClass(t,"comment-deleted");BX.show(t)},showWait:function(){var e=BX("lhe_button_submit_"+this.form.id);this.busy=true;if(!!e){BX.addClass(e,"ui-btn-clock");BX.defer(function(){e.disabled=true})()}},closeWait:function(){var e=BX("lhe_button_submit_"+this.form.id);this.busy=false;if(!!e){e.disabled=false;BX.removeClass(e,"ui-btn-clock")}}};window.convertFormToArray=function(e,t){t=!!t?t:[];if(!!e){var i,s=[],n=e.elements.length;for(i=0;i<n;i++){var o=e.elements[i];if(o.disabled)continue;switch(o.type.toLowerCase()){case"text":case"textarea":case"password":case"hidden":case"select-one":s.push({name:o.name,value:o.value});break;case"radio":case"checkbox":if(o.checked)s.push({name:o.name,value:o.value});break;case"select-multiple":for(var d=0;d<o.options.length;d++){if(o.options[d].selected)s.push({name:o.name,value:o.options[d].value})}break;default:break}}var r=t;i=0;while(i<s.length){var a=s[i].name.indexOf("[");if(a==-1){r[s[i].name]=s[i].value;r=t;i++}else{var h=s[i].name.substring(0,a);var l=s[i].name.substring(a+1);if(!r[h])r[h]=[];var c=l.indexOf("]");if(c==-1){r=t;i++}else if(c===0){r=r[h];s[i].name=""+r.length}else{r=r[h];s[i].name=l.substring(0,c)+l.substring(c+1)}}}}return t};window["fRefreshCaptcha"]=function(e){var t=null,i=BX.findChild(e,{attr:{name:"captcha_code"}},true),s=BX.findChild(e,{attr:{name:"captcha_word"}},true),n=BX.findChild(e,{className:"comments-reply-field-captcha-image"},true);if(n)t=BX.findChild(n,{tag:"img"});if(i&&s&&t){s.value="";BX.ajax.getCaptcha(function(e){i.value=e["captcha_sid"];t.src="/bitrix/tools/captcha.php?captcha_code="+e["captcha_sid"]})}}})(); //# sourceMappingURL=scripts_for_form.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings