PageSourceSearch

https://static.to8to.com/gb_js/seoStatis.js?v=1756313560

js to8to.com collected 2026-10-02 18:55:01 UTC 7,227 bytes, 206 lines download raw bytes

1define = window.define ? window.define : function( name , callback ){
2	callback = callback || name;
3	callback( function(){} , window , window );
4};
5
6function singleSetCookie(name, value, expire, pre){
7    if (!expire){
8        expire = 5000;
9    };
10    if (pre){
11        name = 'to8to_' + name;
12    };
13    var expiry = new Date();
14    expiry.setTime(expiry.getTime() + expire);
15    document.cookie = name + '=' + value + ';expires=' + expiry.toGMTString() + ';path=/;domain=.to8to.com';
16};
17
18define( function( require , exports , module ){
19	var jq = window.jQuery || require( 'jquery' );
20	var urlCity=window.location.host.split('.')[0];
21	var hasValue=urlCity.indexOf("bbs");
22	if((urlCity!='www')&&(urlCity!='xiaoguotu')&&(hasValue==-1)){
23		var scriptNode=document.createElement("script");
24		scriptNode.src="//www.to8to.com/zb/getCity.php?action=reset_cookie&url_city="+urlCity;
25		scriptNode.type="text/javascript";
26		document.getElementsByTagName('head')[0].appendChild(scriptNode);
27	}
28
29	try {
30        var _date = new Date();
31        if (_date.getFullYear() == 2020 && _date.getDate() == 4 && _date.getMonth() == 3) {
32            jq("html").css({"-webkit-filter": "grayscale(100%)", "filte": "grayscale(100%)", "-moz-filter": "grayscale(100%)", "-ms-filter": "grayscale(100%)"});
33		}
34	} catch (e) {
35		console.log(e);
36	}
37
38
39	/*document.getElementsByTagName('head')[0].appendChild('<script src="http://www.to8to.com/zb/getCity.php?action=reset_cookie&url_city='+urlCity+'" type="text/javascript"></script>');
40	/**
41	 * By Emma Shao @ 2013-06-01
42	 * 设置 SEO 统计的着陆页cookie 和 来源cookie
43	 */
44	function setCookie(c_name, value, exdays) {
45		var exdate = new Date();
46		exdate.setDate(exdate.getDate() + exdays);
47		var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
48		document.cookie = c_name + "=" + c_value + ';path=/;domain=.to8to.com';
49	}
50	function getCookie(c_name) {
51		var c_value = document.cookie;
52		var c_start = c_value.indexOf(" " + c_name + "=");
53		if (c_start == -1) {
54			c_start = c_value.indexOf(c_name + "=");
55		}
56		if (c_start == -1) {
57			c_value = null;
58		} else {
59			c_start = c_value.indexOf("=", c_start) + 1;
60			var c_end = c_value.indexOf(";", c_start);
61			if (c_end == -1) {
62				c_end = c_value.length;
63			}
64			c_value = unescape(c_value.substring(c_start, c_end));
65		}
66		return c_value;
67	}
68	/*
69	 * 判断 sourcepage 与 landpage cookie 是否存在,不存在则设置cookie
70	 */
71    function checkCookie(){
72        //判断访问页面是否是着陆页(来源页为空、或者来源页为外部链接即为着陆页)
73        var sourcepage = catchCode(document.referrer);
74
75        if (sourcepage == false || sourcepage.indexOf('to8to.com') == -1 ) {
76            setCookie('to8to_landpage', encodeURI(location.href), 90);
77            setCookie('to8to_sourcepage', encodeURI(document.referrer),90);
78        }
79
80        var tvalue = getCookie('to8to_landtime');
81        if (typeof tvalue == 'string' && tvalue.length > 0) {
82        } else {
83            setCookie('to8to_landtime', Date.parse(new Date())/1000, 90);
84        }
85    }
86
87	/*
88	 * 根据当前的地址,判断是否来自推广,如果来自推广,则搜集相关内容,然后发送ajax请求
89	 */
90	function seoKeywords()
91	{
92		var word={};
93		var cur_url = catchCode(location.href);
94		var engine_pos = cur_url.indexOf('utm_from=');
95		var keyword_pos = cur_url.indexOf('utm_keyword=');
96		var keywords = '';
97		var cur_ref = catchCode(document.referrer);
98		if( engine_pos != -1 && keyword_pos != -1 )
99		{
100			sstart = cur_url.indexOf('=', engine_pos)+1;
101			send = cur_url.indexOf('&', engine_pos);
102			search_engine = cur_url.substring(sstart, send);
103			word['engine'] = search_engine;
104			switch(search_engine)
105			{
106				case 'baidu': //根据referrer获取搜索关键词 
107					wd_pos = cur_ref.indexOf('wd=');
108					sstart = cur_ref.indexOf('=', wd_pos) + 1;
109					send = cur_ref.indexOf('&', wd_pos);
110					keywords = cur_ref.substring(sstart, send);
111					word['keywords'] = keywords;
112					break;
113				case 'google':
114					break;
115				case '360':
116					break;
117				case 'sogou':
118					wd_pos = cur_ref.indexOf('wd=');
119					sstart = cur_ref.indexOf('=', wd_pos) + 1;
120					send = cur_ref.indexOf('&', wd_pos);
121					keywords = cur_ref.substring(sstart, send);
122					word['keywords'] = keywords;
123					break;
124			}
125			
126			sstart = cur_url.indexOf('=', keyword_pos) + 1;
127			send = cur_url.indexOf('&', keyword_pos);
128			word['keywordid'] = cur_url.substring(sstart, send);	
129			
130		}
131		return word;
132	}
133
134	/*
135     * 保存关键词
136     */
137    function keyWords(){
138        var kwdlist = catchCodeComponent(document.referrer).match('&wd=(.+?)(?:&[^&]*=.*)?$'); // 获取百度的关键词
139        if(kwdlist instanceof Object && kwdlist.length > 1){
140            // 存在关键词
141            if(typeof getCookie('to8to_keywordlist') !== "string" || getCookie('to8to_keywordlist').length == 0){
142                // 新建cookie
143                singleSetCookie('to8to_keywordlist', ',,,,,,,,,' + kwdlist[1], 90 * 24 * 60 * 60 *1000);
144            }else{
145            	if(!/[^,]*,.*,.*,.*,.*,.*,.*,.*,.*,(.*)?/.test(getCookie('to8to_keywordlist'))){
146            		singleSetCookie('to8to_keywordlist', ',,,,,,,,,' + (kwdlist[1]), 90 * 24 * 60 * 60 *1000);
147            	}else{
148	                // 从后推入新关键词,覆盖之前的
149	                if(getCookie('to8to_keywordlist').indexOf(kwdlist[1]) < 0){
150	                   singleSetCookie('to8to_keywordlist', getCookie('to8to_keywordlist').replace(/([^,]*)(,?)(.*)(,?)(.*)(,?)(.*)(,?)(.*)(,?)(.*)(,?)(.*)(,?)(.*)(,?)(.*)(,?)(.*)?/, '$3$2$5$4$7$6$9$8$11$10$13$12$15$14$17$16$19$18' + kwdlist[1]), 90 * 24 * 60 * 60 *1000);
151	                }
152            	}
153            }
154        }
155    }
156
157	checkCookie();
158	keyWords();
159	var keywords = seoKeywords();
160	// if(keywords.keywordid && keywords.keywordid.length > 0)
161	// {
162	// 	jq.get('http://www.to8to.com/api/seo_keywords_process.php', keywords);
163	// }
164	var encodeUrl = encodeURIComponent(document.location);
165	if(encodeUrl.search('reg')==-1 && encodeUrl.search('logout')==-1 && encodeUrl.search('login')==-1){
166		setCookie('to8to_nowpage',encodeUrl,3600*1000,1);
167	}
168	jq(function(){
169		var to8to_auth = getCookie('to8to_auth');
170		var to8to_uid  = getCookie('to8to_uid');
171		var to8to_haslogin = getCookie('to8to_haslogin');
172		if(to8to_uid&&to8to_auth&& to8to_uid!=to8to_haslogin){
173			jq.post('//www.to8to.com/api/insert_user_login.php',{to8to_auth:to8to_auth,to8to_uid:to8to_uid},function(data){
174				setCookie('to8to_haslogin',to8to_uid);
175			},'json');
176		}
177	});
178
179	/*
180	 * 替代原来的decodeURI解码字符串,增加容错
181	 * try decodeURI 解码,如果报错则不解码
182	 * 网页编码说明
183	 *
184	 */
185	function catchCode(str) {
186		var result = '';
187		try {
188			result = decodeURI(str);
189		} catch(e) {
190			result = str;
191		}
192
193		return result;
194	}
195
196	function catchCodeComponent(str) {
197		var result = '';
198		try {
199			result = decodeURIComponent(str);
200		} catch(e) {
201			result = str;
202		}
203
204		return result;
205	}
206});

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.