Your IP : 18.222.108.185


Current Path : /var/www/u0635749/data/www/hobbyclick.ru/public/bitrix/js/sender/stat/
Upload File :
Current File : /var/www/u0635749/data/www/hobbyclick.ru/public/bitrix/js/sender/stat/script.min.js

(function(t){if(!t.BX){t.BX={}}if(!t.BX.Sender){t.BX.Sender={}}if(t.BX.Sender.Statistics){return}BX.Sender.Statistics=function(){};BX.Sender.Statistics.prototype={filters:[],blocks:[],filterUrl:"/bitrix/admin/sender_statistics.php",onResponseData:function(t){BX.onCustomEvent(this,"onDataLoad",[t])},onScroll:function(){this.callBlockFunction("onScroll")},callBlockFunction:function(t,e){e=e||{};this.blocks.forEach(function(i){i[t](e)},this)},getFilterQueryData:function(){var t={};this.filters.forEach(function(e){if(!e.value){return}t[e.name]=e.value});return t},filter:function(){BX.onCustomEvent(this,"onDataRequest",[]);var t=this.getFilterQueryData();t.action="getData";t.sessid=BX.bitrix_sessid();BX.ajax({url:this.filterUrl,method:"POST",data:t,dataType:"json",onsuccess:BX.proxy(this.onResponseData,this)})},getFilter:function(t){var e=this.filters.filter(function(e){return e.name==t});return e.length>0?e[0]:null},addBlocks:function(t){t.forEach(function(t){var e="StatisticsBlock"+t;if(!BX.Sender.hasOwnProperty(e)){throw new Error('Class "BX.Sender.'+e+'" not found for block "'+t+'"')}var i=new BX.Sender[e];this.blocks.push(i)},this)},addFilters:function(t){t.forEach(function(t){t.caller=this;t.onFilter=BX.proxy(this.filter,this);this.filters.push(new BX.Sender.StatisticsFilter(t))},this)},init:function(e){this.mess=e.mess;this.context=e.context;var i=e;i.caller=this;this.callBlockFunction("onInit",i);BX.bind(t,"scroll",BX.throttle(this.onScroll.bind(this),350))}};var e=function(e){this.load=function(t){this.nameTemplate=t.nameTemplate;this.pathToUserProfile=t.pathToUserProfile;this.actionUrl=t.actionUrl;this.instance=new BX.Sender.Statistics;this.instance.filterUrl=this.actionUrl;this.instance.addBlocks(this.getBlocks(t));this.instance.addFilters(this.getFilters(t));this.instance.init(t)};this.getBlocks=function(t){return["Counters","ClickMap"]};this.getFilters=function(e){var i=e.chainList.map(function(t){return{id:t.ID,title:t.NAME,className:"bx-sender-stat-popup-item-chain",text:""+'<span class="bx-sender-stat-popup-item-chain-date">'+BX.util.htmlspecialchars(t.DATE_SENT_FORMATTED)+"</span>"+'<span class="bx-sender-stat-popup-item-chain-name">'+BX.util.htmlspecialchars(t.NAME)+"</span>"}},this);i.push({delimiter:true});i.push({id:"all",text:e.mess.allPostings,onclick:BX.proxy(function(){var e="/bitrix/admin/sender_mailing_chain_admin.php";e+="?MAILING_ID="+parseInt(this.instance.getFilter("mailingId").value);t.location.href=e},this)});return[{name:"letterId",value:e.chainId,node:BX("sender_stat_filter_chain_id"),items:[]},{name:"mailingId",value:e.mailingId},{name:"postingId",value:e.postingId}]}};BX.Sender.PostingsStats=new e;var i=function(t){this.load=function(t){this.instance=new BX.Sender.Statistics;this.instance.addBlocks(this.getBlocks(t));this.instance.addFilters(this.getFilters(t));this.instance.init(t)};this.getBlocks=function(t){return["Counters","Efficiency","ChainList","CountersDynamic"]};this.getFilters=function(t){return t.filters.map(function(t){var e=t.list.map(function(t){var e=BX.util.htmlspecialchars(t.NAME||"");return{id:t.ID,text:e,title:e}},this);return{name:t.name,value:t.value,node:BX("sender_stat_filter_"+t.name.toLowerCase()),items:e}},this)}};BX.Sender.GlobalStats=new i;BX.Sender.StatisticsFilter=function(t){this.caller=t.caller;this.name=t.name;this.value=t.value;this.node=t.node||null;this.items=t.items||null;this.onFilter=t.onFilter||null;this.popup=null;if(this.node){BX.bind(this.node,"click",BX.proxy(this.show,this))}if(this.items){this.items.filter(function(t){var e=this.value==""||this.value===null?"all":this.value;return e==t.id},this).forEach(this.setCurrentItem,this)}};BX.Sender.StatisticsFilter.prototype={show:function(){if(!this.popup){var t=this.items.map(function(t){if(!t.onclick){t.onclick=BX.proxy(this.onClick,this)}return t},this);this.popup=this.createPopup("sender_stat_filter_"+this.name,this.node,t)}if(this.popup.show){this.popup.show()}else{this.popup.popupWindow.show()}},setCurrentItem:function(t){if(!this.node){return}this.node.innerText=t.title;this.value=t.id},onClick:function(t,e){this.setCurrentItem(e);this.popup.close();if(this.onFilter){this.onFilter()}},createPopup:function(t,e,i,a){a=a||{};return BX.PopupMenu.create(t,e,i,{autoHide:true,offsetLeft:a.offsetLeft?a.offsetLeft:-21,offsetTop:a.offsetTop?a.offsetTop:-3,angle:{position:"top",offset:42},events:{}})},val:function(t){if(typeof t!="undefined"){this.value=t}return this.value}};BX.Sender.StatisticsBlock=function(){};BX.Sender.StatisticsBlock.prototype={name:"default",attributeBlock:"data-bx-block",attributePoint:"data-bx-point",attributeLoader:"data-bx-view-loader",attributeDataView:"data-bx-view-data",pointNodes:null,blockNodeList:null,onInit:function(t){this.caller=t.caller;var e;if(BX.Sender.StatisticsBlock.prototype.blockNodeList===null){e=this.caller.context.querySelectorAll("["+this.attributeBlock+"]");e=BX.convert.nodeListToArray(e);BX.Sender.StatisticsBlock.prototype.blockNodeList=e}else{e=BX.Sender.StatisticsBlock.prototype.blockNodeList}this.context=e.filter(function(t){return t.getAttribute(this.attributeBlock)==this.name},this)[0];if(this.context){this.loaderNode=this.context.querySelector("["+this.attributeLoader+"]");this.dataViewNode=this.context.querySelector("["+this.attributeDataView+"]")}if(this.context&&this.pointNodes===null){this.pointNodes=this.context.querySelectorAll("["+this.attributePoint+"]");this.pointNodes=BX.convert.nodeListToArray(this.pointNodes)}BX.addCustomEvent(this.caller,"onDataLoad",BX.proxy(this.onDataLoad,this));BX.addCustomEvent(this.caller,"onDataRequest",BX.proxy(this.fadeOut,this));BX.addCustomEvent(this.caller,"onScroll",BX.proxy(this.onScroll,this));this.init(t)},onScroll:function(){},fadeOut:function(){if(this.loaderNode){this.dataViewNode.style.display="none";this.loaderNode.style.display=""}this.pointNodes.forEach(function(t){if(this.getDisplayDataType(t)){return}BX.addClass(t,"bx-sender-loader");var e=document.createElement("SPAN");e.className="bx-sender-loader-sm";t.innerHTML="";t.appendChild(e)},this)},fadeIn:function(){if(this.loaderNode){this.loaderNode.style.display="none";this.dataViewNode.style.display=""}},onDataLoad:function(t){this.loadData(t);this.fadeIn()},init:function(t){},loadData:function(t){},getDisplayDataType:function(t){var e=t.getAttribute(this.attributePoint);var i=e.split(":");return i[1]?i[1]:null},setDisplayData:function(t,e){var i=t.getAttribute(this.attributePoint);var a=i.split(":");var s=a[0].split("/");var n=a[1];var o;s.forEach(function(t){if(o===null){return}if(typeof o=="undefined"){if(!e.hasOwnProperty(t)){o=null;return}o=e[t]}else{if(!o.hasOwnProperty(t)){o=null;return}o=o[t]}});switch(n){case"width":t.style.width=parseInt(parseFloat(o)*100)+"%";break;case"href":t.href=BX.util.strip_tags(o);break;default:t.innerText=o;break}BX.removeClass(t,"bx-sender-loader")},updateDisplayData:function(t){this.pointNodes.forEach(function(e){this.setDisplayData(e,t)},this)}};function a(t){var e=function(){};BX.extend(e,BX.Sender.StatisticsBlock);for(var i in t){if(!t.hasOwnProperty(i)){continue}e.prototype[i]=t[i]}return e}BX.Sender.StatisticsBlockClickMap=a({name:"ClickMap",init:function(t){if(!t.posting){return}this.linkParams=t.posting.linkParams||"";this.clickList=t.clickList;this.frameNode=this.context.querySelector("[data-bx-click-map]");BX.bind(this.frameNode,"load",BX.proxy(this.draw,this));this.ajaxAction=new BX.AjaxAction(this.caller.filterUrl);this.isNodeReloaded=false;this.onScroll()},onScroll:function(){if(!this.context){return}if(!BX.LazyLoad.isElementVisibleOnScreen(this.context)){return}if(this.isNodeReloaded){return}this.reloadFrame()},reloadFrame:function(){this.fadeOut();this.frameNode.src=this.ajaxAction.getRequestingUri("getClickMap",{lang:"",letterId:this.caller.getFilter("letterId").value});this.isNodeReloaded=true},loadData:function(t){this.isNodeReloaded=false;this.linkParams=t.posting.linkParams||"";this.clickList=t.clickList;this.onScroll()},draw:function(){this.fadeIn();var t=this.frameNode.contentDocument;this.frameNode.style.height=t.body.scrollHeight+"px";var e=new BX.HeatMap({document:t});var i=BX.convert.nodeListToArray(t.body.querySelectorAll("a"));if(this.linkParams){this.linkParams=this.linkParams.trim();if(this.linkParams.indexOf("?")===0){this.linkParams=this.linkParams.substring(1)}if(this.linkParams.indexOf("&")===0){this.linkParams=this.linkParams.substring(1)}}this.clickList.forEach(function(t){try{t.URL=BX.util.htmlspecialcharsback(decodeURIComponent(t.URL))}catch(t){}var a=i.filter(function(e){var i=this.prepareUrl(e.href);return i===t.URL},this);if(a.length===0){return}e.addItem({value:t.CNT,baloon:t.URL,anchorNode:a[0]})},this);e.draw()},prepareUrl:function(t){try{t=BX.util.htmlspecialcharsback(decodeURIComponent(t))}catch(t){}t=t.replace(/\+/g," ");if(this.linkParams){t+=(t.indexOf("?")>=0?"&":"?")+this.linkParams}return t}});BX.Sender.StatisticsBlockCounters=a({name:"Counters",init:function(t){this.isNodeReloaded=false;this.onScroll()},loadData:function(t){this.updateDisplayData(t)}});BX.Sender.StatisticsBlockChainList=a({name:"ChainList",init:function(t){this.chainList=t.chainList;this.isNodeReloaded=true;this.onScroll();this.postingsNode=this.context.querySelector("[data-bx-view-data-postings]");this.updateDisplayChainListContainer()},loadData:function(t){this.updateDisplayChainList(t.chainList)},updateDisplayChainList:function(t){var e=BX("sender-stat-template-last-posting");e=e.innerHTML;var i=t.map(function(t){var i=e;for(var a in t){var s=BX.util.htmlspecialchars(t[a]);i=i.replace(new RegExp("%"+a+"%","g"),s)}return i},this);this.postingsNode.innerHTML=i.join("");this.updateDisplayChainListContainer()},updateDisplayChainListContainer:function(){this.postingsNode.style.display=this.postingsNode.children.length>0?"":"none"}});BX.Sender.StatisticsBlockEfficiency=a({name:"Efficiency",init:function(t){this.isNodeReloaded=true;this.onScroll();this.efficiencyPointerNode=this.context.querySelector("[data-bx-view-data-eff]");this.efficiencyValueNode=this.context.querySelector("[data-bx-view-data-eff-val]");if(t.efficiency){this.updateDisplayEfficiency(t.efficiency)}},loadData:function(t){this.updateDisplayEfficiency(t.efficiency)},updateDisplayEfficiency:function(t){this.efficiencyPointerNode.style.left=t.PERCENT_VALUE+"%";this.efficiencyValueNode.innerText=t.VALUE+"%"}});BX.Sender.StatisticsBlockReadByTime=a({name:"ReadByTime",init:function(t){this.readByTimeList=t.readByTimeList;this.isNodeReloaded=false;this.onScroll()},onScroll:function(){if(!BX.LazyLoad.isElementVisibleOnScreen(this.context)){return}if(this.isNodeReloaded){return}this.requestData()},requestData:function(){this.fadeOut();this.isNodeReloaded=true;this.ajaxAction=new BX.AjaxAction(this.caller.filterUrl);this.ajaxAction.request({action:"getReadByTime",data:{letterId:this.caller.getFilter("letterId").value},onsuccess:BX.proxy(function(t){this.readByTimeList=t.readingByTimeList;this.draw()},this)})},loadData:function(t){this.isNodeReloaded=false;this.onScroll()},draw:function(){this.fadeIn();if(this.chart){this.chart.dataProvider=this.readByTimeList;this.chart.validateData();return}this.chart=t.AmCharts.makeChart(this.dataViewNode,{type:"serial",theme:"light",dataProvider:this.readByTimeList,valueAxes:[{gridColor:"#FFFFFF",gridAlpha:.2,dashLength:0,labelFrequency:2,labelFunction:function(t){if(parseFloat(t)==parseInt(t)){return parseInt(t)}return""}}],gridAboveGraphs:true,startDuration:1,graphs:[{balloonText:this.caller.mess.readByTimeBalloon.replace("%time%","[[category]]").replace("%cnt%","<b>[[value]]</b>"),fillAlphas:.8,lineAlpha:.2,type:"column",valueField:"CNT_DISPLAY"}],chartCursor:{categoryBalloonEnabled:false,cursorAlpha:0,zoomable:false},categoryField:"DAY_HOUR_DISPLAY",categoryAxis:{gridPosition:"start",gridAlpha:0,tickPosition:"start",tickLength:20},export:{enabled:false}})}});BX.Sender.StatisticsBlockCountersDynamic=a({name:"CountersDynamic",data:{},attributeChartNode:"data-bx-chart",attributeTextView:"data-bx-view-text",init:function(t){this.data=t.countersDynamic||{};this.charts=this.context.querySelectorAll("["+this.attributeChartNode+"]");this.charts=BX.convert.nodeListToArray(this.charts);this.charts=this.charts.map(function(t){return{name:t.getAttribute(this.attributeChartNode),node:t,loaderNode:t.querySelector("["+this.attributeLoader+"]"),dataViewNode:t.querySelector("["+this.attributeDataView+"]"),textViewNode:t.querySelector("["+this.attributeTextView+"]"),instance:null}},this);this.isNodeReloaded=false;this.onScroll()},onScroll:function(){if(!BX.LazyLoad.isElementVisibleOnScreen(this.context)){return}if(this.isNodeReloaded){return}this.requestData()},fadeOut:function(){this.charts.forEach(function(t){if(t.loaderNode){t.textViewNode.style.display="none";t.dataViewNode.style.display="none";t.loaderNode.style.display=""}})},fadeIn:function(){this.charts.forEach(function(t){if(t.loaderNode){t.textViewNode.style.display="none";t.loaderNode.style.display="none";t.dataViewNode.style.display=""}})},showText:function(t){t.loaderNode.style.display="none";t.dataViewNode.style.display="none";t.textViewNode.style.display=""},requestData:function(){this.fadeOut();this.isNodeReloaded=true;var t=this.caller.getFilterQueryData();t.action="get_counters_dynamic";t.sessid=BX.bitrix_sessid();BX.ajax({url:this.caller.filterUrl,method:"POST",data:t,dataType:"json",onsuccess:BX.proxy(function(t){this.data=t.countersDynamic;this.draw()},this)})},loadData:function(t){this.isNodeReloaded=false;this.onScroll()},draw:function(){this.charts.forEach(this.drawChart,this)},drawChart:function(e){if(!this.data[e.name]){this.showText(e);return}var i=this.data[e.name];i.forEach(function(t){if(BX.type.isNumber(t.DATE)){t.DATE=BX.date.format("j M",t.DATE)}else{t.DATE=0}});this.fadeIn();if(e.instance){e.instance.dataProvider=i;e.instance.validateData();return}e.instance=t.AmCharts.makeChart(e.dataViewNode,{type:"serial",theme:"light",dataProvider:i,valueAxes:[{gridColor:"#FFFFFF",gridAlpha:.2,dashLength:0,unit:"%"}],gridAboveGraphs:true,startDuration:1,graphs:[{balloonText:"[[category]]: <b>[[value]]%</b>",bullet:"round",bulletSize:8,lineColor:"#637bb6",lineThickness:2,type:"smoothedLine",valueField:"PERCENT_VALUE_DISPLAY"}],chartCursor:{categoryBalloonEnabled:false,cursorAlpha:0,zoomable:false},categoryField:"DATE",categoryAxis:{gridPosition:"start",gridAlpha:0,tickPosition:"start",tickLength:20},export:{enabled:false}})}})})(window);
//# sourceMappingURL=script.map.js