/* http://zzsvn.pcauto.com.cn/svn/test/dj/js/windowname/windowname.js */ /* http://zzsvn.pcauto.com.cn/svn/test/dj/js/windowname/windowname.js */ function postCORS(c,h,f,b){var g=createCORSRequest();if(!g){var e=new Transfer(c,function(i){h(i,{isHxr:false})},{params:f});e.send()}else{g.open("POST",c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");if(b&&b.withCookie){g.withCredentials=true}g.onreadystatechange=function(){var i={isXhr:true};if(g.readyState==4){if(g.status==200||g.status==304){i.status="success";h(g.responseText,i)}else{i.status="error";h(g,i)}}};var a=[];for(var d in f){if(f.hasOwnProperty(d)){a.push(encodeURIComponent(d)+"="+encodeURIComponent(f[d]))}}g.send(a.join("&"))}}function createCORSRequest(){var b;try{b=new XMLHttpRequest();if(!("withCredentials" in b)){b=null}}catch(a){b=null}return b}function Transfer(b,d,a){this.url=b;this.callback=d;var c={localProxy:"/favicon.ico",defaultName:"cross.default.name"};this.options=this.extend(c,a);this.init()}Transfer.prototype={init:function(){function a(h,f){var g=null;try{g=document.createElement("<"+h+' name="'+f+'">')}catch(i){}if(!g||g.nodeName!=h.toUpperCase()){g=document.createElement(h);g.name=f}return g}this.params=this.options.params||{};this.params.windowname=1;delete this.options.params;this.files=this.options.files||[];delete this.options.files;var b="transfer_"+new Date().getTime();this.options.defaultName=b;var d=a("iframe",b);d.name=b;d.style.display="none";d.style.position="fixed";d.style.top=d.style.left="-10000px";document.body.appendChild(d);var c=document.createElement("form");c.style.display="none";c.target=b;c.action=this.url;c.method="post";c.encoding=c.enctype="application/x-www-form-urlencoded";document.body.appendChild(c);this.frame=d;this.form=c;this.state=1;this._setRequest()},_setRequest:function(){var j=this,c=j.frame,a=j.form,k=j.options,i=k.localProxy;if(c.onreadystatechange!==undefined){c.onreadystatechange=h}else{c.onload=h}function b(){var l;try{l=c.contentWindow.name}catch(m){l=k.defaultName}if(l==k.defaultName){l='{"error": 1}'}j.callback(l)}function f(){var m=false;try{m=c.contentWindow.location.host==location.host}catch(l){}return m}function g(){clearTimeout(d);c.onreadystatechange=c.onload=null;c.parentNode.removeChild(c);if(a){var p;for(var o=0,m=j._files.length;o < m;o++){p=j._files[o];p[2].insertBefore(p[0],p[1]);p[2].removeChild(p[1])}p=null;j._files=[];a.parentNode.removeChild(a)}c=null;a=null;for(var n in j){if(j.hasOwnProperty(n)){j[n]=null;delete j[n]}}}var e=false;var d;function h(){try{if(c.contentWindow.location.href=="about:blank"){return}}catch(l){}if(j.state==3){if(!f()&&!e){e=true;c.contentWindow.location=i}else{if(c.readyState&&!(/complete|loaded/i.test(c.readyState))){return}b();g()}}if(j.state==2){j.state=3;c.contentWindow.location=i}if(!d){d=setTimeout(function(){b();g()},120000)}}},send:function(){var g=this.params,a=this.files,c=this.form,o,p;var e=Object.prototype.toString;for(o in g){if(g.hasOwnProperty(o)){p=g[o];if(e.call(p)==="[object Array]"){var b=o+"[]";for(var j=0,f=p.length;j0){c.encoding=c.enctype="multipart/form-data";for(var q=0;q < m;q++){h=a[q];r=h.parentNode;n=h.cloneNode();n.disabled="disabled";d.push([h,n,r]);r.insertBefore(n,h);c.appendChild(h)}}h=r=n=null;c.submit();this.state=2;function k(l,s){var i=document.createElement("input");i.name=l;i.value=s;return i}},isObject:function(a){return Object.prototype.toString.call(a)=="[object Object]"&&!a.nodeType},isArray:function(a){return Object.prototype.toString.call(a)=="[object Array]"},extend:function(c,b){var d=this.clone(b);var a;for(a in d){if(d.hasOwnProperty(a)){c[a]=d[a]}}return c},clone:function(f){var c=this,d;if(c.isArray(f)){d=[];for(var e=0,a=f.length;e < a;e++){d.push(c.clone(f[e]))}}else{if(c.isObject(f)){d={};for(var b in f){if(f.hasOwnProperty(b)){d[b]=c.clone(f[b])}}}else{d=f}}return d}}; /*弹框处理*/ function showFB(type){ if(type=="login"){ document.getElementById("pl_login").style.display="block";/*登录*/ }else{ document.getElementById("pl_add").style.display="block";/*回复*/ //document.getElementById("content_pop").value=""; } document.getElementById("floBG").style.display="block"; } function hiddenFB(){ document.getElementById("content_pop").value=""; document.getElementById('pl_login').style.display='none'; document.getElementById("pl_add").style.display="none"; document.getElementById('floBG').style.display='none'; } /*表情处理*/ function getFaceList(e){ var s = document.getElementById("replyShowName").value; var obj2 = document.getElementById("content_pop"); var v = obj2.value; if(v == s){obj2.value = "";obj2.style.color="#aaa";} var flist = e.nextSibling; if(flist.style.display != "inline"){ var areas = flist.getElementsByTagName('textarea'); if (areas.length == 1) { var fr = document.createDocumentFragment(); var div = document.createElement('div'); div.innerHTML = areas[0].value; while(div.childNodes.length) { fr.appendChild(div.childNodes[0]); } flist.appendChild(fr); flist.removeChild(areas[0]); div = null; fr = null; } flist.style.display="inline"; } else{ flist.style.display="none"; } } function putFace(e){ var _OBJ; if(navigator.appName == "Microsoft Internet Explorer" ){ _OBJ = e.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].childNodes[0].childNodes[0];/*IE*/ }else{ _OBJ = e.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[2].childNodes[1].childNodes[1];/*FF Chrome etc*/ } _OBJ.value+=e.title; e.parentNode.style.display="none"; } var _checkLogin = function() { return cmt4_getCookie('cmu') && cmt4_getCookie('common_session_id'); }; var _jumpForLogin = function(){ if (_checkLogin()) { var postUrl = "https://passport3.pchouse.com.cn/passport3/api/mobile_bind.jsp"; postCORS(postUrl, function(data) { var data = eval("("+data+")"); var msg = data.message, code = data.code; if( code == 0 && msg=="手机号未绑定"){ alert('您的账号未绑定手机~'); } }, {act:'check'}, {withCookie: true}); }else{ alert("登陆后才能评论~"); window.location.href = "//my.pchouse.com.cn/login.jsp?return="+window.location.href; } }; document.body.onclick=function(e){ e = window.event || e; var target = e.target || e.srcElement; var type = target.getAttribute("data-event"); switch(type){ case 'detectLogin': _jumpForLogin(); break; } thisObj = document.all?event.srcElement:e.target; do{ if(thisObj.className.indexOf("tFace")>=0){ return}; if(thisObj.tagName.toUpperCase() == "BODY"|| thisObj.tagName.toUpperCase() == 'HTML'){document.getElementById("cmtFace").style.display='none';document.getElementById("cmtFace_pop").style.display='none';return;}; thisObj = thisObj.parentNode; }while(thisObj.parentNode); }; function cmt4_keypress(obj,event,type){ if(event.ctrlKey && (10 == event.keyCode || 13 == event.keyCode)){ if(obj.getAttribute('data-submit') == '1') { return; } if(cmt4_checkFrm(obj.form)){ obj.setAttribute('data-submit', '1'); if(type=="pop"){ cmt4_comment_pop(); }else{ cmt4_comment(); } } } } function cmt4_vote(id, support) { document.body.insertBefore(document.createElement('script'),document.body.firstChild).src = "//cmt.pchouse.com.cn/action/comment/support.jsp?cid="+id+"&sp="+support+"&r="+Math.random(); } function cmt4_checkFrm(f){ if(f.content.value=='') { f.content.focus(); alert('评论内容不能为空!'); return false; } if(f.content.value==cmt4_getAuditInfo()){ f.content.focus(); alert('请先输入您的评论!'); return false; } if(f.content.value.length>500) { f.content.focus(); alert('评论内容字数超过500!'); return false; } if(f.title.value=='') f.title.value=document.title; if(f.title.value=='') f.title.value='[无标题]'; f.username.value=document.getElementById('usernameInput').value; document.getElementById('Submit').disabled=true; return true; } function reply(item, floor, showName, createTime) { showFB('add'); document.getElementById('replyFloor').value= floor; var preContent = '回复' + floor + '楼(' + showName + '):'; //var auditInfo = "注:所有评论通过审核后才会被公开。"; var auditInfo = preContent; //document.getElementById('content_pop').focus(); //document.getElementById('pop_info').value = auditInfo; document.getElementById('replyShowName').value = preContent; cmt4_showAuditInfo2(auditInfo,1); var td = $(item).parent().parent().parent(); var content = td.find('.commentContent').html(); var preReply = td.find('.reply').html(); var replyContent = document.getElementById('replyContent'); replyContent.value = ""; if(preReply != null) { replyContent.value = '
' + preReply + '
'; } replyContent.value += '
' + floor + '楼' + showName + '' + createTime + '

' + content + '

'; return false; } function cmt4__comment_show_entry_(placeHolder) { var div = document.createElement('div'); if(placeHolder == null) placeHolder = document.getElementById("_comment_tag_"); if(placeHolder == null) placeHolder = document.getElementById("comment_tag"); if(placeHolder == null) { alert(placeHolder); return div; } div.id = placeHolder.id; placeHolder.parentNode.replaceChild(div,placeHolder); return div; } (function(){ var s = document.createElement('link'); s.setAttribute('rel', 'stylesheet'); s.href = '//js.3conline.com/pchouse/common/css/expCmt.css'; document.getElementsByTagName('head')[0].appendChild(s); })(); cmt4__comment_show_entry_(document.getElementById("comment_tag")).innerHTML = ""+ " "+ "
"+ "
"+ "网友评论 "+ ""+ "暂无评论,快来抢沙发!"+ ""+ "
"+ "
"+ "
"+ "
"+ "
500) { content.focus(); alert('评论内容字数超过500!'); return false; }"+ "if(title.value=='') title.value=document.title; if(title.value=='') title.value='[无标题]'; "+ "document.getElementById('Submit').disabled=true;"+ "this.username.value=document.getElementById('usernameInput').value;cmt4_comment();return false;\">"+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ "
"+ "通行证登录 注册新用户"+ " "+ " QQ登录"+ " 微博登录"+ " "+ ""+ ""+ "
"+ "表情"+ ""+ ""+ "
"+ "
"+ ""+ "
"+ "请文明发言,发广告将被屏蔽IP"+ " 看不清,换一张"+ ""+ "
"+ "
"+ "
"+ "
"+ "
"+ "
"+ " "+ "  "+ "
"+ "
"+ " "+ "

"+ " "+ "
"+ "
"+ " "+ " "+ " "+ " "+ " "+ " "+ "
"+ "
"+ "
"+ "
"+ "暂无评论,快来抢沙发!"+ "
"+ "
"+ ""+ ""+ "
"+ "
回复评论关闭
"+ "
"+ "
"+ "
500) { content.focus(); alert('评论内容字数超过500!'); return false; }"+ "if(title.value=='') title.value=document.title; if(title.value=='') title.value='[无标题]'; "+ "document.getElementById('Submit_pop').disabled=true;"+ "this.username.value=document.getElementById('usernameInput').value;cmt4_comment_pop();return false;\">"+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ "
"+ "通行证登录 注册新用户"+ ""+ "
"+ "表情"+ ""+ ""+ "
"+ "
"+ ""+ "
"+ "请文明发言,发广告将被屏蔽IP"+ " 看不清,换一张"+ ""+ "
"+ "
"+ "
"+ "
"+ "
"+ ""+ ""+ ""+ ""+ ""+ ""+ "
"+ ""+ "
"+ "
通行证登录关闭
"+ "
"+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ "
 
用户名: "+ ""+ "
密  码: "+ ""+ "
 验证码: "+ ""+ ""+ "
 "+ ""+ ""+ "
 "+ "忘记密码?"+ "
"+ "
"+ "
"+ "还没有注册太平洋通行证?点击立即注册"+ "
"+ "
"+ "
"+ ""+ ""+ "
"+ ""+ " "+ ""; if(!window.jQuery){ var js=document.createElement("script"); js.src="//www1.pconline.com.cn/script/jquery-pconline1.2.js"; document.getElementsByTagName("head")[0].appendChild(js); } function cmt4_cleanMsg(){ //$('#msg').html(""); var _msg = document.getElementById("msg"); if(_msg){ _msg.innerHTML = ""; } } function cmt4_putFace(img, win){ prefix = '{'; postfix = '}'; str = img.src; i = str.indexOf('.',0); while((j=str.indexOf('.',i+1))!=-1 ) { i = j; } em = str.substring(i-3, i); cmt4_insert_code(prefix, postfix, em, win); } function cmt4_insert_code(prefix, postfix, value, win){ cmt4_showAuditInfo(0); //如果点击了回复链接 if(win == 'pop'){ document.getElementById("content_pop").value += prefix+value+postfix; $(".cmtfaceList").hide(); }else{ document.getElementById("content").value += prefix+value+postfix; $(".cmtfaceList").hide(); } } function cmt4_chgCap() { var c = document.getElementById("captchax"); if(c) c.src="//captcha.pchouse.com.cn/captcha/v.jpg?"+new Date().getTime(); } function cmt4_chgCap_pop() { var c = document.getElementById("captchax_pop"); if(c) c.src="//captcha.pchouse.com.cn/captcha/v.jpg?"+new Date().getTime(); } //登陆框验证码切换 function cmt4_change_login_captcha() { var c = document.getElementById("captch_login_pop"); if(c) c.src="//captcha.pchouse.com.cn/captcha/v.jpg?"+new Date().getTime(); } cmt4_firstcaptcha=true; function cmt4_textLimitCheck(thisArea, maxLength){ if (thisArea.value.length > maxLength){ alert('你只能输入' + maxLength + '字。 \r超出的将自动去除。'); thisArea.value = thisArea.value.substring(0, maxLength); thisArea.focus(); } document.getElementById('cmtCountNum').innerHTML = thisArea.value.length; } function cmt4_getCookie(name) { var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) return (arr[2]); return null; } function cmt4_loadAccountName() { var cmu = decodeURIComponent(cmt4_getCookie('cmu')); return cmu; } function cmt4_loadSessionId() { return cmt4_getCookie('common_session_id'); } function cmt4_checkForm() { var usernameInput = document.getElementById('usernameInput').value; if (usernameInput == ""){ document.getElementById("msg").innerHTML = "请输入用户名"; return false; } var passwordInput = document.getElementById('passwordInput').value; if (passwordInput == ""){ document.getElementById("msg").innerHTML = "请输入密码"; return false; } var captchaInput = document.getElementById('captchaInput'); var display = document.getElementById('captch_login_pop_tr'); if (captchaInput && display && display.style.display== "" && captchaInput.value == ""){ //有验证码则校验是否有输入 document.getElementById("msg").innerHTML = "请输入验证码"; return false; } return true; } function cmt4_checkLogin() { cmt4_cleanMsg(); //旧的判断方式 var time=0; var checker = setInterval(function(){ if(time++ < 30 && !document.cookie.match(/(^|; )common_session_id=[^;]+/)) return; //3秒钟 if(document.cookie.match(/(^|; )common_session_id=[^;]+/)) { clearInterval(checker); var cmu = cmt4_loadAccountName(); var sessionId = cmt4_loadSessionId(); if(sessionId!=null){ //登录 if(cmu != "" && cmu != "null" && cmu != "undefined"){ var spanLogin = document.getElementById("loginSpan"); var spanPopLogin = document.getElementById("loginSpan_pop"); var logindHtml = cmt4_getLoginedHTML(cmu); if(spanLogin && logindHtml!='') spanLogin.innerHTML = logindHtml; if(spanPopLogin && logindHtml!='') spanPopLogin.innerHTML = logindHtml; cmt4_changeAuditInfoAfterLogin(); hiddenFB(); //关闭登录弹窗 } } }else{ var _msg = document.getElementById("msg"); if(_msg){ _msg.innerHTML = "登录失败! 请检查帐号和密码是否正确。"; } } },100); } function cmt4_needJS(fn,src,callback) { if(typeof callback == 'undefined' || callback == null) callback = function(){}; if(typeof fn != 'undefined' && fn != null && fn != '') return callback(); var status = typeof _needJS_ == 'undefined' ? _needJS_ = {loaded:[],loading:[]} : _needJS_; for(var i=0; i < status.loaded.length; i++) { if(status.loaded[i] == src) return callback(); } function idx(src) { //供后面的代码调用 for(var i=0; i < status.loading.length;i++) if(status.loading[i].src==src) return i; } var loading = status.loading[idx(src)]; if(loading != null) { loading.callbacks.push(callback); return; } status.loading.push(loading = {src:src,callbacks:[callback]}); var js = document.createElement('script'); js.src = src; js.onload = js.onreadystatechange = function() { if(typeof js.readyState == 'undefined' || js.readyState == 'loaded' || js.readyState == 'complete') { js.onload = js.onreadystatechange = null; status.loaded.push(loading.src); var callbacks = loading.callbacks; status.loading.splice(idx(src),1); for(var i = 0; i < callbacks.length; i++) { loading.callbacks[i](); } } } document.getElementsByTagName('head')[0].appendChild(js); } function Get_Cookie( check_name ) { check_name = escape( check_name ); // first we'll split this cookie up into name/value pairs // note: document.cookie only returns name=value, not the other components var a_all_cookies = document.cookie.split( ';' ); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; // set boolean t/f default f var i = ''; var len = a_all_cookies.length; for ( i = 0; i < len; i++ ) { // now we'll split apart each name=value pair a_temp_cookie = a_all_cookies[i].split( '=' ); // and trim left/right whitespace while we're at it cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); // if the extracted name matches passed check_name if ( cookie_name == check_name ) { b_cookie_found = true; // we need to handle case where cookie has no value but exists (no = sign, that is): if ( a_temp_cookie.length > 1 ) { cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); } // note that in cases where cookie is initialized but no value, null is returned return cookie_value; break; } a_temp_cookie = null; cookie_name = ''; } if ( !b_cookie_found ) { return null; } } function Set_Cookie( name, value, expires, path, domain, secure ) { // set time, it's in milliseconds var today = new Date(); today.setTime( today.getTime() ); // if the expires variable is set, make the correct expires time, the // current script below will set it for x number of days, to make it // for hours, delete * 24, for minutes, delete * 60 * 24 if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } //alert( 'today ' + today.toGMTString() );// this is for testing purpose only var expires_date = new Date( today.getTime() + (expires) ); //alert('expires ' + expires_date.toGMTString());// this is for testing purposes only document.cookie = escape( name ) + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString() ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } //use id as the cookie name function setCookie(cookieName, commentId, domain, expires) { // get cookie var cookie = Get_Cookie(cookieName); if(!expires) { expires = 90; // 默认90天 } if(cookie) { // exist cookie cookie = cookie.split('#'); // covert to array cookie.push(commentId); Set_Cookie(cookieName, cookie.join("#") , expires, '/', domain, ''); } else { // first to set cookie Set_Cookie(cookieName, commentId , expires, '/', domain, ''); } } var UN_AUDIT_COOKIE_NAME = ''; function cmt4_comment() { cmt4_getArea(); cmt4_needJS(window.jQuery,'//www1.pconline.com.cn/script/jquery-pconline1.2.js',function(){ var $=window.jQuery; cmt4_cleanMsg(); var postUrl = "//cmt.pchouse.com.cn/action/comment/create.jsp"; var postData = { isEncode: 1, content: encodeURI($("#content").val()), id: $("#id").val(), captcha: $("#captcha").val(), needCaptcha: $("#needCaptcha").val(), username: encodeURI($("#usernameInput").val()), url: $("#url").val(), title: encodeURI($("#title").val()), columnId: '', area: encodeURI($("#area").val()), urlHandle: '', replyFloor2: 0 }; var successHandle = function(data) { var res = data.resultMsg; if(data.resultCode>=0) { var afterAudit = (data.resultCode == 0); var nc = "" + $('#newComment').html() + ""; var userJump = '//my.pchouse.com.cn/'; if(data.userId > 0 && userJump != ''){ nc = nc.replace('',''+data.showName+''); } nc = nc.replaceAll("", data.floor); nc = nc.replaceAll("", data.showName); nc = nc.replaceAll("", data.commentId); nc = nc.replace("", data.createTime.substring(data.createTime.indexOf("-")+1)); nc = nc.replace("", data.brief); var quoteSpan = document.getElementById("quoteSpan"); if(quoteSpan){ if('pchouse'=='pcauto'){//for pcauto nc = nc.replaceAll("",quoteSpan.innerHTML); }else{ if(data.brief == ''){ nc = nc.replaceAll("",quoteSpan.innerHTML); } } } nc = nc.replaceAll("",""); if(quoteSpan) quoteSpan.innerHTML = ""; if(afterAudit){//先审后出不能引用和回复 // 添加先审后出提示 nc = nc.replaceAll("",'

(感谢参与评论,您的评论内容将在审核后公开。)

'); // 把未审的写到cookie里 //setCookie(UN_AUDIT_COOKIE_NAME + data.topicId, data.commentId, '.pchouse.com.cn'); } else { // 先出后审 nc = nc.replaceAll("", "回复支持(0)"); // add comment_total var a = $("#comment_total").html(); a++; $("#comment_total").html(a); $("#comment_total2").html(a); } $('#commentTable').prepend(nc); $('#content').val(""); res = res + cmt4_getExtraAuditInfo(); } if(document.getElementById("needAlert")){ alert(res); } //是否显示验证码(当用户在1分钟内发表5条以上评论,第6条评论将需要输入验证码,输入验证码提交成功后,下次默认不需输入验证码,以此循环。) // alert(data.commentCount+"...."+5); var captcha = false; if(captcha){ if(document.getElementById("spCode"))document.getElementById("spCode").style.display = 'none'; document.getElementById("needCaptcha").value = "1"; if(document.getElementById('captcha_line'))document.getElementById('captcha_line').style.display = ''; }else{ if(data.commentCount > 5){ if(document.getElementById("spCode"))document.getElementById("spCode").style.display = 'none'; document.getElementById("needCaptcha").value = "1"; if(document.getElementById('captcha_line'))document.getElementById('captcha_line').style.display = ''; cmt4_chgCap(); }else{ if(document.getElementById("spCode"))document.getElementById("spCode").style.display = ''; document.getElementById("needCaptcha").value = "0"; if(document.getElementById('captcha_line'))document.getElementById('captcha_line').style.display = 'none'; } } if(data.resultCode != -8 && data.resultCode != 1 && data.resultCode != 0) { alert(res); } //变换验证码 if(document.getElementById("captcha")){ document.getElementById("captcha").value = ""; cmt4_chgCap(); if(data.resultCode==-9){ document.getElementById("captcha").focus(); } } if(data.resultCode!=-9){ $('#content').focus(); } return false; }; var errorHandle = function() { alert('数据提交失败 ╮(╯_╰)╭ ,尝试重新提交或刷新'); }; var completeHandle = function() { if(document.getElementById('Submit'))document.getElementById('Submit').disabled=false; if(document.getElementById('content')) document.getElementById('content').removeAttribute('data-submit'); }; postCORS(postUrl, function(data) { data = data.replace(/\\/g,"\\\\"); try { data = eval('('+data+')'); successHandle(data); } catch(e) { errorHandle(); } completeHandle(); }, postData, {withCookie: true}); }); return false; } function cmt4_comment_pop() { cmt4_getArea(); cmt4_needJS(window.jQuery,'//www1.pconline.com.cn/script/jquery-pconline1.2.js',function(){ var $=window.jQuery; cmt4_cleanMsg(); //var postUrl = "http://cmt.pchouse.com.cn/action/comment/create.jsp"; var postUrl = "//cmt.pchouse.com.cn/action/comment/create.jsp"; var postData = { isEncode: 1, content: encodeURI($("#content_pop").val()), id: $("#id_pop").val(), captcha: $("#captcha_pop").val(), needCaptcha: $("#needCaptcha_pop").val(), username: encodeURI($("#usernameInput").val()), url: $("#url").val(), title: encodeURI($("#title_pop").val()), columnId: '', area: encodeURI($("#area").val()), urlHandle: '', replyFloor2: $("#replyFloor").val() }; var successHandle = function(data) { var res = data.resultMsg; if(data.resultCode>=0) { var afterAudit = (data.resultCode == 0); var nc = "" + $('#newComment').html() + ""; var userJump = '//my.pchouse.com.cn/'; if(data.userId > 0 && userJump != ''){ nc = nc.replace('',''+data.showName+''); } nc = nc.replace("", data.floor); nc = nc.replace("", data.floor); nc = nc.replace("", data.showName); nc = nc.replace("", data.showName); nc = nc.replace("", data.commentId); nc = nc.replace("", data.createTime.substring(data.createTime.indexOf("-")+1)); nc = nc.replace("", data.brief); var quoteSpan = document.getElementById("quoteSpan"); if(quoteSpan){ if('pchouse'=='pcauto'){//for pcauto nc = nc.replace("",quoteSpan.innerHTML); }else{ if(data.brief == ''){ nc = nc.replace("",quoteSpan.innerHTML); } } } nc = nc.replace("",""); if(quoteSpan) quoteSpan.innerHTML = ""; if(afterAudit){//先审后出不能引用和回复 // 添加先审后出提示 nc = nc.replace("",'

(感谢参与评论,您的评论内容将在审核后公开。)

'); // 把未审的写到cookie里 setCookie(UN_AUDIT_COOKIE_NAME + data.topicId, data.commentId, '.pchouse.com.cn'); } else { // 先出后审 var createTime = data.createTime; // 2011-05-11 15:43:50返回的时间格式 if(createTime) { var i = createTime.indexOf("-"); if(i != -1) { createTime = createTime.substring(i, createTime.length); } } nc = nc.replace("", "回复支持(0)"); // add comment_total var a = $("#comment_total").html(); a++; $("#comment_total").html(a); } nc = nc.replace("", "
" + document.getElementById('replyContent').value + "
"); $('#commentTable').prepend(nc); $('#content_pop').val(""); res = res + cmt4_getExtraAuditInfo(); } //是否显示验证码(当用户在1分钟内发表5条以上评论,第6条评论将需要输入验证码,输入验证码提交成功后,下次默认不需输入验证码,以此循环。) // alert(data.commentCount+"...."+5); var captcha = false; if(captcha){ if(document.getElementById("spCode"))document.getElementById("spCode").style.display = 'none'; document.getElementById("needCaptcha").value = "1"; if(document.getElementById('captcha_line'))document.getElementById('captcha_line').style.display = ''; }else{ if(data.commentCount > 5){ if(document.getElementById("spCode"))document.getElementById("spCode").style.display = 'none'; document.getElementById("needCaptcha").value = "1"; if(document.getElementById('captcha_line'))document.getElementById('captcha_line').style.display = ''; cmt4_chgCap(); }else{ if(document.getElementById("spCode"))document.getElementById("spCode").style.display = ''; document.getElementById("needCaptcha").value = "0"; if(document.getElementById('captcha_line'))document.getElementById('captcha_line').style.display = 'none'; } } if(data.resultCode != -8 && data.resultCode != 1 && data.resultCode != 0) { alert(res); } //变换验证码 if(document.getElementById("captcha_pop")){ document.getElementById("captcha_pop").value = ""; cmt4_chgCap_pop(); if(data.resultCode==-9){ document.getElementById("captcha_pop").focus(); } } if(data.resultCode!=-9){ $('#content_pop').focus(); } if(data.resultCode>=0){ hiddenFB(); } return false; }; var errorHandle = function() { alert('数据提交失败 ╮(╯_╰)╭ ,尝试重新提交或刷新'); }; var completeHandle = function() { if(document.getElementById('Submit_pop'))document.getElementById('Submit_pop').disabled=false; if(document.getElementById('content_pop')) document.getElementById('content_pop').removeAttribute('data-submit'); }; postCORS(postUrl, function(data) { data = data.replace(/\\/g,"\\\\"); try { data = eval('('+data+')'); successHandle(data); } catch(e) { errorHandle(); } completeHandle(); }, postData, {withCookie: true}); }); return false; } function cmt4_showAuditInfo(tag){ var auditInfo = cmt4_getAuditInfo(); var obj = document.getElementById("content"); if(obj){ if(tag == 1){//显示 if(obj.value == ""){obj.value = auditInfo;obj.style.color="#aaa";} }else{//不显示 if(obj.value == auditInfo){obj.value = "";obj.style.color="#aaa";} } } } function cmt4_showAuditInfo2(str,tag){ var s = str; var obj2 = document.getElementById("content_pop"); if(s=="0"||s=="2"||s=="3"){ s = document.getElementById("replyShowName").value; } if(obj2){ var v = obj2.value; if(tag == 1){//显示 if(v == ""){obj2.value = s;obj2.style.color="#aaa";} }else{//不显示 //alert('obj2.value='+v+'==s='+s+'flag'+(v == s)); if(v == s){obj2.value = "";obj2.style.color="#aaa";} if(s=="3"){ if(v == s){obj2.value = "";obj2.style.color="#aaa";} } } } } function cmt4_getExtraAuditInfo(){ var _extra_audit_info_ = ""; if(""=="true"){ var sessionId = cmt4_loadSessionId(); if(sessionId!=null){ //登录 _extra_audit_info_ = ""; }else{ _extra_audit_info_ = "温馨Tips:登录后评论可直接发表。"; } } return _extra_audit_info_; } function cmt4_changeAuditInfoAfterLogin(){ var obj = document.getElementById("content"); if(obj){ if(obj.value == "" || obj.value == "温馨Tips:登录后评论可直接发表,匿名评论须通过审核后才会被公开。" || obj.value == "共建和谐社会,留言中请勿恶意攻击国家、党及其他用户或工作人员;请勿发布任何广告留言,我们将会予以删除或者冻结ID、封锁IP。营造文明友善、观点鲜明、顺畅沟通的良好评论环境,有赖您的支持与配合。"){ obj.value = cmt4_getAuditInfo(); } } } function cmt4_getAuditInfo(){ var auditInfo = ""; if(""=="true"){ var sessionId = cmt4_loadSessionId(); if(sessionId!=null){ //登录 auditInfo = "共建和谐社会,留言中请勿恶意攻击国家、党及其他用户或工作人员;请勿发布任何广告留言,我们将会予以删除或者冻结ID、封锁IP。营造文明友善、观点鲜明、顺畅沟通的良好评论环境,有赖您的支持与配合。"; }else{ auditInfo = "温馨Tips:登录后评论可直接发表,匿名评论须通过审核后才会被公开。"; } } //alert(auditInfo); return auditInfo; } //初始化 cmt4_showAuditInfo(1); String.prototype.replaceAll = function(s1,s2){ return this.replace(new RegExp(s1,"gm"),s2); } function cmt4_getLoginedHTML(accountName){ return "欢迎您,\"/> | 退出 ".replaceAll("",accountName); } var cmt4_fmComment814010659 = document.getElementById('fmComment814010659'); if(cmt4_fmComment814010659){ var cmu = cmt4_loadAccountName(); var sessionId = cmt4_loadSessionId(); if(sessionId!=null){ //登录 if(cmu != "" && cmu != "null" && cmu != "undefined"){ var spanLogin = document.getElementById("loginSpan"); var spanPopLogin = document.getElementById("loginSpan_pop"); var logindHtml = cmt4_getLoginedHTML(cmu); if(spanLogin && logindHtml!='') spanLogin.innerHTML = logindHtml.replaceAll("usernameInput","usernameInput1"); if(spanPopLogin && logindHtml!='') spanPopLogin.innerHTML = logindHtml.replaceAll("usernameInput","usernameInput2"); } } } // ===============================地区获取================================ var COOKIE_NAME_IP = "CMT4_IP_AREA"; function cmt4_getArea() { var cookie = Get_Cookie(COOKIE_NAME_IP); if(cookie) { // 存在cookie // 直接把cookie值不为1时,传到input.area里。 if(cookie != 1 && document.getElementById("area")) { document.getElementById("area").value = cookie; } } else { // 不存在 var script = document.createElement('script'); script.src = "//whois.pconline.com.cn/ipJson.jsp?callback=cmt4_getAreaBack"; document.getElementsByTagName('head')[0].appendChild(script); } } function cmt4_getAreaBack(location) { var area = ""; if(location.pro == location.city) { area = location.city; } else { area = location.pro + location.city; } // 无论area是否获取,都应该写一个cookie标识。 if(!area) { area = 1; } else { // 把结果写到input.area里 if(document.getElementById("area")){ document.getElementById("area").value = area; } } // 把结果写到cookie Set_Cookie(COOKIE_NAME_IP, area, 90, '/', '.pchouse.com.cn', ''); } //这里要预先取一次,因为是ajax异步方式取用户IP所在地区,不能在用户提交表单的时候调用 cmt4_getArea(); // =============================================================== // ===============================获取评论总数======================= function getTopicTotal(){ return 0; } // ===============================获取查看评论的链接地址(即评论列表页)======================= function getTopicUrl(){ return "//cmt.pchouse.com.cn/topic/a0/r0/p1/ps30/t13132561.html"+('' == '13132561' ? "?url=http://sheji.pchouse.com.cn/2014/0820/zt811851.html&columnId=" : ""); }