(function(l){window.__debug||(__debug=false);var n=RegExp("(?:^\\s*)|(?:\\s*$)","g"),o=location.hostname,p=/:\/\/(.[^/]+)/,e={util:{templ:function(a,b,c,d){return a.replace(/\{([\w_$]+)\}/g,function(f,g){var h=b[g];if(d&&typeof h==="string")h=argument.callee(h,b,c,d);if(h===void 0||h===null)return"";return c?encodeURIComponent(h):h})},extend:function(a,b,c){a||(a={});if(b)for(var d in b)if(a[d]===void 0||c)a[d]=b[d];return a},trim:function(a){return a.replace(n,"")},queryString:function(a){if(!a)return"";
var b=[],c;for(c in a){var d=a[c];c=encodeURIComponent(c);var f=typeof d;if(f==="undefined")b.push(c,"=&");else if(f!="function"&&f!="object")b.push(c,"=",encodeURIComponent(d),"&");else if(d instanceof Array)if(d.length){f=0;for(var g=d.length;f<g;f++)b.push(c,"=",encodeURIComponent(d[f]===void 0?"":d[f]),"&")}else b.push(c,"=&")}b.pop();return b.join("")},bind:function(a,b){return function(){return a.apply(b,arguments)}},ajax:function(a){var b,c=a.url;if(window.XMLHttpRequest)b=new XMLHttpRequest;
else if(window.ActiveXObject)try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{b=new ActiveXObject("Microsoft.XMLHTTP")}catch(f){}}if(b){a.method=a.method?a.method.toUpperCase():"GET";var g=a.data,h=!a.cache;if(g||h){var k=c.indexOf("?")>=0;if(h)c=k?c+"&_="+ +new Date:c+"?_="+ +new Date;if(g){if(typeof g==="object")g=j.queryString(g);if(a.method==="GET"){if(!k&&!h)c+="?";c=c+"&"+g}}}b.open(a.method,c,true);if(a.method==="POST")b.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset="+
(a.encoding?a.encoding:""));b.onreadystatechange=function(){if(b.readyState===4){var i=b.status===200;if(i&&a.success){try{var q=!a.dt||a.dt==="json"?eval("("+b.responseText+");"):b.responseText}catch(r){__debug&&console.error("服务器返回JSON格式有误，请检查。\n",r,"\n",b.responseText);i=false}if(i)a.success.call(a.scope||this,q,b)}if(!i&&a.failure)a.failure.call(a.scope||this,b.responseText,b)}};b.send("POST"===a.method?g:void 0);return b}},jsonp:function(a){function b(){if(!k){try{delete window[c];g.parentNode.removeChild(g);
g=null}catch(i){}k=true}}var c="jsonp_"+ +new Date,d=a.doc||document,f=a.url,g=d.createElement("script");d=d.getElementsByTagName("head")[0];var h;if(typeof a=="function"){h=a;a={}}else h=a.success;g.type="text/javascript";a.charset&&(g.charset=a.charset);a.deffer&&(g.deffer=a.deffer);f+=f.indexOf("?")>=0?"&"+(a.jsonp||"jsonp")+"="+c:"?"+(a.jsonp||"jsonp")+"="+c;if(a.data)f+="&"+j.queryString(a.data);if(a.script){j.extend(g,a.script);delete a.script}g.src=f;var k=false;window[c]=function(){b();if(h)h.apply(a.scope||
this,arguments)};g.onreadystatechange=g.onload=function(){var i=this.readyState;if(!k&&(!i||i==="loaded"||i==="complete")){b();if(a.failure)a.failure.call(a.scope||this)}};d.appendChild(g);return g}},init:function(a){this.basePath=a;return this},direct:function(a){a||(a={});var b=a.success;a.success=function(d,f){var g=new (a.responseDefinition||e.DefaultResponseDefinition)(d,a,f);__debug&&console.log("req e:",g);a.scope?b.call(a.scope,g):b(g)};var c=a.url.match(p);!c||c[1]==o?j.ajax(a):j.jsonp(a)},
postReq:function(a,b,c,d){!d&&(d={});d.method="POST";this.q(a,b,c,d)},q:function(a,b,c,d){!d&&(d={});d.url=a;if(d.data)j.extend(d.data,b);else d.data=b;d.success=c;this.direct(d)},basePath:"/",act:function(a,b,c,d){this.postReq(this.apiUrl("action",a),b,c,d)},post:function(a,b,c,d){a={text:a};if(c)a.pic=c;e.act("update",a,b,d)},postImgText:function(a,b,c,d){e.act("upload",{text:a,pic:b},c,d)},repost:function(a,b,c,d,f){e.act("repost",{id:a,text:b,rtids:c},d,f)},getEmotion:function(a){e.act("emotions",
null,a)},del:function(a,b,c){e.act("destroy",{id:a},b,c)},comment:function(a,b,c,d,f,g){e.act("comment",{id:a,text:b,forward:c,type:d},f,g)},delComment:function(a,b,c){e.act("comment_destroy",{id:a},b,c)},reply:function(a,b,c,d,f,g,h){e.act("reply",{id:a,cid:b,text:c,forward:d,type:f},g,h)},follow:function(a,b,c,d){e.act("createFriendship",{uid:a,type:b},c,d)},follows:function(a,b,c,d){e.act("createFriendship",{uid:a,type:b},c,d)},unfollow:function(a,b,c,d){e.act("deleteFriendship",{id:a,name:b,is_follower:0},
c,d)},removeFans:function(a,b,c,d){e.act("deleteFriendship",{id:a,name:b,is_follower:1},c,d)},fav:function(a,b,c){e.act("createFavorite",{id:a},b,c)},delFav:function(a,b,c){e.act("deleteFavorite",{id:a},b,c)},updateHeadPic:function(a,b,c){e.act("updateProfileImage",{image:a},b,c)},setProfile:function(a,b,c){e.act("saveProfile",a,b,c)},unread:function(a,b,c){e.act("unread",{id:a},b,c)},clearUnread:function(a,b,c){e.act("clearTip",{type:a},b,c)},getComments:function(a,b,c,d,f){e.act("getComments",{id:a,
page:b,type:c||1},d,f)},msg:function(a,b,c,d,f){e.act("sendDirectMessage",{id:b?"":a,name:b?a:"",text:c},d,f)},delMsg:function(a,b,c){e.act("deleteDirectMessage",{id:a},b,c)},followed:function(a,b,c,d,f,g){var h={};if(c)h.t_name=a;else h.t_id=a;if(d)if(f)h.s_name=d;else h.s_id=d;e.act("friendShip",h,b,g)},setting:function(a,b,c){e.act("setting",{type:a},b,c)},shieldBlog:function(a,b,c){e.postReq(e.mkUrl("show","disabled"),{id:a},b,c)},reportSpam:function(a,b,c,d){e.postReq(e.mkUrl("show","reportSpam"),
{cid:a,content:b},c,d)},createTags:function(a,b,c){e.act("createTags",{tagName:a},b,c)},delTag:function(a,b,c){e.act("deleteTags",{tag_id:a},b,c)},updateShowProfile:function(a,b,c){e.act("saveShow",a,b,c)},updateNoticeProfile:function(a,b,c){e.act("saveNotice",a,b,c)},saveSkin:function(a,b,c){e.postReq(e.mkUrl("setting","setSkin"),{skin_id:a},b,c)},counts:function(a,b,c){e.act("getCounts",{ids:a},b,c)},blacklistAdd:function(a,b,c,d){e.act("createBlocks",{id:a,name:b},c,d)},blacklistDel:function(a,
b,c,d){e.act("deleteBlocks",{id:a,name:b},c,d)},getProvinces:function(a){e.act("getProvinces",null,a)},sinaurl:function(a,b){e.act("sinaurl",{id:a},b)},mkUrl:function(a,b,c,d){a=(d||"")+"?m="+a;if(b)a+="."+b;if(c)typeof c==="string"?a+="&"+c:a+=j.queryString(c);return this.basePath+a},apiUrl:function(a,b,c){return this.mkUrl("api/weibo/"+a,b,c)},parseProtocol:function(a){return new e.DefaultResponseDefinition(a)}};e.DefaultResponseDefinition=function(a,b,c){this.raw=a;this.reqCfg=b;if(c)this.connector=
c};e.DefaultResponseDefinition.prototype={getRequestCfg:function(){return this.reqCfg},getConnector:function(){return this.connector},getRaw:function(){return this.raw},getData:function(){return this.getRaw().rst},isOk:function(){return!this.getCode()},getCode:function(){return this.getRaw().errno},getError:function(){return this.getRaw().err},getMsg:function(a){if(__debug)m[this.getCode()]||console.warn("未定义错误码消息："+this.getCode(),"@",this.getRaw());return m[this.getCode()]||a||(this.getCode(),this.getRaw())},
each:function(a,b){var c=0,d=this.getData(),f;for(f in d)if(!isNaN(f)){if(b){if(a.call(b,d[f],c)===false)break}else if(a(d[f],c)===false)break;c++}}};var m=e.ERRORMAP={"0":"发布失败。","5":"超过字数了！","1":"图片正在上传，请稍候。","2":"正在发布,请稍候。。","3":"请先输入内容。","4":"请写上你要说的话题。","1020002":"请不要重复发布相同的内容。","1010006":"不能采用sina域下的邮箱。","1010007":"已经提交，请耐心等待管理员审核，谢谢！","20011":"评论字数超过限制","20016":"他还没有关注你,不能发私信","30001":"皮肤保存失败，请重试。","20020":"上传图片为空","20021":"上传图片大小超过限制","20022":"上传图片类型不符合要求","20023":"上传图片失败","20024":"非法的上传图片",
"1021200":"此昵称不存在","1020500":"此微博已被作者移除。","1020301":"此微博已被作者移除。","1020700":"此微博已被作者移除。","1020402":"此微博已被作者移除。","1020504":"此微博已被作者移除。","1020501":"此评论已被作者移除。","1020600":"此评论已被作者移除。","1040003":"您尚未登录，请先登录再操作","1040000":"您尚未登录，请先登录再操作","1050000":"系统繁忙，请稍候再试。","1040007":"发评论太多啦，休息一会儿吧.","1040006":"发微博太多啦，休息一会儿吧.","1040004":"请不要发表违法和不良信息！","1021301":"该昵称已存在，请换一个昵称。","1020104":"内容长度不正确。","1020801":"关注的用户不存在。","1020800":"关注失败","1020805":"已关注该用户","1050000":"操作失败，请重试。"},j=e.util;if(!l)l=window.Xwb={};l.request=
e})(window.Xwb);

