var lanai={highlightSyntax:function(){var a=false;$("pre code").parent().each(function(){if(!$(this).hasClass("prettyprint")){$(this).addClass("prettyprint");a=true}});if(a){prettyPrint()}}};var Vote=function(){var M;var v;var ah;var O;var X="answer-container-";var V="vote-buttons";var s="answer-img-accept-";var T="question-img-favorite";var N="question-img-upvote-";var r="question-img-downvote-";var L="answer-img-upvote-";var ae="answer-img-downvote-";var ad="favorite-number";var j="comment-";var H="vote-number";var a="question-offensive-flag-";var t="answer-offensive-flag-";var x="offensive-flag";var aa="question-controls";var J="question-delete-link-";var b="answer-delete-link-";var o="用户权限不在操作范围";var w="不能设置自己的回答为最佳答案";var g="匿名用户不能收藏问题,请先注册或者登录";var aj="匿名用户不能投票,请先注册或者登录";var K="需要+15积分才能投支持票。查看faq";var Y="需要+100积分才能投反对票。查看faq";var q="不能给自己的帖子投票";var n="对不起,您已用完今日所有的投票。查看faq";var A="这个投票已经过时,不能撤销。查看faq";var u="确定要归类该帖为广告、人身攻击、恶意言论吗?";var ab="匿名用户不能操作,请先注册或者登录";var C="不能重复操作。查看faq";var B="对不起,您已用完今日所有的5次‘水帖’操作。查看faq";var af="需要+15积分才能归类‘垃圾帖’。查看faq";var p="确定要删除/撤销删除该帖吗?";var W="匿名用户不能删除或撤销删除帖子";var Q="操作成功!该帖子已被恢复。";var i="操作成功!该帖子已删除。";var h={acceptAnswer:0,questionUpVote:1,questionDownVote:2,favorite:4,answerUpVote:5,answerDownVote:6,offensiveQuestion:7,offensiveAnswer:8,removeQuestion:9,removeAnswer:10};var Z=function(){var ak="div."+V+" img[class="+T+"]";return $(ak)};var I=function(){var ak="#"+ad;return $(ak)};var e=function(){var ak="div."+V+" img[id^="+N+"]";return $(ak)};var E=function(){var ak="div."+V+" img[id^="+r+"]";return $(ak)};var l=function(){var ak="div."+V+" img[id^="+L+"]";return $(ak)};var k=function(){var ak="div."+V+" img[id^="+ae+"]";return $(ak)};var m=function(al){var ak="div."+V+" img[id="+L+al+"]";return $(ak)};var y=function(al){var ak="div."+V+" img[id="+ae+al+"]";return $(ak)};var z=function(){var ak="table[id=question-table] span[class="+x+"]";return $(ak)};var c=function(){var ak="div.answer span[class="+x+"]";return $(ak)};var R=function(){var ak="div#question-controls a[id^="+J+"]";return $(ak)};var f=function(){var ak="div.answer-controls a[id^="+b+"]";return $(ak)};var U=function(an,al,am){var ak=al?"":"-on";var ao=(an==h.questionUpVote||an==h.answerUpVote)?"up":"down";am.attr("src","/content/images/vote-arrow-"+ao+ak+".png");if(al){if(an==h.questionUpVote||an==h.questionDownVote){$(e()).attr("src","/content/images/vote-arrow-up.png");$(E()).attr("src","/content/images/vote-arrow-down.png")}else{$(m(v)).attr("src","/content/images/vote-arrow-up.png");$(y(v)).attr("src","/content/images/vote-arrow-down.png")}}};var P=function(al,am){var ak=al.parent("div."+V).find("div."+H);$(ak).text(am)};var ac=function(){if(ah==O){var am="div."+V+" img[id^="+s+"]";$(am).unbind("click").click(function(aq){Vote.accept($(aq.target))})}var ao=Z();ao.unbind("click").click(function(aq){Vote.favorite($(aq.target))});var an=e();an.unbind("click").click(function(aq){Vote.vote($(aq.target),h.questionUpVote)});var ak=E();ak.unbind("click").click(function(aq){Vote.vote($(aq.target),h.questionDownVote)});var al=l();al.unbind("click").click(function(aq){Vote.vote($(aq.target),h.answerUpVote)});var ap=k();ap.unbind("click").click(function(aq){Vote.vote($(aq.target),h.answerDownVote)});z().unbind("click").click(function(aq){Vote.offensive(this,h.offensiveQuestion)});c().unbind("click").click(function(aq){Vote.offensive(this,h.offensiveAnswer)});R().unbind("click").click(function(aq){Vote.remove(this,h.removeQuestion)});f().unbind("click").click(function(aq){Vote.remove(this,h.removeAnswer)})};var G=function(ak,al,am){$.ajax({type:"POST",cache:false,dataType:"json",url:"/questions/"+M+"/vote/",data:{type:al,postId:v},error:ai,success:function(an){am(ak,al,an)}})};var ai=function(al,ak){alert("Callback invoke error: "+ak)};var d=function(al,am,ao){if(ao.allowed=="0"&&ao.success=="0"){showMessage(al,o)}else{if(ao.allowed=="-1"){showMessage(al,w)}else{if(ao.status=="1"){al.attr("src","/content/images/vote-accepted.png");$("#"+X+v).removeClass("accepted-answer");$("#"+j+v).removeClass("comment-link-accepted")}else{if(ao.success=="1"){var an="div."+V+" img[id^="+s+"]";$(an).attr("src","/content/images/vote-accepted.png");var ap=("div[id^="+X+"]");$(ap).removeClass("accepted-answer");var ak=("div[id^="+X+"] div[id^="+j+"]");$(ak).removeClass("comment-link-accepted");al.attr("src","/content/images/vote-accepted-on.png");$("#"+X+v).addClass("accepted-answer");$("#"+j+v).addClass("comment-link-accepted")}else{showMessage(al,ao.message)}}}}};var F=function(ak,al,am){if(am.allowed=="0"&&am.success=="0"){showMessage(ak,g.replace("{{QuestionID}}",M))}else{if(am.status=="1"){ak.attr("src","/content/images/vote-favorite-off.png");var an=I();an.removeClass("my-favorite-number");if(am.count==0){am.count=""}an.text(am.count)}else{if(am.success=="1"){ak.attr("src","/content/images/vote-favorite-on.png");var an=I();an.text(am.count);an.addClass("my-favorite-number")}else{showMessage(ak,am.message)}}}};var S=function(ak,al,am){if(am.allowed=="0"&&am.success=="0"){showMessage(ak,aj.replace("{{QuestionID}}",M))}else{if(am.allowed=="-3"){showMessage(ak,n)}else{if(am.allowed=="-2"){if(al==h.questionUpVote||al==h.answerUpVote){showMessage(ak,K)}else{if(al==h.questionDownVote||al==h.answerDownVote){showMessage(ak,Y)}}}else{if(am.allowed=="-1"){showMessage(ak,q)}else{if(am.status=="2"){showMessage(ak,A)}else{if(am.status=="1"){U(al,true,ak);P(ak,am.count)}else{if(am.success=="1"){U(al,false,ak);P(ak,am.count);if(am.message.length>0){showMessage(ak,am.message)}}}}}}}}};var ag=function(ak,al,am){ak=$(ak);if(am.allowed=="0"&&am.success=="0"){showMessage(ak,ab.replace("{{QuestionID}}",M))}else{if(am.allowed=="-3"){showMessage(ak,B)}else{if(am.allowed=="-2"){showMessage(ak,af)}else{if(am.status=="1"){showMessage(ak,C)}else{if(am.success=="1"){$(ak).children("span[class=darkred]").text("("+am.count+")")}}}}}};var D=function(ak,al,am){if(am.allowed=="0"&&am.success=="0"){showMessage(ak,W.replace("{{QuestionID}}",M))}else{if(am.status=="1"){showMessage(ak,Q)}else{if(am.success=="1"){showMessage(ak,i)}}}};return{init:function(ak,al,am){M=ak;ah=al;O=am;ac()},accept:function(ak){v=ak.attr("id").substring(s.length);G(ak,h.acceptAnswer,d)},favorite:function(ak){if(!O||O.toUpperCase()=="NONE"){showMessage(ak,g.replace("{{QuestionID}}",M));return false}G(ak,h.favorite,F)},vote:function(ak,al){if(!O||O.toUpperCase()=="NONE"){showMessage(ak,aj.replace("{{QuestionID}}",M));return false}if(al==h.answerUpVote){v=ak.attr("id").substring(L.length)}else{if(al==h.answerDownVote){v=ak.attr("id").substring(ae.length)}}G(ak,al,S)},offensive:function(ak,al){if(!O||O.toUpperCase()=="NONE"){showMessage($(ak),ab.replace("{{QuestionID}}",M));return false}if(confirm(u)){v=ak.id.substr(ak.id.lastIndexOf("-")+1);G(ak,al,ag)}},remove:function(ak,al){if(!O||O.toUpperCase()=="NONE"){showMessage($(ak),W.replace("{{QuestionID}}",M));return false}if(confirm(p)){v=ak.id.substr(ak.id.lastIndexOf("-")+1);G($(ak),al,D)}}}}();function createComments(i){var d=i;var b=function(k){return $("#comments-"+d+"-"+k)};var j=function(k){appendLoader("#comments-"+d+"-"+k+" div.comments")};var h=function(m,l){var k=l.siblings("#can-post-comments-"+d+"-"+m);return k.val().toLowerCase()=="true"};var f=function(o,m){var n="form-comments-"+d+"-"+o;if(h(o,m)){if(m.find("#"+n).length==0){var l='
';l+='';l+='
';l+='
';m.append(l);setupFormValidation("#"+n,{comment:{required:true,minlength:10}},"",function(){e(o,n)})}}else{var k="comments-rep-needed-"+d+"-"+o;if(m.find("#"+k).length==0){m.append('
评论需要 '+repNeededForComments+' 社区积分 - 查看faq')}}};var a=function(l,k){j(l);$.getJSON("/"+d+"s/"+l+"/comments/",function(m){c(l,m)})};var c=function(n,l){var m=b(n);m=m.find("div.comments");m.find("div[id^='comment-"+d+"-']").remove();removeLoader();if(l&&l.length>0){for(var k=0;k'+n.text;m+=n.user_url?' – ":"");m+=' ('+n.add_date+")";if(n.delete_url){var l="/content/images/close-small.png";var k="/content/images/close-small-hover.png";m+=''}m+="
";o.append(m)};var e=function(n,m){j(n);var l="#"+m;var k=$(l+" textarea");$.ajax({type:"POST",url:"/"+d+"s/"+n+"/comments/",dataType:"json",data:{comment:k.val()},success:function(o){c(n,o);k.val("");commentsFactory[d].updateTextCounter(k);enableSubmitButton(l)},error:function(o,q,p){removeLoader();showMessage(l,o.responseText);enableSubmitButton(l)}})};return{init:function(){$("a[id^='comments-link-"+d+"-']").unbind("click").click(function(){commentsFactory[d].show($(this).attr("id").substr(("comments-link-"+d+"-").length))})},show:function(l){var k=b(l);a(l,k);f(l,k);k.show();if(h(l,k)){k.find("textarea").get(0).focus()}k.siblings("a").unbind("click").click(function(){commentsFactory[d].hide(l)}).text("隐藏评论")},hide:function(n){var m=b(n);var k=m.children("div.comments").children().length;var l=k==0?"添加评论":"评论 ("+k+")";m.hide();m.siblings("a").unbind("click").click(function(){commentsFactory[d].show(n)}).html(l);m.children("div.comments").children().hide()},deleteComment:function(m,l,k){if(confirm("真要删除此评论吗?")){m.hide();j(l);$.post(k,{dataNeeded:"forIIS7"},function(n){c(l,n)},"json")}},updateTextCounter:function(l){var n=l.value?l.value.length:0;var m=n>270?"#f00":n>200?"#f60":"#999";var k=$(l).siblings("span.text-counter");k.html("还可写"+(300-n)+" 字符").css("color",m)}}}var questionComments=createComments("question");var answerComments=createComments("answer");$().ready(function(){questionComments.init();answerComments.init()});var commentsFactory={question:questionComments,answer:answerComments};var PR_SHOULD_USE_CONTINUATION=true;var PR_TAB_WIDTH=8;var PR_normalizedHtml;var PR;var prettyPrintOne;var prettyPrint;function _pr_isIE6(){var a=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);_pr_isIE6=function(){return a};return a}(function(){function W(av){av=av.split(/ /g);var aw={};for(var au=av.length;--au>=0;){var at=av[au];if(at){aw[at]=null}}return aw}var n="break continue do else for if return while ";var D=n+"auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile ";var w=D+"catch class delete false import new operator private protected public this throw true try ";var p=w+"alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ";var G=w+"boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ";var ap=G+"as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ";var F=w+"debugger eval export function get null set undefined var with Infinity NaN ";var y="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ";var ab=n+"and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ";var k=n+"alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ";var aa=n+"case done elif esac eval fi function in local set then until ";var M=(p+ap+F+y+ab+k+aa);var O="str";var L="kwd";var o="com";var al="typ";var Y="lit";var ah="pun";var V="pln";var q="tag";var U="dec";var ad="src";var ao="atn";var s="atv";var ak="nocode";function aq(at){return(at>="a"&&at<="z")||(at>="A"&&at<="Z")}function N(aw,au,at,av){aw.unshift(at,av||0);try{au.splice.apply(au,aw)}finally{aw.splice(0,2)}}var ai=function(){var av=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"];var aw="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)";for(var at=0;at:&])/g,"\\$1")}}aw+="|^)\\s*$";return new RegExp(aw)}();var S=/&/g;var Z=//g;var K=/\"/g;function E(at){return at.replace(S,"&").replace(Z,"<").replace(x,">").replace(K,""")}function r(at){return at.replace(S,"&").replace(Z,"<").replace(x,">")}var e=/</g;var C=/>/g;var d=/'/g;var i=/"/g;var ar=/&/g;var J=/ /g;function t(aw){var ay=aw.indexOf("&");if(ay<0){return aw}for(--ay;(ay=aw.indexOf("&#",ay+1))>=0;){var at=aw.indexOf(";",ay);if(at>=0){var av=aw.substring(ay+3,at);var ax=10;if(av&&av.charAt(0)==="x"){av=av.substring(1);ax=16}var au=parseInt(av,ax);if(!isNaN(au)){aw=(aw.substring(0,ay)+String.fromCharCode(au)+aw.substring(at+1))}}}return aw.replace(e,"<").replace(C,">").replace(d,"'").replace(i,'"').replace(ar,"&").replace(J," ")}function R(at){return"XMP"===at.tagName}function an(ax,av){switch(ax.nodeType){case 1:var au=ax.tagName.toLowerCase();av.push("<",au);for(var aw=0;aw");for(var ay=ax.firstChild;ay;ay=ay.nextSibling){an(ay,av)}if(ax.firstChild||!/^(?:br|link|img)$/.test(au)){av.push("")}break;case 2:av.push(ax.name.toLowerCase(),'="',E(ax.value),'"');break;case 3:case 4:av.push(r(ax.nodeValue));break}}var am=null;function b(aw){if(null===am){var au=document.createElement("PRE");au.appendChild(document.createTextNode('\n'));am=!/=0;aw-=at.length){ax.push(at.substring(0,aw))}aC=ay+1;break;case"\n":au=0;break;default:++au}}if(!ax){return az}ax.push(az.substring(aC));return ax.join("")}}var Q=/(?:[^<]+|||<\/?[a-zA-Z][^>]*>|<)/g;var v=/^|$)/,null],[ad,/^<\?[\s\S]*?(?:\?>|$)/,null],[ad,/^<%[\s\S]*?(?:%>|$)/,null],[ad,/^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i,null],[q,/^<\/?\w[^<>]*>/,null]]);var z=/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/;function ae(ay){var av=a(ay);for(var ax=0;ax\/=]+/,null,"<>/="]],[[q,/^[\w:\-]+/,/^=2&&/^[\"\']/.test(aG)&&aG.charAt(0)===aG.charAt(au-1));var aw;var ay;var aC;if(aA){ay=ax+1;aC=aD-1;aw=aG}else{ay=ax+1;aC=aD-1;aw=aG.substring(1,aG.length-1)}var aH=af(aw);for(var aE=0,az=aH.length;aEaI){if(ax&&ax!==aC){aB.push("");ax=null}if(!ax&&aC){ax=aC;aB.push('')}var aL=r(az(aJ.substring(aI,aK))).replace(aE?aF:aw,"$1 ");aE=aD.test(aL);aB.push(aL.replace(aA,"
"));aI=aK}}while(true){var at;if(av");ax=null}aB.push(au[av+1]);av+=2}else{if(aH")}return aB.join("")}var A={};function g(av,aw){for(var at=aw.length;--at>=0;){var au=aw[at];if(!A.hasOwnProperty(au)){A[au]=av}else{if("console" in window){console.log("cannot override language handler %s",au)}}}}g(af,["default-code"]);g(l,["default-markup","html","htm","xhtml","xml","xsl"]);g(m({keywords:p,hashComments:true,cStyleComments:true}),["c","cc","cpp","cs","cxx","cyc"]);g(m({keywords:G,cStyleComments:true}),["java"]);g(m({keywords:aa,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);g(m({keywords:ab,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);g(m({keywords:y,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);g(m({keywords:k,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);g(m({keywords:F,cStyleComments:true,regexLiterals:true}),["js"]);function H(ay,aw){try{var az=B(ay);var av=az.source;var at=az.tags;if(!A.hasOwnProperty(aw)){aw=/^\s*=0){var aD=aH.className.match(/\blang-(\w+)\b/);if(aD){aD=aD[1]}var aM=false;for(var aB=aH.parentNode;aB;aB=aB.parentNode){if((aB.tagName==="pre"||aB.tagName==="code"||aB.tagName==="xmp")&&aB.className&&aB.className.indexOf("prettyprint")>=0){aM=true;break}}if(!aM){var aJ=b(aH);aJ=aJ.replace(/(?:\r\n?|\n)$/,"");var aN=H(aJ,aD);if(!R(aH)){aH.innerHTML=aN}else{var aC=document.createElement("PRE");for(var aF=0;aF=0;){var aL=aI[aE];aL.parentNode.replaceChild(document.createTextNode("\r\n"),aL)}}}}}if(at