PageSourceSearch

https://infoexporta.com/templets/oscms/assets/js/globle.js

js infoexporta.com collected 2026-10-08 15:04:00 UTC 14,279 bytes, 421 lines download raw bytes

1$(function(){
2	//global_sider 全局侧边栏
3	(function(){
4		var topbtn = $('#gotop_btn'),
5			$shouCang = $('#J_shoucang');	// 收藏
6		$shouCang.hover(function(){
7			$(this).addClass('active');
8			$(this).next().show();
9		}, function(){
10			$(this).removeClass('active');
11			$(this).next().hide();
12		});
13		//绑定页面滚动事件
14		$(window).bind('scroll',function(){
15			var len=$(this).scrollTop();
16			if(len>=100){
17				//显示回到顶部按钮
18				$('.goto_top').show();
19			}else{
20				//影藏回到顶部按钮
21				$('.goto_top').hide();
22			}
23		});
24		//顶部
25		topbtn.on('click', function(){
26			$("html, body").filter(':not(:animated)').animate({
27				scrollTop: 0
28			});
29		});
30	})();
31
32	(function(){
33		// 获取uid,存入cookie
34		var recommendtype='-1';//是否是推荐新闻默认-1
35		var uid_url='http://tjpc.dfshurufa.com/getpcdata/getuid';//请求UID 接口
36		var getData_url='http://pclog.dftoutiao.com/getpcdata/data';//请求传递数据接口修改地址01月17日
37		var getOnlineData_url='http://tjpc.dfshurufa.com/pconline/pconline';//请求传递online数据接口
38		var flag_cooke=0;
39		var u_id='';//访客uid
40		var soft_type='toutiao';
41		var soft_name='DFTT';
42		var OSType=detectOS();//操作系统
43		var browserType=explorerType();//浏览器
44		var _vbb='0.5.1';//版本号
45		var wayPath=String(coo_name);//渠道来源
46		var from='';//来源(备选参数)
47		var idx=''//新闻链接位置
48		var ishot='';//是否热新闻
49		var btype=''//大类
50		var subtype=''//子类
51		var to=window.location.host+window.location.pathname;//当前url
52		var fr_url=document.referrer;//来源
53		if(fr_url=='' || fr_url == 'null'){
54			fr_url='null';
55		}else{
56			fr_url=fr_url.split("?");
57			fr_url=String(fr_url[0]);
58			if( fr_url.indexOf('sm.cn') != -1){
59				$.cookie('search_qid','smcn',{expires:1,path:'/'});
60			}
61			if( fr_url.indexOf('baidu.com') != -1 ){
62				$.cookie('search_qid','baiducom',{expires:1,path:'/'});
63			}
64		}
65		from=fr_url;
66		var temp = window.location.search; //获取url中"?"符后的字串
67		if ( temp.indexOf("?") != -1 && String(GetRequest(temp).btype) != 'undefined' ){
68			btype=GetRequest(temp).btype;
69			subtype=GetRequest(temp).subtype;
70			idx=GetRequest(temp).idx;
71			ishot=GetRequest(temp).ishot;
72		}else{
73			btype='null';
74			subtype='null'
75			idx='null';//没传参时的情况下
76			ishot=0;
77		}
78		if(wayPath == 'null' || wayPath== ''){
79			//推广渠道优先原则,如果推广渠道没有的情况下 种的$.cookie('search_qid')存在则代表是从搜索过来的
80			if( $.cookie('search_qid') ){
81				wayPath = $.cookie('search_qid');
82			}else{
83				wayPath == 'null';
84			}
85		}else{
86			if(wayPath.indexOf('=') != -1){
87				wayPath=wayPath.split('=')[1];
88			}
89		}
90		if(!$.cookie('mylist')){
91			uid_ajax(uid_url,0);
92		}else{
93			u_id=$.parseJSON($.cookie('mylist')).uid;
94			getData_ajax(getData_url);//请求传递数据,wayPath\newstype全局变量qid
95		}
96		//10秒定时去请求传online数据
97		setInterval(function(){
98			if(!$.cookie('mylist')){
99				uid_ajax(uid_url,1);
100			} else {
101				u_id=$.parseJSON($.cookie('mylist')).uid;
102				getOnline_ajax(getOnlineData_url);
103			}
104		},10000);
105		function Mycookie(uid){
106			//设置cookie
107			var info = '{"uid":"' + uid + '","softtype":"'+ soft_type +'","softname":"'+ soft_name +'"}';
108			$.cookie('mylist',info,{expires:3000,path:'/'});
109		}
110		//获取UID
111		function uid_ajax(url,gotype){
112			$.ajax({
113				type:'get',
114				url:url,
115				dataType:'jsonp',
116				jsonp: 'jsonpcallback',
117				timeout:6000,
118				beforeSend:function () {
119					// 加载提示
120					// $('#ajax_tips').show();
121				},
122				success:function(data){
123					//数据传递验证成功后执行的操作
124					u_id=data.uid;
125					Mycookie(u_id);
126					flag_cooke=1;
127				},
128				complete:function () {
129					if(flag_cooke==1){
130						if(gotype==0){
131							//gotype为0代表日志请求否则代表online接口请求
132							getData_ajax(getData_url);//请求传递数据,wayPath\newstype全局变量qid
133						}else{
134							getOnline_ajax(getOnlineData_url);
135						}
136					}
137				},
138				error:function(jqXHR,textStatus,errrorThrown){if(errrorThrown=='Not Found'){console.log('Your requested address is not found.');}else if(textStatus=='timeout'){console.log('Verify the request timeout, please refresh the page and try again');}else{console.log('Your requested address is not found.');}}
139			});
140		}
141		//请求传递数据
142		function getData_ajax(url){
143			var strPath = String(window.location.pathname);
144			if( strPath.indexOf('/a/') != -1 ){
145				//是否是推荐新闻的详细页是就赋值recommendtype
146				var temp = window.location.search; //获取url中"?"符后的字串
147				if (temp.indexOf("?") != -1) {
148					if( String(GetRequest(temp).recommendtype) != 'undefined' ){
149						recommendtype=GetRequest(temp).recommendtype;
150						from=String(window.location.host)+"/a/"+String(GetRequest(temp).uk)+".html";
151					}
152				}
153			}
154			var param=wayPath+"\t"+u_id+"\t"+soft_type+"\t"+soft_name+"\t"+newstype+"\t"+from+"\t"+to+"\t"+btype+"\t"+subtype+"\t"+idx+"\t"+ishot+"\t"+fr_url+"\t"+_vbb+"\t"+OSType+"\t"+browserType+"\t"+recommendtype;
155			$.ajax({
156				type:'get',
157				url:url+'?param='+encodeURI(param),
158				dataType:'jsonp',
159				jsonp: 'jsonpcallback',
160				timeout:6000,
161				beforeSend:function () {
162					// 加载提示
163					// $('#ajax_tips').show();
164				},
165				success:function(data){
166					//数据传递验证成功后执行的操作
167					// console.log(url);
168				},
169				complete:function () {
170				},
171				error:function(jqXHR,textStatus,errrorThrown){if(errrorThrown=='Not Found'){console.log('Your requested address is not found.');}else if(textStatus=='timeout'){console.log('Verify the request timeout, please refresh the page and try again');}else{console.log('Your requested address is not found.');}}
172			});
173		}
174		//请求传递online数据
175		function getOnline_ajax(url){
176			var setIntervalTime=10;
177			var paramOnline=wayPath+"\t"+u_id+"\t"+soft_type+"\t"+soft_name+"\t"+newstype+"\t"+to+"\t"+ishot+"\t"+_vbb+"\t"+OSType+"\t"+browserType+"\t"+setIntervalTime;
178			$.ajax({
179				type:'get',
180				url:url,
181				data:{
182					param:encodeURI(paramOnline)
183				},
184				dataType:'jsonp',
185				jsonp: 'jsonpcallback'
186			});
187		}
188		//判断浏览器
189		function explorerType(){
190			var brow=$.browser;
191			var bInfo="非主流浏览器";
192			if(brow.msie){
193				bInfo="MicrosoftInternetExplorer"+brow.version;
194			}
195			if(brow.mozilla){
196				bInfo="MozillaFirefox"+brow.version;
197			}
198			if(brow.safari){
199				bInfo="AppleSafari"+brow.version;
200			}
201			if(brow.opera){
202				bInfo="Opera"+brow.version;
203			}
204			if(brow.chrome){
205				bInfo="chrome"+brow.version;
206			}
207			return bInfo;
208		}
209		//获取客户端操作系统类型
210		function detectOS() {
211			var sUserAgent = navigator.userAgent;
212			var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
213			var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");
214			if (isMac) return "Mac";
215			var isUnix = (navigator.platform == "X11") && !isWin && !isMac;
216			if (isUnix) return "Unix";
217			var isLinux = (String(navigator.platform).indexOf("Linux") > -1);
218			if (isLinux) return "Linux";
219			if (isWin) {
220				var isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1 || sUserAgent.indexOf("Windows 2000") > -1;
221				if (isWin2K) return "Win2000";
222				var isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1 || sUserAgent.indexOf("Windows XP") > -1;
223				if (isWinXP) return "WinXP";
224				var isWin2003 = sUserAgent.indexOf("Windows NT 5.2") > -1 || sUserAgent.indexOf("Windows 2003") > -1;
225				if (isWin2003) return "Win2003";
226				var isWin2003 = sUserAgent.indexOf("Windows NT 6.0") > -1 || sUserAgent.indexOf("Windows Vista") > -1;
227				if (isWin2003) return "WinVista";
228				var isWin2003 = sUserAgent.indexOf("Windows NT 6.1") > -1 || sUserAgent.indexOf("Windows 7") > -1;
229				if (isWin2003) return "Win7";
230			}
231			return "None";
232		}
233		/*截取url参数*/
234		function GetRequest(temp) {
235			var theRequest = new Object();
236			// if (url.indexOf("?") != -1) {
237			var str = temp.substr(1);
238			var strs = str.split("&");
239			for(var i = 0; i < strs.length; i ++) {
240				theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
241			}
242			// }
243			return theRequest;
244		}
245	})();
246
247	/* 添加快讯 */
248	(function(){
249		/*
250		 <div class="fixed-kuaixun">
251		 <img src="<?php echo __WWW_IMG ?>kuaixun.png" alt="快讯" width="86" height="48">
252		 <a class="txt" href="javascript:;">国防部证实我国正在研制第二航母舰队</a>
253		 <a class="close" href="javascript:;" title="点击关闭">关闭</a>
254		 </div>
255		 */
256		setTimeout(function(){
257			var COOKIE_NAME = 'kuaixun',    // 快讯cookie name
258					cookieVal = $.cookie(COOKIE_NAME),  // 快讯cookie value
259					ymd = getDateStr(),   // 年月日字符串
260					url = '/json/kuaixun/kuaixun_' + ymd + '.json';
261			$.getJSON(url, function(data, status){
262				if(status != 'success' || !data){
263					return false;
264				}
265				if(!cookieVal && cookieVal != data.id){
266					var startTime = new Date(data.start_time.replace(/-/g, '/')),
267							endTime = new Date(data.end_time.replace(/-/g, '/')),
268							curTime = new Date();
269					if(curTime.getTime() > startTime.getTime() && curTime.getTime() < endTime.getTime()){
270						var $kuaixun = $('<div class="fixed-kuaixun"><img src="/assets/images/kuaixun.png" alt="快讯" width="86" height="48"></div>'),
271								$kxLink = $('<a class="txt" href="javascript:;" target="_blank"></a>'),
272								$kxClose = $('<a class="close" href="javascript:;" title="点击关闭">关闭</a>');
273						$kxLink.attr('href', data.url);
274						$kxLink.html(data.topic);
275						$('body').append($kuaixun.append($kxLink).append($kxClose));
276						$kxClose.on('click', function(){
277							$.cookie(COOKIE_NAME, data.id, {expires: 30, path: '/'});
278							$kuaixun.remove();
279						});
280						$kxLink.on('click', function(){
281							$.cookie(COOKIE_NAME, data.id, {expires: 30, path: '/'});
282							$kuaixun.remove();
283						});
284
285						if(navigator.userAgent.indexOf('MSIE') >= 0 && $.browser.version.toString().substring(0,1) == '6'){
286							$kuaixun.animate({
287								top: '-=140px'
288							});
289						} else {
290							$kuaixun.animate({
291								bottom: '70px'
292							});
293						}
294					}
295				}
296			});
297
298			function getDateStr(){
299				var now = new Date(),
300						year = now.getFullYear().toString().slice(2),
301						month = (now.getMonth() + 1).toString(),
302						day = now.getDate().toString();
303				month = (month.length === 1) ? (month = '0' + month) : month;
304				day = (day.length === 1) ? (day = '0' + day) : day;
305				return year + month + day;   // 年月日字符串
306			}
307		}, 3000);
308
309
310	})();
311
312	/*记录传递访客最后的三个详细新闻页面*/
313	(function(){
314		/**
315		 *  jQuery 扩展方法
316		 *      $.Object.count( p )
317		 *          获取一个对象的长度,需要指定上下文,通过 call/apply 调用
318		 *          示例: $.Object.count.call( obj, true );
319		 *          @param  {p}             是否跳过 null / undefined / 空值
320		 */
321		$.extend({
322			//  获取对象的长度,需要指定上下文 this
323			Object:     {
324				count: function( p ) {
325					p = p || false;
326					return $.map( this, function(o) {
327						if( !p ) return o;
328						return true;
329					} ).length;
330				}
331			}
332		});
333		//  示例
334		// var obj = {a:null,b:undefined,c:1,d:2,e:'test'};
335		// //  不过滤空值
336		// console.log( $.Object.count.call( obj ) );
337		// //  过滤空值
338		// console.log( $.Object.count.call( obj, true ) );		
339		//只有详细页执行
340		var strPath = String(window.location.pathname);
341		if( strPath.indexOf('/a/') != -1 ){
342			//(重要)注意:整站只有详细页路径带有/a/,如果后期其他非详细页面的名称会带有数字则需对此进行相应修改!!
343			var articleId = strPath.substring(strPath.lastIndexOf('/') + 1, strPath.indexOf('.'));
344			if(window.localStorage){
345				// supports localStorage
346				if(!localStorage.getItem('pageId')){
347					localStorage.setItem('pageId','{"pid0":"' + articleId + '","pid1":"null","pid2":"null"}');//设置存储文章ID
348				}else{
349					var pageIdTemp=$.parseJSON( localStorage.getItem('pageId') );
350					var len=$.Object.count.call( pageIdTemp ,true );
351					var flag = true;
352					for(var i=0;i<len;i++){
353						if( pageIdTemp['pid' + i] != 'null'){
354							if( articleId == pageIdTemp['pid' + i] ){
355								flag = false;
356							}
357						}
358					}
359					if(flag){
360						localStorage.removeItem('pageId');
361						localStorage.setItem('pageId','{"pid0":"' + articleId + '","pid1":"'+ pageIdTemp['pid0'] +'","pid2":"'+ pageIdTemp['pid1'] +'"}');
362					}
363				}
364			}else{
365				// does not supports localStorage
366				// delCookie('pageId');
367				if(getCookie('pageId') == null){
368					// $.cookie('pageId','{"pid0":"' + articleId + '","pid1":"null","pid2":"null"}',{expires:30,path:'/'});
369					setCookie('pageId','{"pid0":"' + articleId + '","pid1":"null","pid2":"null"}');
370				}else{
371					var pageIdTemp=$.parseJSON( getCookie('pageId') );
372					var len=$.Object.count.call( pageIdTemp ,true );
373					var flag = true;
374					for(var i=0;i<len;i++){
375						if( pageIdTemp['pid' + i] != 'null'){
376							if( articleId == pageIdTemp['pid' + i] ){
377								flag = false;
378							}
379						}
380					}
381					if(flag){
382						delCookie('pageId');
383						setCookie('pageId','{"pid0":"' + articleId + '","pid1":"'+ pageIdTemp['pid0'] +'","pid2":"'+ pageIdTemp['pid1'] +'"}');
384					}
385				}
386				// console.log(getCookie('pageId'));			
387			}
388		}
389		//写cookies
390		function setCookie(name,value){
391			var Days = 3000;//天
392			var exp = new Date();
393			exp.setTime(exp.getTime() + Days*24*60*60*1000);
394			document.cookie = name + "="+ encodeURI (value) + ";expires=" + exp.toUTCString() + ";path=/";
395		}
396		//读取cookies
397		function getCookie(name){
398			var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
399			if(arr=document.cookie.match(reg)){
400				return decodeURI(arr[2]);
401			}else{
402				return null;
403			}
404		}
405		//删除cookies
406		function delCookie(name){
407			var exp = new Date();
408			exp.setTime(exp.getTime() - 1);
409			var cval=getCookie(name);
410			if(cval!=null){
411				document.cookie= name + "="+cval+";expires="+exp.toUTCString() + ";path=/";
412			}
413		}
414	})();
415	$('ul.nav li:last').hover(function(){
416		$(this).children('div').show();
417	},function(){
418		$(this).children('div').hide();
419	});
420
421});

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.