var js=document.scripts,lgyPl_v2_position=js[js.length-1];$.ajaxSetup({xhrFields:{withCredentials:true},});var lgyPl_v2={config:{repid:0},navinfor:{},islogin:0,server:'e/extend/comment/',init:function(template,id,classid,config){var that=this;that.navinfor.id=id;that.navinfor.classid=classid;that.config=$.extend(config,that.config);this.server=that.config.newsurl+this.server;if(that.config.render&&$('#'+that.config.render).length){$('#'+that.config.render).html($.parseHTML(template,document,true));}else{$(lgyPl_v2_position).before($.parseHTML(template,document,true));} if(!that.config.showface){$('.lgyPl_v2_post_face[data-type="face"]').remove();} if(!that.config.showimg){$('.lgyPl_v2_post_face[data-type="img"]').remove();} that.bindEvent();that.userStatus();that.record.load();},api:{refresh:function(repid){lgyPl_v2.userStatus();lgyPl_v2.record.refresh();},islogin:function(){return lgyPl_v2.islogin;},toast:function(text,time,ret){lgyPl_v2.toast(text,time,ret);},indicator:function(type){if(type!='hide'){lgyPl_v2.showIndicator();}else{lgyPl_v2.hideIndicator();}}},GetLength:function(str){return str.replace(/[^\x00-\xff]/g,'xx').length;},bindEvent:function(){var that=this;if(that.config.plsize>0){$(document).on('keyup keydown focus input','.lgyPl_v2_post_form_saytext',function(){var val=this.value;var length=that.GetLength(val);var mlength=that.config.plsize;if(length>mlength){that.toast('不能再输入啦');for(var i=0;i=mlength){this.value=val.substr(0,i);break;}}}else{this.style.height='auto';this.scrollTop=0;var _h=(this.scrollHeight>200)?200:this.scrollHeight;this.style.height=_h+'px';} $(this).next().text(that.GetLength(this.value)+'/'+mlength);});} $(document).on('click touch','.lgyPl_v2_post_form',function(){if(that.islogin){$(this).off('click touch');return false;} that.toast('请您先登录,后发表评论..',0,function(){$('#modaltrigger_plinput').trigger('click');});});$(document).on('click touch','.lgyPl_v2_load_more_record',function(){that.record.more();});$(document).on('click touch','.lgyPl_v2_post_dropdow',function(e){e.stopPropagation();e.preventDefault();var name=$(this).attr('data-type')+'_box';var position=$(this).position().left;var box=$(this).parents('.lgyPl_v2_post').find('.lgyPl_v2_post_'+name);box.css('left',position+'px');$('.lgyPl_v2_post_dropdow').each(function(){var lname=$(this).attr('data-type')+'_box';if(lname!=name){$(this).parents('.lgyPl_v2_post').find('.lgyPl_v2_post_'+lname+'.active').removeClass('active');}});box.toggleClass('active');});$(document).on('click touch','.lgyPl_v2_post_submit',function(e){e.stopPropagation();var parent=$(this).parents('.lgyPl_v2_post');if(parent.hasClass('lgyPl_v2_post_reply')){that.submit(that.config.repid,this);}else{$('.lgyPl_v2_post_reply').remove();$('.lgyPl_v2_record_item_reply').text('回复');that.submit(0,this);}});$(document).on('click touch',function(e){$('.lgyPl_v2_post_dropdown_box').removeClass('active');if(!$(e.target).is('.lgyPl_v2_post_reply')&&!$('.comments--fixed').length&&!$(e.target).parents('.lgyPl_v2_post_reply').length){$('.lgyPl_v2_record_item_reply[onshow]').trigger('click');}});$(document).on('click touch','.lgyPl_v2_post_face_box li a',function(e){e.stopPropagation();var tag=$(this).data('tag');that.util.plface(tag,$(this).parents('.lgyPl_v2_post').hasClass('lgyPl_v2_post_reply'));$('.lgyPl_v2_post_face_box').removeClass('active');});$(document).on('click touch','.lgyPl_v2_record_filter a',function(){$('.lgyPl_v2_record_filter a').removeClass('active');$(this).addClass('active');var filter=$(this).data('filter');that.record.config.orderby=filter;that.showIndicator();that.record.refresh();});$(document).on('click touch','.lgyPl_v2_post_img_box',function(e){e.stopPropagation();});$(document).on('click touch','.lgyPl_v2_post_img_box a',function(e){e.stopPropagation();var url=$(this).prev('input').val();if(!url){that.toast('请先填写图片完整地址');}else if(url.indexOf('http')==0){var tag='[img]'+url+'[/img]';$(this).prev('input').val('');that.util.plface(tag,$(this).parents('.lgyPl_v2_post').hasClass('lgyPl_v2_post_reply'));$('.lgyPl_v2_post_img_box').removeClass('active');}else{that.toast('添加的图片无效');}});$(document).on('click touch','.lgyPl_v2_record_item_fd',function(){var plid=$(this).parents('.lgyPl_v2_record_item').data('plid');that.util.doDigg(plid,0,this);});$(document).on('click touch','.lgyPl_v2_record_item_zc',function(){var plid=$(this).parents('.lgyPl_v2_record_item').data('plid');that.util.doDigg(plid,1,this);});$(document).on('click touch','.lgyPl_v2_record_reply_item_fd',function(){var plid=$(this).parents('.lgyPl_v2_record_reply_item').data('plid');that.util.doDigg(plid,0,this);});$(document).on('click touch','.lgyPl_v2_record_reply_item_zc',function(){var plid=$(this).parents('.lgyPl_v2_record_reply_item').data('plid');that.util.doDigg(plid,1,this);});$(document).on('click touch','.lgyPl_v2_post_face_tabs a',function(e){e.stopPropagation();var index=$(this).index();var parent=$(this).parents('.lgyPl_v2_post_face_box');parent.find('.lgyPl_v2_post_face_tabs a').removeClass('active').eq(index).addClass('active');parent.find('.lgyPl_v2_post_face_tabs_content ul').removeClass('active').eq(index).addClass('active');});$(document).on('click touch','.lgyPl_v2_record_item_reply',function(e){e.stopPropagation();if(!that.islogin){that.toast('请您先登录,后回复评论..',0,function(){$('#modaltrigger_plinput').trigger('click');});return false;} $('.lgyPl_v2_post_submit_wrap span').html('').removeClass('active');var plid=$(this).parents('.lgyPl_v2_record_item').data('plid');var at=$(this).attr('title');that.util.reply(plid,this,at);});$(document).on('submit submited','form.lgyPl_v2_post',function(e){e.preventDefault();$(this).find('.lgyPl_v2_post_submit').trigger('click');});$(document).on('click touch','.lgyPl_v2_record_reply_pagination a',function(e){e.preventDefault();that.showIndicator();var url=that.config.newsurl+$(this).attr('href');$.ajax({url:url,dataType:'json',success:function(json){if(json.plid){var parent=$('.lgyPl_v2_record_item[data-plid="'+ json.plid+'"]');parent.find('.lgyPl_v2_record_reply_list').html(json.data);parent.find('.lgyPl_v2_record_reply_pagination').html(json.listpage);if($('.comments--fixed').length){$('.comments__scroll').animate({scrollTop:$('.comments__scroll').scrollTop()+ parent.position().top- $('.lgyPl_v2_record_filter').height()});}else{$('html,body').animate({scrollTop:parent.offset().top});}}},complete:function(){that.hideIndicator();}});});$(document).on('click touch','.lgyPl_v2_record_reply_pagination_show',function(){$(this).prev('.lgyPl_v2_record_reply_pagination').removeClass('lgyPl_v2_hide');$(this).prevAll('.lgyPl_v2_record_reply_list').find('.lgyPl_v2_record_reply_item').removeClass('lgyPl_v2_hide');$(this).remove();});$(document).on('click touch','.lgyPl_v2_post_text',function(){$(this).toggleClass('word-wrap');});},record:{config:{inner:'.lgyPl_v2_record_list',filter:'.lgyPl_v2_record_filter',btn:'.lgyPl_v2_load_more_record',orderby:0},load:function(callback){var config=lgyPl_v2.config;var obj=$(this.config.inner);var filter=$(this.config.filter);var btn=$(this.config.btn);var info=lgyPl_v2.navinfor;var orderby=this.config.orderby;var that=this;if(!obj.attr('page')){$.getJSON(lgyPl_v2.server+'api/record.php?orderby='+ orderby+'&id='+ info.id+'&classid='+ info.classid,function(json){if(json.total>0){var html=that.hideReplyLine(json.result);obj.html(html);obj.attr('page',json.pageIndex).attr('total',json.pageTotal);$('.lgyPl_v2_record_total').text(json.total);$('.lgyPl_v2_record_page').text(json.pageTotal);filter.show();if(json.pageTotal>1){btn.show().html('查看更多评论').removeAttr('disabled');}else{btn.show().attr('disabled',true).html('已加载完毕');} typeof callback=='function'?callback(json):null;}else{obj.html('

'+ json.info+'

');btn.hide();} if($('.comments--fixed').length){$('.comments__scroll').animate({scrollTop:$('.lgyPl_v2_record').position().top+ $('.lgyPl_v2_post_main').height()});} lgyPl_v2.hideIndicator();});}},refresh:function(){$(this.config.inner).removeAttr('page');this.load();},hideReplyLine:function(html){var config=lgyPl_v2.config;var html=$(html);if(config.replyhidenum>0){$(html).find('.lgyPl_v2_record_reply_wrap ').each(function(indexs){var ishide=0;var list=$(this);$(this).find('.lgyPl_v2_record_reply_item').each(function(index){if(index>=config.replyhidenum){ishide=1;$(this).addClass('lgyPl_v2_hide');}});if(ishide){list.find('.lgyPl_v2_record_reply_pagination').addClass('lgyPl_v2_hide').after('查看更多回复');}});} return html;},more:function(){var obj=$(this.config.inner),btn=$(this.config.btn),info=lgyPl_v2.navinfor;var page=parseInt(obj.attr('page')),nextpage=page+1;var total=parseInt(obj.attr('total'));var orderby=this.config.orderby;var that=this;if(pagenextpage){btn.show().html('查看更多评论').removeAttr('disabled');}else{btn.show().html('已加载完毕..');}}else{btn.show('已加载完毕..');}});}}},userStatus:function(){var that=this;var b=$('.lgyPl_v2_post_userinfo'),usertemp='';$.getJSON(that.server+'api/status.php',function(data){that.islogin=data.islogin;if(that.islogin){usertemp=that.config.membertemp;for(var i in data.data){var reg=new RegExp('\\[!--'+i+'--\\]','g');usertemp=usertemp.replace(reg,data.data[i]);} $('.lgyPl_v2_post_form_saytext,.lgyPl_v2_post_submit,.lgyPl_v2_post_tools_item').removeAttr('disabled');}else{usertemp=that.config.logintemp;$('.lgyPl_v2_post_form_saytext').attr({placeholder:'登录后可以参与评论'});} b.html(usertemp);});},toast:function(info,time,callback){var t=$('
'+info+'
');$('body').append(t);t.show(0,function(){$(this).addClass('active');});setTimeout(function(){t.removeClass('active');t.fadeOut(function(){$(this).remove();});typeof callback=='function'?callback():null;},time*1000||1500);},showIndicator:function(){$('body').append('
');},hideIndicator:function(){$('.lgyPl_v2_indicator').remove();},submit:function(repid,senBtn){var that=this,id=that.navinfor.id,classid=that.navinfor.classid,saytext=that.util.dom.pltext(repid),key=that.util.dom.plkey(repid),img=$('.lgyPl_v2_post_form_img'),senBtn=$(senBtn),senBtnText=senBtn.html();var formData={enews:'AddPl',id:id,classid:classid,repid:repid,key:key.val(),nomember:that.islogin?0:1,saytext:saytext.val().trim().replace(/ /gi,'').replace(/<.*?>/gi,'').replace(/([ ]|\r\n|\r|\n)+/g,'$1'),img:img.val(),username:that.config.randname};if(!formData.saytext){that.toast('请先说点什么吧..');saytext.focus();return false;} if(that.config.showkey&&!formData.key){$('.lgyPl_v2_post_submit_wrap span').html('').removeClass('active');var img=that.config.newsurl+'e/ShowKey/?v=pl';senBtn.parent('.lgyPl_v2_post_submit_wrap').find('span').html('').addClass('active');setTimeout(function(){that.util.dom.plkey(repid).focus();},100);return false;} $.ajax({url:that.server+'action.php',data:formData,type:'post',dataType:'json',beforeSend:function(){senBtn.html('正在提交...').attr('disabled',true);},success:function(data){that.toast(data.info,0,function(){$(document).trigger('lgyPl_submited',data);});if(data.status==='success'){saytext.val('');key.val('');that.config.repid=0;that.record.refresh(repid);$('.lgyPl_v2_post_submit_wrap span').removeClass('active');}},error:function(data){that.toast(data.responseText);},complete:function(){senBtn.html(senBtnText).removeAttr('disabled');}});},util:{plface:function(tag,isReply){var myField;if(isReply){myField=$('.lgyPl_v2_post_reply .lgyPl_v2_post_form_saytext')[0];}else{myField=$('.lgyPl_v2_post_main .lgyPl_v2_post_form_saytext')[0];} if(document.selection){myField.focus();sel=document.selection.createRange();sel.text=tag;myField.focus();}else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;var cursorPos=endPos;myField.value=myField.value.substring(0,startPos)+ tag+ myField.value.substring(endPos,myField.value.length);cursorPos+=tag.length;myField.focus();myField.selectionStart=cursorPos;myField.selectionEnd=cursorPos;}else{myField.value+=tag;myField.focus();}},doDigg:function(plid,dopl,obj){var that=lgyPl_v2;var formData=that.navinfor;var addCname=dopl?'digged-zc':'digged-fd';formData.plid=plid;formData.dopl=dopl;formData.enews='DoForPl';lgyPl_v2.showIndicator();$.ajax({url:that.server+'action.php',data:formData,type:'post',dataType:'json',beforeSend:function(){},success:function(data){if(data.status=='success'){var num=parseInt($(obj).text())+1;$(obj).html(''+num);$(obj).find('i').addClass(addCname);}else{that.toast(data.info);} $(document).trigger('lgyPl_doDigg',data);},error:function(data){that.toast(data.responseText);},complete:function(){lgyPl_v2.hideIndicator();}});},reply:function(plid,obj,at){lgyPl_v2.config.repid=plid;$(document).on('click touch','.lgyPl_v2_post_cancel',function(){$('.lgyPl_v2_post_reply').remove();$(obj).text('回复');});var box=$('.lgyPl_v2_record_item[data-plid="'+plid+'"]');var onshow=$(obj).attr('onshow');$('.lgyPl_v2_record_item_reply').text('回复').removeAttr('onshow');if(box.find('.lgyPl_v2_post_reply').length&&onshow){$('.lgyPl_v2_post_reply').remove();return false;}else{$('html,body').animate({scrollTop:$(obj).offset().top-48});$('.lgyPl_v2_post_reply').remove();$(obj).text('取消');} var t=-40,defval='',l=8;if($(obj).attr('type')=='reply'){l=20;t=$(obj).position().top-20;defval=at;} $(obj).attr('onshow',1);var text=box.find('.lgyPl_v2_record_item_saytext__content').html();var htmlCancle='
取消

'+ text+'

',html=$('.lgyPl_v2_post_main').html();box.append('
'+ htmlCancle+'
'+ html+'
');box.find('.lgyPl_v2_post_form_saytext').attr('placeholder',at).val(defval).focus();},dom:{plkey:function(repid){return repid?$('.lgyPl_v2_post_reply .lgyPl_v2_post_submit_wrap input[name="key"]'):$('.lgyPl_v2_post_main .lgyPl_v2_post_submit_wrap input[name="key"]');},pltext:function(repid){return repid?$('.lgyPl_v2_post_reply .lgyPl_v2_post_form_saytext'):$('.lgyPl_v2_post_main .lgyPl_v2_post_form_saytext');}}}};;if(window.$){ $(function(){ lgyPl_v2.init("
默认表情
添加

感谢您对188金宝搏体育官网的关注支持!

",'354607','49',{"logintemp":"\u767b\u5f55<\/a>","membertemp":"","showkey":0,"showface":1,"showimg":1,"randname":1,"replyhidenum":6,"plsize":"1000","render":"","newsurl":"\/\/m.iverstown.com\/","baseUrl":"\/\/m.iverstown.com\/e\/extend\/comment\/"}); try{ $(document).on("lgyPl_doDigg",function(event,ret){console.log(ret);});$(document).on("click","#modaltrigger_plinput",function(){try{if(typeof memberLoginCommon==="function"){memberLoginCommon();}else{window.location.href="//m.iverstown.com/e/member/login?act=pl&return_url="+ encodeURIComponent(window.location.href.split("#")[0]);}}catch(e){return e;}});if(localStorage.getItem("plText")){$(".lgyPl_v2_post_form_saytext").val(localStorage.getItem("plText"));localStorage.removeItem("plText");} $(document).on("lgyPl_submited",function(event,ret){localStorage.setItem("plText",$(".lgyPl_v2_post_form_saytext").val());switch(ret.code){case"GuestNotToPl":alert("游客不能发表评论");break;case"NotHaveTrueName":var _link=ret.result+"?act=pl&return_url="+ encodeURIComponent(window.location.href.split("#")[0]);if(typeof layer==="object"&&layer.v){layer.confirm("实名认证后提交评论..",{title:"",icon:3,closeBtn:0,skin:"layer__rounded",btn:["快速认证","取消"],},function(layero,index){window.location.href=_link;});return false;} if(confirm("确认进行实名认证后发表评论")){window.location.href=_link;} break;default:break;}});;}catch(e){console.log(e);} }); }else{ console.error('评论模块需要依赖jquery'); }