;url=window.location;urlObject=new URL(url);var curlat=urlObject.searchParams.get('lat'),curlng=urlObject.searchParams.get('lng'),curz=urlObject.searchParams.get('z'),curlocid=urlObject.searchParams.get('locid'),clusteredDataProvider,myLocationUpdate=!1,myLocationMarker,canUseGPS=!1,GPSinterval,interval,reportMessageID,timeout;if(curlocid){clearTimeout(interval);$.ajax({url:'locations_model.php?get_location&locationid='+curlocid,success:function(e){e=$.parseJSON(e);clearTimeout(interval);var t=e.lat,a=e.lng,s=curlocid;map.setView([t,a],16);getComments(s,!1);$('.commentswrapper').scrollTop(0)}})};if(!curlat){curlat=64.13926574719851};if(!curlng){curlng=24.291530205199326};if(!curz){curz=6};var map=L.map('map',{zoomControl:!1}).setView([curlat,curlng],curz);new L.Control.Zoom({position:'bottomright'}).addTo(map);L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{attribution:'© OpenStreetMap',subdomains:['a','b','c']}).addTo(map);var markers=L.markerClusterGroup();for(var i=0;i
',buttons:{formSubmit:{text:'send',btnClass:'btn-blue',action:function(){var t=this.$content.find('.firstmessage').val();saveData(e.latlng.lat,e.latlng.lng,t)}},cancel:function(){text:'Cancel'},},onContentReady:function(){var e=this;this.$content.find('form').on('submit',function(t){t.preventDefault();e.$$formSubmit.trigger('click')})}})});map.on('moveend',function(e){var t=map.getCenter().lat,a=map.getCenter().lng,s=map.getZoom();curlat=t;curlng=a;curz=s;if(curz>11){$.post('locations_model.php?add_viewer_location',{lat:t,lng:a})};if(myLocationUpdate==!1){window.history.replaceState({lat:t,lng:a,z:s,locid:curlocid},'','/?lat='+t+'&lng='+a+'&z='+s+'&locid='+curlocid)} else{myLocationUpdate=!1}});function Timeout(e,t){if(this.cleared){this.id=setTimeout(e,t);this.cleared=!1} else{clearTimeout(this.id);this.id=setTimeout(e,t)};this.clear=function(){this.cleared=!0;clearTimeout(this.id)}};var popup;function getComments(e,t){clearTimeout(interval);$.ajax({url:'locations_model.php?get_location_comments&locid='+e,success:function(a){if(t!=!0){uniqueid=Date.now()+Math.floor(Math.random()*10000);$('.newmessagewrapper').html('

All personal info will be removed. Illegal material will be reported to police.
Send your image by pressing Send.
Chathistory');document.getElementById('image').addEventListener('change',function(e){imagechange()},!1)};timeout=Timeout(function(){getComments(e,!0)},3400);html='';a=$.parseJSON(a);usernear=0;var n='',s='',o,i;$.each(a,function(t,a){if(s==''){s=a.comment;o=a.lat;i=a.lng};html+='
'+a.comment+'
';if(a.user_id!=0){html+='
'} else{html+='
'};if(a.image){html+='
'};if(a.user_id!=0){html+='
'+a.date+' '+a.username+' | Report
'} else{html+='
'+a.date+' '+a.username+' | Report
'};if(a.can_delete==1){html+='
'};if(a.city!=null){html+='
'+a.city+'
'};html+='
';html+='
';usernear=a.usersNear;n=a.haiskaaperseellespammaajat});if(typeof popup==='object'){if(popup.getContent()!=s){popup=L.popup({autoPan:!1,closeButton:!1}).setLatLng([o,i]).setContent(s).openOn(map)}} else{popup=L.popup({autoPan:!1,closeButton:!1}).setLatLng([o,i]).setContent(s).openOn(map)};$('.commentswrapper').html(html);$('#vitunspammaajatperkelehaiskaaperseelle').html(n);if(e!=-1){if(canUseGPS){$('.locationusers').html('Tämän paikan lähellä on '+usernear+' käyttäjää, jotka ovat sallineet paikannuksen')} else{$('.locationusers').html('Salli paikannus, niin näet monta käyttäjää tämän merkin lähistöllä on.')}} else{$('.locationusers').html('')};addDeletes();if(e==-1){$('.commentswrapper').css('height',($(window).height()-80)+'px')} else{$('.commentswrapper').css('height',($(window).height()-310)+'px')}}})};function thisFileUpload(){document.getElementById('image').click()};function imagechange(){$('.preview-wrapper').fadeIn();var e=new FileReader();e.onload=function(e){document.getElementById('previewimage').src=e.target.result};e.readAsDataURL(document.querySelector('input[type=file]').files[0])};$('#registerUser').click(function(){var t=$('#registerUser').html();$('#registerUser').html('');var e=new FormData(registerdata);$.ajax({url:'/locations_model.php?register_user',type:'POST',data:e,success:function(e){flashMessage(e);$('#registerUser').html(t)},cache:!1,contentType:!1,processData:!1})});$('#saveProfile').click(function(){var t=$('#saveProfile').html();$('#saveProfile').html('');var e=new FormData(profiledata);$.ajax({url:'/locations_model.php?update_profile',type:'POST',data:e,success:function(e){flashMessage(e);$('#saveProfile').html(t)},cache:!1,contentType:!1,processData:!1})});$('#openProfile').click(function(){var e=$('#openProfile').html();$('#openProfile').html('');$.ajax({url:'locations_model.php?get_profile',success:function(t){$('#openProfile').html(e);$('#profileModal').modal();$('[data-toggle="tooltip"]').tooltip();t=$.parseJSON(t);var a=0;$.each(t,function(e,t){if(e.search('will')>-1){if(t==1){$('*[name="'+e+'"]').bootstrapToggle('on')}} else{$('*[name="'+e+'"]').val(t)};a++})}})});$('#loginUser').click(function(){var t=$('#loginUser').html();$('#loginUser').html('');var e=new FormData(logindata);$.ajax({url:'/locations_model.php?login_user',type:'POST',data:e,success:function(e){if(e.search('NOK')!=-1){flashMessage(e)} else{flashMessageRefresh(e)};$('#loginUser').html(t)},cache:!1,contentType:!1,processData:!1})});$('#resetpassword').click(function(){var t=$('#resetpassword').html();$('#resetpassword').html('');var e=new FormData(logindata);$.ajax({url:'/locations_model.php?lost_password',type:'POST',data:e,success:function(e){if(e.search('NOK')!=-1){flashMessage(e)} else{flashMessageRefresh(e)};$('#resetpassword').html(t)},cache:!1,contentType:!1,processData:!1})});$('#logoutUser').click(function(){var e=new FormData(logindata);$.ajax({url:'/locations_model.php?logout_user',type:'POST',data:e,success:function(e){flashMessageRefresh(e)},cache:!1,contentType:!1,processData:!1})});function addMessage(e){$('#vitunspammaajatimekaakulliamielummin').val($('#vitunspammaajatperkelehaiskaaperseelle').html());var a=$('#messagebutton').html();$('#messagebutton').html('');var t=new FormData(formdata);$.ajax({url:'/locations_model.php?add_message_post',type:'POST',data:t,success:function(t){if(t.length>1){if(t.search('NOK')!=-1){flashMessage(t)};$('.preview-wrapper').fadeOut();getComments(e,!1)} else{flashMessage(t)};$('#messagebutton').html(a)},cache:!1,contentType:!1,processData:!1})};function saveData(e,t,a){var a=a;$.ajax({url:'locations_model.php?getJouMama4535136',success:function(s){var o='locations_model.php?add_location&description='+a+'&lat='+e+'&jou949300134342='+s+'&lng='+t;downloadUrl(o,function(a,s){if(s===200&&a.length>0){if(a.search('NOK')==-1){addNewMarker(e,t,a);flashMessage('Added marker successfully')} else{flashMessage(a)}} else{flashMessage(a)}})}})};function addNewMarker(e,t,a){var s=L.marker([e,t]);s.locid=a;s.on('click',function(s){clearTimeout(interval);curlocid=a;getComments(s.target.locid,!1);$('.commentswrapper').scrollTop(0);map.setView(s.latlng,curz);$('.commentswrapper').scrollTop(0);if($('#comments').css('left')=='-276px'){$('#comments').animate({left:'0px'},350);$('#comments').css('background-color','#fff');$('#commentarea').fadeIn()};window.history.replaceState({lat:s.latlng.lat,lng:s.latlng.lng,z:curz,locid:a},'','/?lat='+e+'&lng='+t+'&z='+curz+'&locid='+a)});markers.addLayer(s)};function flashMessage(e){var t='';if(e.search('NOK')!=-1){t='color: #f00'};e=e.replace('NOK ','');$('#flashmessage').html(''+e+'');$('#flashmessage').fadeIn(350);$('#flashmessage').animate({width:'300px'},350);setTimeout(function(){$('#flashmessage').animate({width:'0px'},350);$('#flashmessage').fadeOut(350);$('#flashmessage').html('')},5000)};function flashMessageRefresh(e){var t='';if(e.search('NOK')!=-1){t='color: #f00'};e=e.replace('NOK ','');$('#flashmessage').html(''+e+'');$('#flashmessage').fadeIn(350);$('#flashmessage').animate({width:'300px'},350);setTimeout(function(){$('#flashmessage').animate({width:'0px'},350);$('#flashmessage').fadeOut(350);$('#flashmessage').html('');location.reload()},2000)};function addDeletes(){$('.delete').click(function(){var e=$(this).data('messageid'),t=$(this).data('locid');$.confirm({title:'Are you sure?',theme:'supervan',content:'This will permanently delete your message.',buttons:{delete:{action:function(){$.ajax({url:'locations_model.php?delete_message&messageid='+e,success:function(e){getComments(t,!0);flashMessage(e)}})},btnClass:'btn-red'},cancel:function(){}}})});$('.openMessage').click(function(){var e=$(this).data('messageid'),t=$(this).data('locid'),a=$(this).data('userid');$('#openMessage').modal()});$('.openReport').click(function(){var e=$(this).data('messageid');reportMessageID=e;var t=$(this).data('locid'),a=$(this).data('userid');$('#openReport').modal()});$('#reportMessageButton').click(function(){$.ajax({url:'locations_model.php?report_message&commentid='+reportMessageID,success:function(e){$('#openReport').modal('hide')}})});$('.openUserModal').click(function(){var t=$(this).data('messageid'),a=$(this).data('locid'),e=$(this).data('userid');$('#userModal').modal();$('#userModalTitle').html('Verified profile');$('#userModelContent').html('Loading...');$.ajax({url:'locations_model.php?get_user&userid='+e,success:function(t){$('#userModelContent').html('');var a='';$.ajax({url:'locations_model.php?get_profile&user_id='+e,success:function(e){e=$.parseJSON(e);a+='
';if(e.gender){a+=''};if(e.height){a+=''};if(e.weight){a+=''};if(e.penis){a+=''};if(e.birthdate){a+=''};a+='
';a+='';a+='';a+='';a+='';a+='';a+='';a+='';a+='';a+='';a+='
';t=$.parseJSON(t);a+='
';var s=0;$.each(t,function(e,t){a+='';s++});if(s==0)a+='

No images found

';a+='
';$('#userModelContent').html(a)}})}})});$('.openIPModal').click(function(){var t=$(this).data('messageid'),a=$(this).data('locid'),e=$(this).data('commentid');$('#userModal').modal();$('#userModalTitle').html('Images from this IP');$('#userModelContent').html('Loading...');$.ajax({url:'locations_model.php?get_ip_user&commentid='+e,success:function(e){$('#userModelContent').html('');e=$.parseJSON(e);var t='

IP-addresses change over time and many people share same IP, so it is not guarateed these all was sent from single person or if this commenter has sent these images.

',a=0;$.each(e,function(e,s){t+='';a++});if(a==0)t+='

No images found

';t+='
';$('#userModelContent').html(t)}})});$('.seeAllImagesButton').click(function(){var t=$(this).data('messageid'),a=$(this).data('locid'),e=$(this).data('locationid');$('#userModal').modal();$('#userModalTitle').html('All images from this location');$('#userModelContent').html('Loading...');$.ajax({url:'locations_model.php?get_location_images&locationid='+e,success:function(e){$('#userModelContent').html('');if(e=='NOK forPatrons'){$('#userModelContent').html('
This feature is only for logged in supporters (1€/month).
')} else{e=$.parseJSON(e);var t='
',a=0;$.each(e,function(e,s){t+='';a++});if(a==0)t+='

No images found

';t+='
';$('#userModelContent').html(t)}}})});$('.movemap').click(function(){clearTimeout(interval);var t=$(this).data('lat'),a=$(this).data('lng'),e=$(this).data('locid');curlocid=e;map.setView([t,a],16);getComments(e,!1);$('.commentswrapper').scrollTop(0)})};function downloadUrl(e,t){var a=window.ActiveXObject?new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest;a.onreadystatechange=function(){if(a.readyState==4){t(a.responseText,a.status)}};a.open('GET',e,!0);a.send(null)};$('#menutoggle').click(function(){if($('#comments').css('left')=='0px'){$('#comments').animate({left:'-276px'},350);$('#comments').css('background-color','transparent');$('#commentarea').fadeOut()} else{$('#comments').animate({left:'0px'},350);$('#comments').css('background-color','#fff');$('#commentarea').fadeIn()}});if($(window).width()<1000){$('#comments').animate({left:'-276px'},350);$('#comments').css('background-color','transparent');$('#commentarea').fadeOut()};$('.showGDPR').click(function(){$('#info').fadeIn()});$('#close').click(function(){$('#info').fadeOut()});getComments(-1,!0);getLocation();function getLocation(){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(showPosition)} else{}};function showPosition(e){canUseGPS=!0;myLocationUpdate=!0;url=window.location;urlObject=new URL(url);if(!urlObject.searchParams.get('lat')){map.setView([e.coords.latitude,e.coords.longitude],16)};$.post('locations_model.php?add_user_location',{lat:e.coords.latitude,lng:e.coords.longitude});myLocationMarker=L.marker([e.coords.latitude,e.coords.longitude],{icon:L.divIcon({html:'',iconSize:[20,20],className:'my-location'})}).addTo(map);GPSinterval=setTimeout(function(){updateLocation()},20000)};function updateLocation(){clearTimeout(GPSinterval);if(navigator.geolocation){navigator.geolocation.getCurrentPosition(updatePosition)} else{}};function updatePosition(e){myLocationUpdate=!0;$.post('locations_model.php?add_user_location',{lat:e.coords.latitude,lng:e.coords.longitude});GPSinterval=setTimeout(function(){updateLocation()},20000)};$.getJSON('locations_model.php?get_user_locations',function(e){var t=[];$.each(e,function(e,t){L.marker([t.lat,t.lng],{icon:L.divIcon({html:'',iconSize:[20,20],className:'my-location'})}).addTo(map)})});