hao123_上网从这里开始


{“aqi”:{“url”:””,”title”:””,”value”:”16″,”level”:”优”,”levelnum”:”1″,”levelLong”:”优”,”detail”:{“pm25″:”15″,”no2″:”0″,”o3″:”0″,”pm10″:””,”so2″:”0″,”co”:”0″,”level_num_pm25″:1,”level_num_no2″:1,”level_num_o3″:1,”level_num_pm10″:””,”level_num_so2″:1,”level_num_co”:1},”tip”:”各类人群可正常活动。”,”update_at”:1788123600,”time”:”2026年08月31日05时”,”date”:”2026-08-31″},”forecast5d”:{“f”:{“f0″:”202608310510″,”f1”:[{“date”:”08月31日”,”week”:”星期一”,”fa”:”08″,”weatherd_zh”:”中雨”,”fb”:”04″,”weathern_zh”:”雷阵雨”,”fc”:32,”fd”:24,”fe”:”8″,”windird_zh”:”北风”,”ff”:”7″,”windirn_zh”:”西北风”,”fg”:”0″,”winlevd_zh”:”微风”,”fh”:”1″,”winlevn_zh”:”3-4级”,”fi”:”06:09|18:46″,”pm25″:””,”aqi_value”:””,”aqi_level”:””,”icon_url”:”https://hao123-static.cdn.bcebos.com/res/weather/v3/a4.png”},{“date”:”09月01日”,”week”:”星期二”,”fa”:”04″,”weatherd_zh”:”雷阵雨”,”fb”:”08″,”weathern_zh”:”中雨”,”fc”:32,”fd”:23,”fe”:”8″,”windird_zh”:”北风”,”ff”:”7″,”windirn_zh”:”西北风”,”fg”:”1″,”winlevd_zh”:”3-4级”,”fh”:”1″,”winlevn_zh”:”3-4级”,”fi”:”06:09|18:45″,”pm25″:””,”aqi_value”:””,”aqi_level”:””,”icon_url”:”https://hao123-static.cdn.bcebos.com/res/weather/v3/a8.png”},{“date”:”09月02日”,”week”:”星期三”,”fa”:”00″,”weatherd_zh”:”晴”,”fb”:”04″,”weathern_zh”:”雷阵雨”,”fc”:30,”fd”:23,”fe”:”7″,”windird_zh”:”西北风”,”ff”:”7″,”windirn_zh”:”西北风”,”fg”:”1″,”winlevd_zh”:”3-4级”,”fh”:”1″,”winlevn_zh”:”3-4级”,”fi”:”06:09|18:44″,”pm25″:””,”aqi_value”:””,”aqi_level”:””,”icon_url”:”https://hao123-static.cdn.bcebos.com/res/weather/v3/a4.png”},{“date”:”09月03日”,”week”:”星期四”,”fa”:”01″,”weatherd_zh”:”多云”,”fb”:”01″,”weathern_zh”:”多云”,”fc”:30,”fd”:24,”fe”:”7″,”windird_zh”:”西北风”,”ff”:”8″,”windirn_zh”:”北风”,”fg”:”1″,”winlevd_zh”:”3-4级”,”fh”:”1″,”winlevn_zh”:”3-4级”,”fi”:”06:10|18:43″,”pm25″:””,”aqi_value”:””,”aqi_level”:””,”icon_url”:”https://hao123-static.cdn.bcebos.com/res/weather/v3/a1.png”},{“date”:”09月04日”,”week”:”星期五”,”fa”:”01″,”weatherd_zh”:”多云”,”fb”:”01″,”weathern_zh”:”多云”,”fc”:30,”fd”:24,”fe”:”7″,”windird_zh”:”西北风”,”ff”:”8″,”windirn_zh”:”北风”,”fg”:”1″,”winlevd_zh”:”3-4级”,”fh”:”1″,”winlevn_zh”:”3-4级”,”fi”:”06:10|18:43″,”pm25″:””,”aqi_value”:””,”aqi_level”:””,”icon_url”:”https://hao123-static.cdn.bcebos.com/res/weather/v3/a1.png”}]}},”24hoursforecast”:{“range”:[],”now”:[],”tomorrow”:[]},”index”:[],”observe”:{“l”:{“l1″:””,”l2″:””,”l3″:””,”l4″:””,”l7″:”05:35″,”l10″:””,”weather”:””,”weather_zh”:””,”windir”:””,”prec”:””,”press”:””}},”alarm”:{“w”:[]},”cityinfo”:{“localcode”:”08_01_01″,”prov”:”广东”,”prov_py”:”guangdong”,”city”:”广州”,”city_py”:”guangzhou”,”dist”:”广州”,”dist_py”:”guangzhou”,”pid”:”08″,”cid”:”01″,”zid”:”01″,”areaid”:101280101}}{“date”:”08月31日”,”week”:”星期一”,”fa”:”08″,”weatherd_zh”:”中雨”,”fb”:”04″,”weathern_zh”:”雷阵雨”,”fc”:32,”fd”:24,”fe”:”8″,”windird_zh”:”北风”,”ff”:”7″,”windirn_zh”:”西北风”,”fg”:”0″,”winlevd_zh”:”微风”,”fh”:”1″,”winlevn_zh”:”3-4级”,”fi”:”06:09|18:46″,”pm25″:””,”aqi_value”:””,”aqi_level”:””,”icon_url”:”https://hao123-static.cdn.bcebos.com/res/weather/v3/a4.png”}[{“title”:”first_line”,”url”:””,”style”:””,”imgurl”:””,”tip”:””,”data”:[{“title”:”查IP”,”url”:”https://www.baidu.com/s?word=IP%E6%9F%A5%E8%AF%A2&tn=50000212_hao_pg&ie=utf-8″,”style”:””,”imgurl”:””,”tip”:””},{“title”:”地图”,”url”:”https://www.baidu.com/s?word=%E7%99%BE%E5%BA%A6%E5%9C%B0%E5%9B%BE&tn=50000213_hao_pg&ie=utf-8″,”style”:””,”imgurl”:””,”tip”:””},{“title”:”火车票”,”url”:”https://www.baidu.com/s?word=%E7%81%AB%E8%BD%A6%E7%A5%A8&tn=50000214_hao_pg&ie=utf-8″,”style”:””,”imgurl”:””,”tip”:””},{“title”:”计算器”,”url”:”https://www.baidu.com/s?word=%E8%AE%A1%E7%AE%97%E5%99%A8&tn=50000215_hao_pg”,”style”:””,”imgurl”:””,”tip”:””}]},{“title”:”second_line”,”url”:””,”style”:””,”imgurl”:””,”tip”:””,”data”:[{“title”:”邮箱”,”url”:”https://www.baidu.com/s?word=%E9%82%AE%E7%AE%B1%E5%AF%BC%E8%88%AA&tn=50000216_hao_pg&ie=utf-8″,”style”:””,”imgurl”:””,”tip”:””},{“title”:”汇率”,”url”:”https://www.baidu.com/s?word=%E6%B1%87%E7%8E%87&tn=50000217_hao_pg&ie=utf-8″,”style”:””,”imgurl”:””,”tip”:””},{“title”:”查快递”,”url”:”https://www.baidu.com/s?word=%E6%9F%A5%E8%AF%A2%E5%BF%AB%E9%80%92&tn=50000218_hao_pg&ie=utf-8″,”style”:””,”imgurl”:””,”tip”:””},{“title”:”查股票”,”url”:”https://www.baidu.com/s?word=%E6%8C%87%E6%95%B0%E8%A1%8C%E6%83%85&tn=50000219_hao_pg”,”style”:””,”imgurl”:””,”tip”:””},{“title”:”个税查询”,”url”:”https://www.baidu.com/s?word=%E4%B8%AA%E7%A8%8E%E6%9F%A5%E8%AF%A2&tn=50000244_hao_pg&ie=utf-8″,”style”:””,”imgurl”:””,”tip”:””},{“title”:”辟谣”,”url”:”http://www.piyao.org.cn/yybgt/index.htm”,”style”:””,”imgurl”:””,”tip”:””}]}]‘ + firstLine[key].title + ”+ ‘]]>‘+ (secondLine[key] ? (”) : ”)+”);};getByClass(‘head-item-links-area’).innerHTML = linkTpl.join(”);request(‘/api/gethitthecity’, {}, function (data) {if (data.isHit) {var originText = getByClass(‘has-limit’).innerHTML.replace(‘查询’, ”);originText += (‘ 限号‘);getByClass(‘has-limit’).innerHTML = originText;makeSearchLink(name + ‘限行’, ‘50000247_hao_pg’, getByClass(‘no-car’));}});};function bindWeatherLink(cityName) {var w_tn = ‘50000211_hao_pg’;makeSearchLink(cityName + ‘一周天气预报’, w_tn, getByClass(‘weather-week’));makeSearchLink(cityName + ‘一周天气预报’, w_tn, getByClass(‘more-icon’));makeSearchLink(cityName + ‘天气预报’, w_tn, getByClass(‘weather-today’));makeSearchLink(cityName + ‘明天天气’, w_tn, getByClass(‘weather-tomorrow’));};function bindCalendarLink() {var c_tn = ‘50000167_hao_pg’;makeSearchLink(‘日历’, c_tn, getByClass(‘solar-date’));makeSearchLink(‘星座运势’, c_tn, getByClass(‘lucky-date’));makeSearchLink(‘日历’, c_tn, getByClass(‘week-date’));makeSearchLink(‘农历查询’, c_tn, getByClass(‘lunar-date’));};function createSwiper(node) {var current = 0;var warnNodeList;var exactNode;function renderWarns(warns, data) {var tagColor = [‘yellow-tag’, ‘orange-tag’, ‘blue-tag’, ‘red-tag’];var airTagColor = [‘air-green-tag’, ‘air-lightgreen-tag’, ‘air-orange-tag’, ‘air-lightred-tag’, ‘air-red-tag’, ‘air-darkred-tag’];var tpl = ‘

‘+ ” + data.min + ‘~’ + data.max + ‘℃ ‘+ ” + data.air + ”+ ‘

‘;var itemTagColor;for (var key in warns) {if (warns.hasOwnProperty(key)) {if(warns[key].name === ‘pollution’) {itemTagColor = airTagColor[warns[key].level – 1] + ‘ air-weather-tag’;} else {itemTagColor = tagColor[warns[key].level – 1];}tpl += ‘

‘+ (warns[key].icon ? ‘‘ : ”)+ warns[key].disc+ ‘

‘;}};node.innerHTML = tpl;warnNodeList = node.children;current = 0;};function getNext() {var newNode = warnNodeList[current++];!warnNodeList[current] && (current = 0);return newNode;};function recur() {var list = [];var running = false;function more(callBack, defer) {list.push(function () {setTimeout(function () {callBack && callBack();list[0] && list.shift()();}, defer || 300);});!running && list[0] && (running = true) && list.shift()();return more;};return more;};function checkout() {setTimeout(function () {if (!exactNode) {exactNode = getNext();}var newNode = getNext();recur()(function () {exactNode.style.top = ‘-100%’;newNode.style.top = ‘0px’;}, 0)(function () {exactNode.style.opacity = 0;}, 300)(function () {exactNode.style.top = ‘100%’;}, 300)(function () {exactNode.style.opacity = 1;exactNode = newNode;}, 0);checkout();}, 3000);};checkout();return renderWarns;};function warnFormat(data) {var warns = [];var w = data.alarm.w;var levelMap = {‘红色’: 5,’蓝色’: 4,’橙色’: 3,’黄色’: 2,’绿色’: 1};for (var key in w) {if (w.hasOwnProperty(key)) {warns.push({icon: HAO.httpsTrans(‘https://hao123-static.cdn.bcebos.com/res/weather/yj/i’ + w[key].w4 + ‘.png’),disc: w[key].w5.length >= 4 ? w[key].w5 : w[key].w5 + ‘预警’,level: levelMap[w[key].w7]});}};var levelDisc = data.aqi.levelLong || ”;levelDisc = levelDisc.replace(‘污染’, ”);warns.push({name: ‘pollution’,level: parseInt(data.aqi.levelnum),disc: levelDisc});return warns;};function weatherFormat(data, day) {var info = {status: day.weathern_zh || day.weatherd_zh,min: day.fd,max: day.fc,air: data.aqi.level,icon: day.icon_url};return info;};var cityInfo = {cityCode: [],cityStr: ”,updateCity: function (data) {this.cityCode = data.cityCode;this.cityStr = data.cityStr;var cityName = this.cityStr[2] || this.cityStr[1] || this.cityStr[0];getByClass(‘city-name’).innerText = cityName;var param = {t: 2,provice: this.cityStr[0],city: this.cityStr[1],district: this.cityStr[2]};bindWeatherLink(cityName);makeSearchLink(cityName + ‘限行’, ‘50000247_hao_pg’, getByClass(‘no-car’));request(‘/api/newforecast’, param, function (data) {var weather = {today: weatherFormat(data, data.forecast5d.f.f1[0]),tomorrow: weatherFormat(data, data.forecast5d.f.f1[1]),warns: warnFormat(data)};renderWeather(weather);});}};function renderWeather(data) {function renderDay(node, day) {getByClass(‘weather-status’, node).innerText = day.status;getByClass(‘weather-temp’, node).innerText = day.min + ‘~’ + day.max + ‘℃’;(getByClass(‘weather-air’, node) || {}).innerText = day.air;getByClass(‘status-icon’, node).style.backgroundImage = ‘url(‘ + day.icon + ‘)’;};renderDay(getByClass(‘weather-today’), data.today);renderDay(getByClass(‘weather-tomorrow’), data.tomorrow);swiper(data.warns, data.today);};function getSelectedName(node) {var name = ((node.options[node.selectedIndex] || {}).innerText || ”).split(‘ ‘);return name[1] || name[0];};function getAreaList(pid, cid, fn) {function preProcess(data) {var list = [];for (var key in data) {if (data.hasOwnProperty(key)) {list.push({id: data[key].id,name: data[key].firstchar + ‘ ‘ + data[key].name});}};fn(list);};var param = {};pid && (param.pid = pid);cid && (param.cid = cid);request(‘/api/citymenu’, param, preProcess);};function setSelect(node, list) {var text = ”;var index = 0;var item;for (var key in list) {item = list[key];text += ” + item.name + ”;index++;}node.innerHTML = text;};function chooseProvince(e) {e.stopPropagation();getAreaList($province.value, null, function (data){setSelect($city, data);setSelect($dist, [data[0]]);});};function chooseCity(e) {e.stopPropagation();getAreaList($province.value, $city.value, function (data){setSelect($dist, data);});};function confirm(e) {var newCity = {cityCode: [$province.value, $city.value, $dist.value],cityStr: [getSelectedName($province), getSelectedName($city), getSelectedName($dist)]};cityInfo.updateCity(newCity);close(e);};function close(e) {stop(e);selectBoard.style.display !== ‘none’ && (selectBoard.style.display = ‘none’);};function open(e) {stop(e);selectBoard.style.display = ‘block’;};function stop(e) {e.stopPropagation();};function bindEvent(node, event, fn) {node.addEventListener? node.addEventListener(event, fn): node.attachEvent(‘on’ + event, fn);};var initDist = {name: ‘广州’,id: ’01’};var initCity = {name: ‘广州’,id: ’01’};var initProv = {name: ‘广东’,id: ‘$08’};var links = JSON.parse(getByClass(‘head-links’).innerText);var $weatherData = JSON.parse(getByClass(‘head-weatherData’).innerText);var $today = JSON.parse(getByClass(‘head-today’).innerText);getByClass(‘page-width’).removeChild(getByClass(‘head-weatherData’));getByClass(‘page-width’).removeChild(getByClass(‘head-today’));getByClass(‘page-width’).removeChild(getByClass(‘head-links’));var selectBoard = getByClass(‘select-area’);var $province = getByClass(‘select-province’);var $city = getByClass(‘select-city’);var $dist = getByClass(‘select-dist’);var swiper = createSwiper(getByClass(‘weather-tag-area’));bindEvent(selectBoard, ‘click’, stop);bindEvent(getByClass(‘city-change-btn’), ‘click’, open);bindEvent(getByClass(‘select-cancel-btn’), ‘click’, close);bindEvent(getByClass(‘select-confirm-btn’), ‘click’, confirm);bindEvent($province, ‘change’, chooseProvince);bindEvent($city, ‘change’, chooseCity);bindEvent(window, ‘click’, close);renderQuery(initDist.name);swiper(warnFormat($weatherData), weatherFormat($weatherData, $today));setSelect($province, [initProv]);setSelect($city, [initCity]);setSelect($dist, [initDist]);bindWeatherLink(initDist.name || initCity.name || initProv.name);bindCalendarLink();getAreaList(null, null, function (data) {setSelect($province, data);});})();

Source

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

滚动至顶部