C1 Cid: SINA_TEXT_PAGE_INFO.newsid, // 默认为空 parent: '' }, { channel: SINA_TEXT_PAGE_INFO.channel, // 新闻id newsid: SINA_TEXT_PAGE_INFO.newsid, // 默认为0,多条新闻(图片)集合的评论为1 group: 0, // 开始页数,默认为1 page: 1, // 每页评论条数 pageSize: 20, showReplay: true, maxWordCount: 140, hotPageNum: 3, firstPageNum: 10, clickMoreTimes: 3, hideList: SINA_TEXT_PAGE_INFO.hideCommentList, loaded: function(self) { setTimeout(function() { if (articleComment.setHeight) { articleComment.setHeight(); } }, 500); var numSplit = function(num) { num = num + ""; var re = /(-?\d+)(\d{3})/ while (re.test(num)) { num = num.replace(re, "$1,$2") } return num; }; if (self.data && self.data.count && self.data.count.total) { // 设置评论数 $('#commentCount1').html(numSplit(self.data.count.total)); } } }, {}); window.articleComment = (function() { var wrap = node; var commentWrap = $('#pl_comment') var close = $('#pl_comment_close'); var win = $(window); var body = $('body'); var html = $('html'); var cont = $('#pl_main_content'); var toggleClz = 'comment-mode'; var isShow = false; var minWidth = 570; if (window.isIpad) { toggleClz = toggleClz + '-ipad'; } var resize = function() { var id = 'comment-resize-style'; var winWidth = win.outerWidth(); var wrapWidth = winWidth; if (!window.isIpad) { wrapWidth = 570 + (winWidth - cont.width()) / 2; wrapWidth = Math.max(minWidth, wrapWidth); setCSS('div.comment-wrap{right:-'+ wrapWidth +'px;}',id); // wrap.css('right', -wrapWidth); } else { // wrapWidth = '100%'; wrap.css('left', -wrapWidth); } wrap.css('width', wrapWidth); }; var hide = function() { html.removeClass(toggleClz); $('textarea',commentWrap).blur(); isShow = false; }; var show = function() { resize(); html.addClass(toggleClz); setHeight(); isShow = true; }; var setHeight = (function() { var form = null; var list = null; return function() { if (!list || list.length === 0) { form = $('[comment-type=form]', wrap); list = $('[comment-type=list]', wrap); var onReachBottom = function(selector,proximity,fn){ var obj = $(selector); var el = obj[0]; obj.on('scroll', function() { if (el == window) { scrollHeight = $(document).height(); } else { scrollHeight = el.scrollHeight; } scrollPosition = obj.height() + obj.scrollTop(); if ((scrollHeight - scrollPosition) / scrollHeight <= proximity) { // 到达底部 if (typeof fn === 'function') { fn(); } } }); }; onReachBottom(list,0.03,function(){ FormList1.commentList.getMoreLatest(); }); } if (list.length) { list.css({ // height: getVisibleSize().height - form.height(), height: $(window).height() - form.height(), overflow: 'auto' }); } }; })(); var bind = function() { var body = $('body'); var supportsOrientationChange = "onorientationchange" in window, orientationEvent = supportsOrientationChange ? "orientationchange resize" : "resize"; close.on(eventType, hide); win.on(orientationEvent, function() { setTimeout(function(){ setHeight(); },100); if (window.isIpad) { $('textarea',commentWrap).blur(); setTimeout(function(){ resize(); }, 100); } }); body.on(eventType, '.comment2-small,.page-tool-c', function(e) { show(); }); body.on(eventType, '.pad-side-tool .comment-small', function(e) { if(isShow){ hide(); }else{ show(); } }); body.on(eventType, '.close-small,.share-small', function(e) { hide(); }); commentWrap.on('blur','textarea',function(){ setTimeout(function(){ setHeight(); },100); }); commentWrap.on('focus','textarea',function(){ setTimeout(function(){ if(window.isIpad){ window.scrollTo(); } },100); }); }; resize(); bind(); return { show: show, hide: hide, setHeight: setHeight }; })(); } }); })(window);