671
| <![CDATA[<script>
$(document).ready(function() {
$('.expand-audio').on('click', function() {
$('#audima-container').slideToggle(250);
});
new window.VLibras.Widget('https://vlibras.gov.br/app');
Raven.config('https://350d57fe132e48a1a33a09123b861837@sentry.io/290570').install() ;
let $v_PageIsDirty = $('#page_is_dirty');
if($v_PageIsDirty.val() == 0) {
$v_PageIsDirty.val(1);
}
//loads or fetches weather data from openweathermap
let v_WeatherData = JSON.parse(localStorage.getItem('currentWeather'));
let v_Today = new Date().getTime();
//if has weather data and it's within the specified lifetime, displays it. Otherwise, fetches new data
if(v_WeatherData != null && ((v_Today - (v_WeatherData.dt * 1000)) < WEATHER_LIFETIME )){
displayWeather(v_WeatherData);
}
else {
if (v_WeatherData != null) {
localStorage.removeItem('currentWeather');
}
$.ajax({
url: 'https://api.openweathermap.org/data/2.5/weather?q=Nova+Lima,br&units=metric&lang=pt&APPID=324350afdbca18da0b2a1b71563bb3d2',
dataType: 'jsonp',
success: function (p_WeatherData) {
if (p_WeatherData != undefined && p_WeatherData.cod == 200) {
displayWeather(p_WeatherData);
localStorage.setItem('currentWeather', JSON.stringify(p_WeatherData));
}
}
});
}
});
//displays weather info
function displayWeather(p_WeatherData){
let v_Weather = p_WeatherData.main.temp;
v_Weather = Math.round(v_Weather * 10)/10;
v_Weather = (v_Weather + 'º').replace('.',',');
$('#weather').html(v_Weather);
$('#weather_img').removeClass('d-none').attr('src', 'https://novalima.mg.gov.br/assets/images/weather/' + p_WeatherData.weather[0].icon + '.png');
}
</script>]]>
|