(function(){function G(c){var d=c||F.load(),f=d.access_token||"",g=d.expires_in||"";f!=""&&(a=1);p({url:e,onComplete:function(c){WB2.console.log(c);c=c||{};if(c.status==1&&c.access_token){F.save(c);WB2._config.access_token=c.access_token;WB2._config.uid=c.uid}if(c.error){b=!1;WB2.console.warn(c.error);c.error=="xd2.jsp has not Referer!"&&WB2.console.warn("您使用的appkey未和域名进行绑定,请绑定后使用。")}else{a=c.status;x()}},args:{source:WB2._config.appkey}})}function E(){return a==1}function D(b){b!=null&&(a=b)}function C(a){if(!!WB2.checkLogin()&&WB2._config.appkey!=null){F.del();D(-1);WB2._config.access_token=null;delete WB2._config.access_token;try{p({url:"https://api.weibo.com/2/account/end_session.json?source="+WB2._config.appkey,onComplete:function(b){a&&a(b.data)}})}catch(b){throw"JavaScript SDK: logout error"}}}function B(a){if(!!b){x(a,!0);WB2.checkLogin()||(window.postMessage&&!m.IE?y({appkey:WB2._config.appkey}):v({appkey:WB2._config.appkey,requestType:"login",callback:A}))}}function A(a){WB2.console.log(a);D(a.status);if(a.success==1){F.save(a);x()}else c.pop()}function z(a){if(/\api.weibo\.com$/.test(a.origin)){var b=a.data;b=unescape(b);b=o(b);if(b.error_code){b.success=-1;b.status=-1}else{b.success=1;b.status=1}A(b)}}function y(a){var b=i.core.util.URL(g),c=600,d=455;b.setParam("client_id",a.appkey);b.setParam("response_type","token");b.setParam("display","js");b.setParam("transport","html5");b.setParam("referer",encodeURI(document.location.href));f=window.open(b,"oauth_login_window","width="+c+",height="+d+",toolbar=no,menubar=no,resizable=no,status=no,left="+(screen.width-c)/2+",top="+(screen.height-d)/2);f&&f.focus();return}function x(a,b){var d,e;a!=null&&(b==!0?c.unshift(a):c.push(a));if(WB2.checkLogin()){for(d=0,e=c.length;d0){d=a[c++];while(d){if(d.src.indexOf("api/js/wb.js")!=-1){e=d.src.split("?").pop();break}d=a[c++]}}e=e.toLowerCase();var i=o(e);f=i.appkey||"";g=i.secret||"";debug=i.debug||!1;h=i.version||1;return{appkey:f,secret:g,debug:debug,version:h}}function v(a){var b=a||{},c=function(){t(b);s.next()},d=function(a){h.bundle?a&&a():q({url:WB2._config.host+"/open/api/js/api/bundle.js?version="+WB2._config.cdn_version,onComplete:function(){h.bundle=1;a&&a()}})};s.add(d,{args:[c]})}function u(a){var b={requestType:"anywhere",callback:a};v(b)}function t(a){var b=WB2._config.version,c=WB2.anyWhere._instances,d=c[b];d?d.contentWindow._ready?d.contentWindow.request(a):WB2.addToCallbacks(d.contentWindow,a):WB2.delayCall(a)}var STK=function(){var a={},b=[];a.inc=function(a,b){return!0};a.register=function(c,d){var e=c.split("."),f=a,g=null;while(g=e.shift())if(e.length){f[g]===undefined&&(f[g]={});f=f[g]}else if(f[g]===undefined)try{f[g]=d(a)}catch(h){b.push(h)}};a.regShort=function(b,c){if(a[b]!==undefined)throw"["+b+"] : short : has been register";a[b]=c};a.IE=/msie/i.test(navigator.userAgent);a.E=function(a){return typeof a=="string"?document.getElementById(a):a};a.C=function(a){var b;a=a.toUpperCase();a=="TEXT"?b=document.createTextNode(""):a=="BUFFER"?b=document.createDocumentFragment():b=document.createElement(a);return b};a.log=function(a){b.push("["+(new Date).getTime()%1e5+"]: "+a)};a.getErrorLogInformationList=function(a){return b.splice(0,a||b.length)};return a}();$Import=STK.inc; STK.register("core.str.trim",function(a){return function(a){if(typeof a!="string")throw"trim need a string as parameter";var b=a.length,c=0,d=/(\u3000|\s|\t|\u00A0)/;while(cc){if(!d.test(a.charAt(b-1)))break;b-=1}return a.slice(c,b)}}); STK.register("core.evt.addEvent",function(a){return function(b,c,d){var e=a.E(b);if(e==null)return!1;c=c||"click";if((typeof d).toLowerCase()=="function"){e.addEventListener?e.addEventListener(c,d,!1):e.attachEvent?e.attachEvent("on"+c,d):e["on"+c]=d;return!0}}}); STK.register("core.obj.parseParam",function(a){return function(a,b,c){var d,e={};b=b||{};for(d in a){e[d]=a[d];b[d]!=null&&(c?a.hasOwnProperty[d]&&(e[d]=b[d]):e[d]=b[d])}return e}}); STK.register("core.arr.isArray",function(a){return function(a){return Object.prototype.toString.call(a)==="[object Array]"}}); STK.register("core.json.queryToJson",function(a){return function(b,c){var d=a.core.str.trim(b).split("&"),e={},f=function(a){return c?decodeURIComponent(a):a};for(var g=0,h=d.length;g=0;e--){var f=c[e];f.specified&&(d[c[e].name]=c[e].value)}d.dom=a;d.tagName=b;return d},g=function(){var a=[];for(var b=0,g=c.length;bLoading...';a.push({tag:i,widget:j,params:f(k[l],i)})}}var g=a.length;if(g>0)if(/weibo|ucbrowser/i.test(navigator.userAgent))for(var b=0,g=a.length;b1?RegExp.$1.length>2?"/u661f/u671f":"/u5468":"")+d[a.getDay()+""]));for(var e in c)(new RegExp("("+e+")")).test(b)&&(b=b.replace(RegExp.$1,RegExp.$1.length==1?c[e]:("00"+c[e]).substr((""+c[e]).length)));return b};return function(b,c){b=b||new Date;c=c||"yyyy-MM-dd hh:mm:ss";return a(b,c)}}); STK.register("conf.api.log",function($){var isConsoleEnable=typeof window.console=="object"&&(typeof window.console.log=="function"||typeof window.console.log=="object"),panelId="weibo_jssdk_console_panel",minHeight=30,maxHeight=90,Icon={info:"#0088CC",warn:"#D2D128",error:"#F50A0A"},cPanel={init:function(){var pos="position:fixed;";$.core.util.browser.IE6&&(pos="position:absolute;");var title=$.C("h5");title.innerHTML='Sina Weibo JSSDK Console PanelHelp?';title.style.cssText="margin: 8px;font-size:13px;border-bottom:1px solid #ccc;";var logDiv=$.C("div");logDiv.id=panelId+"_logdiv";logDiv.style.cssText="background:#000; color:#FFF; margin:5px; border:1px solid #ccc; height:150px; max-height:150px; overflow-x:hidden; overflow-y: auto; word-break:nowrap; padding:5px 5px;border-radius:5px;";var textArea=$.C("textarea");textArea.value='WB2.console.log("test");';textArea.style.cssText="line-height:20px;font-size:12px;width:380px;height:30px;overflow-y:auto;margin:3px;padding:5px; border-radius:5px;border:1px solid #ccc;";textArea.onfocus=function(){textArea.select()};textArea.ondblclick=function(){parseInt(textArea.style.height)'+a;cPanel.output.innerHTML!=""&&(f=f+"\r\n"+cPanel.output.innerHTML);cPanel.output.innerHTML=f+"

";cPanel.output.scrollTop=0}},log:function(a,b){cPanel.show();var c="";typeof a=="object"||Object.prototype.toString.call(a)==="[object Array]"?typeof a.parent=="object"?c=a.toString():c=$.core.json.jsonToStr(a,null,"\t"):typeof a=="undefined"?c="undefined":c=a.toString();cPanel.setLog(c,b)}},debugLevel=["log","info","warn","error","dir"];return function(){function a(){for(var a=0,b=debugLevel.length;a0)for(var d=0,e=c.length;d0&&d.onTimeout!=null&&(c=setTimeout(function(){d.onTimeout()},d.timeout));return b},r=function(){this.started=1;this.taskList=[];this.setStatue=function(a){this.started=a};this.start=function(){this.setStatue(0);var a,b,c,d,e=this.taskList.shift(),b=e[0],c=e[1],d=e[2];b.apply(d,c)};this.next=function(){this.setStatue(1);this.taskList.length>0&&this.start()};this.add=function(a,b){var c={args:[],pointer:window,top:!1};c=j(c,b);c.top?this.taskList.unshift([a,c.args,c.pointer]):this.taskList.push([a,c.args,c.pointer]);this.started&&this.start()}},s=new r,F={load:function(){if(!i.core.obj.isEmpty(WB2.oauthData))return WB2.oauthData;var a=n.get("weibojs_"+WB2._config.appkey);a=unescape(a);var b=o(a);return b},save:function(b){WB2.oauthData=b;var c="access_token="+(b.access_token||"")+"&refresh_token="+(b.refresh_token||"")+"&expires_in="+(b.expires_in||0)+"&uid="+(b.uid||"")+"&status="+(b.status||a||-1);n.set("weibojs_"+WB2._config.appkey,c,{path:"/",domain:document.domain})},del:function(){WB2.oauthData={};n.remove("weibojs_"+WB2._config.appkey,{path:"/",domain:document.domain})}},H=function(c){if(c.access_token){a=1;b=!0;var d={status:a,access_token:c.access_token};c.uid&&(d.uid=c.uid);F.save(d)}};window.WB2=window.WB2||{};WB2.widget={};var I=w();WB2._config=WB2._config||{};WB2._config.version=I.version;WB2._config.appkey=I.appkey;WB2._config.secret=I.secret;WB2._config.debug=I.debug;WB2.oauthData={};WB2.init=H;WB2.login=B;WB2.logout=C;WB2.checkLogin=E;WB2.anyWhere=u;WB2.anyWhere._instances={};WB2.Cookie=F;WB2.regIframeRequest=v;i.conf.api.log();i.conf.api.wbml();WB2._config.appkey&&G();window.postMessage&&!m.IE&&i.core.evt.addEvent(window,"message",z)})();