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.