PageSourceSearch

https://www.tsblasting.com/Tpl/HJZF2_Z/js/ztm.js

js tsblasting.com collected 2026-10-04 04:24:42 UTC 3,818 bytes, 150 lines download raw bytes

1
2
3
4
5//拓展一下jQuery
6$.fn.isChildAndSelfOf = function(b){
7	return (this.closest(b).length > 0);
8};	
9
10//判断有没有指定客户
11if(window.ztm_explore_types){
12	var ztm_explore_types=window.ztm_explore_types;
13}else{
14	var ztm_explore_types=[];
15}
16consolelog("customer_name_"+$webid+":",customer_name);
17//setInterval(upload_customer_info, 1000);
18$(document).on("click","body",function(e){
19	consolelog("监听到一次点击",e);
20	var target=e.target||e.srcElement  
21	var ids=[];
22	var target_parents=$(target).parents();
23	target_parents.push($(target));        
24	
25	consolelog("点击目标传递路径",target_parents);
26	
27	ids=get_explore_types(ztm_explore_types,target_parents);
28	consolelog("产生的自定义事件",ids);
29	if(ids){
30		var click_ztm_custom_event={};
31		click_ztm_custom_event.equipment_info_Ztm_Os=Ztm_Os;
32		click_ztm_custom_event.equipment_info_Ztm_Browser=Ztm_Browser;
33		click_ztm_custom_event.equipment_info_Ztm_Lang=Ztm_Lang;
34		click_ztm_custom_event.equipment_info_Ztm_Ip=Ztm_Ip;
35		click_ztm_custom_event.Ztm_Url=Ztm_Url;		
36		click_ztm_custom_event.id=ids.join(",");
37		click_ztm_custom_event.webid=$webid;
38		click_ztm_custom_event.customer_name=customer_name;
39		click_ztm_custom_event.createtime=gettimestamp();
40		click_ztm_custom_event.dom=target.outerHTML;
41		click_ztm_custom_event.window_width=$(window).width();
42		click_ztm_custom_event.name="event_name_"+guid()+"_"+gettimestamp();
43		var module_name=$(target).parents("one_module").attr("pagename");
44		if(module_name){
45			click_ztm_custom_event.module_name=module_name;
46		}
47		click_ztm_custom_event.page_name=window.pagename;
48		if(customer_info.click_ztm_custom_event){
49			customer_info.click_ztm_custom_event.push(click_ztm_custom_event);	
50		}else{
51			customer_info.click_ztm_custom_event=[{}];	
52		}
53		upload_customer_info(click_ztm_custom_event);
54			
55	}
56
57})
58//辅助的一些方法
59function upload_customer_info(click_ztm_custom_event){
60	$.post(baseUrl+"index.php/BigCApi/index",click_ztm_custom_event,function(){
61		consolelog("上传数据"+getNowTime());
62	})
63}
64
65
66
67function get_explore_types(ztm_explore_types,target_parents,target){
68	 var ids=[];
69	 consolelog("get_explore_types"+getNowTime());
70	 $.each(target_parents,function(i,v){
71		 	consolelog("get_explore_types"+getNowTime());
72			var tmp_ids=get_explore_type_one(ztm_explore_types,v);
73			if(tmp_ids){
74				$.each(tmp_ids,function(i,v){
75					if($.isArray(v,ids)>-1){
76						ids.push(v);
77					}
78				})
79				
80			}	
81	 });
82	 //一次事件应该只产生一个id所有要去重
83	 var new_ids=[];
84	for(var i=0;i<ids.length;i++) {
85	  var items=ids[i];
86	  //判断元素是否存在于new_arr中,如果不存在则插入到new_arr的最后
87	  if($.inArray(items,new_ids)==-1) {
88	    new_ids.push(items);
89	  }
90	}	 
91	 return new_ids;
92}
93/**
94 * 返回监听事件id的集合
95 * @param string $name
96 * @return mixed
97**/
98function get_explore_type_one(ztm_explore_types,target){
99	var ztm_explore_types_ids=[];
100	$.each(ztm_explore_types,function(i,v){
101		var point="",ztm_flag=0;
102		switch(v.type) {
103			case "href":
104				point=$(target).attr("href");
105			break;
106			case "html":
107				point=$(target).html();
108			break;
109			case "class":
110				point=$(target).attr("class");
111			break;
112			case "select":
113				point=$(target);
114				v.logic="is";
115			break;			
116		};
117		//consolelog("产生的point",point);
118		if(point){
119			switch(v.logic) {
120				case "indexof":
121					if(point.indexOf(v.data)>-1){
122						ztm_flag=1;
123					}
124				break;
125				case "eq":
126					if($.trim(point)==$.trim(v.data)){
127						ztm_flag=1;
128					}
129				break;	
130				case "is":
131					if(point.is(v.data)){
132						ztm_flag=1;
133					}
134				break;					
135			};			
136		}
137		if(ztm_flag==1){
138			ztm_explore_types_ids.push(v.id);
139			
140		}
141		//consolelog("产生的ztm_explore_types_ids",ztm_flag);
142	 })
143		
144		return ztm_explore_types_ids;
145}
146
147
148
149
150

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.