File manager - Edit - /home/web/vm-3fadc827.na4u.ru/www/bitrix/modules/socialnetwork/install/js/socialnetwork/content_view.min.js
Back
(function(){var e=window.BX;if(e.UserContentView){return}e.UserContentView={mobile:false,context:"",pathToUserProfile:"",inited:false,viewAreaSentList:[],viewAreaTimePeriodAvg:1500,viewAreaTimePeriodAvgMobile:50,sendViewAreaTimeout:5e3,failedSetTimeout:10*60*1e3,commentsContainerId:null,commentsClassName:"feed-com-text-inner",commentsFullContentClassName:"feed-com-text-inner-inner",currentPopupId:null,popupList:{},toSendList:[],ignoreCurrentUserLive:[],viewAreaReadList:{},observer:null,checkerMap:null,viewAreaMap:null,ajaxSent:false,failedAjaxCounter:0,failedAjaxLimit:10};e.UserContentView.clear=function(){this.viewAreaMap=new WeakMap};e.UserContentView.init=function(t){if(this.inited){return}if((e.message("USER_ID")?parseInt(e.message("USER_ID")):0)<=0){return}if(e.type.isPlainObject(t)){if(e.type.isBoolean(t.mobile)){this.mobile=t.mobile}if(e.type.isNotEmptyString(t.context)){this.context=t.context}if(e.type.isNotEmptyString(t.commentsContainerId)){this.commentsContainerId=t.commentsContainerId}if(e.type.isNotEmptyString(t.commentsClassName)){this.commentsClassName=t.commentsClassName}if(e.type.isNotEmptyString(t.commentsFullContentClassName)){this.commentsFullContentClassName=t.commentsFullContentClassName}}var i={rootMargin:this.mobile?"0%":"-10% 0% -10% 0%",threshold:.1};this.observer=new IntersectionObserver(this.onIntersection.bind(this),i);this.checkerMap=new WeakMap;this.viewAreaMap=new WeakMap;this.viewAreaReadList={};this.inited=true;if(e.browser.SupportLocalStorage()){var n=e.localStorage.get("viewedContent");if(e.type.isArray(n)){this.viewAreaSentList=n}}e.addCustomEvent(window,"OnUCRecordHasDrawn",e.delegate(this.onUCRecordHasDrawn,this));e.addCustomEvent(window,"OnUCListWasShown",e.delegate(this.OnUCListWasShown,this));if(this.mobile){e.addCustomEvent(window,"OnUCHasBeenInitialized",e.delegate(this.OnUCHasBeenInitializedMobile,this));this.sendViewAreaTimeout=1500}setTimeout(e.delegate(this.sendViewAreaData,this),this.sendViewAreaTimeout)};e.UserContentView.getXmlId=function(e){return e.getAttribute("bx-content-view-xml-id")};e.UserContentView.getSaveValue=function(e){var t=e.getAttribute("bx-content-view-key");var i=e.getAttribute("bx-content-view-key-signed");return{key:t?t:"",signedKey:i?i:"",value:e.getAttribute("bx-content-view-save")!="N"?"Y":"N"}};e.UserContentView.getReadStatus=function(t){return e.type.isNotEmptyString(t)&&e(t)&&this.viewAreaReadList.hasOwnProperty(t)};e.UserContentView.setRead=function(t){var i=this.getXmlId(t);if(e.type.isNotEmptyString(i)&&!this.getReadStatus(i)){this.viewAreaReadList[i]=this.getSaveValue(t);var n={xmlId:i};e.onCustomEvent(window,"BX.UserContentView.onSetRead",[n]);if(typeof BXMobileApp!="undefined"&&e.type.isNotEmptyObject(BXMobileApp)){BXMobileApp.onCustomEvent("BX.UserContentView.onSetRead",n,true)}}};e.UserContentView.sendViewAreaData=function(){this.toSendList=[];for(var t in this.viewAreaReadList){if(!this.viewAreaReadList.hasOwnProperty(t)||e.util.in_array(t,this.viewAreaSentList)){continue}this.toSendList.push({xmlId:t,save:this.viewAreaReadList[t].value,key:this.viewAreaReadList[t].key,signedKey:this.viewAreaReadList[t].signedKey})}if(this.failedAjaxCounter>=this.failedAjaxLimit){setTimeout(function(){this.failedAjaxCounter=0}.bind(this),this.failedSetTimeout)}else if(this.toSendList.length>0&&!this.ajaxSent){this.ajaxSent=true;var i=!!this.mobile?new MobileAjaxWrapper:e.ajax;i.runAction("socialnetwork.api.contentview.set",{data:{params:{viewXMLIdList:this.toSendList,context:this.context}}}).then(function(e){this.ajaxSent=false;this.failedAjaxCounter=0;this.success(e.data)}.bind(this),function(e){this.ajaxSent=false;this.failedAjaxCounter++}.bind(this))}setTimeout(this.sendViewAreaData.bind(this),this.sendViewAreaTimeout)};e.UserContentView.success=function(t){if(e.type.isNotEmptyString(t.SUCCESS)&&t.SUCCESS=="Y"){for(i=0,length=this.toSendList.length;i<length;i++){this.viewAreaSentList.push(this.toSendList[i].xmlId)}if(e.browser.SupportLocalStorage()){e.localStorage.set("viewedContent",this.viewAreaSentList,86400)}}};e.UserContentView.registerViewArea=function(t){if(e.type.isNotEmptyString(t)&&e(t)&&this.viewAreaMap&&!this.viewAreaMap.has(e(t))){this.observer.observe(e(t))}};e.UserContentView.onUCRecordHasDrawn=function(t,i,n){if(typeof n=="undefined"||typeof n.ACTION=="undefined"||typeof i=="undefined"){return}if(n.ACTION=="REPLY"){var s=e.delegate((function(){this.onUCRecordHasDrawnFunc(i)}),this);var o=e.debounce(e.delegate((function(){e.unbind(document,"mousemove",o);s()}),this),100,this);var a=e.delegate((function(){BXMobileApp.UI.Page.isVisible({callback:function(e){if(e&&e.status=="visible"){s()}else{setTimeout(a,50)}}})}),this);if(this.mobile){setTimeout(a,50)}else{e.bind(document,"mousemove",o)}}};e.UserContentView.onUCRecordHasDrawnFunc=function(t){var i="record-"+t.join("-");if(e(i)){var n=e.findChild(e(i),{tag:"div",className:this.commentsClassName},true);if(n&&e.type.isNotEmptyString(n.id)){e.UserContentView.registerViewArea(n.id)}}};e.UserContentView.OnUCListWasShown=function(t,i,n){var s=e.findChildren(n,{tag:"div",className:this.commentsClassName},true);for(var o in s){if(!s.hasOwnProperty(o)){continue}if(e.type.isNotEmptyString(s[o].id)){this.registerViewArea(s[o].id)}}};e.UserContentView.OnUCHasBeenInitializedMobile=function(e,t){this.registerViewAreaList({containerId:this.commentsContainerId,className:this.commentsClassName,fullContentClassName:this.commentsFullContentClassName})};e.UserContentView.registerViewAreaList=function(t){if(!e.type.isNotEmptyObject(t)||!e.type.isNotEmptyString(t.containerId)||!e.type.isNotEmptyString(t.className)||!e(t.containerId)){return}var i=e.findChildren(e(t.containerId),{tag:"div",className:t.className},true);for(var n in i){if(!i.hasOwnProperty(n)){continue}if(e.type.isNotEmptyString(i[n].id)){this.registerViewArea(i[n].id)}}};e.UserContentView.liveUpdate=function(t){if(e.type.isNotEmptyString(t.CONTENT_ID)&&e.util.in_array(t.CONTENT_ID,e.UserContentView.ignoreCurrentUserLive)&&typeof t.USER_ID!="undefined"&&parseInt(t.USER_ID)>0&&parseInt(t.USER_ID)==parseInt(e.message("USER_ID"))){return}var i=e("feed-post-contentview-cnt-"+t.CONTENT_ID);var n=e("feed-post-contentview-cnt-wrap-"+t.CONTENT_ID);if(i&&n){var s=e.create("SPAN",{props:{className:"feed-content-view-plus-one"},style:{width:n.clientWidth-8+"px",height:n.clientHeight-8+"px"},html:"1"});n.insertBefore(s,n.firstChild);setTimeout((function(){i.innerHTML=parseInt(i.innerHTML)+1}),500);setTimeout((function(){e.cleanNode(s,true)}),2e3)}};e.UserContentView.onIntersection=function(t){t.forEach(function(t){if(t.isIntersecting){var i=this.getXmlId(t.target);if(!e.type.isNotEmptyString(i)||this.getReadStatus(i)){return}if(!this.checkerMap.has(t.target)){this.checkerMap.set(t.target,true)}setTimeout(function(){if(e.UserContentView.checkerMap.has(this)){e.UserContentView.setRead(this)}}.bind(t.target),this.mobile?this.viewAreaTimePeriodAvgMobile:this.viewAreaTimePeriodAvg)}else{if(this.checkerMap.has(t.target)){this.checkerMap.delete(t.target)}}}.bind(this))};e.UserContentView.Counter=function(){this.contentId=null;this.nodeId=null;this.node=null;this.popup=null;this.popupTimeoutId=null;this.popupContent=null;this.hiddenCountNode=null;this.popupContentPage=1;this.popupShownIdList=[];this.pathToUserProfile="";this.mouseLeaveTimeoutId=null;this.listXHR=null};e.UserContentView.Counter.prototype.init=function(t){this.contentId=t.contentId;this.nodeId=t.nodeId;if(this.nodeId){this.node=e(this.nodeId);this.popupContent=e.findChild(e("bx-contentview-cnt-popup-cont-"+this.contentId),{tagName:"span",className:"bx-contentview-popup"},true,false)}if(e.type.isNotEmptyString(t.pathToUserProfile)){this.pathToUserProfile=t.pathToUserProfile}if(e.type.isNotEmptyString(t.isSet)&&t.isSet=="Y"&&!e.util.in_array(this.contentId,e.UserContentView.ignoreCurrentUserLive)){e.UserContentView.ignoreCurrentUserLive.push(this.contentId)}if(typeof e.PULL!="undefined"){e.PULL.extendWatch("CONTENTVIEW"+this.contentId)}this.popupScroll();e.bind(this.node,"mouseover",e.delegate((function(){if(this.popup!==null&&this.popup.isShown()){return}clearTimeout(this.popupTimeoutId);this.popupContentPage=1;e.cleanNode(this.popupContent);this.popupContent.appendChild(e.create("SPAN",{props:{className:"bx-contentview-wait"}}));this.popupTimeoutId=setTimeout(e.delegate((function(){if(e.UserContentView.currentPopupId==this.contentId){return false}if(this.popupContentPage==1){this.list({page:1})}this.popupTimeoutId=setTimeout(e.delegate((function(){this.openPopup()}),this),400)}),this),400)}),this));e.bind(this.node,"mouseout",e.delegate((function(){clearTimeout(this.popupTimeoutId)}),this));e.bind(this.node,"click",e.delegate((function(){clearTimeout(this.popupTimeoutId);if(this.popupContentPage==1){this.list({page:1})}this.openPopup()}),this))};e.UserContentView.Counter.prototype.list=function(t){if(this.listXHR){this.listXHR.abort()}var i=t.page;if(parseInt(this.node.innerHTML)==0){return false}if(i==null){i=this.popupContentPage}if(i==1){this.popupShownIdList=[]}e.ajax.runAction("socialnetwork.api.contentview.getlist",{data:{params:{contentId:this.contentId,pathToUserProfile:this.pathToUserProfile,page:i}},onrequeststart:function(e){this.listXHR=e}.bind(this)}).then(function(t){var n=t.data;if(!n||parseInt(n.itemsCount)<=0&&parseInt(n.hiddenCount)<=0){return false}if(i==1){this.popupContent.innerHTML=""}this.popupContentPage+=1;var s=null;for(var o in n.items){if(!n.items.hasOwnProperty(o)||e.util.in_array(n.items[o]["ID"],this.popupShownIdList)){continue}this.popupShownIdList.push(n.items[o]["ID"]);if(e.type.isNotEmptyString(n.items[o]["PHOTO_SRC"])){s=e.create("IMG",{attrs:{src:n.items[o]["PHOTO_SRC"]},props:{className:"bx-contentview-popup-avatar-img"}})}else{s=e.create("IMG",{attrs:{src:"/bitrix/images/main/blank.gif"},props:{className:"bx-contentview-popup-avatar-img bx-contentview-popup-avatar-img-default"}})}this.popupContent.appendChild(e.create("A",{attrs:{href:n.items[o]["URL"],target:"_blank",title:n.items[o]["DATE_VIEW_FORMATTED"]},props:{className:"bx-contentview-popup-img"+(!!n.items[o]["TYPE"]?" bx-contentview-popup-img-"+n.items[o]["TYPE"]:"")},children:[e.create("SPAN",{props:{className:"bx-contentview-popup-avatar-new"},children:[s,e.create("SPAN",{props:{className:"bx-contentview-popup-avatar-status-icon"}})]}),e.create("SPAN",{props:{className:"bx-contentview-popup-name-new"},html:n.items[o]["FULL_NAME"]})]}))}if(parseInt(n.hiddenCount)>0){e.cleanNode(this.hiddenCountNode,true);this.hiddenCountNode=e.create("SPAN",{props:{className:"bx-contentview-popup-name-new contentview-counter-hidden"},html:e.message("SONET_CONTENTVIEW_JS_HIDDEN_COUNT").replace("#CNT#",n.hiddenCount)});this.popupContent.appendChild(this.hiddenCountNode)}this.adjustWindow();this.popupScroll()}.bind(this),function(e){}.bind(this));return false};e.UserContentView.Counter.prototype.openPopup=function(){if(parseInt(this.node.innerHTML)==0){return false}if(this.popup==null){this.popup=new e.PopupWindow("contentview-popup-"+this.contentId,this.node,{lightShadow:true,offsetLeft:-22,autoHide:true,closeByEsc:true,zIndex:2005,bindOptions:{position:"top"},animationOptions:{show:{type:"opacity-transform"},close:{type:"opacity"}},events:{onPopupClose:function(){e.UserContentView.currentPopupId=null},onPopupDestroy:function(){}},content:e("bx-contentview-cnt-popup-cont-"+this.contentId),className:"popup-window-contentview"});e.UserContentView.popupList[this.contentId]=this.popup;e.bind(e("contentview-popup-"+this.contentId),"mouseout",e.delegate((function(){clearTimeout(this.popupTimeout);this.popupTimeout=setTimeout(e.delegate((function(){this.popup.close()}),this),1e3)}),this));e.bind(e("contentview-popup-"+this.contentId),"mouseover",e.delegate((function(){clearTimeout(this.popupTimeout);clearTimeout(this.mouseLeaveTimeoutId)}),this));e.bind(this.node,"mouseleave",e.delegate((function(){this.mouseLeaveTimeoutId=setTimeout(e.delegate((function(){this.popup.close()}),this),1e3)}),this))}if(e.UserContentView.currentPopupId!=null){e.UserContentView.popupList[e.UserContentView.currentPopupId].close()}e.UserContentView.currentPopupId=this.contentId;this.popup.show();this.adjustWindow()};e.UserContentView.Counter.prototype.popupScroll=function(){e.bind(this.popupContent,"scroll",e.delegate((function(){var t=e.proxy_context;if(t.scrollTop>(t.scrollHeight-t.offsetHeight)/1.5){this.list({page:null});e.unbindAll(t)}}),this))};e.UserContentView.Counter.prototype.adjustWindow=function(){if(this.popup!=null){this.popup.bindOptions.forceBindPosition=true;this.popup.adjustPosition();this.popup.bindOptions.forceBindPosition=false}};e.addCustomEvent(window,"BX.UserContentView.onInitCall",e.delegate(e.UserContentView.init,e.UserContentView));e.addCustomEvent(window,"BX.UserContentView.onRegisterViewAreaListCall",e.delegate(e.UserContentView.registerViewAreaList,e.UserContentView));e.addCustomEvent(window,"BX.UserContentView.onClearCall",e.delegate(e.UserContentView.clear,e.UserContentView));e.addCustomEvent("onPullEvent-contentview",(function(t,i){if(t=="add"){e.UserContentView.liveUpdate(i)}}))})(); //# sourceMappingURL=content_view.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings