You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							41 lines
						
					
					
						
							1.1 KiB
						
					
					
				
			
		
		
	
	
							41 lines
						
					
					
						
							1.1 KiB
						
					
					
				| {% extends 'base.html' %} | |
|  | |
| {% block app_content %} | |
|     <meta name="csrf-token" content="{{ csrf_token() }}"> | |
|     {% block player_app_content %}{% endblock %} | |
| {% endblock %} | |
|  | |
| {% block scripts %} | |
| {{ super() }} | |
| <script src="{{ url_for('static', filename='assets/geolocation_utils.js') }}"></script> | |
| <script> | |
| $(document).ready(getPosition(postCoordinates)) | |
|  | |
| setInterval(function() {getPosition(postCoordinates)}, 65 * 1000); | |
|  | |
| function postCoordinates(position) { | |
|     $.ajax({ | |
|         type: "POST", | |
|         url: "{{ url_for('main.send_location', username=current_user.name) }}", | |
|         data:{ | |
|             lat: position.coords.latitude,  | |
|             long: position.coords.longitude | |
|         }, | |
|          | |
|         error: function(error) { | |
|             console.log(error); | |
|         } | |
|     }); | |
| } | |
|  | |
| var csrftoken = $('meta[name=csrf-token]').attr('content') | |
| $.ajaxSetup({ | |
|     beforeSend: function(xhr, settings) { | |
|         if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) { | |
|             xhr.setRequestHeader("X-CSRFToken", csrftoken) | |
|         } | |
|     } | |
| }) | |
|  | |
| </script> | |
| {% endblock %} |