(function(e){function B(a,b){a.addClass("row_chked");if(a.data("picked"))return b();var d=a[0].id.substr(5),f=n.find(">div.btn_area>select").val();f="pushid="+d+"&catid="+a.find("input").val()+"&status="+f;var i=a.find("img.del").hide(),j;if((j=i.next("img")).length)j.attr("src","images/loading.gif");else{j=e('<img width="16" height="16" src="images/loading.gif" />');i.after(j)}e.ajax({url:"?app=push&controller=push&action=push",data:f,type:"post",dataType:"json",success:function(c){if(c.state){a.data("picked",
1);j.attr("src","images/sh.gif");c=s.getRow(d);var h;if(c){c.removeClass("viewed new").addClass("pushed");h=c.data("json")}if(c=m.getRow(d)){h=c.data("json");m.deleteRow(d)}h.status="pushed";v.addRow(h);setTimeout(function(){a.fadeOut(function(){o.remove(d)})},5E3)}else{j.attr("src","images/warn.png");i.show()}b()},error:function(){j.attr("src","images/warn.png");i.show();b()}})}var p,C,n,w,D,t,E,I,J,F,K,L,M,N,O,P,q,s,m,v,o,u="0",Q=function(){var a=ct.innerHeight();if(a>250){a=a-I-J;var b=a-N;p.height(e.boxModel?
b:a);D.height(b-F);a=b-F-K;t.height(a);E.height(a)}a=ct.innerWidth();if(a>500){a=a-L;b=a-M;p.width(e.boxModel?b:a);a=b-O;w.width(parseInt(a*0.6));a-=w[0].offsetWidth;n.width(a-P)}},k=null,U=function(){var a=e('<div class="loading" style="width:120px;position:fixed;"><sub></sub> \u8f7d\u5165\u4e2d\u2026\u2026</div>');a.appendTo(document.body);a.ajaxStart(function(){a.css({left:ct.innerWidth()/2-130,top:ct.innerHeight()/2-50}).show()}).ajaxStop(function(){a.hide()})},y=function(a){var b=a.taskid,d=
e('<li id="task_'+b+'"><a href="javascript:;">'+a.title+"</a></li>").hover(function(){d.addClass("hover")},function(){d.removeClass("hover")}).click(function(){if(k!=d){k&&k.removeClass("focus");k=d;d.addClass("focus");s.load("taskid="+b);m.load("taskid="+b);v.load("taskid="+b)}}).contextMenu("#right_menu",function(f){R[f](b,d,a)});return d},S=function(a,b){if(!(b.hasClass("viewed")||b.hasClass("pushed"))){var d=b.data("json");e.post("?app=push&controller=push&action=viewedone&pushid="+a,function(){d.status=
"viewed";b.addClass("viewed");m.addRow(d)})}},V=function(a){e(a[0].url).keyup(function(){this.value&&e.getJSON("?app=spider&controller=manager&action=matchRule&url="+encodeURIComponent(this.value),function(b){if(b.state)a[0].ruleid.value=b.ruleid})}).keyup()},z=0,l=null,A=null,G=null,R={init:function(a){G=a;p=e("#box");C=e("#leftBox");w=e("#centerBox");n=e("#rightBox");D=e("#leftList");t=e("#centerList");E=e("#rightList");var b=C.find("h3"),d=w.find("div.btn_area");I=p.offset().top;J=5;F=b[0].offsetHeight;
K=d[0].offsetHeight;L=parseFloat(p.css("marginLeft"))*2;M=parseFloat(p.css("borderLeftWidth"))*2;N=parseFloat(p.css("borderTopWidth"))*2;O=C[0].offsetWidth;P=n[0].offsetWidth-n.width();e(window).bind("resize",Q);Q();var f=t.find("ul").hide(),i=w.find("h3>span").each(function(){var c=e(this).click(function(){f.hide();i.removeClass("active");c.addClass("active");u=c.attr("index");d.find("button:first").css("visibility",u=="0"?"visible":"hidden");f.eq(c.attr("index")).show()})});i.eq(0).click();var j=
function(c){c=e.extend({},c);if(a)c=e.extend(c,a);o.add(c)};s=new scrollFeed(f[0],{template:'\t\t<li id="item_{pushid}" param="pushid={pushid}" class="{status}">\t\t\t<h3 class="item-header">\t\t\t\t<span class="header-right">\t\t\t\t\t<b>({length}&nbsp;/&nbsp;{replynum}&nbsp;/&nbsp;{visitnum})</b>\t\t\t\t\t<img src="images/txt.gif" title="\u6807\u8bb0\u5df2\u8bfb" class="markread" height="16" width="16">\t\t\t\t\t<img class="marktask" width="16" height="16" title="\u6dfb\u52a0\u5230\u63a8\u9001\u4efb\u52a1" src="images/add_1.gif" />\t\t\t\t</span>\t\t\t\t<span class="header-left"><a href="{link}" target="_blank" tips="{tips}">{title}</a></span>\t\t\t</h3>\t\t</li>',
baseUrl:"?app=push&controller=push&action=loadlist",descUrl:"?app=push&controller=push&action=loaddetail",rowReady:function(c,h){c.find("span.header-left>a").attrTips("tips");c.find("img.marktask").click(function(g){g.stopPropagation();j(h)});c.find("img.markread").click(function(g){g.stopPropagation();S(h.pushid,c)})},rowViewed:function(c,h,g){g.status="viewed";h.addClass("viewed");m.addRow(g)},countRow:function(c){e("em",i[0]).text(c)},pageCtrl:t});m=new scrollFeed(f[1],{template:'\t\t<li id="item_{pushid}" param="pushid={pushid}" class="{status}">\t\t\t<h3 class="item-header">\t\t\t\t<span class="header-right">\t\t\t\t    <b>({length}&nbsp;/&nbsp;{replynum}&nbsp;/&nbsp;{visitnum})</b>\t\t\t\t\t<img class="marktask" width="16" height="16" title="\u6dfb\u52a0\u5230\u63a8\u9001\u4efb\u52a1" src="images/add_1.gif" />\t\t\t\t</span>\t\t\t\t<span class="header-left"><a href="{link}" target="_blank" tips="{tips}">{title}</a></span>\t\t\t</h3>\t\t</li>',
baseUrl:"?app=push&controller=push&action=loadlist&status=viewed",descUrl:"?app=push&controller=push&action=loaddetail",rowReady:function(c,h){c.find("span.header-left>a").attrTips("tips");c.find("img.marktask").click(function(g){g.stopPropagation();j(h)})},countRow:function(c){e("em",i[1]).text(c)},pageCtrl:t});v=new scrollFeed(f[2],{template:'\t\t<li id="item_{pushid}" param="pushid={pushid}" class="{status}">\t\t\t<h3 class="item-header">\t\t\t\t<span class="header-right">\t\t\t\t\t<b>({length}&nbsp;/&nbsp;{replynum}&nbsp;/&nbsp;{visitnum})</b>\t\t\t\t\t<img class="marktask" width="16" height="16" title="\u6dfb\u52a0\u5230\u63a8\u9001\u4efb\u52a1" src="images/add_1.gif" />\t\t\t\t</span>\t\t\t\t<span class="header-left"><a href="{link}" target="_blank" tips="{tips}">{title}</a></span>\t\t\t</h3>\t\t</li>',
baseUrl:"?app=push&controller=push&action=loadlist&status=pushed",descUrl:"?app=push&controller=push&action=loaddetail",rowReady:function(c,h){c.find("span.header-left>a").attrTips("tips");c.find("img.marktask").click(function(g){g.stopPropagation();j(h)})},countRow:function(c){e("em",i[2]).text(c)},pageCtrl:t});o=new taskList(E.find("table"),{template:'\t\t<tr id="task_{pushid}">\t\t\t<td>\t\t\t\t<a href="{link}" target="_blank">{title}</a>\t\t\t</td>\t\t\t<td width="100" class="t_c"><span title="\u70b9\u51fb\u4fee\u6539" class="catname"><input type="hidden" value="{catid}" />[<b>{catname}</b>]</span></td>\t\t\t<td width="50" class="t_c">\t\t\t\t<img width="16" height="16" class="hand del" src="images/del.gif" />\t\t\t</td>\t\t</tr>',
rowReady:function(c,h){h.find("img.del").click(function(H){H.stopPropagation();o.remove(c)});var g=h.find("span.catname").click(function(H){H.stopPropagation();var r=g.next("select"),x=r[0],T=g.find("input"),W=g.find("b");if(r.length){g.hide();r.show().focus()}else e.get("?app=push&controller=push&action=getcat",function(X){r=e(X).blur(function(){r.hide();g.show()}).change(function(){W.text(e.trim(x.options[x.selectedIndex].text));T.val(this.value)});x=r[0];x.value=T.val();g.hide().after(r);x.focus()})})},
countRow:function(c){n.find(">h3:first em").text(c)}});q=D.find("ul");e.getJSON("?app=push&controller=push&action=tasklist",function(c){for(var h=0,g;g=c[h++];q.append(y(g)));q.find("li:first").click()});e("#status").change(function(){e.post("?app=push&controller=push&action=memstatus","status="+this.value)});U()},clearTask:function(){o.clear()},viewedAll:function(){var a=s.allRow();for(var b in a)S(b,a[b])},addAlltask:function(){var a=(u=="0"?s:u=="1"?m:v).allRow();for(var b in a){var d=a[b].data("json");
d=e.extend({},d);if(G)d=e.extend(d,G);o.add(d)}},addTask:function(){ct.form("\u6dfb\u52a0\u76d1\u542c\u4efb\u52a1","?app=push&controller=push&action=addTask",400,220,function(a){if(a.state){ct.tips("\u6dfb\u52a0\u76d1\u542c\u4efb\u52a1\u6210\u529f","success");q.append(y(a.data));return true}},V)},editTask:function(a,b){ct.form("\u7f16\u8f91\u76d1\u542c\u4efb\u52a1","?app=push&controller=push&action=editTask&taskid="+a,400,220,function(d){if(d.state){ct.tips("\u7f16\u8f91\u76d1\u542c\u4efb\u52a1\u6210\u529f",
"success");var f=k==b;d=y(d.data);b.replaceWith(d);f&&d.click();return true}})},delTask:function(a,b){var d="\u6b64\u64cd\u4f5c\u4e0d\u53ef\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u76d1\u542c\u4efb\u52a1\u201c"+b.text()+"\u201d\u5417\uff1f";ct.confirm(d,function(){e.getJSON("?app=push&controller=push&action=delTask&taskid="+a,function(f){if(f.state){if(k==b)k=null;b.remove();ct.tips("\u5220\u9664\u6210\u529f","success")}else ct.tips("\u5220\u9664\u5931\u8d25","error")})})},refreshNav:function(){var a=
null;if(k)a=k.attr("id");q.empty();e.getJSON("?app=push&controller=push&action=tasklist",function(b){for(var d=0,f;f=b[d++];q.append(y(f)));a&&q.find("#"+a).click()})},refreshItem:function(){if(k){var a="taskid="+k[0].id.substr(5);if(u=="0")s.load(a);else u=="1"?m.load(a):v.load(a)}},run:function(){l=o.first();var a=n.find(">div.btn_area>*"),b=a.filter(":lt(3)"),d=a.eq(3).show();b.css("visibility","hidden");var f=function(){l=null;b.css("visibility","visible");d.hide()};if(!l.length)return f();var i=
function(){l.removeClass("row_chked");l=l.next();if(l.length)if(z)A=function(){B(l,i)};else B(l,i);else f()};B(l,i)},pause:function(a){if(z){a.innerHTML="\u6682\u505c";z=0;if(A){A();A=null}}else{a.innerHTML="\u7ee7\u7eed";z=1}}};window.App=R})(jQuery);
