1var search_place;var lat;var lon;var current_location_name_is;var is_on_select=false;var close_when_clicked;if(parseInt(window.innerWidth)>=602){close_when_clicked=false;} 2else{close_when_clicked=true;} 3function getCookie(name){var name=name+"=";var decodedCookie=decodeURIComponent(document.cookie);var ca=decodedCookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1);} 4if(c.indexOf(name)==0){return c.substring(name.length,c.length);}} 5return"";} 6var myCookie=getCookie("current_place_name");var myCookie1=getCookie("current_lat");var myCookie2=getCookie("current_lon");if(myCookie==""||myCookie1==""||myCookie2==""){lat=60.16952;lon=24.93545;current_location_name_is="Helsinki";get_forecast_weather();} 7else{lat=parseFloat(myCookie1);lon=parseFloat(myCookie2);place_change(myCookie,lat,lon);var find_if_exist=document.getElementById("quick_select_row").children;var is_it_element=true;for(o=0;o<find_if_exist.length;o++){if(find_if_exist[o].textContent.toLowerCase()==myCookie.toLowerCase()){is_it_element=false;}} 8if(is_it_element){var quick_select=document.createElement("div");quick_select.classList.add("location_button");quick_select.classList.add("col-auto");quick_select.setAttribute('onclick','haekohde('+lat+','+lon+',this);');var quick_select_p=document.createElement("p");quick_select_p.textContent=myCookie;quick_select.appendChild(quick_select_p);document.getElementById("quick_select_row").appendChild(quick_select);}} 9var input=document.getElementById('searchTextField');var options={types:['(cities)'],componentRestrictions:{country:'fi'}};autocomplete=new google.maps.places.Autocomplete(input,options);google.maps.event.addListener(autocomplete,'place_changed',function(){var place=autocomplete.getPlace();if(place!=null||place.geometry!=undefined){search_place=place.name;lat_new=place.geometry.location.lat();lon_new=place.geometry.location.lng();place_change(search_place,lat_new,lon_new);input.value="";}});input.value="";function get_current_location(){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(showPosition);}else{alert("Selain ei tue paikallissään hakua");}} 10function showPosition(position){lat_new=parseFloat(position.coords.latitude);lon_new=parseFloat(position.coords.longitude);const geocoder=new google.maps.Geocoder();const latlng=new google.maps.LatLng({lat:lat_new,lng:lon_new});geocoder.geocode({location:latlng},(results,status)=>{if(status==="OK"){if(results[0]){search_place=results[0].address_components[2].long_name;document.cookie="current_place_name="+search_place+"; SameSite=None;path=/; Secure";document.cookie="current_lat="+lat_new+"; SameSite=None;path=/; Secure";document.cookie="current_lon="+lon_new+"; SameSite=None;path=/; Secure";var find_if_exist=document.getElementById("quick_select_row").children;
10var is_it_element=true;for(o=0;o<find_if_exist.length;o++){if(find_if_exist[o].textContent.toLowerCase()==search_place.toLowerCase()){is_it_element=false;}} 11if(is_it_element){var quick_select=document.createElement("div");quick_select.classList.add("location_button");quick_select.classList.add("col-auto");quick_select.setAttribute('onclick','haekohde('+lat_new+','+lon_new+',this);');var quick_select_p=document.createElement("p");quick_select_p.textContent=search_place;quick_select.appendChild(quick_select_p);document.getElementById("quick_select_row").appendChild(quick_select);} 12place_change(search_place,lat_new,lon_new);}else{window.alert("Jokin meni pieleen säätä haettaessa");}}else{window.alert("Jokin meni pieleen säätä haettaessa");}});} 13function place_change(place,lat_new,lon_new){lon=lon_new;lat=lat_new;check_does_allready();current_location_name_is=place;get_forecast_weather();} 14function check_does_allready(){var parent=document.getElementsByClassName("create_weather_map");if(parent[0].hasChildNodes()){parent[0].innerHTML='';}} 15function haekohde(lat1,lon2,btn_text){lat=lat1;lon=lon2;check_does_allready();if(close_when_clicked){document.getElementById("quick_select_row").style.display="none";} 16current_location_name_is=btn_text.textContent;get_forecast_weather();} 17function get_forecast_weather(){var times=new Date();var two_days_after=new Date(times);var startTim=times.getUTCFullYear()+'-'+(times.getUTCMonth()+1)+'-'+times.getUTCDate()+'T'+times.getUTCHours()+":00:00Z";var endTim=new Date(two_days_after.setDate(two_days_after.getDate()+2)).toISOString();var url='https://opendata.fmi.fi/wfs/fin?service=WFS&version=2.0.0&request=getFeature&storedquery_id=fmi::forecast::harmonie::surface::point::simple&latlon='+lat+","+lon+'&starttime='+startTim+'&endtime='+endTim+'¶meters=Temperature,WindSpeedMS,Humidity,WeatherSymbol3,TotalCloudCover,WindDirection';var xhr=new XMLHttpRequest();xhr.open('GET',url);xhr.onreadystatechange=function(){if(xhr.readyState===XMLHttpRequest.DONE){var status=xhr.status;if(status===0||(status>=200&&status<400)){haeennuste(this);} 18else{alert("Jokin meni pieleen dataa haettaessa");}}} 19xhr.send();} 20function haeennuste(xml){var i;var xmlDoc=xml.responseXML;var x=xmlDoc.getElementsByTagName("BsWfs:BsWfsElement");var to_this_div=document.getElementsByClassName("create_weather_map");var date_to_follow=x[0].getElementsByTagName("BsWfs:Time");date_to_follow=date_to_follow[0]["textContent"].slice(0,-10);var lampostring="Temperature";var new_day=0;var another_day;var calculate_many_missing=0;var last_date_var;var timeUTCplusses;var do_usetime;var start_new_time;var right_now_weather;var new_right_now_weather;var right_now_weather_div;var times;for(i=0;i<x.length;i++){var if_have_weather=x[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=x[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=x[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){var check_date=temperature_time[y]["textContent"].slice(0,-10);do_usetime=temperature_time[y]["textContent"].slice(11,-7);if(new_day==0&&do_usetime!=24&&y==0&&i==0){var today=new Date();timeUTCplusses=today.getHours()-parseInt(do_usetime);} 21if(if_have_weather[y]["textContent"]==lampostring){if(if_have_weather_value[y]["textContent"]!="NaN"){var today=new Date();do_usetime=parseInt(do_usetime)+timeUTCplusses;if(do_usetime==24){var another_day=document.createElement('div');another_day.classList.add("another_day");to_this_div[0].appendChild(another_day);date_to_follow=check_date;new_day++;start_new_time=do_usetime;do_usetime=0;var what_day_is_it=document.createElement('div');what_day_is_it.classList.add("what_day_is_it");var day=document.createElement('p');if(new_day==1){day.textContent="Huomenna - "+current_location_name_is;} 22else{var dates=new Date(temperature_time[y]["textContent"]);dates.setHours(dates.getHours()+timeUTCplusses);if(dates.getDay()==1){day.textContent="Maanantai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 23else if(dates.getDay()==2){day.textContent="Tiistai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 24else if(dates.getDay()==3){day.textContent="Keskiviikko "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 25else if(dates.getDay()==4){day.textContent="Torstai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 26else if(dates.getDay()==5){day.textContent="Perjantai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 27else if(dates.getDay()==6){day.textContent="Lauantai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 28else if(dates.getDay()==0){day.textContent="Sunnuntai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;}} 29what_day_is_it.appendChild(day);another_day.appendChild(what_day_is_it);var times=document.createElement('div');times.classList.add("times");another_day.appendChild(times);} 30if(do_usetime>24){do_usetime=do_usetime-start_new_time;} 31if(i==0){document.getElementById("forecast_location").innerHTML="";var place_is_now=document.createElement('p');place_is_now.classList.add("forecast_city");place_is_now.innerHTML=current_location_name_is+" ";right_now_weather_div=document.createElement('div');right_now_weather_div.classList.add("right_now_weather_heading");right_now_weather=document.createElement('div');right_now_weather.classList.add("right_now_weather");document.getElementById("forecast_location").appendChild(right_now_weather);right_now_weather_div.appendChild(place_is_now);right_now_weather.appendChild(right_now_weather_div);var right_now_weather_container=document.createElement("div");right_now_weather_container.classList.add("right_now_weather_container");document.getElementById("forecast_location").appendChild(right_now_weather_container);new_right_now_weather=document.createElement("div");new_right_now_weather.classList.add("moving_forecast_buttons");document.getElementById("forecast_location").appendChild(new_right_now_weather);right_now_weather=right_now_weather_container;var another_day=document.createElement('div');another_day.classList.add("another_day");to_this_div[0].appendChild(another_day);var what_day_is_it=document.createElement('div');what_day_is_it.classList.add("what_day_is_it");var day=document.createElement('p');day.textContent="Tänään - "+current_location_name_is;
31what_day_is_it.appendChild(day);another_day.appendChild(what_day_is_it);var times=document.createElement('div');times.classList.add("times");another_day.appendChild(times);} 32var today=new Date();if(new_day==0){if(do_usetime<=today.getUTCHours()+timeUTCplusses){continue;} 33else{if(do_usetime==today.getUTCHours()+timeUTCplusses+1){var current_time=document.createElement('p');current_time.classList.add("forecast_clock_time_now");current_time.textContent="- säätila klo "+do_usetime+":00";right_now_weather_div.appendChild(current_time);var right_now_temperature_symbol=document.createElement("div");right_now_temperature_symbol.classList.add("right_now_temperature_symbol");pick_symbol_2(temperature_time[y]["textContent"],right_now_temperature_symbol,x);var temperature_is=document.createElement('p');temperature_is.innerHTML=Math.round(if_have_weather_value[y]["textContent"])+"℃";right_now_temperature_symbol.appendChild(temperature_is);right_now_weather.appendChild(right_now_temperature_symbol);var wind_speed1=wind_speed(temperature_time[y]["textContent"],right_now_weather,x);var humidity1=humidity(temperature_time[y]["textContent"],right_now_weather,x);var cloud_cover1=cloud_cover(temperature_time[y]["textContent"],right_now_weather,x);wind_direction_2(temperature_time[y]["textContent"],right_now_weather,x,wind_speed1,cloud_cover1,humidity1);var buttons_left_right=document.createElement('div');buttons_left_right.classList.add("buttons_left_right");new_right_now_weather.appendChild(buttons_left_right);var left_forecast=document.createElement('div');left_forecast.id="left_forecast";var right_forecast=document.createElement('div');right_forecast.id="right_forecast";var right_forecast_p=document.createElement('i');var left_forecast_p=document.createElement('i');right_forecast_p.classList.add("fas");right_forecast_p.classList.add("fa-angle-right");left_forecast_p.classList.add("fas");left_forecast_p.classList.add("fa-angle-left");left_forecast.setAttribute('onclick','move_forecasts_left();');right_forecast.setAttribute('onclick','move_forecasts_right();');buttons_left_right.appendChild(left_forecast);buttons_left_right.appendChild(right_forecast);right_forecast.appendChild(right_forecast_p);left_forecast.appendChild(left_forecast_p);} 34var another_time=document.createElement('div');another_time.classList.add("another_time");var clock_time=document.createElement('p');clock_time.textContent=do_usetime+":00";clock_time.classList.add("forecast_clocktime");var temperature_is=document.createElement('p');temperature_is.classList.add("temperature_forecast");temperature_is.innerHTML=Math.round(if_have_weather_value[y]["textContent"])+"℃";another_time.appendChild(clock_time);pick_symbol(temperature_time[y]["textContent"],another_time,x);another_time.appendChild(temperature_is);times.appendChild(another_time);var wind_speed1=wind_speed(temperature_time[y]["textContent"],another_time,x);var humidity1=humidity(temperature_time[y]["textContent"],another_time,x);var cloud_cover1=cloud_cover(temperature_time[y]["textContent"],another_time,x);wind_direction(temperature_time[y]["textContent"],another_time,x,wind_speed1,cloud_cover1,humidity1);last_date_var=temperature_time[y]["textContent"];}} 35else if(new_day>=2){if(do_usetime%3==0){var another_time=document.createElement('div');another_time.classList.add("another_time");var clock_time=document.createElement('p');clock_time.textContent=do_usetime+":00";clock_time.classList.add("forecast_clocktime");var temperature_is=document.createElement('p');temperature_is.classList.add("temperature_forecast");temperature_is.innerHTML=Math.round(if_have_weather_value[y]["textContent"])+"℃";another_time.appendChild(clock_time);pick_symbol(temperature_time[y]["textContent"],another_time,x);another_time.appendChild(temperature_is);var wind_speed1=wind_speed(temperature_time[y]["textContent"],another_time,x);var humidity1=humidity(temperature_time[y]["textContent"],another_time,x);var cloud_cover1=cloud_cover(temperature_time[y]["textContent"],another_time,x);wind_direction(temperature_time[y]["textContent"],another_time,x,wind_speed1,cloud_cover1,humidity1);times.appendChild(another_time);calculate_many_missing++;last_date_var=new Date(temperature_time[y]["textContent"]);last_date_var.setHours(last_date_var.getHours()+timeUTCplusses);last_date_var=last_date_var.toISOString();}} 36else{var another_time=document.createElement('div');another_time.classList.add("another_time");var clock_time=document.createElement('p');clock_time.textContent=do_usetime+":00";clock_time.classList.add("forecast_clocktime");var temperature_is=document.createElement('p');temperature_is.classList.add("temperature_forecast");temperature_is.innerHTML=Math.round(if_have_weather_value[y]["textContent"])+"℃";another_time.appendChild(clock_time);pick_symbol(temperature_time[y]["textContent"],another_time,x);another_time.appendChild(temperature_is);var wind_speed1=wind_speed(temperature_time[y]["textContent"],another_time,x);var humidity1=humidity(temperature_time[y]["textContent"],another_time,x);var cloud_cover1=cloud_cover(temperature_time[y]["textContent"],another_time,x);wind_direction(temperature_time[y]["textContent"],another_time,x,wind_speed1,cloud_cover1,humidity1);times.appendChild(another_time);}}}}} 37longer_forecast_get(another_day,calculate_many_missing,last_date_var,timeUTCplusses,times);} 38function longer_forecast_get(elem,forecast_already,last_time_date,UTCplus,times){jQuery(document).ready(function($){$.ajax({url:window.location,type:'POST',dataType:"json",data:{lat:lat,lon:lon},success:function(response){longer_forecast_return(elem,forecast_already,last_time_date,UTCplus,response,times);},error:function(error){alert("Jokin meni pieleen dataa haettaessa");}});});} 39function longer_forecast_return(elem,forecast_already,last_time_date,UTCplus,json_file,times){var json_file=JSON.parse(json_file);var elem=elem;
39var timedate_last_added=parseInt(last_time_date.slice(11,-7));var calculate;var added_forecast=forecast_already;for(k=0;k<json_file["list"].length;k++){var date_time=json_file["list"][k]['dt']*1000;if(new Date(last_time_date).toISOString()<=new Date(date_time).toISOString()){} 40else{continue;} 41if(forecast_already>0&&forecast_already<=7){var temperature=parseFloat(json_file["list"][k]['main']['temp'])-273.15;timedate_last_added=timedate_last_added+3;var another_time=document.createElement('div');another_time.classList.add("another_time");var clock_time=document.createElement('p');clock_time.textContent=timedate_last_added+":00";clock_time.classList.add("forecast_clocktime");var temperature_is=document.createElement('p');temperature_is.classList.add("temperature_forecast");temperature_is.innerHTML=Math.round(temperature)+"℃";another_time.appendChild(clock_time);get_longer_forecast_symbols(json_file["list"][k]['weather'][0]['id'],json_file["list"][k]['clouds']['all'],another_time);another_time.appendChild(temperature_is);times.appendChild(another_time);forecast_already++;var wind_dir=parseFloat(json_file["list"][k]['wind']['deg']);var kolinenmin=22.5;var kolinenmax=67.5;var itamin=67.5;var itamax=112.5;var kaakkomin=112.5;var kaakkomax=157.5;var etelamin=157.5;var etelamax=202.5;var lounasmin=202.5;var lounasmax=247.5;var lansimin=247.5;var lansimax=292.5;var luodemin=292.5;var luodemax=337.5;var create_div=document.createElement("div");create_div.classList.add("wind_dire");var arrow=document.createElement("span");var p_windms=document.createElement("p");var p_clouds=document.createElement("p");var p_humidity=document.createElement("p");if(wind_dir>=kolinenmin&&wind_dir<kolinenmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-down'></i>";} 42else if(wind_dir>=itamin&&wind_dir<itamax){arrow.innerHTML="<i class='fas fa-arrow-left'></i>";} 43else if(wind_dir>=kaakkomin&&wind_dir<kaakkomax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-left'></i>";} 44else if(wind_dir>=etelamin&&wind_dir<etelamax){arrow.innerHTML="<i class='fas fa-arrow-up'></i>";} 45else if(wind_dir>=lounasmin&&wind_dir<lounasmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-up'></i>";} 46else if(wind_dir>=lansimin&&wind_dir<lansimax){arrow.innerHTML="<i class='fas fa-arrow-right'></i>";} 47else if(wind_dir>=luodemin&&wind_dir<luodemax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-right'></i>";} 48else{arrow.innerHTML="<i class='fas fa-arrow-down'></i>";} 49tuulen_nopeus=Math.abs(parseFloat(json_file["list"][k]['wind']['speed']));if(parseInt(tuulen_nopeus)==0){p_windms.textContent=0;arrow.innerHTML="";arrow.innerHTML="<i class='far fa-circle'></i>";} 50else{p_windms.textContent=Math.round(tuulen_nopeus);} 51var p_clouds_p=document.createElement("p");p_clouds_p.textContent="Pilvisyys";var p_humidity_p=document.createElement("p");p_humidity_p.textContent="Kosteus";p_clouds.textContent=Math.round(json_file["list"][k]['clouds']['all'])+"%";p_humidity.textContent=Math.round(json_file["list"][k]['main']['humidity'])+"%";var div_other_forecasts=document.createElement("div");div_other_forecasts.classList.add("div_other_forecasts");var div_clouds=document.createElement("div");div_clouds.classList.add("div_clouds");div_clouds.appendChild(p_clouds_p);div_clouds.appendChild(p_clouds);var div_humidity=document.createElement("div");div_humidity.classList.add("div_humidity");div_humidity.appendChild(p_humidity_p);div_humidity.appendChild(p_humidity);div_other_forecasts.appendChild(div_clouds);div_other_forecasts.appendChild(div_humidity);var wind_div=document.createElement("div");wind_div.classList.add("wind_div");wind_div.appendChild(arrow);wind_div.appendChild(p_windms);create_div.appendChild(wind_div);create_div.appendChild(div_other_forecasts);another_time.appendChild(create_div);}else{elem=document.createElement('div');elem.classList.add("another_day");document.getElementsByClassName("create_weather_map")[0].appendChild(elem);timedate_last_added=0;var temperature=parseFloat(json_file["list"][k]['main']['temp'])-273.15;var another_time=document.createElement('div');another_time.classList.add("another_time");var clock_time=document.createElement('p');clock_time.textContent=timedate_last_added+":00";clock_time.classList.add("forecast_clocktime");var temperature_is=document.createElement('p');temperature_is.classList.add("temperature_forecast");temperature_is.innerHTML=Math.round(temperature)+"℃";another_time.appendChild(clock_time);get_longer_forecast_symbols(json_file["list"][k]['weather'][0]['id'],json_file["list"][k]['clouds']['all'],another_time);another_time.appendChild(temperature_is);var what_day_is_it=document.createElement('div');what_day_is_it.classList.add("what_day_is_it");var day=document.createElement('p');var dates=new Date(date_time);dates.setHours(dates.getHours()+UTCplus);if(dates.getDay()==1){day.textContent="Maanantai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 52else if(dates.getDay()==2){day.textContent="Tiistai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 53else if(dates.getDay()==3){day.textContent="Keskiviikko "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 54else if(dates.getDay()==4){day.textContent="Torstai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 55else if(dates.getDay()==5){day.textContent="Perjantai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 56else if(dates.getDay()==6){day.textContent="Lauantai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 57else if(dates.getDay()==0){day.textContent="Sunnuntai "+dates.getDate()+"."+(dates.getMonth()+1)+" - "+current_location_name_is;} 58what_day_is_it.appendChild(day);
58elem.appendChild(what_day_is_it);var times=document.createElement('div');times.classList.add("times");elem.appendChild(times);times.appendChild(another_time);forecast_already=1;var wind_dir=parseFloat(json_file["list"][k]['wind']['deg']);var kolinenmin=22.5;var kolinenmax=67.5;var itamin=67.5;var itamax=112.5;var kaakkomin=112.5;var kaakkomax=157.5;var etelamin=157.5;var etelamax=202.5;var lounasmin=202.5;var lounasmax=247.5;var lansimin=247.5;var lansimax=292.5;var luodemin=292.5;var luodemax=337.5;var create_div=document.createElement("div");create_div.classList.add("wind_dire");var arrow=document.createElement("span");var p_windms=document.createElement("p");var p_clouds=document.createElement("p");var p_humidity=document.createElement("p");if(wind_dir>=kolinenmin&&wind_dir<kolinenmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-down'></i>";} 59else if(wind_dir>=itamin&&wind_dir<itamax){arrow.innerHTML="<i class='fas fa-arrow-left'></i>";} 60else if(wind_dir>=kaakkomin&&wind_dir<kaakkomax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-left'></i>";} 61else if(wind_dir>=etelamin&&wind_dir<etelamax){arrow.innerHTML="<i class='fas fa-arrow-up'></i>";} 62else if(wind_dir>=lounasmin&&wind_dir<lounasmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-up'></i>";} 63else if(wind_dir>=lansimin&&wind_dir<lansimax){arrow.innerHTML="<i class='fas fa-arrow-right'></i>";} 64else if(wind_dir>=luodemin&&wind_dir<luodemax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-right'></i>";} 65else{arrow.innerHTML="<i class='fas fa-arrow-down'></i>";} 66tuulen_nopeus=Math.abs(parseFloat(json_file["list"][k]['wind']['speed']));if(parseInt(tuulen_nopeus)==0){p_windms.textContent=0;arrow.innerHTML="";arrow.innerHTML="<i class='far fa-circle'></i>";} 67else{p_windms.textContent=Math.round(tuulen_nopeus);} 68var p_clouds_p=document.createElement("p");p_clouds_p.textContent="Pilvisyys";var p_humidity_p=document.createElement("p");p_humidity_p.textContent="Kosteus";p_clouds.textContent=Math.round(json_file["list"][k]['clouds']['all'])+"%";p_humidity.textContent=Math.round(json_file["list"][k]['main']['humidity'])+"%";var div_other_forecasts=document.createElement("div");div_other_forecasts.classList.add("div_other_forecasts");var div_clouds=document.createElement("div");div_clouds.classList.add("div_clouds");div_clouds.appendChild(p_clouds_p);div_clouds.appendChild(p_clouds);var div_humidity=document.createElement("div");div_humidity.classList.add("div_humidity");div_humidity.appendChild(p_humidity_p);div_humidity.appendChild(p_humidity);div_other_forecasts.appendChild(div_clouds);div_other_forecasts.appendChild(div_humidity);var wind_div=document.createElement("div");wind_div.classList.add("wind_div");wind_div.appendChild(arrow);wind_div.appendChild(p_windms);create_div.appendChild(wind_div);create_div.appendChild(div_other_forecasts);another_time.appendChild(create_div);}}} 69function get_longer_forecast_symbols(symbol_id,clouds,obj){var real_symbol;var cloudiness=clouds;if(symbol_id==800||symbol_id==801){real_symbol="1";} 70else if(symbol_id==802||symbol_id==803){real_symbol="2";} 71else if(symbol_id==804){real_symbol="3";} 72else if(symbol_id==701||symbol_id==721||symbol_id==741){real_symbol="92";} 73else if(symbol_id==711||symbol_id==731||symbol_id==751||symbol_id==761||symbol_id==762||symbol_id==771||symbol_id==781){real_symbol="91";} 74else if(symbol_id>=500&&symbol_id<=531){if(clouds>=85){if(symbol_id==500||symbol_id==520||symbol_id==531){real_symbol="31";} 75else if(symbol_id==501||symbol_id==521){real_symbol="32";} 76else if(symbol_id==502||symbol_id==503||symbol_id==504||symbol_id==522){real_symbol="33";} 77else if(symbol_id==511){real_symbol="82";}} 78else{if(symbol_id==500||symbol_id==520||symbol_id==531){real_symbol="21";} 79else if(symbol_id==501||symbol_id==521){real_symbol="22";} 80else if(symbol_id==502||symbol_id==503||symbol_id==504||symbol_id==522){real_symbol="23";} 81else if(symbol_id==511){real_symbol="72";}}} 82else if(symbol_id>=300&&symbol_id<=321){if(clouds>=85){if(symbol_id==300||symbol_id==310){real_symbol="31";} 83else if(symbol_id==301||symbol_id==311||symbol_id==313||symbol_id==321){real_symbol="32";} 84else if(symbol_id==302||symbol_id==312||symbol_id==314){real_symbol="33";}} 85else{if(symbol_id==300||symbol_id==310){real_symbol="21";} 86else if(symbol_id==301||symbol_id==311||symbol_id==313||symbol_id==321){real_symbol="22";} 87else if(symbol_id==302||symbol_id==312||symbol_id==314){real_symbol="23";}}} 88else if(symbol_id>=200&&symbol_id<=232){if(clouds>=85){if(symbol_id==230||symbol_id==231||symbol_id==232||symbol_id==221||symbol_id==201||symbol_id==202||symbol_id==200||symbol_id==210){real_symbol="63";} 89else if(symbol_id==211||symbol_id==212){real_symbol="64";}}else{if(symbol_id==230||symbol_id==231||symbol_id==232||symbol_id==221||symbol_id==201||symbol_id==202||symbol_id==200||symbol_id==210){real_symbol="61";} 90else if(symbol_id==211||symbol_id==212){real_symbol="62";}}} 91else if(symbol_id>=600&&symbol_id<=622){if(clouds>=85){if(symbol_id==600){real_symbol="51";} 92else if(symbol_id==601){real_symbol="52";} 93else if(symbol_id==602){real_symbol="53";} 94else if(symbol_id==611){real_symbol="82";} 95else if(symbol_id==612){real_symbol="81";} 96else if(symbol_id==613){real_symbol="83";} 97else if(symbol_id==615){real_symbol="82";} 98else if(symbol_id==616){real_symbol="81";} 99else if(symbol_id==620){real_symbol="51";} 100else if(symbol_id==621){real_symbol="52";} 101else if(symbol_id==622){real_symbol="53";}} 102else{if(symbol_id==600){real_symbol="41";} 103else if(symbol_id==601){real_symbol="42";} 104else if(symbol_id==602){real_symbol="43";} 105else if(symbol_id==611){real_symbol="72";} 106else if(symbol_id==612){real_symbol="71";} 107else if(symbol_id==613){real_symbol="73";} 108else if(symbol_id==615){real_symbol="72";} 109else if(symbol_id==616){real_symbol="71";} 110else if(symbol_id==620){real_symbol="41";} 111else if(symbol_id==621){real_symbol="42";} 112else if(symbol_id==622){real_symbol="43";}}} 113var add_symbol=document.createElement("img");add_symbol.classList.add("forecast_symbols");var find_src=frontend.saa_symbolit_baseurl+real_symbol+".svg";add_symbol.src=find_src.replace(/\//g,'/');obj.appendChild(add_symbol);} 114function pick_symbol(time,obj,file){for(i=0;i<file.length;i++){var if_have_weather=file[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=file[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=file[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){if(if_have_weather[y]["textContent"]=="WeatherSymbol3"){if(if_have_weather_value[y]["textContent"]!="NaN"){if(temperature_time[y]["textContent"]==time){var add_symbol=document.createElement("img");add_symbol.classList.add("forecast_symbols");var find_src=frontend.saa_symbolit_baseurl+parseInt(if_have_weather_value[y]["textContent"])+".svg";add_symbol.src=find_src.replace(/\//g,'/');obj.appendChild(add_symbol);}}}}}} 115function pick_symbol_2(time,obj,file){for(i=0;i<file.length;i++){var if_have_weather=file[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=file[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=file[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){if(if_have_weather[y]["textContent"]=="WeatherSymbol3"){if(if_have_weather_value[y]["textContent"]!="NaN"){if(temperature_time[y]["textContent"]==time){var add_symbol=document.createElement("img");add_symbol.classList.add("current_forecast_symbols");var find_src=frontend.saa_symbolit_baseurl+parseInt(if_have_weather_value[y]["textContent"])+".svg";add_symbol.src=find_src.replace(/\//g,'/');obj.appendChild(add_symbol);}}}}}} 116function wind_speed(time,obj,file){for(i=0;i<file.length;i++){var if_have_weather=file[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=file[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=file[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){if(if_have_weather[y]["textContent"]=="WindSpeedMS"){if(if_have_weather_value[y]["textContent"]!="NaN"){if(temperature_time[y]["textContent"]==time){var wind_speed=if_have_weather_value[y]["textContent"];return wind_speed;}}}}}} 117function humidity(time,obj,file){for(i=0;i<file.length;i++){var if_have_weather=file[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=file[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=file[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){if(if_have_weather[y]["textContent"]=="Humidity"){if(if_have_weather_value[y]["textContent"]!="NaN"){if(temperature_time[y]["textContent"]==time){var humidity=if_have_weather_value[y]["textContent"];return humidity;}}}}}} 118function cloud_cover(time,obj,file){for(i=0;i<file.length;i++){var if_have_weather=file[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=file[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=file[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){if(if_have_weather[y]["textContent"]=="TotalCloudCover"){if(if_have_weather_value[y]["textContent"]!="NaN"){if(temperature_time[y]["textContent"]==time){var cloud_cover=if_have_weather_value[y]["textContent"];return cloud_cover;}}}}}} 119function wind_direction(time,obj,file,speed,cloud,humidity){for(i=0;i<file.length;i++){var if_have_weather=file[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=file[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=file[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){if(if_have_weather[y]["textContent"]=="WindDirection"){if(if_have_weather_value[y]["textContent"]!="NaN"){if(temperature_time[y]["textContent"]==time){var wind_dir=parseFloat(if_have_weather_value[y]["textContent"]);var kolinenmin=22.5;var kolinenmax=67.5;var itamin=67.5;var itamax=112.5;var kaakkomin=112.5;var kaakkomax=157.5;var etelamin=157.5;var etelamax=202.5;var lounasmin=202.5;var lounasmax=247.5;var lansimin=247.5;var lansimax=292.5;var luodemin=292.5;var luodemax=337.5;var create_div=document.createElement("div");create_div.classList.add("wind_dire");var arrow=document.createElement("span");var p_windms=document.createElement("p");var p_windgt=document.createElement("p");var p_clouds=document.createElement("p");var p_humidity=document.createElement("p");if(wind_dir>=kolinenmin&&wind_dir<kolinenmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-down'></i>";} 120else if(wind_dir>=itamin&&wind_dir<itamax){arrow.innerHTML="<i class='fas fa-arrow-left'></i>";} 121else if(wind_dir>=kaakkomin&&wind_dir<kaakkomax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-left'></i>";} 122else if(wind_dir>=etelamin&&wind_dir<etelamax){arrow.innerHTML="<i class='fas fa-arrow-up'></i>";} 123else if(wind_dir>=lounasmin&&wind_dir<lounasmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-up'></i>";} 124else if(wind_dir>=lansimin&&wind_dir<lansimax){arrow.innerHTML="<i class='fas fa-arrow-right'></i>";} 125else if(wind_dir>=luodemin&&wind_dir<luodemax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-right'></i>";} 126else{arrow.innerHTML="<i class='fas fa-arrow-down'></i>";} 127tuulen_nopeus=Math.abs(speed);if(parseInt(tuulen_nopeus)==0){p_windms.textContent=0;arrow.innerHTML="";arrow.innerHTML="<i class='far fa-circle'></i>";} 128else{p_windms.textContent=Math.round(tuulen_nopeus);} 129var p_clouds_p=document.createElement("p");p_clouds_p.textContent="Pilvisyys";var p_humidity_p=document.createElement("p");p_humidity_p.textContent="Kosteus";p_clouds.textContent=Math.round(cloud)+"%";p_humidity.textContent=Math.round(humidity)+"%";var div_other_forecasts=document.createElement("div");div_other_forecasts.classList.add("div_other_forecasts");var div_clouds=document.createElement("div");div_clouds.classList.add("div_clouds");div_clouds.appendChild(p_clouds_p);div_clouds.appendChild(p_clouds);var div_humidity=document.createElement("div");div_humidity.classList.add("div_humidity");div_humidity.appendChild(p_humidity_p);div_humidity.appendChild(p_humidity);div_other_forecasts.appendChild(div_clouds);div_other_forecasts.appendChild(div_humidity);var wind_div=document.createElement("div");wind_div.classList.add("wind_div");wind_div.appendChild(arrow);wind_div.appendChild(p_windms);create_div.appendChild(wind_div);create_div.appendChild(div_other_forecasts);obj.appendChild(create_div);}}}}}} 130function wind_direction_2(time,obj,file,speed,cloud,humidity){for(i=0;i<file.length;i++){var if_have_weather=file[i].getElementsByTagName("BsWfs:ParameterName");var if_have_weather_value=file[i].getElementsByTagName("BsWfs:ParameterValue");var temperature_time=file[i].getElementsByTagName("BsWfs:Time");for(var y=0;y<if_have_weather.length;y++){if(if_have_weather[y]["textContent"]=="WindDirection"){if(if_have_weather_value[y]["textContent"]!="NaN"){if(temperature_time[y]["textContent"]==time){var wind_dir=parseFloat(if_have_weather_value[y]["textContent"]);var kolinenmin=22.5;var kolinenmax=67.5;var itamin=67.5;var itamax=112.5;var kaakkomin=112.5;var kaakkomax=157.5;var etelamin=157.5;var etelamax=202.5;var lounasmin=202.5;var lounasmax=247.5;var lansimin=247.5;var lansimax=292.5;var luodemin=292.5;var luodemax=337.5;var create_div=document.createElement("div");create_div.classList.add("current_wind_dire");var arrow=document.createElement("p");var p_windms=document.createElement("p");var p_windgt=document.createElement("p");var p_clouds=document.createElement("p");var p_humidity=document.createElement("p");if(wind_dir>=kolinenmin&&wind_dir<kolinenmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-down'></i>";} 131else if(wind_dir>=itamin&&wind_dir<itamax){arrow.innerHTML="<i class='fas fa-arrow-left'></i>";} 132else if(wind_dir>=kaakkomin&&wind_dir<kaakkomax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-left'></i>";} 133else if(wind_dir>=etelamin&&wind_dir<etelamax){arrow.innerHTML="<i class='fas fa-arrow-up'></i>";} 134else if(wind_dir>=lounasmin&&wind_dir<lounasmax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-up'></i>";} 135else if(wind_dir>=lansimin&&wind_dir<lansimax){arrow.innerHTML="<i class='fas fa-arrow-right'></i>";} 136else if(wind_dir>=luodemin&&wind_dir<luodemax){arrow.innerHTML="<i style='transform: rotate(45deg);' class='fas fa-arrow-right'></i>";} 137else{arrow.innerHTML="<i class='fas fa-arrow-down'></i>";} 138tuulen_nopeus=Math.abs(speed);if(parseInt(tuulen_nopeus)==0){p_windms.textContent=0;arrow.innerHTML="";arrow.innerHTML="<i class='far fa-circle'></i>";} 139else{p_windms.textContent=Math.round(tuulen_nopeus);} 140var p_clouds_p=document.createElement("p");p_clouds_p.textContent="Pilvisyys";var p_humidity_p=document.createElement("p");p_humidity_p.textContent="Kosteus";p_clouds.textContent=Math.round(cloud)+"%";p_humidity.textContent=Math.round(humidity)+"%";var div_other_forecasts=document.createElement("div");div_other_forecasts.classList.add("current_div_other_forecasts");var div_clouds=document.createElement("div");div_clouds.classList.add("current_div_clouds");div_clouds.appendChild(p_clouds_p);div_clouds.appendChild(p_clouds);var div_humidity=document.createElement("div");div_humidity.classList.add("current_div_humidity");div_humidity.appendChild(p_humidity_p);div_humidity.appendChild(p_humidity);div_other_forecasts.appendChild(div_clouds);div_other_forecasts.appendChild(div_humidity);var wind_div=document.createElement("div");var tuuli_text=document.createElement("p");tuuli_text.innerHTML="Tuuli";wind_div.classList.add("current_wind_div");wind_div.appendChild(tuuli_text);wind_div.appendChild(arrow);wind_div.appendChild(p_windms);create_div.appendChild(wind_div);create_div.appendChild(div_other_forecasts);obj.appendChild(create_div);}}}}}} 141var scrollingwidth;var minus_kerroin=94;scrollingwidth=document.getElementById("scroller_hid").offsetWidth;jQuery(window).on("resize",function(event){scrollingwidth=document.getElementById("scroller_hid").offsetWidth;var isMobile=/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent);if(!isMobile){document.getElementsByClassName("create_weather_map")[0].style.marg
141inLeft="0px";if(parseInt(window.innerWidth)>=602){close_when_clicked=false;document.getElementById("quick_select_row").style.display="block";is_on_select=false;var icon_change=document.getElementById("mini_quick_location").children;document.getElementById("mini_quick_location").style.borderRadius="25px 25px 25px 25px";icon_change[1].className='';icon_change[1].classList.add("fas");icon_change[1].classList.add("fa-chevron-up");} 142else{document.getElementById("mini_quick_location").style.borderRadius="25px 25px 25px 25px";document.getElementById("quick_select_row").style.display="none";is_on_select=false;close_when_clicked=true;var icon_change=document.getElementById("mini_quick_location").children;icon_change[1].className='';icon_change[1].classList.add("fas");icon_change[1].classList.add("fa-chevron-up");}} 143check_day_showing();});function move_forecasts_left(){var calculate_margin=minus_kerroin*(Math.floor(parseFloat(scrollingwidth)/minus_kerroin));if(jQuery(".create_weather_map").css("marginLeft")!='0px'){document.getElementById("left_forecast").removeAttribute("onclick");if(parseFloat(jQuery(".create_weather_map").css("marginLeft"))+calculate_margin>0){jQuery(".create_weather_map").animate({marginLeft:"0px"},function(){document.getElementById("left_forecast").setAttribute("onclick","move_forecasts_left();");check_day_showing();});} 144else{jQuery(".create_weather_map").animate({marginLeft:"+="+calculate_margin+"px"},function(){document.getElementById("left_forecast").setAttribute("onclick","move_forecasts_left();");check_day_showing();});}}} 145function move_forecasts_right(){scrollingwidth=document.getElementById("scroller_hid").offsetWidth;var calculate_margin=minus_kerroin*(Math.floor(parseFloat(scrollingwidth)/minus_kerroin));var maksimi_minus=parseFloat(document.getElementsByClassName("create_weather_map")[0].scrollWidth)-parseFloat(scrollingwidth);if(jQuery(".create_weather_map").css("marginLeft")!="-"+maksimi_minus+'px'){document.getElementById("right_forecast").removeAttribute("onclick");if(parseFloat(jQuery(".create_weather_map").css("marginLeft"))-calculate_margin<parseFloat(Math.abs(maksimi_minus)*-1)){jQuery(".create_weather_map").animate({marginLeft:"-"+maksimi_minus+"px"},function(){document.getElementById("right_forecast").setAttribute("onclick","move_forecasts_right();");check_day_showing();});} 146else{jQuery(".create_weather_map").animate({marginLeft:"-="+calculate_margin+"px"},function(){document.getElementById("right_forecast").setAttribute("onclick","move_forecasts_right();");check_day_showing();});}}} 147function check_day_showing(){var what_day_is_showing=document.getElementsByClassName("what_day_is_it");var margin_check=0;var real_margin_now=parseFloat(jQuery(".create_weather_map").css("marginLeft"))*-1;var in_margin;var in_margin2;for(var u=0;u<what_day_is_showing.length;u++){what_day_is_showing[u].style.marginLeft="0px";if(u==0){in_margin=parseFloat(what_day_is_showing[u].scrollWidth)-90;in_margin2=0;} 148else{in_margin=(parseFloat(what_day_is_showing[u].scrollWidth)+margin_check)-90;in_margin2=margin_check;} 149margin_check=margin_check+parseFloat(what_day_is_showing[u].scrollWidth);if(in_margin>=real_margin_now&&in_margin2<=real_margin_now){what_day_is_showing[u].style.marginLeft=(real_margin_now-in_margin2)+"px";}}} 150function show_quick_select(){if(is_on_select){document.getElementById("quick_select_row").style.display="none";document.getElementById("mini_quick_location").style.borderRadius="25px 25px 25px 25px";is_on_select=false;var icon_change=document.getElementById("mini_quick_location").children;icon_change[1].className='';icon_change[1].classList.add("fas");icon_change[1].classList.add("fa-chevron-up");} 151else{document.getElementById("quick_select_row").style.display="block";document.getElementById("mini_quick_location").style.borderRadius="25px 25px 0px 0px";var icon_change=document.getElementById("mini_quick_location").children;icon_change[1].className='';icon_change[1].classList.add("fas");icon_change[1].classList.add("fa-chevron-down");is_on_select=true;}}
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.