1////////////////////////// 2// FUNCIONES // 3////////////////////////// 4 5$(document).ready(function () { 6 7 $('.boxInfoWeather').css('left', '-50%'); 8 $('.boxInfoWeather').css('opacity', '0'); 9 10 $('.iconClima img').addClass('oculto'); 11 $('.ciudadWt img').addClass('oculto'); 12 $('.cieloWt img').addClass('oculto'); 13 14 $('.iconClima').css('opacity', '0'); 15 $('.iconClima').css('margin-left', '-50%'); 16 17 $('.wtDay').css('opacity', '0'); 18 $('.wtDate').css('opacity', '0'); 19 $('.wtDay').css('margin-left', '50%'); 20 $('.wtDate').css('margin-left', '50%'); 21 22 $('.wtGrade').css('opacity', '0'); 23 $('.wtGrade').css('margin-left', '-50%'); 24 25 $('.wtPlace').css('opacity', '0'); 26 $('.wtPlace').css('margin-left', '50%'); 27 28 $('.wtMaxTemp').css('opacity', '0'); 29 $('.wtMinTemp').css('opacity', '0'); 30 $('.wtMaxTemp').css('margin-left', '-50%'); 31 $('.wtMinTemp').css('margin-left', '-50%'); 32 33 $('.wtRainProb').css('opacity', '0'); 34 $('.wtRainProb').css('margin-left', '50%'); 35 36 $('.wtWindGrade').css('opacity', '0'); 37 $('.wtWindGrade').css('margin-left', '-50%'); 38 39 getWeather(); 40 41 /* if (idiomaAdmin == "esp") { 42 43 moment.lang('es') 44 fechaHoy = moment(); 45 46 var diaSemana = moment().format('dddd'); 47 var numDia = moment().format('DD'); 48 var mes = moment().format('MMMM'); 49 50 mes = mes.charAt(0).toUpperCase() + mes.slice(1); 51 diaSemana = diaSemana.charAt(0).toUpperCase() + diaSemana.slice(1); 52 53 $('.wtDay').html(diaSemana); 54 $('.wtDate').html(numDia + ' de ' + mes); 55 56 } else {*/ 57 58 moment.lang() 59 fechaHoy = moment(); 60 61 var diaSemana = moment().format('dddd'); 62 var numDia = moment().format('Do'); 63 var mes = moment().format('MMMM'); 64 65 mes = mes.charAt(0).toUpperCase() + mes.slice(1); 66 diaSemana = diaSemana.charAt(0).toUpperCase() + diaSemana.slice(1); 67 68 $('.wtDay').html(diaSemana); 69 $('.wtDate').html(mes + ', ' + numDia); 70 71 /* }*/ 72 73}); 74 75 76function getWeather() { 77 78 $.ajax({ 79 type: "GET", 80 //url: "http://api.openweathermap.org/data/2.5/find?q=barcelona,es&units=metric", 81 url:"http://api.openweathermap.org/data/2.5/forecast/city?id=4155726&APPID=cff2ff071b27f6622790776c78abdde7", 82 dataType: "json", 83 success: function (response) { 84 // trace(response); 85 showWeather(response.list[0],response); 86 }, 87 error: function (e, a) { 88 // trace(e); 89 // trace("////////////////////////////////////////////////////////"); 90 } 91 }); 92 93} 94 95 96function showWeather(misDatos, response) { 97 98 var estado = misDatos.weather[0].main; 99 var viento = misDatos.wind.speed; 100 var place = response.city.name; 101 var maxTemp = Math.floor((misDatos.main.temp_max)-273.15); 102 var minTemp = Math.floor((misDatos.main.temp_min)-273.15); 103 var temp = Math.floor((misDatos.main.temp)-273.15); 104 var humedad = misDatos.main.humidity; 105 106 $('.wtGrade').html(temp + "º"); 107 $('.wtPlace').html('<img src="public/assets/img/iconPlace.png" alt="">' + place); 108 $('.wtMaxTemp').html('<img src="public/assets/img/iconMaxTemp.png" alt="">' + maxTemp + "º"); 109 $('.wtMinTemp').html('<img src="public/assets/img/iconMinTemp.png" alt="">' + minTemp + "º"); 110 $('.wtRainProb').html('<img src="public/assets/img/iconRainProb.png" alt="">' + humedad + "%"); 111 $('.wtWindGrade').html('<img src="public/assets/img/iconWindGrade.png" alt="">' + viento + " KM/H"); 112 113 if (estado == "Clouds") { 114 if (parseInt(misDatos.clouds.all) <= 20) { 115 estado = "Clear"; 116 } 117 } 118 119 $('#icon' + estado).show(); 120 $('#' + estado).show(); 121 // if ((estado == "Clear") && (parseInt(misDatos.clouds.all) < 20)) { 122 // setTimeout($('#sky' + estado).fadeIn(2000, function () { 123 // $('.boxInfoWeather').animate({ left: "50%", opacity: 1 }, 2500, "swing", animarElementos); 124 // }), 500); 125 // } else { 126 // $('.boxInfoWeather').animate({ left: "50%", opacity: 1 }, 2500, "swing", animarElementos); 127 // } 128 setTimeout($('#sky' + estado).fadeIn(500, function () { 129 $('.boxInfoWeather').animate({ left: "50%", opacity: 1 }, 2500, "swing", animarElementos); 130 }), 500); 131 132} 133 134 135function animarElementos() { 136 137 //trace("animar!"); 138 139 $('.iconClima').animate({ marginLeft: "5%", opacity: 1 }, 1000); 140 141 $('.wtDay').animate({ marginLeft: "5%", opacity: 1 }, 1000); 142 $('.wtDate').animate({ marginLeft: "5%", opacity: 1 }, 1000); 143 144 $('.wtGrade').animate({ marginLeft: "5%", opacity: 1 }, 1000); 145 146 $('.wtPlace').animate({ marginLeft: "5%", opacity: 1 }, 1000); 147 148 $('.wtMaxTemp').animate({ marginLeft: "0px", opacity: 1 }, 1000); 149 $('.wtMinTemp').animate({ marginLeft: "0px", opacity: 1 }, 1000); 150 151 $('.wtRainProb').animate({ marginLeft: "0px", opacity: 1 }, 1000); 152 153 $('.wtWindGrade').animate({ marginLeft: "0px", opacity: 1 }, 1000); 154 155}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.