PageSourceSearch

https://assets.lrts.me/fed-assets/web/assets/javascript/common.js?v=102

js lrts.me collected 2026-10-02 03:37:12 UTC 40,891 bytes, 1,520 lines download raw bytes

1$(function (){
2	var assetsPrefix = '//assets.lrts.me/fed-assets/web';
3	var s_md5 = document.createElement("script");
4	s_md5.setAttribute("type", "text/javascript");
5	s_md5.setAttribute("src", assetsPrefix + '/assets/javascript/cryptojs/md5.js');
6	var s_hmac = document.createElement("script");
7	s_hmac.setAttribute("type", "text/javascript");
8	s_hmac.setAttribute("src", assetsPrefix + '/assets/javascript/cryptojs/hmac-sha1.js');
9	var s_des = document.createElement("script");
10	s_des.setAttribute("type", "text/javascript");
11	s_des.setAttribute("src", assetsPrefix + '/assets/javascript/cryptojs/tripledes.js');
12	document.getElementsByTagName("head")[0].appendChild(s_md5);
13	document.getElementsByTagName("head")[0].appendChild(s_hmac);
14	document.getElementsByTagName("head")[0].appendChild(s_des);
15
16	// 大同 sdk 上报
17	window.datahub = {
18    initUniversalReport: function (appkey) {
19      const APP_KEY = '0WEB03GLCO48INQY'
20      // const isOnline = (location.host === 'm.lrts.me')
21      const isOnline = true
22
23      if (isOnline) { appkey = APP_KEY }
24      // 只实例化一次
25      if (!appkey || window.$DtReporter) {
26        return null
27      }
28      const publicParams = {
29        app_id: 'fed-lrts-web',
30        lr_h5_app_id: 'fed-lrts-web'
31      }
32      const query = this.getUrlSearch()
33      // 记录第三方渠道信息
34      if (query.source) {
35        publicParams.web_channel = query.source
36      }
37
38      window.$DtReporter = new window.UniversalReport({
39        version: '1.0.0',
40        beacon: appkey, // 灯塔 APPKEY
41        publicParams
42      })
43    },
44    // 初始化大同统计
45    initDatonSDK: function (pageId, options = {}) {
46      if (!window.UniversalReport || !pageId) { return }
47      this.dtPageId = pageId
48      options = Object.assign({
49        params: {},
50        isReportPv: true // 默认曝光
51      }, options)
52      // 只实例化一次
53      const query = this.getUrlSearch()
54      let { dtkey } = query
55      this.initUniversalReport(dtkey)
56      // 需要手动曝光
57      if (options.isReportPv) { this.dtPvReport(options.params) }
58    },
59    // 页面曝光
60    dtPvReport: function (params) {
61      if (!window.$DtReporter || !this.dtPageId) { return }
62
63      let pgid = this.dtPageId
64      params.pgid = pgid
65      window.$DtReporter.setPage(params, document.body).observe(pgid)
66    },
67    // 点击事件
68    dtClickReport: function  (ele, eid, params = {}) {
69      if (!window.$DtReporter || !this.dtPageId) { return }
70
71      params.eid = eid
72      window.$DtReporter.reportElement(ele, {
73        pgid: this.dtPageId,
74        eventName: 'dt_clck',
75        businessParams: params
76      })
77    },
78    // 曝光事件
79    dtImpReport: function  (ele, eid, params = {}) {
80      if (!window.$DtReporter || !this.dtPageId) { return }
81
82      params.eid = eid
83      window.$DtReporter.reportElement(ele, {
84        pgid: this.dtPageId,
85        eventName: 'dt_imp',
86        businessParams: params
87      })
88    },
89    // 结束曝光
90    dtImpEndReport: function  (ele, eid, params = {}) {
91      if (!window.$DtReporter || !this.dtPageId) { return }
92
93      params.eid = eid
94      window.$DtReporter.reportElement(ele, {
95        pgid: this.dtPageId,
96        eventName: 'dt_imp_end',
97        businessParams: params
98      })
99    },
100    // 自定义事件
101    dtEventReport: function  (event, params = {}) {
102      if (!window.$DtReporter || !this.dtPageId) { return }
103
104      window.$DtReporter.reportEvent({
105        pgid: this.dtPageId,
106        eventName: event,
107        businessParams: params
108      })
109    },
110    getUrlSearch: function () {
111      var url = location.search; //获取url中"?"符后的字串
112      var theRequest = new Object();
113      if (url.indexOf("?") != -1) {
114         var str = url.substr(1);
115         strs = str.split("&");
116         for(var i = 0; i < strs.length; i ++) {
117            theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
118         }
119      }
120      return theRequest;
121   },
122	 /**
123		* 解析链接,生成 pgid 及 lr_media_id
124		* 示例:/index ==> {lr_media_id: '', pgid: 'index'}
125		* 示例:/book/29566 ==> {lr_media_id: '29566', pgid: 'book'}
126		* 示例:/book/category/3 ==> {lr_media_id: '3', pgid: 'book_category'}
127		* 示例:/album/category/3088/play_count ==> {lr_media_id: '3088', pgid: 'explore_album_category'}
128		* @returns 
129		*/
130	 getPathObj: function () {
131		var pathArr = location.pathname.split('/')
132		pathArr.shift()
133		var arr = []
134		var lr_media_id = ''
135		var flag = false
136
137		pathArr.forEach(function (item, index) {
138			if (!flag) {
139				// 非第一位,且只为数字时,定义为 lr_media_id
140				if (index !== 0 && !isNaN(Number(item))) {
141					lr_media_id = item
142					flag = true
143				} else {
144					arr.push(item !== '' ? item : 'index')
145				}
146			}
147		})
148
149		return {
150			lr_media_id: lr_media_id,
151			pgid: arr.join('_')
152		}
153	 },
154
155	 init: function () {
156		var obj = this.getPathObj()
157		this.initDatonSDK(obj.pgid, {
158			params: { lr_media_id: obj.lr_media_id }
159		})
160	 }
161  }
162	datahub.init()
163
164	// RUM-SDK上报
165	window.rumsdk={
166		init:function(){
167			// 忽略错误列表
168			var ignoreRules = [
169				'Script error.',
170				'chrome-extension',
171				'UCShellJava.',
172				'hackLocationFailed',
173				'runCustomize',
174				'MyAppGetLinkSRCAtPoint',
175				'MyAppGetLinkTitleNameAtPoint',
176				'MyAppGetLinkHREFAtPoint',
177				'window.ucbrowser.smWeather.changecity',
178				'WebViewJavascriptBridge.init called twice',
179				'MyAppGetHTMLElementsAtPoint',
180				'out of memory',
181				'window.bannerNight',
182				'hackLocationSuccess',
183				'__tv_keydown',
184				'window.playingAudio.pause'
185			]
186			// 忽略level等级列表 详见https://cloud.tencent.com/document/product/1464/58557#beforerequest
187			var ignoreLevels = ['512']
188			// 过滤忽略规则列表
189			function isMatchedIgnoreRules(value) {
190				return ignoreRules.some(function (rule) {
191					return value.indexOf(rule) > -1
192				})
193			}
194			var aegis = new window.Aegis({
195				id: 'mZJ5lhLW33wxxLLpRQ', // 上报 id
196				uin: '', // 用户唯一 ID(可选)
197				reportApiSpeed: true, // 接口测速
198				reportAssetSpeed: true, // 静态资源测速
199				random: 0.3, // 采样率
200				spa: true, // spa 应用页面跳转的时候开启 pv 计算
201				hostUrl: 'https://rumt-zh.com',
202				beforeRequest: function(data) {
203					// 入参data的数据结构:{logs: {…}, logType: "log"}
204					if (
205						data.logType === 'log' && 
206						(isMatchedIgnoreRules(data.logs.msg) || ignoreLevels.includes(data.logs.level))
207					) {
208						// 拦截:日志类型为 log,且包含过滤规则的请求
209						return false
210					}
211					if(data.logType === 'speed' && [401].includes(data.logs.status)){
212						return false
213					}
214				}
215			});
216			window.aegis = aegis
217		}
218	}
219	if(location.host==='www.lrts.me' && window.Aegis){
220		// 线上域名且存在Aegis才上报
221		rumsdk.init()
222	}
223	
224	window.XSS = {
225
226		isType: function(type) {
227				return function(obj) {
228						return Object.prototype.toString.call(obj) === "[object " + type + "]";
229				}
230		},
231
232		go: function(item) {
233				var rs = item;
234				if (!item) {
235						return rs;
236				}
237				var itemType = typeof(item),
238						itemObjType;
239				if (itemType == 'string') {
240						rs = this.filterHtml(item);
241				} else if (itemType == 'object') {
242						if (this.isType('Object')(item)) {
243								rs = this.parseObject(item);
244						} else if (this.isType('Array')(item)) {
245								rs = this.parseArray(item);
246						}
247						rs.autoXss = true;
248				}
249				return rs;
250		},
251
252		filterHtml: function(str) {
253			var map = {
254        '&': '&amp;',
255        '<': '&lt;',
256        '>': '&gt;',
257        '"': '&quot;',
258        "'": '&#x27;', // 单引号
259        '`': '&#x60;', // 反引号
260        '/': '&#x2F;', // 斜杠
261    	};
262
263			var text = decodeURIComponent(str)
264
265    	return text.replace(/[&<>"'`/]/g, match => map[match]);
266		},
267		parseArray: function(obj) {
268				var i = 0,
269						l = obj.length,
270						item;
271				for (; i < l; i++) {
272						obj[i] = this.go(obj[i]);
273				}
274				return obj;
275		},
276		parseObject: function(obj) {
277				for (var key in obj) {
278						if (obj.hasOwnProperty(key)) {
279								obj[key] = this.go(obj[key]);
280						}
281				}
282				return obj;
283		}
284	};
285
286	/*字节长度*/
287	String.prototype.byteLength=function () {
288		var byteLen = 0, len = this.length;
289		if( !this ) return 0;
290		for( var i=0; i<len; i++ )
291			byteLen += this.charCodeAt(i) > 255 ? 2 : 1;
292		return byteLen;
293	};
294	/*字节截取*/
295	String.prototype.byteSubstring=function(len){  
296		var result = '',
297		strlen = this.length, // 字符串长度
298		chrlen = this.replace(/[^\x00-\xff]/g,'**').length; // 字节长度
299
300		if(chrlen<=len){return this;}
301		for(var i=0,j=0;i<strlen;i++){
302		    var chr = this.charAt(i);
303		    if(/[\x00-\xff]/.test(chr)){
304		        j++; // ascii码为0-255,一个字符就是一个字节的长度
305		    }else{
306		        j+=2; // ascii码为0-255以外,一个字符就是两个字节的长度
307		    }
308		    if(j<=len){ // 当加上当前字符以后,如果总字节长度小于等于L,则将当前字符真实的+在result后
309		        result += chr;
310		    }else{ // 反之则说明result已经是不拆分字符的情况下最接近L的值了,直接返回
311		        return result;
312		    }
313		}
314	};
315	$.yyting={
316		reg:{
317			email:/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/,
318			password:/^\w{6,20}$/,
319			idcard:/^\d{15}$|^\d{17}(?:\d|x|X)$/
320		},
321		localStorage:function(key,val){
322			if($.browser.msie&&parseInt($.browser.version)<8){
323				if(arguments.length==2){
324					if(key=='user'){
325						$.cookie('cover',JSON.parse(val).cover);
326					}
327					$.cookie(key,val,{expires: 30,path:'/'});
328				}else{
329					if(key=='user'||key=='player-info'){
330						var val=$.cookie(key);
331						if(val){
332							val=val.replace(/{/g,'').replace(/}/g,'');
333							var obj={};
334							var arr=val.split(',');
335							for(var i=0;i<arr.length;i++){
336								var temp=arr[i].replace(/:/,',');
337								var splitArr=temp.split(',');
338								if(splitArr){
339									obj[splitArr[0]]=splitArr[1]||'';
340								}
341							}
342							if(key=='user'){
343								obj.cover=$.cookie('cover');
344							}
345							return JSON.stringify(obj);
346						}else{
347							return val;
348						}
349					}else{
350						return $.cookie(key);
351					}
352				}
353			}else{
354				if(arguments.length==2){
355					localStorage.setItem(key,val);
356				}else{
357					return localStorage.getItem(key);
358				}
359			}
360		},
361		handlerMsg:function(msg,v){
362			$.dialog.tips({
363			type:v?'success':'error',
364			title:msg
365			});
366		},
367		checkNull: function(v,msg){
368			if(!v || v.length==0) {
369				$.yyting.handlerMsg(msg,false);
370				return false;
371			}
372			return true;
373		},
374		checkMinMax:function(v,min,max,msg){
375			if(!v||v.byteLength()<min) {
376				$.yyting.handlerMsg(msg+"不能少于"+min+"个字符",false);
377				return false;
378			} else if(v.byteLength()>max){
379				$.yyting.handlerMsg(msg+"不能大于"+max+"个字符",false);
380				return false;
381			}
382			return true;
383		},
384		redirect:function(url){
385			if(url && !$.yyting.checkLogin()) {
386				$.yyting.loginbox(function (){
387					location.href=url;
388				});
389			}
390		},
391		ajax:function (options){
392			if(options.type&&options.type.toUpperCase()=='POST'){
393				if(options.login===true||options.login===undefined){//options.login是否检查登录
394					if(!$.yyting.checkLogin()){
395						$.yyting.loginbox(function (){
396							$.yyting.ajax(options);
397						});
398						return;
399					}
400				}
401			}
402			if($.browser.msie&&options.cache===undefined){
403				options.cache=false;
404			}
405			if(options.waiter){//options.waiter发送GET|POST请求需要承显的交互效果的地方
406				var clas=!options.type||options.type.toUpperCase()=='GET'?'g-ajax-loader':'g-ajax-poster';
407				if(options.waiter.hasClass('g-ajax-poster')){
408					return;
409				}
410				options.waiter.addClass(clas);
411				var success=options.success;
412				options.success=function (){
413					options.waiter.removeClass(clas);
414					success.apply(this,arguments);
415				}
416				var error=options.error;
417				options.error=function (){
418					options.waiter.removeClass(clas);
419					if(options.error&&typeof options.error=='function'){
420						error.apply(this,arguments);
421					}
422				}
423			}
424			$.ajax(options);
425		},
426		parseURL:function (path){
427			var result = {}, param = /([^?=&]+)=([^&]+)/ig, match;
428			while (( match = param.exec(path)) != null) {
429				result[match[1]] = match[2];
430			}
431			return result;
432    },
433    bindPhoneBox:function (){
434      $.dialog({
435        title:'',
436        content:$('#bindPhoneDiv').html(),
437        complete:function (){
438          this.el.find('#cancel').on('click',function (){
439            $.dialog.close();
440          })
441          this.el.find('#toBindPhone').on('click',function (e){
442            e.preventDefault();
443            location.href = '/setting/bind?from=comment';
444          })
445        }
446      })
447    },
448    checkBindPhone:function (){
449      var user=this.localStorage('user');
450      if(user&&this.checkLogin()){
451        user=JSON.parse(user);
452        return user.isPhoneBind == 1
453      }
454      return false
455    },
456		checkLogin:function (){
457			// var result = document.cookie.match(new RegExp("(^| )sid=([^;]*)(;|$)")) || []
458			// return result.length > 1;
459			var sidExp = localStorage.getItem('sidExp')
460			if (sidExp && new Date(new Date().getTime() + 24 * 60 * 60 * 1000).getTime() > new Date(Number(sidExp)).getTime()) {
461				return true
462			}
463			var res = false
464			$.ajax({
465				login:false,//根据需要填写
466				url:'/status/isLogin',
467				type:'get',
468				dataType:"json",
469				async: false,
470				data:{
471				},
472				success:function (data){
473					res = data.data
474					if (res) {
475						localStorage.setItem('sidExp', new Date().getTime())
476					}
477					// console.log('res', res)
478				}
479			});
480			return res
481		},
482		loginbox:function (callback){
483			var that = this;
484			$.dialog({
485				title:'',
486				content:$('#login-template').html(),
487				complete:function (){
488					var self=this;
489					var localUser=$.yyting.localStorage('user');
490					if(localUser){
491					   localUser=JSON.parse(localUser);
492					   self.el.find('input').eq(0).val(localUser.accountName);
493					}
494					this.el.find('.btn-primary').on('click',function (){
495						var accountName=self.el.find('input').eq(0).val();
496						var password=self.el.find('input').eq(1).val();
497						var autoLogin=0;
498						if( self.el.find('input').eq(2).attr("checked") =="checked" ){
499						   autoLogin=self.el.find('input').eq(2).val();
500						}
501						
502						if(!accountName || !password){
503							self.el.find('.field-error').text('用户名密码不能为空').parent().show();
504							return;
505						}
506						
507						$.when(that.getToken(accountName)).done(function(token){
508							if(!token){
509								self.el.find('.field-error').text("操作异常").parent().show();
510								return;
511							}
512						
513							that.cryptoLogin(accountName,password,token,autoLogin,'',function (data) {
514								if(data.status=='success'){
515						    		$.yyting.localStorage('user', JSON.stringify(data.data));
516						    		$.yyting.initUser();
517							    	$.dialog.close();
518							    	$.yyting.loginSuccess(data.data);
519									if(callback&&typeof callback=='function'){
520										callback();
521									}
522						    	}else{
523						    		if(data.data=='login_code'){
524										window.location.href='/login?showValidateCode=1';
525									}else{
526										self.el.find('.field-error').text(data.errMsg).parent().show();
527									}
528						    	}
529							});
530						});
531						
532					});
533					this.el.on('keyup','input',function(e){
534						if(e.keyCode==13){
535							self.el.find('.btn-primary').click();
536						}
537					});
538				}
539			});
540		},
541		loginSuccess:function (data){},
542		initUser:function(){
543			var user=$.yyting.localStorage('user');
544			var umenu=$('.g-top-umenu');
545			// 修复第三方登陆浏览器localstorage没有存储user的问题
546			if($.yyting.checkLogin()) {
547				$.ajax({
548					url:"/user/loginUserInfo.do",
549					type:"get",
550					dataType:"json",
551					data:{},
552					success: function(data){
553						$.yyting.localStorage('user', JSON.stringify(data.data))
554						user=$.yyting.localStorage('user')
555						user=JSON.parse(user);
556						umenu.show().prev().hide();
557						
558						if(user.cover){
559							umenu.find('.g-user-i img').attr('src',user.cover);					
560						}
561
562						//这里要修改登录状态的连接的地址				
563						umenu.find('#myhome,#myhomecover').attr('href',"/user/"+ user.userId);
564						umenu.find('#myfollowing').attr('href',"/my/following");
565						umenu.find('#myalbum').attr('href',"/user/" + user.userId +"/album");	
566					},
567					error: function(error){
568						umenu.hide().prev().show();
569				  }
570				})
571
572				// if (!user) {
573					
574				// } else {
575				// 	user=JSON.parse(user);
576				// 	umenu.show().prev().hide();
577					
578				// 	if(user.cover){
579				// 		umenu.find('.g-user-i img').attr('src',user.cover);					
580				// 	}
581
582				// 	//这里要修改登录状态的连接的地址				
583				// 	umenu.find('#myhome,#myhomecover').attr('href',"/user/"+ user.userId);
584				// 	umenu.find('#myfollowing').attr('href',"/my/following");
585				// 	umenu.find('#myalbum').attr('href',"/user/" + user.userId +"/album");	
586				// }
587			} else {
588				umenu.hide().prev().show();
589			}
590			// if(user&&$.yyting.checkLogin()){
591			// 	user=JSON.parse(user);
592			// 	umenu.show().prev().hide();
593				
594			// 	if(user.cover){
595			// 		umenu.find('.g-user-i img').attr('src',user.cover);					
596			// 	}
597
598			// 	//这里要修改登录状态的连接的地址				
599			// 	umenu.find('#myhome,#myhomecover').attr('href',"/user/"+ user.userId);
600			// 	umenu.find('#myfollowing').attr('href',"/my/following");
601			// 	umenu.find('#myalbum').attr('href',"/user/" + user.userId +"/album");		
602			// }else{
603			// 	umenu.hide().prev().show();
604			// }
605		},
606		getToken:function (accountName){
607			var defer = $.Deferred();
608			if(!accountName){
609				defer.resolve('');
610				return defer.promise();
611			}
612			$.ajax({
613				login:false,
614				url:"/user/login_token.do",
615				type:"POST",
616				dataType:"json",
617				data:{
618			    		"accountName":accountName
619			    	 },
620			    success: function(data){
621			    	defer.resolve(data.data);
622				}
623			});
624			return defer.promise();
625		},
626		cryptoLogin:function (accountName,password,token,autoLogin,validateCode,callback){
627			if(!accountName || !password || !token) return;
628			
629			if(!autoLogin) autoLogin = 0;
630			if(!validateCode) validateCode = '';
631			
632			//var hashPass = CryptoJS.HmacSHA1(CryptoJS.MD5(password).toString(), token).toString();
633			
634			var key = CryptoJS.enc.Utf8.parse(token);
635			var iv = CryptoJS.enc.Utf8.parse("lrts8621");
636			 
637			var encryptedPassword = CryptoJS.DES.encrypt(CryptoJS.MD5(password).toString(), key, {
638			    iv: iv,
639			    mode: CryptoJS.mode.CBC,
640			    padding: CryptoJS.pad.Pkcs7
641			});
642			// 转换为字符串
643			encryptedPassword = encryptedPassword.toString();
644			$.ajax({
645				url:"/user/login.do",
646				type:"POST",
647				dataType:"json",
648				data:{
649			    		"accountName":accountName,
650			    		"hashPass":encryptedPassword,
651			    		"autoLogin":autoLogin,
652			    		"validateCode":validateCode
653			    	 },
654			   	//async:false,
655			    success: function(data){
656			    	if(callback) callback(data);
657				}
658			});
659		}
660	};
661	$.yyting.initUser();
662	$.yyting.params=$.yyting.parseURL(location.href);
663	$('#dialog-login').click($.yyting.loginbox);
664	$(document).on('focusin','textarea',function(){
665		var $this=$(this);
666		if(!$this.attr('data-check-login')&&!$.yyting.checkLogin()){
667			$this.blur();
668			$.yyting.loginbox(function(){
669				$this.focus();
670			});
671		}
672	})
673	/*动态评论显示*/
674	//$('.feed-item-comments').on('click',function (){
675		//$(this).parent().next().toggleClass('hide');
676	//});
677	
678	/*顶部搜索框*/
679	$('.g-search-b input').on('keyup',function (e){
680		var $this=$(this),v=$.trim($this.val());
681		if(v){
682			v=v.replace(/\.|\\|\//g,'');
683			if(e.keyCode==38){
684				var $prev=$('.g-search-l .active').prev();
685				if($prev.length==1){
686					$prev.addClass('active').siblings().removeClass('active');
687				}
688			} else if(e.keyCode==40){
689				var $next=$('.g-search-l .active').next();
690				if($next.length==1){
691					$next.addClass('active').siblings().removeClass('active');
692				}
693			}
694			if(e.keyCode==13){
695				var t=$('.g-search-l .active i').attr('class').replace('icon-s-','');
696				if(t=='user') t='anchor';
697				location.href='/search/'+t+'/'+encodeURIComponent(v);
698			}
699			$('.g-search-l').show();
700			$('.g-search-l span').text(v);
701		}else{
702			$('.g-search-l').hide();
703		}
704	}).on('focus',function(){
705		var t=$(this);
706		setTimeout(function(){t.select();},200);
707	});
708	$('.g-search-l li').on('click',function (){
709		var v=$.trim($('.g-search-b input').val());
710		if(v) {
711			v=v.replace(/\.|\\|\//g,'');
712			var t=$(this).find('i').attr('class').replace('icon-s-','');
713			if(t=='user') t='anchor';
714			location.href='/search/'+t+'/'+encodeURIComponent(v);
715		}
716	});
717	$('.g-search-icon').on('click',function(){
718		var v=$.trim($('.g-search-b input').val());
719		if(v) {
720			v=v.replace(/\.|\\|\//g,'');
721			location.href='/search/book/'+encodeURIComponent(v);
722		}
723	});
724	
725	/*原著跳转*/
726	$(document).on('click','.author',function(){
727		var self = $(this);
728		var v=$.trim(self.text());
729		var stype = $.trim(self.attr('stype'));
730		if(v) {
731			if(stype=='album'){
732				location.href='/search/album/'+encodeURIComponent(v);
733			}else{
734				location.href='/search/book/'+encodeURIComponent(v);
735			}
736		}
737	});
738	
739	/*名片*/
740	var namecardEnterTime=null,namecardLeaveTime=null,namecard=$('.g-name-card');
741	$('body').append(namecard);
742	$(document).on('mouseenter','.g-user',function (){
743		if(namecardLeaveTime){
744			clearTimeout(namecardLeaveTime);
745		}
746		var $this=$(this);
747		var href=$this.attr('href');
748		if($this.children('img').length==1){
749			$this=$this.children('img')
750		}
751		if(namecard.trigger!=this){
752			namecardEnterTime=setTimeout(function (){
753				var userid=/\d+$/.exec(href)[0];
754				if($.yyting.localStorage('user')&&userid==JSON.parse($.yyting.localStorage('user')).userId){
755					namecard.addClass('self-name-card');
756				}else{
757					namecard.removeClass('self-name-card');
758				}
759				var obj={
760					left:$this.offset().left-namecard.width()-16,
761					top:$this.offset().top+$this.height()/2-45
762				}
763				namecard.find('.g-name-card-arrow').show().siblings('.g-name-card-arrow-b').hide();
764				if($this.offset().left<$(window).width()/2){
765					obj={
766							left:$this.offset().left+$this.width()/2-42,
767							top:$this.offset().top-15-namecard.height()
768						}
769					namecard.find('.g-name-card-arrow').hide().siblings('.g-name-card-arrow-b').show();
770				}
771				namecard.show().css(obj);
772				namecard.trigger=$this[0];
773				namecard.children('.g-name-card-inner').html('');
774				$.yyting.ajax({
775					url:'/user/'+userid+'/card',
776					waiter:namecard.children('.g-name-card-inner'),
777					success:function(data){
778						namecard.children('.g-name-card-inner').html(data);
779					}
780				});
781			},500);
782		}
783	}).on('mouseleave','.g-user',function (){
784		if(namecardEnterTime){
785			clearTimeout(namecardEnterTime);
786		}
787		namecardLeaveTime=setTimeout(function (){
788			namecard.hide();
789			namecard.trigger=null;
790		},600);
791	});
792	namecard.on('mouseenter',function (){
793		if(namecardLeaveTime){
794			clearTimeout(namecardLeaveTime);
795		}
796	}).on('mouseleave',function (){
797		namecardLeaveTime=setTimeout(function (){
798			namecard.hide();
799			namecard.trigger=null;
800		},600);
801	});
802	
803	//发私信
804	$(document).on('click',".btn-msg",function (){		
805		if(!$.yyting.checkLogin()){
806			$.yyting.loginbox();
807		}else{
808			$.dialog({
809				title:'',
810				content:$('#sendDiv').html()
811			});
812			$('#name').text($(this).attr('name'));
813		    $('#sendId').val($(this).attr('id'));
814		}	
815	});
816		
817	$(document).on("keyup","#sendText",function(){
818			var c=parseInt(168),t=parseInt($.trim($(this).val()).length);
819			if(t >1) {				
820				$("#send").removeClass("btn-disable");
821				$("#send").removeAttr("disabled");
822			}else{
823				$("#send").addClass("btn-disable");
824				$("#send").attr("disabled", "disabled");
825			}
826			
827			var count = parseInt(c-t);
828			if(count<0){
829				count=0;
830			}			
831			$("#shareCount").html(count);
832			if(count < 1){
833				$("#sendText").val($.trim($(this).val()).substring(0,167));
834			}
835	});
836			
837	$(document).on("click","#send",function (){
838	   var id=$('#sendId').val();
839	   var content=$('#sendText').val();
840	   var textleng=$('#sendText').val().length;	
841	   if(textleng){		   			   
842			 $.yyting.ajax({
843			    login:true,
844				url :"/my/message/sendMessage.do",
845				type:"POST",
846				dataType:"json",
847				data:{
848			    		"receiverId":id,
849			    		"content":content,
850		    			"cToken":$('#cToken').val()
851			    	 },
852			    success: function(data){
853		    		if(data.status=='success') {
854		    			$('#sendEmail').hide();
855		   				$('#upload-success').removeClass('hide').width(575);		   
856		 					setTimeout(function(){
857					  			$.dialog.close();
858					  		},2000);
859					}else{
860						$.dialog.tips({
861							type:'error',
862							title:data.errMsg
863						});
864					}
865				}
866		     });
867		 }else{
868		    $.dialog.tips({
869				type:'error',
870				title:'请输入邮件内容'
871			});
872		 }			     
873	})      		
874	/*认证标示事件*/
875	$(document).on("click",".icon-vip-m",function (){
876		if(!$(this).attr('href')){
877			location.href="/anchor";
878		}
879	})
880	/*会员标示事件*/
881	$(document).on("click",".icon-member-a,.icon-member-l,icon-member-b",function (){
882		if(!$(this).attr('href')){
883			location.href="/uservip/vip";
884		}
885	})
886	/*关注和取消关注*/
887	$(document).on('mouseenter','.btn-follow',function (){
888		var $this=$(this);
889		var text=$.trim($this.text());
890		if(text=='已关注'){
891			$this.text('取消关注');
892		}
893	}).on('mouseleave','.btn-follow',function (){
894		var $this=$(this);
895		var text=$.trim($this.text());
896		if(text=='取消关注'){
897			$this.text('已关注');
898		}
899	}).on('click','.btn-follow,.gc-follow',function (){
900		var $this=$(this);
901		var text=$.trim($this.text());
902		if(text=='关注'){
903			$.yyting.ajax({
904				url:'/user/addFollow.do',
905				type:'POST',
906				dataType:"json",
907				login:true,
908				data:{
909					userId:$this.data('userid'),
910	    			cToken:$('#cToken').val()
911				},
912				success:function (data){
913					if(data.status=='success'){
914						$this.text('取消关注');
915						if(!$this.hasClass('gc-follow')){
916							$this.addClass('btn-follow-has');
917						}
918					}
919				}
920			})
921			
922		}else{
923			$.yyting.ajax({
924				url:'/user/cancellFollow.do',
925				type:'POST',
926				dataType:"json",
927				login:true,
928				data:{
929					userId:$this.data('userid'),
930	    			cToken:$('#cToken').val()
931				},
932				success:function (data){
933					if(data.status=='success'){
934						$this.html('<i class="icon-plus"></i>关注').removeClass('btn-follow-has');
935					}
936				}
937			});
938		}
939	});
940	/*加载更多*/
941	$(document).on('click','.btn-load-more,.anchor-item-more',function(e){
942		var $this=$(this).addClass('g-ajax-loader');
943		var tempHTML=$this.html();
944		$this.html('<i class="icon-ajax-loader"></i>&nbsp;&nbsp;加载中...');
945		if($this.hasClass('anchor-item-more')){
946			$this.find('i').addClass('icon-ajax-loader2');
947		}
948		var size=$this.attr('data-size')||20;
949		// 优先使用href属性
950		var url = $this.attr('href') || $this.prev('ul').children('li:last').attr('data-more-url')
951		$.yyting.ajax({
952			url:url,
953			success:function (data){
954				$this.html(tempHTML);
955				if(data.data){
956					data=data.data;
957				}
958				var li=$(data).children('li');
959				$this.removeClass('g-ajax-loader').prev('ul').append(li);
960				if(size&&li.length<parseInt(size)){
961					$this.hide();
962				}
963			}
964		});
965		e.stopPropagation();
966		e.preventDefault();
967	});
968
969	/*返回顶部*/
970	$(window).on('scroll',function(){
971		if($(window).scrollTop()>$(window).height()){
972			$('.go-top').show();
973		}else{
974			$('.go-top').hide();
975		}
976	})
977	$('.go-top').on('click',function (){
978		$("html,body").animate({
979			scrollTop: "0px"
980		},400);
981	});
982	/*文本域登录提示*/
983	$(document).on('focus','textarea[data-login="true"]',function(){
984		if(!$.yyting.checkLogin()){
985			$.yyting.loginbox()
986		}
987	});
988	/*默认行为*/
989	$(document).on('click',function (e){
990		if($(e.target).closest('.g-auto-hide').length==0){
991			$('.g-auto-hide').hide();
992		}
993		if($(e.target).closest('.g-auto-remove').length==0){
994			$('.g-auto-remove').hide();
995		}
996	});
997	/*ie7头部下拉菜单修正*/
998	if($.browser.msie&&$.browser.version=='7.0'){
999		var wrapper=$('body').children('.wrapper');
1000		$(document).on('mouseenter','.g-main-listen,.g-top-umenu',function (){
1001			wrapper.css({position:'relative',zIndex:-1});
1002		}).on('mouseleave','.g-main-listen,.g-top-umenu',function (){
1003			wrapper.removeAttr('style');
1004		});
1005	}
1006	
1007	/*收藏*/
1008	$(document).on('click','#addCollection,.addCollection',function(){
1009		var self = $(this);
1010		
1011		var entityId = self.attr("entityId");
1012		var entityType = self.attr("entityType");
1013		var collectionCount = parseInt(self.find("#collectionCount").text());
1014		var showType = self.attr("showType");
1015		
1016		if(showType == 4){
1017			entityType = window.ydata['share-entityType'];
1018			entityId = window.ydata['share-fatherEntityId'];
1019			
1020			if(entityType == 4){
1021				entityType = 3;
1022			}
1023		}
1024		
1025		//取消收藏
1026		if(self.hasClass("d-collection-a") || self.find(".icon-collection").hasClass("icon-collection-a")){
1027			$.yyting.ajax({
1028				url:'/user/delCollection.do',
1029				type:'POST',
1030				dataType:"json",
1031				data:{
1032					"entityId":entityId,
1033					"entityType":entityType,
1034	    			"cToken":$('#cToken').val()
1035				},
1036				success:function (data){
1037					if(data.status=='success'){
1038						if(showType == 1){
1039							self.removeClass("d-collection-a");
1040							self.html("添加收藏");
1041						}else if(showType == 2){
1042							self.find(".icon-collection").removeClass("icon-collection-a");
1043							self.find("#collectionShow").text("收藏");
1044						}else if(showType == 3){
1045							self.removeClass("d-collection-a");
1046							self.removeClass("disable");
1047							self.html("收藏");
1048						}else if(showType == 4){
1049							self.html("收藏");
1050							self.removeClass("d-collection-a");
1051						}else{
1052							self.removeClass("d-collection-a");
1053							self.find("#collectionShow").text("收藏");
1054						}
1055						collectionCount = collectionCount+parseInt(-1);
1056						self.find("#collectionCount").text(collectionCount);
1057					}else{
1058						$.dialog.tips({
1059							type:'error',
1060							title:data.errMsg
1061						});
1062					}
1063				}
1064			})
1065		}else{
1066			$.yyting.ajax({
1067				url:'/user/addCollection.do',
1068				type:'POST',
1069				dataType:"json",
1070				data:{
1071					"entityId":entityId,
1072					"entityType":entityType,
1073	    			"cToken":$('#cToken').val()
1074				},
1075				success:function (data){
1076					if(data.status=='success'){
1077						if(showType == 1){
1078							self.addClass("d-collection-a");
1079							self.html("取消收藏");
1080						}else if(showType == 2){
1081							self.find(".icon-collection").addClass("icon-collection-a");
1082							self.find("#collectionShow").text("已收藏");
1083						}else if(showType == 3){
1084							self.addClass("d-collection-a");
1085							self.addClass("disable");
1086							self.html("已收藏");
1087						}else if(showType == 4){
1088							self.html("已收藏");
1089							self.addClass("d-collection-a");
1090						}else{
1091							self.addClass("d-collection-a");
1092							self.find("#collectionShow").text("已收藏");
1093						}
1094						collectionCount = collectionCount+parseInt(1);
1095						self.find("#collectionCount").text(collectionCount);
1096					}else{
1097						$.dialog.tips({
1098							type:'error',
1099							title:data.errMsg
1100						});
1101					}
1102				}
1103			})
1104		}
1105	});
1106	$(document).on('mouseenter','.book-item .btn-collection',function (){
1107		var $this=$(this);
1108		var text=$.trim($this.text());
1109		if(text=='已收藏'){
1110			$this.text('取消收藏');
1111		}
1112	}).on('mouseleave','.book-item .btn-collection',function (){
1113		var $this=$(this);
1114		var text=$.trim($this.text());
1115		if(text=='取消收藏'){
1116			$this.text('已收藏');
1117		}
1118	});
1119
1120	/*申请完本*/
1121	$(document).on('click', '.album-f-applyend', function () {
1122		var $this = $(this),
1123			albumId = $this.attr('albumnId');
1124		$.dialog({
1125			title: '',
1126			content: $('#album-dialog-template').html(),
1127			defined: function () {
1128				$.yyting.ajax({
1129					login: true,
1130					url: '/upload/updateContentState.do',
1131					type: 'post',
1132					dataType: 'json',
1133					data: {
1134						id: albumId,
1135						contentState: 2
1136					},
1137					success: function (data) {
1138						if (data.status == 'success') {
1139							$.dialog.tips({
1140								title: '申请完本受理成功!'
1141							});
1142							var html = '<span class="album-f-status album-f-isapplying">完本受理中...</span>';
1143							$this.prev().css('display', 'none');
1144							$this.replaceWith(html);
1145						} else {
1146							$.dialog.tips({
1147								type: 'error',
1148								title: data.errMsg
1149							})
1150						}
1151					}
1152				});
1153			}
1154		});
1155	});
1156
1157	/*喜欢赞*/
1158	$(document).on('click','#addLike',function(){
1159		var self = $(this);
1160		//取消赞
1161		if(self.hasClass("d-praise-a")){
1162		}else{
1163			
1164			var entityId = self.attr("entityId");
1165			var entityType = self.attr("entityType");
1166			var likeCount = parseInt(self.find("#likeCount").text());
1167			//点赞
1168			$.yyting.ajax({
1169				url:'/user/addLike.do',
1170				type:'POST',
1171				dataType:"json",
1172				data:{
1173					"entityId":entityId,
1174					"entityType":entityType,
1175	    			"cToken":$('#cToken').val()
1176				},
1177				success:function (data){
1178					if(data.status=='success'){
1179						self.addClass("d-praise-a");
1180						likeCount = likeCount+parseInt(1);
1181						self.find("#likeCount").text(likeCount);
1182					}else{
1183						$.dialog.tips({
1184							type:'error',
1185							title:data.errMsg
1186						});
1187					}
1188				}
1189			})
1190		}
1191		
1192	})
1193	
1194	
1195	/*头部收听记录*/
1196	$(document).on('mouseenter','.g-listen',function(){
1197		var self = $(this);
1198		if($.yyting.checkLogin()){
1199			$.yyting.ajax({
1200				login:false,//根据需要填写
1201				url:'/my/history.do',
1202				type:'get',
1203				dataType:"json",
1204				data:{
1205				},
1206				success:function (data){
1207					if(data.status=='success'){
1208						self.siblings(".g-main-listen-l").html(data.data);
1209					}else{
1210						$.dialog.tips({
1211							type:'error',
1212							title:data.errMsg
1213						});
1214					}
1215				}
1216			})
1217		}else{
1218			$('.g-main-listen-more').hide();
1219		}
1220	});
1221	
1222	/*删除头部收听记录*/
1223	$(document).on('click','.icon-close',function(){
1224		var self = $(this);
1225		var id = self.attr("recent_id");
1226		if($.yyting.checkLogin()){
1227			$.yyting.ajax({
1228				login:false,//根据需要填写
1229				url:'/delReListen',
1230				type:'get',
1231				dataType:"json",
1232				data:{
1233					"id":id,
1234	    			"cToken":$('#cToken').val()
1235				},
1236				success:function (data){
1237					if(data.status=='success'){
1238						self.closest('li').remove();
1239					}else{
1240						$.dialog.tips({
1241							type:'error',
1242							title:data.errMsg
1243						});
1244					}
1245				}
1246			})
1247		}else{
1248			$('.g-main-listen-more').hide();
1249		}
1250	});
1251	
1252	$(document).on('click','#thirdLogin',function(){
1253		var url = $(this).attr("login")+"?bakUrl="+location.href;
1254		location.href=url;
1255	});
1256	// 音乐电台
1257	$(document).on('click','#music_audio',function(){
1258		//必须登陆才能跳转音乐电台
1259		if($.yyting.checkLogin()){
1260			location.href = '/player_radio'
1261		} else {
1262			$.yyting.loginbox(function (){
1263				location.href= '/player_radio';
1264			});
1265		}
1266	
1267	});
1268	// 退出登录
1269	$(document).on('click','.g-top-logout',function(){
1270		localStorage.removeItem('sidExp')
1271	});
1272	//特殊请求 重新获取头部信息
1273	var isThird = $.yyting.params.isThird;
1274	
1275	if("000000" == isThird){
1276		$.yyting.ajax({
1277			login:false,//根据需要填写
1278			url:'/userinfo/info.do',
1279			type:'get',
1280			dataType:"json",
1281			data:{
1282			},
1283			success:function (data){
1284				if(data.status=='success'){
1285					$.yyting.localStorage('user', JSON.stringify(data.data));
1286					$.yyting.initUser();
1287					$.yyting.loginSuccess(data.data);
1288				}else{
1289					$.dialog.tips({
1290						type:'error',
1291						title:data.errMsg
1292					});
1293				}
1294			}
1295		});
1296	}
1297	
1298	var playerEvent={
1299		timer:null,
1300		data:{},
1301		init:function(){
1302			var self=this;
1303			if($.browser.msie){
1304				if(location.href.indexOf('/playlist')>-1){
1305					setInterval(function(){
1306						var request=$.yyting.localStorage('request');
1307						if(request&&self.data.request!=request){
1308							self.data.request=request;
1309							self.request();
1310						}
1311						var response=$.yyting.localStorage('response');
1312						if(response&&self.data.response!=response){
1313							self.data.response=response;
1314							self.response();
1315						}
1316						
1317					},300);
1318				}else{
1319					setInterval(function(){
1320						var exist=$.yyting.localStorage('exist');
1321						if(exist&&self.data.exist!=exist){
1322							self.data.exist=exist;
1323							self.exist();
1324						}
1325					},300)
1326				}
1327			}else{
1328				window.addEventListener('storage',function(l){
1329					if(self[l.key]){
1330						self[l.key].apply(self,arguments);
1331					}
1332				},false);
1333			}
1334			this.bind();
1335		},
1336		exist:function(){
1337			this.isopen=true;
1338			var self=this;
1339			if(this.timer){
1340				clearTimeout(this.timer);
1341			}
1342			this.timer=setTimeout(function(){
1343				self.isopen=false;
1344			},1000);
1345		},
1346		response:function(l){
1347			if(!window.audio){
1348				
1349				this.playTips();
1350				//console.log('已经开始播放了。。。');
1351			}
1352		},
1353		request:function(){
1354			if(window.audio){
1355				//console.log('响应播放了。。。');
1356				$.yyting.localStorage('response',this.getRandom());
1357				this.play();
1358			}
1359		},
1360		play:function(){
1361			if(window.audio){
1362				window.player.toPlay();
1363			}
1364		},
1365		getRandom:function(){
1366			return Math.ceil(Math.random()*100000);
1367		},
1368		bind:function(){
1369			var self=this;
1370			$(document).on('click','.player-trigger',function(e){
1371				self.target=this;
1372				var $this=$(this);
1373				var $input=$this.find('input[type="hidden"]');
1374				
1375				// 收费书籍屏蔽 2016-06-06 TODO
1376				if($this.hasClass('pay-section')){
1377					$.dialog({
1378						title:'',
1379						content:$('#download-pre').html(),
1380						complete:function(){
1381							var  $h4 = this.el.find('h4');
1382							$h4.text($h4.text().replace(/下载/,'收听'));
1383						}
1384					})
1385					e.preventDefault();
1386					return
1387				}
1388				
1389				if($input.length==1&&parseInt($input.val())==0){
1390					self.playTips('没有可以播放的声音');
1391					e.stopPropagation();
1392					return;
1393				}
1394				if(!self.isopen){
1395					window.open('/playlist','player');
1396				}
1397				if($.browser.msie){
1398					self.poll();
1399				}
1400				var data=$.yyting.parseURL($this.attr('player-info'));
1401				$.yyting.localStorage('request',self.getRandom());
1402				$.yyting.localStorage('player-info',JSON.stringify(data));
1403			
1404				e.preventDefault();
1405			});
1406		},
1407		poll:function(){
1408			var self=this;
1409			this.interval=setInterval(function(){
1410				var response=$.yyting.localStorage('response');
1411				if(self.data.response!=response){
1412					self.data.response=response;
1413					self.response();
1414				}
1415			},100);
1416			setTimeout(function(){
1417				if(self.interval){
1418					clearInterval(self.interval);
1419				}
1420			},450)
1421		},
1422		playTips:function(text){
1423			if(!this.target){
1424				return;
1425			}
1426			var text=text||'已经开始播放...';
1427			var $this=$(this.target);
1428			var tips=$('<div class="play-tips g-auto-hide"><p>'+text+'</p></div>').show();
1429			$('body').append(tips);
1430			var top=$this.offset().top-tips.height()-5;
1431			tips.css({
1432				left:$this.offset().left,
1433				top:top
1434			});
1435			setTimeout(function(){
1436				tips.animate({top:top-40,opacity:0}
1436,400,function(){
1437					tips.remove();
1438				});
1439			},200);
1440			this.target=null;
1441		}
1442	}
1443	playerEvent.init();
1444	//轮询获取通知
1445	if(location.href.indexOf('/playlist')==-1){
1446		var timeInterval = null
1447		if ($.yyting.checkLogin()) {
1448			// console.log('$.yyting.checkLogin()', $.yyting.checkLogin())
1449			timeInterval = setInterval(function(){
1450				$.ajax({
1451					url:'/my/message/unread',
1452					success:function(data){
1453						if(data.status=='success'){
1454							window.setNotifyNumber(data);
1455						}
1456						if(data.status=='fail'){
1457							clearInterval(timeInterval)
1458							timeInterval = null
1459							localStorage.removeItem('sidExp')
1460						}
1461					}
1462				})
1463			}, 10000)
1464		}
1465		// timeInterval = setInterval(function(){
1466		// 	console.log('unread')
1467		// 	if($.yyting.checkLogin()){
1468		// 		$.ajax({
1469		// 			url:'/my/message/unread',
1470		// 			success:function(data){
1471		// 				console.log('data', data)
1472		// 				if(data.status=='success'){
1473		// 					window.setNotifyNumber(data);
1474		// 				}
1475		// 				if(data.status=='fail'){
1476		// 					console.log('fail')
1477		// 					clearInterval(timeInterval)
1478		// 					timeInterval = null
1479		// 					localStorage.removeItem('sidExp')
1480		// 				}
1481		// 			}
1482		// 		});
1483		// 	}
1484		// },10000);
1485	}
1486	window.setNotifyNumber=function(data){
1487		var notifyNum=0;
1488		for(var i in data.data){
1489			var $dom=$('.g-top-menu-l .notify-remind-'+i);
1490			var $lDom=$('.sns-control .notify-remind-'+i);
1491			if($dom.length>0){
1492				var number=data.data[i]>1000?'1000+':data.data[i];
1493				if(data.data[i]>0){
1494					$dom.text('('+data.data[i]+')').show();
1495					$lDom.text(number).show();
1496				}else{
1497					$dom.text('('+data.data[i]+')').hide();
1498					$lDom.text(number).hide();
1499				}
1500				notifyNum+=data.data[i];
1501			}
1502		}
1503		if(notifyNum>0){
1504			$('.icon-notify-number').show().text(notifyNum>1000?'1000+':notifyNum);
1505			$('.notify-count').text(notifyNum).parent().show();
1506		}else{
1507			$('.icon-notify-number').hide();
1508			$('.notify-count').parent().hide();
1509		}
1510		
1511	}
1512	setTimeout(function(){
1513		var columnL=$('article .column-l');
1514		var columnR=$('article .column-r');
1515		if(columnL.length==1&&columnR.length==1){
1516			columnR.css('minHeight',columnR.parent().height());
1517			columnL.css('minHeight',columnR.parent().height());
1518		}
1519	},1000);
1520});

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.