{% extends "base.html" %}
{% block title %}{{ i18n('index_title', path=path) }}{% endblock %}
{% block links %}
<link rel="stylesheet" type="text/css" href="{{ static_url('index.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static_url('index-ex.css') }}">
{%- endblock %}
{% block scripts %}
<script>
const LANG = {
  label_selected: {{ i18n('label_selected') | tojson }},
  command_move_prompt: {{ i18n('command_move_prompt') | tojson }},
  command_move_prompt_multi: {{ i18n('command_move_prompt_multi') | tojson }},
  command_copy_prompt: {{ i18n('command_copy_prompt') | tojson }},
  command_copy_prompt_multi: {{ i18n('command_copy_prompt_multi') | tojson }},
  command_link_prompt: {{ i18n('command_link_prompt') | tojson }},
  command_link_prompt_multi: {{ i18n('command_link_prompt_multi') | tojson }},
  previewer_toolbar_title: {{ i18n('previewer_toolbar_title') | tojson }},
  previewer_button_previous: {{ i18n('previewer_button_previous') | tojson }},
  previewer_button_next: {{ i18n('previewer_button_next') | tojson }},
  previewer_button_infobar: {{ i18n('previewer_button_infobar') | tojson }},
  previewer_button_close: {{ i18n('previewer_button_close') | tojson }},
};
</script>
<script src="{{ static_url('common.js') }}"></script>
<script src="{{ static_url('index.js') }}"></script>
<script src="{{ static_url('index-ex.js') }}"></script>
{%- endblock %}
{% block content %}
<header>
<h1 id="header" class="breadcrumbs">
{%- for label, subpath, sep, is_last in get_breadcrumbs(pathparts, base, sitename) -%}
  {%- if not loop.last -%}
    <a href="{{ quote_path(subpath) }}">{{ label }}</a>{{ sep }}
  {%- else -%}
    <a>{{ label }}</a>{{ sep }}
  {%- endif -%}
{%- endfor -%}
</h1>
</header>
<main data-sitename="{{ sitename }}" data-base="{{ base }}" data-path="{{ path }}">
<table id="data-table">
<thead>
  <tr><th data-sort-type="string_ci"><a hidden>{{ i18n('data_table_header_directory') }}</a></th><th data-sort-type="string_ci"><a>{{ i18n('data_table_header_name') }}</a></th><th class="detail" data-sort-type="float"><a>{{ i18n('data_table_header_last_modified') }}</a></th><th class="detail" data-sort-type="integer"><a>{{ i18n('data_table_header_size') }}</a></th></tr>
</thead>
<tbody>
{%- for info in subentries if info.name %}
  {%- set filename = info.name %}
  {%- set url = quote_path(info.name) + ('/' if info.type == 'dir' else '') %}
  {%- set filetype = info.type %}
  {%- set size = info.size %}
  {%- set size_text = format_filesize(size) if size else '' %}
  {%- set lm = info.last_modified %}
  {%- set lm_text = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(lm)) %}
  <tr data-entry data-type="{{ filetype }}" data-path="{{ filename }}"><td data-sort="{{ filename }}"><span class="icon" data-type="{{ filetype }}" title="{{ filename }}"></span><td data-sort="{{ filename }}"><a href="{{ url }}">{{ filename }}</a></td><td class="detail" data-sort="{{ lm or '' }}">{{ lm_text }}</td><td class="detail" data-sort="{{ size or '' }}">{{ size_text }}</td></tr>
{%- endfor %}
</tbody>
</table>
</main>
<footer>
<form id="panel" autocomplete="off" hidden>
  <select id="explorer" title="{{ i18n('explorer_tooltip', 'V') }}" accesskey="V">
    <option value="table" selected>{{ i18n('explorer_table') }}</option>
    <option value="gallery">{{ i18n('explorer_gallery') }}</option>
    <option value="gallery2">{{ i18n('explorer_gallery2') }}</option>
  </select>
  <select id="tools" title="{{ i18n('tools_tooltip', 'T') }}" accesskey="T">
    <option value="" selected>...</option>
    <option value="preview-on">{{ i18n('tools_preview_on') }}</option>
    <option value="preview-off">{{ i18n('tools_preview_off') }}</option>
    <option value="select-all">{{ i18n('tools_select_all') }}</option>
    <option value="deselect-all">{{ i18n('tools_deselect_all') }}</option>
    <option value="expand-all">{{ i18n('tools_expand_all') }}</option>
    <option value="filter">{{ i18n('tools_filter') }}</option>
    <option value="filter-clear">{{ i18n('tools_filter_clear') }}</option>
  </select>
  <select id="command" title="{{ i18n('command_tooltip', 'C') }}" accesskey="C">
    <option value="" selected>...</option>
    <option value="mkdir" hidden>{{ i18n('command_mkdir') }}</option>
    <option value="mkzip" hidden>{{ i18n('command_mkzip') }}</option>
    <option value="mkfile" hidden>{{ i18n('command_mkfile') }}</option>
    <option value="upload" hidden>{{ i18n('command_upload') }}</option>
    <option value="uploaddir" hidden>{{ i18n('command_uploaddir') }}</option>
    <option value="source" hidden>{{ i18n('command_source') }}</option>
    <option value="download" hidden>{{ i18n('command_download') }}</option>
    <option value="exec" hidden{{ '' if is_local else ' disabled' }}>{{ i18n('command_exec') }}</option>
    <option value="browse" hidden{{ '' if is_local else ' disabled' }}>{{ i18n('command_browse') }}</option>
    <option value="edit" hidden>{{ i18n('command_edit') }}</option>
    <option value="editx" hidden>{{ i18n('command_editx') }}</option>
    <option value="move" hidden>{{ i18n('command_move') }}</option>
    <option value="copy" hidden>{{ i18n('command_copy') }}</option>
    <option value="link" hidden>{{ i18n('command_link') }}</option>
    <option value="delete" hidden>{{ i18n('command_delete') }}</option>
  </select>
  <label id="panel-selections"></label>
  <input type="file" id="upload-file-selector" multiple hidden>
  <input type="file" id="upload-dir-selector" webkitdirectory hidden>
</form>
</footer>
{% endblock %}