(function(){function i(n){this.conf=e(n,r),t(this)}var e=qboot.mix,t=qboot.createEvents,n=qboot.jsonp,r={jsonp:"_callback",threshold:6e5,timeout:3e4};i.prototype={addFilter:function(e){this.conf.filter=e},get:function(t,r){typeof t=="function"&&(r=t,t={});var i=e({params:t||{}},this.conf),s=r,o=this.conf.filter,u=this.conf.setup,a=this.conf.teardown,f=this;o&&s&&(s=function(e){e=o.call(f,e),r(e)}),e(i,{callback:s}),this.fire("setup",i)&&u&&u(i),this.fire("request",i)&&n(i.host,i.params,function(e){i.callback&&i.callback(e)},{jsonp:i.jsonp,timeout:i.timeout,threshold:i.threshold}),this.fire("teardown",i)&&a&&a(i)}},window.JsonpProvider=i})();

(function(){function t(e,t,n,r){t instanceof AppData?this.appData=t:this.appData=new AppData(t,n,r),this.key=e}var e=qboot.mix;t.prototype={set:function(e,t){this.appData.set(this.key,e,t)},get:function(e){return this.appData.get(this.key,e)},flush:function(){this.appData.remove(this.key)}},e(t,{NORMAL:0,FLUSH:1,QUITE:2}),window.DataCache=t})();

(function(){function e(e,t){this.provider=e,this.cache=t}e.prototype={update:function(e,t,n,r){typeof e=="function"&&(r=n,n=t,t=e,e={});var i=this.provider,s=this.cache,o;s&&DataCache.FLUSH==n&&s.flush(),o=s&&s.get(),s&&DataCache.QUITE==n&&i.get(e,function(e){s.set(e,r)}),o==null?i.get(e,function(e){s&&s.set(e,r),t(e)}):t(o)}},window.DataAdapter=e})();

(function(){var e=qboot.mix,t=qboot.jsonp,n={jsonp:"_callback",cluster:!1,cache:!1,storeObj:null,appData:"all"},r={_requests:{},_task:null,prepare:function(e){var t=this._requests;t[e.host]=t[e.host]||[],t[e.host].push(e);if(!this._task){var n=this;this._task=setTimeout(function(){n.send()})}},send:function(){var r=this._requests,i=[];for(var s in r){var o=r[s]||[],u=[],a={},f={};for(var l=0;l<o.length;l++){var c=o[l];u.push(c.api),c.api in f?i.push(c):(e(a,c.params,function(e,t){return e==null&&(e=[]),e instanceof Array||(e=[e]),e.concat([t])}),f[c.api]=c.callback)}u.length&&function(e,r,i){t(e,r,function(e){for(var t in i){var n=i[t];n&&e&&n(e[t])}},{jsonp:n.jsonp})}(s,a,f)}delete this._requests,this._requests={},clearTimeout(this._task),delete this._task;while(i.length)this.prepare(i.shift())}},i={register:function(t,i){if(i==null)throw new Error("call unknown api:"+apiconf);typeof i=="string"?i={host:i,api:arguments[2]}:i=e({},i),e(i,n);var s=new JsonpProvider(i);s.on("request",function(t){var n=t.params;t.api&&t.cluster&&e(t.params,{m:[t.api,t.v,t.r]}),t.cluster&&(r.prepare(t),t.preventDefault())});var o;i.cache&&(o=new DataCache(i.api,"api.hao.360.cn",i.r,i.storeObj));var u=new DataAdapter(s,o);return t.request=function(e,t,n,r){u.update(e,t,n,r)},t.getApi=function(){return u},t.getCache=function(){return o},t.getDataProvider=function(){return s},t}};e(i,{CACHE_QUIET:DataCache.QUIET,CACHE_FLUSH:DataCache.FLUSH,CACHE_NORMAL:DataCache.NORMAL}),window.Bus=i})();

(function(){function a(r){u&&clearInterval(u),e(t,function(e){e||(e=(new Date).getTime()),i=(new Date(e)).getTime(),o=s=(new Date).getTime(),f(r),u=setInterval(function(){f(null)},n)})}function f(e){var t=(new Date).getTime();!o||Math.abs(t-o)>n*3?a(e):(o=t,Math.abs(i-s)>r&&(t=i-s+t)),e&&e(new Date(t))}var e=qboot.jsonp,t="http://hao.360.cn/time.php",n=6e4,r=3e5,i=null,s=null,o=null,u=null,l={getTime:f};window.TimeSVC=l})();

(function(){function n(e){this.config=e,this.init()}var e=qboot.mix,t=HAO_CONFIG.feedsConfig;e(n,{get:function(r,i,s,o,u){var a=t[r];a.cluster=!0,a.cache=!0;var r=new n(e(a,s,!0));r.expires=u||(new Date).getTime()+a.expires,r.get(i,o)}}),e(n.prototype,{get:function(e,t){this.request(e,t,this.expires)},init:function(){Bus.register(this,this.config)}}),qboot.mix(n,t,function(e,t,r){return e?e:function(e){return function(){var t=Array.prototype.slice.call(arguments);return n.get.apply(null,[e].concat(t))}}(r)}),window.Feed=n})();

(function(){function i(e,t,n){for(var r=0,i=n.length;r<i;r++){var s=n[r];n[r]=s>=0?s:"&nbsp;"+s}return{icoCode:e,weather:t.length!==1?t:"&nbsp;&nbsp;"+t,c:n.join("~")}}var e=qboot.mix,t=HAO_CONFIG.weather,n=function(e){var n=e.params,r=n.code,i=n.grade;e.host=r||i?t.cnd_host:t.host,e.host+=i?t.area.path:t.weather.path,n.app="hao360"},r=new AppData("api.hao.360.cn",t.area.r),s={getWeather:function(e,r,o){var u=Bus.register({},{jsonp:"_jsonp",setup:n,filter:function(e){var t=null,n=(new Date(e.time*1e3)).getHours(),r={area:"\u5317\u4eac",weather:{today:{},tomorrow:{}}},s=hao360.todayObj||new Date,o=s.getFullYear(),u=s.getMonth(),a=s.getDate(),f=(new Date(o,u,a)).getTime(),l=(new Date(o,u,a+1)).getTime();r.area=e.area[2][0],r.code=e.area[2][1];var c={prov:e.area[0][1],city:e.area[1][1],town:e.area[2][1]},h=!1,p=!1;for(var d=0,v=e.weather.length;d<v;d++){var m=e.weather[d],g=m.date.split("-"),y=(new Date(g[0],g[1]-1,g[2])).getTime();if(y==f){if(!m.info)return{};h=h||!0,n>=18?(r.weather.today=i(m.info.night[0],m.info.night[1],[m.info.night[2]]),t=l):n<6?(r.weather.today=i(m.info.dawn[0],m.info.dawn[1],[m.info.dawn[2],m.info.day[2]]),t=(new Date(o,u,a,6)).getTime()):(r.weather.today=i(m.info.day[0],m.info.day[1],[m.info.day[2],m.info.night[2]]),t=(new Date(o,u,a,18)).getTime())}if(y==l){if(!m.info)return{};p=p||!0,r.weather.tomorrow=i(m.info.day[0],m.info.day[1],[m.info.day[2],m.info.night[2]])}}if(!h||!p)r=null;return{a:c,d:r,e:t}}});u.request({code:r||s.code},function(n){if(n.d){var r=new AppData("api.hao.360.cn",t.weather.r);r.set(t.weather.api,n.d,Math.min(n.e,(new Date).getTime()+t.weather.expires)),s.set(n.a),e(n.d)}},o)},getArea:function(e,t,r,i){e=e||"province";var s=Bus.register({},{jsonp:"_jsonp",setup:n});s.request({grade:e,code:r},t,i)},getProvince:function(e,t){s.getArea("province",e,t)},getCity:function(e,t,n){s.getArea("city",e,t,n)},getTown:function(e,t,n){s.getArea("town",e,t,n)},setCode:function(e){s.code=e},local:{},set:function(e){s.local=e,r.set(t.area.api,e)}};s.set(r.get(t.area.api)||{}),window.Weather=s})();

(function(){function n(r){this.mid=hao360.mid,this.conf=e({host:t.host,v:t.v,r:t.r,api:t.api,sites:[],types:[],expires:t.expires},r,!0);var i=this;Bus.register(this,e({jsonp:"_jsonp",cache:!0,filter:function(e){return!e||e.errno!=0||e.guess.length!=6?i.conf.sites.length?n.formate(i.conf.types,i.conf.sites):null:n.formate(i.conf.types,e.guess)}},this.conf,!0)),this.params={mid:this.mid,v:this.conf.v},this.cache=new AppData("api.hao.360.cn",this.conf.r),this.expires=this.conf.expires+(new Date).getTime()}var e=qboot.mix,t=HAO_CONFIG.iguessConfig;e(n,{formate:function(e,t){var n=[],r=[];for(var i=0,s=e.length;i<s;i++){var o=e[i],u=o[0];n[u]=o}for(var a=0,f=t.length;a<f;a++){var l=t[a],c=l[0];n[c]&&(l.push(n[c]),r.push(l))}if(!r.length)return;return r}}),e(n.prototype,{get:function(e,t){if(!this.conf.types.length)return;if(!this.mid&&e){var r=this;qboot.await(function(){return r.conf.sites},function(){var t=n.formate(r.conf.types,r.conf.sites);t&&(e(t),r.cache.set(r.conf.api,t,r.expires))});return}var i=new Date;this.params.t=i.getHours(),this.params.tag="",this.request(this.params,function(t){e&&e(t)},t,this.expires)},setOrder:function(e,t){var n=this.getOrder();n[e]=t,this.cache.set("iguessOrder",n.join("|"))},getOrder:function(e){var t=this.cache.get("iguessOrder")||"";return orderArray=t.split("|"),e?parseInt(orderArray[e])||0:orderArray}}),window.IGuess=n})();

(function(){function e(e){this.el=typeof e=="string"?document.getElementById(e):e;var t=this.el;return t.status=0|t.getAttribute("data-rstatus"),t.eid=e.replace(/\-(\w)/ig,function(e,t){return t.toUpperCase()}),t}function f(e,n,i){var s=e.callback;if(typeof s=="function")s(n.eid,n,i);else{if(i==r)return;var o=s.func,u=s.argv;for(var a=0,f=u.length;a<f;a++)u[a]=="callback"&&(u[a]=function(e){i==t&&R(n).setData(e)}),u[a]=="status"&&(u[a]=i);typeof o=="function"&&(o=[o,window]),o[0].apply(o[1],u)}}var t=DataCache.FLUSH,n=DataCache.QUITE,r=DataCache.NORMAL,i=qboot.cookie.get("city_code");if(!i)var s=HAO_CONFIG.weather.area,o=new AppData("api.hao.360.cn",s.r),u=o.get("area")||{},i=u.town;var a={"weather-inner":{dataconf:HAO_CONFIG.weather.weather,callback:{func:Weather.getWeather,argv:["callback",i,"status"]}},ajoke:{dataconf:HAO_CONFIG.feedsConfig.joke,callback:{func:Feed.joke,argv:["callback",{},"status"]}},"hot-site-iguess":{dataconf:HAO_CONFIG.iguessConfig,callback:function(e,t,n){var r=new IGuess({sites:IGUESS_DATA.iguess_default_data||[],types:IGUESS_DATA.iguess_types||[]});r.get(function(e){R("hot-site-iguess").setData(e)},n)},requires:["iguessdata"]}},l=(new Date).getTime();TimeSVC.getTime(function(e){var t=e.getTime(),n=new AppData("api.hao.360.cn");Math.abs(l-t)>3e5?(hao360.todayObj=e,n.set("timeOffset",l-t)):n.remove("timeOffset")}),setTimeout(function(){for(moduleId in a){var i=e(moduleId),s=a[moduleId];if(s.callback){var o=r;if(i.status!=R.STATUS_OK)o=t;else if(s.dataconf&&s.dataconf.quietUpdateTime){var u=(new Date).getTime(),l=new AppData("api.hao.360.cn",s.dataconf.r),c=l.getUpdatedTime(s.dataconf.api);c+s.dataconf.quietUpdateTime<u&&(o=n)}if(o==r)continue;(function(e,t,n){e.requires?qboot.load.apply(null,e.requires.concat(function(){f(e,t,n)})):f(e,t,n)})(s,i,o)}}},20)})();
