function showWeatherCallback(j,d) { var c = d.query.results.channel, a = c.item.description.match(/http:\/\/[^"']*/), b = '
  • '+j+'

    ' + c.item.condition.temp + "°C
    Humidity: " + c.atmosphere.humidity + "%
    Wind speed: " + c.wind.speed + " km/h
  • "; return b; } function showWeather(j, a) { $.ajax({ dataType: "json", url: "http://query.yahooapis.com/v1/public/yql?q=select%20item.description,%20item.condition.temp,%20atmosphere.humidity,%20wind.speed%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text=%27"+a+"%27)%20and%20u=%27c%27&format=json", data: {}, success: function(d) { var c = showWeatherCallback(j, d); $('.thoi_tiet ul').append(c); } }); } function weatherCarouselLite(tt, mt) { $.support.cors = true; var mtt = tt.split(";"); var mmt = mt.split(";"); var j = mtt.length; for (i = 0; i < j; i++) { if($.trim(mtt[i]) != '') { showWeather(mtt[i], mmt[i] + ',vietnam'); } } var myVar = setInterval(function() { if ($('.thoi_tiet ul li').length == j - 1) { $('.thoi_tiet').show(); if (j-1 >= 2) { $(".thoi_tiet").jCarouselLite({ auto: 2000, speed: 2000, visible: 1 }); clearInterval(myVar); } } }, 300); }