var date_week_9 = new Array(); var date_day_9 = new Array(); $(function () { day10(); Foshorttime(); }); ///////////////////////////////////////////// function day10() { $.getJSON("/weather/data/10day.js", function (json) { if (json) { var dayNames = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); var datetime = new Date(json[0]["datetime"].replace(/-/g, "/")); //转换成Data(); for (var i = 0; i < 11; i++) { date_day_9.push(datetime.Format('MM-dd')); date_week_9.push(dayNames[datetime.getDay()]); datetime.setDate(datetime.getDate() + 1); } var datehour = datetime.getHours(); if (datehour >= 6 && datehour <= 11) { var strbtit = new Array(); strbtit.push("
"); strbtit.push("

" + date_week_9[0] + "

" + date_day_9[0] + "

" + parseInt(json[0]["tmin1"]) + "~" + parseInt(json[0]["tmax1"]) + "℃

" + json[0]["wa1"] + "

"); strbtit.push("

" + date_week_9[1] + "

" + date_day_9[1] + "

" + parseInt(json[0]["tmin2"]) + "~" + parseInt(json[0]["tmax2"]) + "℃

" + json[0]["wa2"] + "

"); strbtit.push("

" + date_week_9[2] + "

" + date_day_9[2] + "

" + parseInt(json[0]["tmin3"]) + "~" + parseInt(json[0]["tmax3"]) + "℃

" + json[0]["wa3"] + "

"); strbtit.push("

" + date_week_9[3] + "

" + date_day_9[3] + "

" + parseInt(json[0]["tmin4"]) + "~" + parseInt(json[0]["tmax4"]) + "℃

" + json[0]["wa4"] + "

"); strbtit.push("

" + date_week_9[4] + "

" + date_day_9[4] + "

" + parseInt(json[0]["tmin5"]) + "~" + parseInt(json[0]["tmax5"]) + "℃

" + json[0]["wa5"] + "

"); strbtit.push("
"); strbtit.push("
"); strbtit.push("

" + date_week_9[5] + "

" + date_day_9[5] + "

" + parseInt(json[0]["tmin6"]) + "~" + parseInt(json[0]["tmax6"]) + "℃

" + json[0]["wa6"] + "

"); strbtit.push("

" + date_week_9[6] + "

" + date_day_9[6] + "

" + parseInt(json[0]["tmin7"]) + "~" + parseInt(json[0]["tmax7"]) + "℃

" + json[0]["wa7"] + "

"); strbtit.push("

" + date_week_9[7] + "

" + date_day_9[7] + "

" + parseInt(json[0]["tmin8"]) + "~" + parseInt(json[0]["tmax8"]) + "℃

" + json[0]["wa8"] + "

"); strbtit.push("

" + date_week_9[8] + "

" + date_day_9[8] + "

" + parseInt(json[0]["tmin9"]) + "~" + parseInt(json[0]["tmax9"]) + "℃

" + json[0]["wa9"] + "

"); strbtit.push("

" + date_week_9[9] + "

" + date_day_9[9] + "

" + parseInt(json[0]["tmin10"]) + "~" + parseInt(json[0]["tmax10"]) + "℃

" + json[0]["wa10"] + "

"); strbtit.push("
"); $("#littit").append(strbtit.join("")); } else { var strbtit = new Array(); strbtit.push("
"); strbtit.push("

" + date_week_9[1] + "

" + date_day_9[1] + "

" + parseInt(json[0]["tmin1"]) + "~" + parseInt(json[0]["tmax1"]) + "℃

" + json[0]["wa1"] + "

"); strbtit.push("

" + date_week_9[2] + "

" + date_day_9[2] + "

" + parseInt(json[0]["tmin2"]) + "~" + parseInt(json[0]["tmax2"]) + "℃

" + json[0]["wa2"] + "

"); strbtit.push("

" + date_week_9[3] + "

" + date_day_9[3] + "

" + parseInt(json[0]["tmin3"]) + "~" + parseInt(json[0]["tmax3"]) + "℃

" + json[0]["wa3"] + "

"); strbtit.push("

" + date_week_9[4] + "

" + date_day_9[4] + "

" + parseInt(json[0]["tmin4"]) + "~" + parseInt(json[0]["tmax4"]) + "℃

" + json[0]["wa4"] + "

"); strbtit.push("

" + date_week_9[5] + "

" + date_day_9[5] + "

" + parseInt(json[0]["tmin5"]) + "~" + parseInt(json[0]["tmax5"]) + "℃

" + json[0]["wa5"] + "

"); strbtit.push("
"); strbtit.push("
"); strbtit.push("

" + date_week_9[6] + "

" + date_day_9[6] + "

" + parseInt(json[0]["tmin6"]) + "~" + parseInt(json[0]["tmax6"]) + "℃

" + json[0]["wa6"] + "

"); strbtit.push("

" + date_week_9[7] + "

" + date_day_9[7] + "

" + parseInt(json[0]["tmin7"]) + "~" + parseInt(json[0]["tmax7"]) + "℃

" + json[0]["wa7"] + "

"); strbtit.push("

" + date_week_9[8] + "

" + date_day_9[8] + "

" + parseInt(json[0]["tmin8"]) + "~" + parseInt(json[0]["tmax8"]) + "℃

" + json[0]["wa8"] + "

"); strbtit.push("

" + date_week_9[9] + "

" + date_day_9[9] + "

" + parseInt(json[0]["tmin9"]) + "~" + parseInt(json[0]["tmax9"]) + "℃

" + json[0]["wa9"] + "

"); strbtit.push("

" + date_week_9[10] + "

" + date_day_9[10] + "

" + parseInt(json[0]["tmin10"]) + "~" + parseInt(json[0]["tmax10"]) + "℃

" + json[0]["wa10"] + "

"); strbtit.push("
"); $("#littit").append(strbtit.join("")); } } }); } function Foshorttime() { $.getJSON("/weather/data/wc_last.js?t=" + Math.random(), function (wc_lastJson) { $.getJSON("/weather/data/foshorttime.js", function (json) { if (json) { var dayNames = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); var datetime = new Date(json[0]["issue_datetime"].replace(/-/g, "/")); //转换成Data(); var pa = 0.0; var datetime_curr = new Date(); var PeriodPath = "day"; if (datetime_curr.getHours() >= 19 || datetime_curr.getHours() < 7) PeriodPath = "night"; var shidu = json[0]["hmin"] + "% ~ " + json[0]["hmax"] + "% "; var strcontent = "
"; //strcontent += "

佛山

"+json[0]["tmin"]+"-"+json[0]["tmax"]+"

"; strcontent += "

佛山

" + json[0]["tmin"] + "-" + json[0]["tmax"] + "

"; strcontent += "
"; strcontent += "

" + new Date(datetime).Format("dd日") + "(" + dayNames[datetime.getDay()] + ")" + new Date(datetime).Format("hh") + "时

"; strcontent += "
"; var sid = wc_lastJson[wc_lastJson.length - 1]["sid"]; if (sid == "G2212") sid = "G7045"; if (sid == "G2229") sid = "G2289"; $.ajaxSettings.async = false; //气压 $.getJSON("/weather/data/aws_inst_fo_" + sid + ".js", function (json2) { $(json2).each(function (index, item2) { if (item2.datetime == json[0]["issue_datetime"]) { pa = item2.p; return false; } }) }); strcontent += "

气压:" + pa + "hPa

"; strcontent += "

湿度" + shidu + "

"; strcontent += "

" + json[0]["wind"] + "

"; strcontent += "
"; $("#foshorttime01").append(strcontent); $(".mainbg2").height(document.body.scrollHeight - $("#footer").height()); //自适应屏幕 } }) return false; }) }; //日期 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; }