You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB
JavaScript

// JavaScript Document
var weatherMapCity = '';
$(function(){
$(".weatherMap span").each(function(){
var cityName = $(this).attr("class").replace("Weather", "");
$.ajax({
type: "GET",
url: "/guide-use.php/apps/weather/juheweather/get_city_weather/"+ cityName,
success: function(Data){
var path = "//data.chinahighlights.com/css/images/weater-icons/";
var _c = Data.error_code;
if( _c == 0){
path = path + getOverheadIcon(Data.result[0].today.iconDay, Data.result[0].today.iconNight);
var _img = "<img src='"+ path +"'>" + "<b>"+ Data.result[0].today.temperature+"</b>";
$("."+ cityName +"Weather").append(_img);
}
}
});
});
var _t = (new Date());
var now;
_t = _t.toString().split(" ");
now = _t[1]+' '+_t[2]+', '+_t[3];
$(".currentData").html(now);
});
function getOverheadIcon(day, night){
var d = new Date();
var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
var n = new Date(utc + (3600000 * 8));
if(n.getHours() < 18 ) {
return day;
}else{
return night;
}
}