-
Notifications
You must be signed in to change notification settings - Fork 540
Expand file tree
/
Copy pathvapph5define.min.js
More file actions
1 lines (1 loc) · 4.4 KB
/
vapph5define.min.js
File metadata and controls
1 lines (1 loc) · 4.4 KB
1
!function(){var e=null,t=null,n={getVisibility:function(e){var t,n=e.getBoundingClientRect();function i(e,t){return window.getComputedStyle?document.defaultView.getComputedStyle(e,null)[t]:e.currentStyle?e.currentStyle[t]:void 0}return function e(t){var o=t.parentNode;if(9===o.nodeType)return!0;if("0"===i(t,"opacity")||"none"===i(t,"display")||"hidden"===i(t,"visibility"))return!1;if(o){var r=o.getBoundingClientRect();if("hidden"===i(o,"overflow")||"scroll"===i(o,"overflow")){if(n.bottom<=r.top||n.top>=r.bottom||n.right<=r.left||n.left>=r.right)return!1}else if("hidden"===i(o,"overflow-y")||"scroll"===i(o,"overflow-y")){if(n.bottom<=r.top||n.top>=r.bottom)return!1}else if(("hidden"===i(o,"overflow-x")||"scroll"===i(o,"overflow-x"))&&(n.right<=r.left||n.left>=r.right))return!1;return e(o)}return!0}(e)&&(t=document.body.getBoundingClientRect(),!(n.top>=t.bottom||n.bottom<=t.top||n.left>=t.right||n.right<=t.left))},getSubElements:function(t){var n=[];if(t.children.length)for(var i=0;i<t.children.length;i++)e.isElement(t.children[i])&&e.isObject(t.children[i].sensorsDefineStore)&&n.push(t.children[i].sensorsDefineStore.id);return n},getInfo:function(n){if(!e.isElement(n)||!e.isObject(n.sensorsDefineStore))return null;var i=n.getBoundingClientRect(),o=n.tagName,r={id:n.sensorsDefineStore.id,$element_content:e.getEleInfo({target:n}).$element_content,$element_selector:t.heatmap.getDomSelector(n),tagName:o,top:i.top,left:i.left,scrollX:window.pageXOffset,scrollY:window.pageYOffset,width:i.width,height:i.height,scale:window.devicePixelRatio,visibility:this.getVisibility(n),$url:location.href,$title:document.title,lib_version:t.lib_version,subelements:this.getSubElements(n),level:n.sensorsDefineStore.level,is_list_view:"li"===o.toLowerCase(),$element_path:t.heatmap.getElementPath(n,t.para.heatmap&&"not_use_id"===t.para.heatmap.element_selector)},l=t.heatmap.getElementPosition(n,r.$element_path,t.para.heatmap&&"not_use_id"===t.para.heatmap.element_selector);return e.isNumber(l)&&(r.$element_position=l),t.heatmap.getClosestLi(n)&&(r.list_selector=this.getListSelector(n)),e.isString(n.sensorsDefineStore.list_selector)&&(r.list_selector=n.sensorsDefineStore.list_selector),r},getZIndex:function(e){var t=window.getComputedStyle(e,null).getPropertyValue("z-index");return t&&!isNaN(+t)?t:0},getlevel:function(e,t){var n=Number(this.getZIndex(e)),i=0,o=window.getComputedStyle(e,null).getPropertyValue("position");return!o||"absolute"!==o&&"fixed"!==o||(i=1e5),t+n+i},getListSelector:function(e){var n="",i=t.heatmap.getClosestLi(e);if(i){var o=t.heatmap.getDomSelector(i,[],!0);n=t.heatmap.getDomSelector(e,[],!0).replace(o,"")}return n},initElements:function(){var n=this,i=0,o=[];function r(e,n){var o={level:n,id:"h"+i};i++,e.sensorsDefineStore=o;var r=t.heatmap.getTargetElement(e);r&&(r.sensorsdata_enable_click=!0,"inline"===window.getComputedStyle(r,null).getPropertyValue("display")&&(r.style.display="inline-block"))}return function t(i,l){for(var s=0;s<i.length;s++)if(e.isElement(i[s])){var a=i[s],d=n.getlevel(a,l);r(a,d),o.push(a),a.children&&t(a.children,d+1)}}(document.body.children,1),o},getElementsInfo:function(){var t=this,n=[],i=[],o=this.initElements();return e.isArray(o)&&e.each(o,function(o){if(e.isElement(o)){var r=o,l=t.getInfo(r);e.isObject(l)&&l.visibility&&(!0===r.sensorsdata_enable_click?(l.enable_click=!0,n.push(l)):(l.enable_click=!1,i.push(l)))}}),{data:this.sortLevel(n),extra_elements:this.sortLevel(i)}},sortLevel:function(e){return e.sort(function(e,t){return e.level-t.level}),e},postDefineInfo:function(){var e=n.getElementsInfo(),i={data:e.data,extra_elements:e.extra_elements};new t.SDKJSBridge("visualized_track").notifyApp(i)},addDefineListener:function(n){var i=this;var o=e.throttle(n,1e3);!function(e,t,n){new(window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver)(n).observe(e,t)}(document.body,{childList:!0,subtree:!0,attributes:!0},o),e.addEvent(window,"scroll",o),e.addEvent(window,"resize",o),e.addEvent(window,"load",o),t.ee&&t.ee.spa&&t.ee.spa.on("switch",function(e){e!==location.href&&i.postPageInfo()})},postPageInfo:function(){var e={data:{$title:document.title,$url:location.href,lib_version:t.lib_version}};new t.SDKJSBridge("page_info").notifyApp(e)},init:function(){var n=this;window.sa_jssdk_app_define_mode=function(i,o){o?(n.postPageInfo(),n.postDefineInfo()):(e=(t=i)._,n.postPageInfo(),e.bindReady(function(){n.postDefineInfo(),n.addDefineListener(n.postDefineInfo)}))}}};n.init()}();