<commit_before>{% from "macros/flags.jinja" import insert_flag with context %}
{% from "macros/datetime.jinja" import insert_timeago with context %}
{% from "macros/links.jinja" import user_link %}
{% from 'tracking/details-table.jinja' import render_details_table with context %}

{% extends "base-fullscreen.jinja" %}
{% set active_page = "tracking" %}


{% block title -%}
{% if pilots|length == 1 -%}
{{ _('Live Tracking <small>of %(pilot)s</small>', pilot=user_link(pilots[0])) }}
{%- elif pilots|length == 2 -%}
{{ _('Live Tracking <small>of %(pilot)s and %(other_pilot)s</small>', pilot=user_link(pilots[0]), other_pilot=user_link(pilots[1])) }}
{%- else -%}
{{ _('Live Tracking <small>of %(pilot)s and %(num_pilots)d other pilots</small>', pilot=user_link(pilots[0]), num_pilots=(pilots|length - 1)) }}
{%- endif %}
{%- endblock %}


{%- block styles %}
{{ super() }}

{% if traces -%}
  {% assets 'openlayers_css' -%}
  <link href="{{ ASSET_URL }}" rel="stylesheet" type="text/css" />
  {%- endassets %}
{%- endif %}
{%- endblock %}


{%- block scripts %}
{{ super() }}

{% if traces -%}
  {% assets 'openlayers_js' -%}
  <script type="text/javascript" src="{{ ASSET_URL }}"></script>
  {%- endassets %}

  {% assets 'flot_js' -%}
  <script type="text/javascript" src="{{ ASSET_URL }}"></script>
  {%- endassets %}
{%- endif %}

{% assets 'flight_js' -%}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %}

{% assets 'tracking_js' -%}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %}

{% if traces -%}
<script type="text/javascript">
  $(function() {
    var sidebar = $('#sidebar').sidebar();

    $("#barogram_panel").resize(function() {
      var height = $("#barogram_panel").height() + 10;
      sidebar.css('bottom', height);
      $(".ol-scale-line").css('bottom', height);
      $(".ol-attribution").css('bottom', height);
    });

    if (window.location.hash &&
        sidebar.find('li > a[href="#' + window.location.hash.substring(1) + '"]').length != 0) {
      sidebar.open(window.location.hash.substring(1));
    }

    if (!isCanvasSupported()) {
      $("#map_canvas").html('<b>Your browser is too old to display this map.<br />' +
                            'Please update to a current version.</b>');
      return;
    }

    slUnits.init({{ h.json.dumps(h.get_setting_name('distance_unit')) }},
                 {{ h.json.dumps(h.get_setting_name('speed_unit')) }},
                 {{ h.json.dumps(h.get_setting_name('lift_unit')) }},
                 {{ h.json.dumps(h.get_setting_name('altitude_unit')) }});

    var sl_map =
      new slMap("map_canvas",
                "{{ config.get('SKYLINES_MAP_TILE_URL') }}",
                { {% if 'baselayer' in request.args %}'base_layer': '{{ request.args['baselayer'] }}',{% endif %}{% if 'overlays' in request.args %}'overlay_layers': '{{ request.args['overlays'] }}',{% endif %} });

    var map = sl_map.getMap();
    var flight_display = slFlightTracking(sl_map.getMap(), $("#fix-data"), $("#barogram"));

    {% for pilot, trace in zip(pilots, traces) -%}
    {% if trace -%}
    flight_display.addFlight({ sfid: {{ pilot.id }},
                points: {{ h.json.dumps(trace.points) }},
                barogram_t: {{ h.json.dumps(trace.barogram_t) }},
                barogram_h: {{ h.json.dumps(trace.barogram_h) }},
                enl: {{ h.json.dumps(trace.enl) }},
                contests: undefined,
                elevations_t: {{ h.json.dumps(trace.barogram_t) }},
                elevations_h: {{ h.json.dumps(trace.elevations) }},
                additional: {
                  competition_id: "{{ pilot.tracking_callsign or pilot.initials() }}",
                  color: "{{ pilot.color }}"
                }
    });
    {%- endif %}
    {%- endfor %}

    var getPadding = function() { return [20, 20, $("#barogram_panel").height() + 20, sidebar.width() + 20]; };
    var extent = flight_display.getFlights().getBounds();
    sl_map.fitExtentPadded(extent, map.getSize(), getPadding());

    sl_map.addBingLayers("{{ config.get('SKYLINES_BING_API_KEY', 'null') }}");
    sl_map.addMapboxLayer("{{ config.get('SKYLINES_MAPBOX_API_KEY', 'null') }}");

    // update flight track every 15 seconds
    setInterval(function() {
      flight_display.updateFlightsFromJSON();
    }, 15*1000);

    var map_click_handler = slMapClickHandler(map, flight_display,
                                              {flight_info: true, location_info: true});
  });
</script>
{%- endif %}
{%- endblock %}


{% block content -%}
{% if traces -%}
<div id="fullscreen-content" class="olFullscreen">
<div id="sidebar" class="sidebar">
<!-- Nav tabs -->
  <ul class="sidebar-tabs" role="tablist">
    <li class="active">
      <a href="#tab-overview" title="{{ _('Overview') }}" role="tab">
        <i class="icon-info icon-large"></i>
      </a>
    </li>
  </ul>
<!-- Tab panes -->
  <div class="sidebar-content">
    <div class="sidebar-pane active" id="tab-overview">
      <h3>{% trans %}Overview{% endtrans %}</h3>
      <div class="sidebar-pane-content">
        {{ render_details_table(pilots) }}<commit_msg>templates/tracking/map: add fullscreen control<commit_after>{% from "macros/flags.jinja" import insert_flag with context %}
{% from "macros/datetime.jinja" import insert_timeago with context %}
{% from "macros/links.jinja" import user_link %}
{% from 'tracking/details-table.jinja' import render_details_table with context %}

{% extends "base-fullscreen.jinja" %}
{% set active_page = "tracking" %}


{% block title -%}
{% if pilots|length == 1 -%}
{{ _('Live Tracking <small>of %(pilot)s</small>', pilot=user_link(pilots[0])) }}
{%- elif pilots|length == 2 -%}
{{ _('Live Tracking <small>of %(pilot)s and %(other_pilot)s</small>', pilot=user_link(pilots[0]), other_pilot=user_link(pilots[1])) }}
{%- else -%}
{{ _('Live Tracking <small>of %(pilot)s and %(num_pilots)d other pilots</small>', pilot=user_link(pilots[0]), num_pilots=(pilots|length - 1)) }}
{%- endif %}
{%- endblock %}


{%- block styles %}
{{ super() }}

{% if traces -%}
  {% assets 'openlayers_css' -%}
  <link href="{{ ASSET_URL }}" rel="stylesheet" type="text/css" />
  {%- endassets %}
{%- endif %}
{%- endblock %}


{%- block scripts %}
{{ super() }}

{% if traces -%}
  {% assets 'openlayers_js' -%}
  <script type="text/javascript" src="{{ ASSET_URL }}"></script>
  {%- endassets %}

  {% assets 'flot_js' -%}
  <script type="text/javascript" src="{{ ASSET_URL }}"></script>
  {%- endassets %}
{%- endif %}

{% assets 'flight_js' -%}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %}

{% assets 'tracking_js' -%}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %}

{% if traces -%}
<script type="text/javascript">
  $(function() {
    var sidebar = $('#sidebar').sidebar();

    $("#barogram_panel").resize(function() {
      var height = $("#barogram_panel").height() + 10;
      sidebar.css('bottom', height);
      $(".ol-scale-line").css('bottom', height);
      $(".ol-attribution").css('bottom', height);
    });

    if (window.location.hash &&
        sidebar.find('li > a[href="#' + window.location.hash.substring(1) + '"]').length != 0) {
      sidebar.open(window.location.hash.substring(1));
    }

    if (!isCanvasSupported()) {
      $("#map_canvas").html('<b>Your browser is too old to display this map.<br />' +
                            'Please update to a current version.</b>');
      return;
    }

    slUnits.init({{ h.json.dumps(h.get_setting_name('distance_unit')) }},
                 {{ h.json.dumps(h.get_setting_name('speed_unit')) }},
                 {{ h.json.dumps(h.get_setting_name('lift_unit')) }},
                 {{ h.json.dumps(h.get_setting_name('altitude_unit')) }});

    var sl_map =
      new slMap("map_canvas",
                "{{ config.get('SKYLINES_MAP_TILE_URL') }}",
                { {% if 'baselayer' in request.args %}'base_layer': '{{ request.args['baselayer'] }}',{% endif %}{% if 'overlays' in request.args %}'overlay_layers': '{{ request.args['overlays'] }}',{% endif %} });

    var map = sl_map.getMap();
    var flight_display = slFlightTracking(sl_map.getMap(), $("#fix-data"), $("#barogram"));

    {% for pilot, trace in zip(pilots, traces) -%}
    {% if trace -%}
    flight_display.addFlight({ sfid: {{ pilot.id }},
                points: {{ h.json.dumps(trace.points) }},
                barogram_t: {{ h.json.dumps(trace.barogram_t) }},
                barogram_h: {{ h.json.dumps(trace.barogram_h) }},
                enl: {{ h.json.dumps(trace.enl) }},
                contests: undefined,
                elevations_t: {{ h.json.dumps(trace.barogram_t) }},
                elevations_h: {{ h.json.dumps(trace.elevations) }},
                additional: {
                  competition_id: "{{ pilot.tracking_callsign or pilot.initials() }}",
                  color: "{{ pilot.color }}"
                }
    });
    {%- endif %}
    {%- endfor %}

    var getPadding = function() { return [20, 20, $("#barogram_panel").height() + 20, sidebar.width() + 20]; };
    var extent = flight_display.getFlights().getBounds();
    sl_map.fitExtentPadded(extent, map.getSize(), getPadding());

    sl_map.addBingLayers("{{ config.get('SKYLINES_BING_API_KEY', 'null') }}");
    sl_map.addMapboxLayer("{{ config.get('SKYLINES_MAPBOX_API_KEY', 'null') }}");

    // update flight track every 15 seconds
    setInterval(function() {
      flight_display.updateFlightsFromJSON();
    }, 15*1000);

    var map_click_handler = slMapClickHandler(map, flight_display,
                                              {flight_info: true, location_info: true});

    var fullscreen_button = new FullscreenButton($("#fullscreen-content"));
    map.addControl(fullscreen_button);
  });
</script>
{%- endif %}
{%- endblock %}


{% block content -%}
{% if traces -%}
<div id="fullscreen-content" class="olFullscreen">
<div id="sidebar" class="sidebar">
<!-- Nav tabs -->
  <ul class="sidebar-tabs" role="tablist">
    <li class="active">
      <a href="#tab-overview" title="{{ _('Overview') }}" role="tab">
        <i class="icon-info icon-large"></i>
      </a>
    </li>
  </ul>
<!-- Tab panes -->
  <div class="sidebar-content">
    <div class="sidebar-pane active" id="tab-overview">
      <h3>{% trans %}Overview{% endtrans %}</h3>
      <div class="sidebar-pane-content">
        {{ render_details_table(pilots) }}
{'fraction_non_alphanumeric': 0.20652069987570512, 'fraction_numerical': 0.005736686107658476, 'mean_word_length': 3.1164895710350256, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3740452', 'n_tokens_mistral': 3757, 'n_tokens_neox': 3474, 'n_words': 634}