/*天气插件开始
天气插件api请在wea目录中index.php修改
申请地址:和风天气-https://dev.heweather.com/
*/
//菜单点击
$("#menu").click(function(event) {
$(".mywth").toggleClass('hidden');
});
$("#content").click(function(event) {
$(".mywth").removeClass('hidden');
});
$.ajax({
url: './template/5iux/wea/',
dataType: 'json',
error: function() {
console.log('天气插件网络错误!');
},
success: function(res) {
//判断夜晚
var now = new Date(),
hour = now.getHours();
if (hour < 18) { myday = "d"; } else { myday = "n"; }
//天气
$('.mywth').append(res.HeWeather6[0].basic.location + ' ' + res.HeWeather6[0].now.cond_txt + ' ' + res.HeWeather6[0].now.tmp + '℃ ' + res.HeWeather6[0].now.wind_dir);
$('.wea_hover').css('background-image', 'url(https://cdn.heweather.com/img/plugin/190516/bg/view/' + res.HeWeather6[0].now.cond_code + myday + '.png)');
//今日天气
$('.wea_top').append('' + res.HeWeather6[0].basic.location + ' ' + res.HeWeather6[0].update.loc + ' 更新 ' + res.HeWeather6[0].now.tmp + '℃' + res.HeWeather6[0].now.cond_txt + '紫外线指数:' + res.HeWeather6[0].lifestyle[5].brf + '
相对湿度:' + res.HeWeather6[0].now.hum + '%
' + res.HeWeather6[0].now.wind_dir + ':' + res.HeWeather6[0].now.wind_sc + '级' + res.HeWeather6[0].lifestyle[3].txt + '');
//今日指数
var wea_con;
for (var x = 0; x < 8; x++) {
wea_con = '