$(function () {
//预警
war();
})
function war() {
sContent01 = "";
sContent02 = "";
var ss = "", nh = "", fo = "", gm = "", sd = "";
$.getJSON("/weather/data/wa_fo_inforce.js", function (json) {
if (json == "null") {
$(".yjqy").show();
return;
}
if (json) {
$.each(json, function (key, value) {
if (value["station_code"] == "GDSS") {
ss += "
";
ss += "" + new Date(value["datetime"].replace(/-/g, "/")).Format("MM月dd日hh时mm分") + "发布三水区" + value["name"] + "
";
} else if (value["station_code"] == "GDNH") {
nh += "";
nh += "" + new Date(value["datetime"].replace(/-/g, "/")).Format("MM月dd日hh时mm分") + "发布南海区" + value["name"] + "
";
} else if (value["station_code"] == "BFFO") {
fo += "";
fo += "" + new Date(value["datetime"].replace(/-/g, "/")).Format("MM月dd日hh时mm分") + "发布禅城区" + value["name"] + "
";
sContent02 += "";
sContent02 += "【" + value["name"] + "】市气象台于" + new Date(value["datetime"].replace(/-/g, "/")).Format("MM月dd日hh时mm分") + "在全市发布。
";
} else if (value["station_code"] == "GDGM") {
gm += "";
gm += "" + new Date(value["datetime"].replace(/-/g, "/")).Format("MM月dd日hh时mm分") + "发布高明区" + value["name"] + "
";
} else if (value["station_code"] == "GDSD") {
sd += "";
sd += "" + new Date(value["datetime"].replace(/-/g, "/")).Format("MM月dd日hh时mm分") + "发布顺德区" + value["name"] + "
";
}
})
if (fo != "")
sContent01 += "佛山禅城区
发布单位:佛山市气象台
" + fo + "";
if (nh != "")
sContent01 += "佛山南海区
发布单位:南海区气象台
" + nh + "";
if (sd != "")
sContent01 += "佛山顺德区
发布单位:顺德区气象台
" + sd + "";
if (gm != "")
sContent01 += "佛山高明区
发布单位:高明区气象台
" + gm + "";
if (ss!="")
sContent01 += "佛山三水区
发布单位:三水区气象台
" + ss + "";
$("#qxShow1").html(sContent01);
$("#qxShow2").html(sContent02);
}
});
}
//日期
Date.prototype.Format = function (fmt) { //author: meizz
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}