$(function () { wea_foshan(); war(); /*当窗口变化大小*/ var browserheight = $(window).height(); $("#body_main").css("height", browserheight); $(window).resize(function () { var w, h if (!!(window.attachEvent && !window.opera)) { h = document.documentElement.clientHeight; w = document.documentElement.clientWidth; } else { h = window.innerHeight; w = window.innerWidth; bgscroll(h); } $("#body_main").css("height", h); }); $("#list1").dragsort({ /*拖动手柄*/dragSelector: "dl", /*启用多组列表之间拖动*/dragBetween: true, /*拖动列表的HTML部分*/placeHolderTemplate: "
  • " }); $(".da_wu2 dt:last").css("background", "none") $(".message li:last").css("background", "none") $(".da_wu li:last").css("border-bottom", "none") $(".dz_l li:last").css("border-bottom", "none") $(".qx_1 li:last").css("border-bottom", "none") /*end*/ }); //现时天气 function wea_foshan() { //实况 $.getJSON("weather/data/vis_last.js?t=" + Math.random(),function (vis_lastJson) { $.getJSON("weather/data/aws_inst_fo_G2201.js?t=" + Math.random(), function (json) { if (json) { $.getJSON("weather/data/fohours_59828.js?t=" + Math.random(), function (content) { var newJson = json[json.length - 1]; var t = parseFloat(newJson.t).toFixed(1);//气温 var firstJson = json[0]; var calT = parseFloat(t - firstJson.t).toFixed(1);//温度计算 var wd2 = newJson.wd2;//风向 var wf2 = newJson.wf2;//风速 $.each(vis_lastJson, function (k, vis_lastcontent) { if (vis_lastcontent.stationid == "59828") { $("#wea_foshan").append("季华五路 " + t + "°C"); $("#wea_foshan").append("

    较昨日:" + (calT >= 0 ? "上升" : "下降") + Math.abs(calT) + "℃

    "); $("#wea_foshan").append("

    风向:" + wd8[wd2][0] + "    风速:" + wf2 + " m/s

    "); $("#wea_foshan").append("

    能见度:" + (vis_lastcontent.vis / 1000).toFixed(1) + "公里

    "); //天气图标 var curr_datetime = new Date(); var PeriodPath = "day"; if (curr_datetime.getHours() >= 19 || curr_datetime.getHours() < 7) PeriodPath = "night"; var w_code = content[0].w; w_code = ShikuanType(w_code); $("#shik .right").append(""); } }); }); } }); }); $.getJSON("weather/data/foshorttime.js?t=" + Math.random(), function (json) { $.each(json, function (index, value) { if (value.stationid == "59828") { // $("#wea_foshan").append("" + value["tmin"] + "°C/" + value["tmax"] + "°C佛山
    " + value["ws"]); $("#wea_zdzd").append("禅城 " + Math.floor(value.tmin) + "-" + Math.floor(value.tmax) + "°C " + value["ws"] + "
    相对湿度 " + value["hmin"] + "%~" + value["hmax"] + "%," + value["wind"]); return false; } }) }) } //预警 function war() { var sContent01 = new Array(); var sContent02 = new Array(); $.getJSON("/weather/data/wa_fo_inforce.js?t=" + Math.random(), function (json) { if (json == "null") { $(".load").hide(); $(".yjqy").show(); return; } if (json) { $(".load").hide(); $.each(json, function (key, value) { if (value["station_code"] == "GDSS") { sContent01.push("三水 " + value["name"] + "
    "); //sContent02.push("
    "); } else if (value["station_code"] == "GDNH") { sContent01.push("南海 " + value["name"] + "
    "); // sContent02.push("
    "); } else if (value["station_code"] == "BFFO") { sContent01.push("禅城 " + value["name"] + "
    "); // sContent02.push("
    "); } else if (value["station_code"] == "GDGM") { sContent01.push("高明 " + value["name"] + "
    "); // sContent02.push("
    "); } else if (value["station_code"] == "GDSD") { sContent01.push("顺德 " + value["name"] + "
    "); // sContent02.push("
    "); } }) $("#tqyj_tit").html(sContent01.join('')); // $("#tqyj_con").html(sContent02.join('')); } }); } //跟进逐三小时图标获取实况对应背景图、天气图标 function ShikuanType(code) { var type = ""; switch (code) { case "0": //晴 type = "sunny"; break; case "1": //多云 case "53": //霾 type = "partly-cloudy"; break; case "2":// 阴 case "18": //雾 type = "cloudy"; break; case "3": //阵雨 case "4": //雷阵雨 type = "shower"; break; case "5"://雷阵雨并伴有冰雹 case "6": //雨夹雪 case "7": //小雨 case "8":// 中雨 case "9":// 大雨 case "10":// 暴雨 case "11":// 大暴雨 case "12": //特大暴雨 case "21":// 小到中雨 case "22":// 中到大雨 case "23":// 大到暴雨 case "24": //暴雨到大暴雨 case "25": //大暴雨到特大暴雨 type = "rainy"; break; } return type; // : 13: 阵雪 //: 14: 小雪 //: 15: 中雪 //: 16: 大雪 //: 17: 暴雪 //: 19: 冻雨 //: 20: 沙尘暴 //: 26: 小到中雪 //: 27: 中到大雪 //: 28: 大到暴雪 //: 29: 浮尘 //: 30: 扬沙 //: 31: 强沙尘暴 }