function showAddNew(){$("#top_na").fadeOut("slow");$("#itemlist").fadeOut("slow");$("#newfeed").fadeIn("slow");$("#newfeed").find(".tips_f").empty();$("#feeddesc").hide();if($("#topfeed").html()=="")loadCommFeed()}function loadCommFeed(){$.getJSON(path+"addchannelservlet?k=commandChannel",function(A){var _="";$.each(A.bindings,function($){_=_+"<div class=\""+["feed_b_l","feed_b_r"][$%2]+"\"><div class=\"right5\"><a href=\""+path+"rss/single.jsp?feedID="+this.FID+"\">";_=_+"<img src=\""+getPic(this.FPIC,100)+"\"/></a></div><div class=\"green_m\">";_=_+"<a href=\""+path+"rss/single.jsp?feedID="+this.FID+"\">";_=_+this.FNAME+"</a></div><div class=\"gray_s\">";_=_+this.FDESC+"</div></div>"});$("#topfeed").append(_);$("#topfeed").find("a").attr("target","_blank");$("#topfeed").find("img").addClass("videoimg").attr("style","height:60px;width:60px;")})}function addChannel(){var _="\u5730\u5740\u89e3\u6790\u9519\u8bef\uff0c\u8bf7\u786e\u8ba4\u5730\u5740\u662f\u6709\u6548\u7684RSS\u5730\u5740",B=$.trim($("#rssUrlText").val()),A=/^([1-9]\d{4,9})$/;if(A.test(B))B="http://feeds.qzone.qq.com/cgi-bin/cgi_rss_out?uin="+B;if(B.indexOf(".")==-1){$("#newfeed").find(".tips_f").html(_);return false}if(B.indexOf("http://")!=0)B="http://"+B;showLoader("#rssUrlText",0);$("#submitfeed").attr("disabled","disabled");$.getJSON(path+"addchannelservlet?k=addFeedByUrl&url="+encodeURIComponent(B),function(A){hideLoader();$("#submitfeed").removeAttr("disabled");if(A.FLAG==0)$("#newfeed").find(".tips_f").html(_);else if(A.FLAG==1){RootList[A.FID]=new Array();RootList[A.FID]["index"]=100;RootList[A.FID]["id"]=A.FID;RootList[A.FID]["title"]=A.TITLE;RootList[A.FID]["unread"]=0;RootList[A.FID]["time"]=A.TIME;$("#mylist").append("<li id='root_"+A.FID+"'><span>"+A.TITLE+"</span><label></label></li>");addTreePro("root_"+A.FID);viewFeed(A.FID);$("#mylist").sortable("refresh");$("#rssUrlText").val("")}else if(A.FLAG==2){viewFeed(A.FID);$("#rssUrlText").val("")}});return false}var loadtimes=0;function loadMyRss(){showLoader("#treecontent",100);if(userinfo.val("UID")==null){if(loadtimes<1)$.get(path+"userindexservlet?k=tempuser",function($){if($==1){userinfo=new UserInfo();loadMyRss()}});loadtimes++}else var _=new MyRoot()}function viewFeed(_){loadarticlelist(_,"1");if(Bmyrss){markFeedTree(_);$("#newfeed").fadeOut("slow");$("#top_na").fadeIn("slow");$("#itemlist").fadeIn("slow");$(".pagelist > .feed_t").empty();$(".pagelist > .feed_t").append("<SPAN class=\"down\">"+RootList[_]["title"]+"</SPAN>")}$(".pagelist > .feed_t > span").click(function(){loadFeedDesc(_)})}function markFeedTree(_){$("#mylist").find(".li_s").attr("class","li_n");$("#root_"+_+" > span").attr("class","li_s");$("#root_"+_+">label").fadeOut("slow");userinfo.val("FID",_);userinfo.update()}function InitUNRead(_,C){if(Bmyrss&&C!=null){var A=0,D=RootList[_]["time"],B=C.bindings.item;for(var E=0;E<B.length;E++)if(B[E].adate>D){$("#"+B[E].oid).find(".atitle").prepend("<div class='unread'></div>");A++}if(A>0){$.get(path+"userfeedcategoryservlet?k=markFeed&FID="+_);RootList[_]["time"]=new Date().getTime()}}}function loadarticlelist(_,A){showLoader("#myart",50);var B=path+"viewfeedservlet?k=viewFeed&feedID="+_+"&pageno="+A+"&f=loadarticlelist&cache="+cache();$.getJSON(B,function(A){$("#itemlist").fadeOut("slow");InitArtList(A);InitUNRead(_,A);$("#itemlist").fadeIn("fast");initPageScroll();hideLoader()})}var RootList=new Array;function MyRoot(){var _=path+"userfeedcategoryservlet?k=fetchUserFeed&cache="+cache();$.getJSON(_,function($){hideLoader();InitRoot($)})}function InitRoot(A){if(A!=null){var _=A.bindings;$("#mylist").empty();for(var B=0;B<_.length;B++){RootList[_[B].FID]=new Array();RootList[_[B].FID]["index"]=B;RootList[_[B].FID]["id"]=_[B].FID;RootList[_[B].FID]["title"]=_[B].TITLE;RootList[_[B].FID]["unread"]=0;RootList[_[B].FID]["time"]=_[B].TIME;$("#mylist").append("<li id='root_"+_[B].FID+"'><span>"+_[B].TITLE+"</span><label></label></li>")}$.each($("#mylist > li"),function(){addTreePro($(this).attr("id"))});if(userinfo.val("FID")!=""&&(RootList[userinfo.val("FID")]))viewFeed(userinfo.val("FID"));else if($("#itemlist").html()=="")showAddNew();$("#mylist").sortable({});$(".treemenu > div").hover(function(){$(this).attr("class","tm_h")},function(){$(this).attr("class","")});$(".treemenu > div:first").click(function(){editFeed($(this).parent().attr("id").substring(3))});$(".treemenu > div:last").click(function(){delFeed($(this).parent().attr("id").substring(3))});$(document).click(function(){hideTMenu()});$.getJSON(path+"userfeedcategoryservlet?k=unread&cache="+cache(),function($){loadUNRead($)})}}function addTreePro(_){$("#"+_+" > span").attr("class","li_n");$("#"+_+" > label").attr("class","li_c");$("#"+_+" > span").click(function(){viewFeed(_.substring(5))});$("#"+_+" > span").mousedown(function($){$.stopPropagation()});$("#"+_).mousedown(function(){$("#editinput").blur()});$("#"+_).bind("contextmenu",function(){showTMenu(_.substring(5));return false})}function hideTMenu(){if($(".treemenu").css("display")!="none"){$(".treemenu").hide(0);$("#mylist").find(".dotb").attr("class","")}}function showTMenu(_){var A=$(".treemenu:eq(0)");A.attr("id","tm_"+_);var C=$("#root_"+_);C.attr("class","dotb");var B=C.offset(),D=B.top+C.height()-$("#treecontent").offset().top+$("#treecontent").scrollTop()-2+"px",E=B.left+50+"px";A.css({top:D,left:E});A.show(0)}function editFeed(_){$("#root_"+_).find("span").hide(0);$("#root_"+_).prepend("<input type='text' id='editinput'></input>");$("#editinput").val($("#root_"+_).find("span").text());$("#editinput").blur(function(){var A=$("#editinput").val();if(A!=$("#root_"+_).find("span").text()&&A!=""){$("#root_"+_).find("span").text(A);RootList[_]["title"]=A;$.get(path+"userfeedcategoryservlet?k=updateUserFeed&feedID="+_+"&title="+encodeURIComponent(A)+"&cache="+cache())}$("#editinput").remove();$("#root_"+_).find("span").show(0)});$("#editinput").mousedown(function($){$.stopPropagation()});$("#editinput").focus()}function delFeed(_){$("#root_"+_).remove();RootList[_]=null;if(userinfo.val("FID")==_){userinfo.val("FID","");userinfo.update()}consData();$.get(path+"userfeedcategoryservlet?k=delUserFeed&feedID="+_+"&cache="+cache())}function checkRootSort(){var C=$("#mylist>li"),B=[],_=false;for(var D=0;D<C.length;D++){var A=C.eq(D).attr("id").substring(5);if(RootList[A]["index"]!=D){RootList[A]["index"]=D;_=true}B.push(A)}if(_)$.post(path+"userfeedcategoryservlet",{k:"feedOrder",feedIDs:B.join(","),cache:cache()});B=null}function consData(){var A=$("#mylist>li");for(var B=0;B<A.length;B++){var _=A.eq(B).attr("id").substring(5);RootList[_]["index"]=B}}function loadUNRead(_){if(_!=null){var A=_.bindings;for(var B=0;B<A.length;B++){RootList[A[B].FID]["unread"]=A[B].C;$("#root_"+A[B].FID).append("<label class=\"li_c\">("+A[B].C+")</label>")}}}function showFeedDesc(){if($("#feeddesc").css("display")=="none"){$(".pagelist > .feed_t > span").attr("class","up");$("#feeddesc").slideDown("fast");if(Bmyrss){var _=$("#feeddesc").height()+5;adjustHeight("#myart",95+_)}}else{$(".pagelist > .feed_t > span").attr("class","down");$("#feeddesc").slideUp("fast");if(Bmyrss)adjustHeight("#myart",95)}}function loadFeedDesc(_){$("#feeddesc>ul").empty();if(RootList[_]==null)RootList[_]=new Array();if(RootList[_]["L"]==null)$.getJSON(path+"viewfeedservlet?commandkey=fetchFeedMessage&feedID="+_+"&cache="+cache(),function($){RootList[_]["C"]=$.C;RootList[_]["U"]=$.U;RootList[_]["L"]=$.L;RootList[_]["H"]=$.H;RootList[_]["D"]=$.D;loadFeedDesc(_)});else{$("#feeddesc>ul").append("<li>\u8ba2\u9605\u7528\u6237:<a href=\""+path+"searchservlet?k=user&t=1&q="+_+"\">"+RootList[_]["C"]+"\u4eba</a></li>");$("#feeddesc>ul").append("<li>\u6700\u540e\u66f4\u65b0:<span class=\"deepgray\">"+CNDate(RootList[_]["U"])+"</span></li>");$("#feeddesc>ul").append("<li>\u8ba2\u9605\u5730\u5740:<a href=\""+RootList[_]["L"]+"\">"+RootList[_]["L"]+"</a></li>");$("#feeddesc>ul").append("<li>\u4e3b\u9875\u5730\u5740:<a href=\""+RootList[_]["H"]+"\">"+RootList[_]["H"]+"</a></li>");$("#feeddesc>ul").append("<li>\u63cf\u8ff0\u4fe1\u606f:<span class=\"deepgray\">"+RootList[_]["D"]+"</span></li>");$("#feeddesc>ul>li").find("a").attr("target","_blank");showFeedDesc()}}function adjustHeight(_,A){$(_).css("height",$(window).height()-A+"px")}function initWin(){adjustHeight("#treecontent",102);adjustHeight("#myart",95);$(window).resize(function(){adjustHeight("#treecontent",102);adjustHeight("#myart",95)});var _="\u8bf7\u8f93\u5165RSS\u94fe\u63a5\u5730\u5740\u6216blog\u5730\u5740\u6216QQ\u53f7(Qzone)",A=$("#rssUrlText");A.val(_);A.focus(function(){if($(this).val()==_)$(this).val("");$("#newfeed").find(".tips_f").empty()});A.blur(function(){if($(this).val()=="")$(this).val(_)})}