PageSourceSearch

https://www.storexppen.kr/newxp/static2024/js/index/comment.js?ver=20260814

js storexppen.kr collected 2026-09-29 00:41:05 UTC 6,857 bytes, 189 lines download raw bytes

1// JavaScript Document
2// 用ajax分页显示评论
3function ajaxComment(url){
4	$.ajax({
5		type : "GET",
6		 url:url,//+tab,
7		success: function(data){
8			$("#comment_list_box").html('');
9			$("#comment_list_box").html(data);
10		}
11	});
12}
13//Ajax判断评价是否有用/无用
14function save_user_count(obj){
15	var $this=obj;
16	var goods_id=$this.attr("data-goods-id"),comment_id=$this.attr("data-id"),type=$this.attr("data-type");
17	$.ajax({
18		type : "POST",
19		dataType: "json",
20		url:_ROOT_+"Comment/ajax_comment_user",//+tab,
21		data:{"goods_id":goods_id,"comment_id":comment_id,"type":type},
22		success: function(data){
23			if(data.code==-1){
24				login_box(data.msg);
25			}else if(data.code==1){
26				$this.find("b").html(parseInt($this.find("b").html())+1);
27				layer.msg(data.msg,{icon:1});  	
28			}else{
29				 layer.msg(data.msg,{icon:2});  	
30			}
31		}
32	});
33}
34
35$(document).ready(function(){
36	console.log(default_url,'default_url');
37	
38	   ajaxComment(default_url);// ajax 加载评价列表
39	  //ajax 分页
40	  $(document).on("click",".comment_page a",function(){
41		 var url=$(this).attr("href");
42         let regex = /page=(\d+)/;
43         let match = url.match(regex);
44         let page = match ? match[1] : 1;
45         ajaxComment(default_url+'?page='+page);// ajax 加载评价列表
46          //定位到评价的顶部
47		 $(".nav_miaodian").find("li").each(function(index, element) {
48			 if($(element).attr("data-jump")=='Reviews'){
49				  $(element).find("a").addClass("active");  
50			 }else{
51				  $(element).find("a").removeClass("active");  
52			 }
53		  });
54		  var top=$(".scrollspy-example div[id='Reviews']").offset().top;
55		  $('html, body').animate({scrollTop:top+200}, 500); 
56		  return false;
57	 });
58	 
59	 
60	 //Ajax判断评价是否有用/无用
61	 $(document).on("click",".add_comment_total",function(){
62		save_user_count($(this)); 
63	 });
64	 
65	  //加载评价的html
66	 $(document).on('click',".add_comment_list",function(){
67		 var $this=$(this);
68		 var goods_id=$this.attr("data-goods-id"),comment_id=$this.attr("data-id"),reply_id=$this.attr("data-reply-id"),page=$(this).attr("data-page"),type=$(this).attr("data-type");
69		 var key_id="#comment_form_"+goods_id+"_"+comment_id+"_"+reply_id;
70		 if($this.hasClass("selected")){
71			 $this.removeClass("selected");
72			$(key_id).hide().html(''); 
73		 }else{
74			 $(".comment_form").hide().html('');
75			 $(key_id).show().html('<div style="text-align:center; margin:20px 0;"><img src='+_STATIC_+'layer/skin/default/loading-1.gif /></div>');
76			 $.ajax({
77				type : "POST",
78				dataType: "json",
79				url:_ROOT_+"Comment/ajax_reply_comment/type/0.html",//+tab,
80				data:{"goods_id":goods_id,"comment_id":comment_id,"reply_id":reply_id,"page":page,"type":type},
81				success: function(data){
82					if(data.code==-1){
83						$(key_id).hide().html('');
84						login_box(data.msg);
85					}else if(data.code==1){
86						$(key_id).html(data.msg);
87						$this.addClass("selected");
88					}else{
89						 layer.msg(data.msg,{icon:2});  	
90					}
91				}
92			});
93		 }
94	 });
95	 
96	 //提交回复评价
97	 $(document).on("click","#button-inquire-sumbit",function(){
98		 var $this=$(this);
99		 var goods_id=$this.attr("data-goods-id"),comment_id=$this.attr("data-comment-id"),reply_id=$this.attr("data-reply-id"),page=$(this).attr("data-page"),type=$(this).attr("data-type");
100		 var content=$("#comment_content").val();
101		 var content_len=getStrLength(content);
102		  if(content_len<=0 || (content_len>0 && content_len<5) ){
103			  //"最少5字,还需要输入"+parseInt(5-content_len)+"字"
104			  $(".kb-input-content").addClass("comment_hover").find(".input-number-tip").addClass("warm").html(L('LEAST_WORDS',parseInt(5-content_len)));
105			  return false;
106		  }
107		   var comment_pic=[]; //获取上传的图片
108		  $("#comment_form_"+goods_id+"_"+comment_id+"_"+reply_id+" input[type='hidden'][name='comment_pic[]']").each(function(i){
109			  comment_pic[i]=$(this).val();
110		  });
111		  var param={"goods_id":goods_id,"content":content,"thumbs":comment_pic,"model_name":model_name,"comment_id":comment_id,"reply_id":reply_id};
112		  $.post(_ROOT_+"Comment/ajax_reply_comment/type/1.html",param,function(data){
113			  if(data.code==-1){
114				   login_box(data.msg);
115			  }else if(data.code==1){
116				  var index=layer.alert(data.msg,{'icon':1,title:L('PROMPT_MESSAGE'),btn:[L('DETERMINE')]},function(){
117						$("#comment_form_"+goods_id+"_"+comment_id+"_"+reply_id).hide().html('');
118						layer.close(index);
119						ajaxComment(default_url+"?type="+type+"&page="+page);// ajax 加载评价列表	 
120				  });	
121			  }else{
122				  layer.alert(data.msg,{'icon':2,title:L('PROMPT_MESSAGE'),btn:[L('DETERMINE')]});	
123			  }
124		  })
125		  return false;
126		  
127		  
128	 });
129	 
130	   /* 文本区域字数检测 */
131	  $(document).on("keyup mouseup","#comment_content",function(event){
132		   var count_html=count_str($(this).val(),500);
133		   $(".kb-input-content").find(".input-number-tip").html(count_html);
134		   var content=$(this).val();
135		   var content_len=getStrLength(content);
136		   if(content_len<5){
137			  $(".kb-input-content") .find(".input-number-tip").addClass("warm");
138		   }else{
139			   $(".kb-input-content") .find(".input-number-tip").removeClass("warm");
140			}
141	  });
142	  
143	//折叠/open更多的评价
144	$(document).on("click",".open_comment_list",function(){
145		var goods_id=$(this).attr("data-goods-id"),ask_id=$(this).attr("data-id"),data_num=$(this).attr("data-num");
146		var key_id="#comment_box_"+goods_id+"_"+ask_id+"_0";
147		if($(this).hasClass("selected")){
148			$(this).removeClass("selected").html(L('VIEW_MORE_EVALUATION')+"("+data_num+")");//查看更多评价
149			$(key_id).find(".comment_selected").addClass("hide");	
150		}else{
151			$(this).addClass("selected").html(L('FOLD_ALL_EVALUATION'));//折叠全部评价
152			$(key_id).find(".comment_selected").removeClass("hide");
153		}
154	});
155	
156	//检验当前登录用户是否购买了商品
157	$(document).on("click",".myWantComment",function(){
158		var $this=$(this),goodsId=$this.attr("data-goods-id");
159		$.post(_ROOT_+"Order/check_buy",{"goodsId":goodsId},function(data){
160			if(data.code==1){
161				window.location.href=$this.attr("link");	
162			}else{
163				login_box(data.msg);
164			}
165		});
166		return false;
167	})
168
169
170	// 产品详情描述文案复制
171	$(document).on("click",".Product_Describe_Copy",function(){
172		var alt_yh = $(this).text();
173		var alt_success = L('PRODUCT_DESCRIBE_WORD_COPY') ;
174		CopyToClip(alt_yh, alt_success)
175	})
176	function CopyToClip(content, message) {
177		var AuxC = document.createElement("input"); 
178		AuxC.setAttribute("value", content); 
179		document.body.appendChild(AuxC); 
180		AuxC.select();
181		document.execCommand("copy"); 
182		document.body.removeChild(AuxC);
183		if (message) {
184			layer.msg(message);
185		}
186	}
187
188	 
189});

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.