<!-- $Id: upddata.txt %version; 24/06/2024 01:38:06 $ -->
<!-- Copyright (c) 2006-2007 INRIA -->
<!DOCTYPE html>
<html lang="%lang;" id="book">
<head>
  <title>%title; – %subtitle;</title>
  <meta name="robots" content="none">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="shortcut icon" href="%images_prefix;favicon_gwd.png">
  %include;css
</head>
<body%body_prop;>
<div id="loading-overlay"></div>
%include;hed
%include;home
%define;subsection(x)
  [*go to section %s:::x]%nn;
%end;
%define;wikidata(x)
  [*wikidata:::x]%nn;
%end;
%define;subinit(z)
  %let;ini;%if;(z!="")%substr_start_e.z.s;%end;%in;
  %if;(ini!="" and ini!=e.s)
    <a tabindex="%expr(5+z)" href="%prefix;m=MOD_DATA&data=%e.data;&s=%ini;"
      class="list-group-item list-group-item-action list-group-item-info w-auto sub-char d-flex align-items-center"
      title="[*search/case sensitive]0 “%ini;”">%ini;</a>
  %end;
%end;
<div class="container">
%define;list_of(xx,yy,zz)
  <div%if;("xx"!="fn" or e.data!="") class="mt-2"%end;>
    %if;(e.data!="xx")
      <a href="%prefix;m=MOD_DATA&data=xx" class="sub-char" title="[*book of %s:::yy]">
    %end;
    %if;(e.data="")<div class="d-inline-flex align-self-center">%end;
    <i class="fa fa-zz fa-2x fa-fw %if;(e.data="xx")text-success%end;"></i>
    %if;(e.data="")<span class="h4 d-flex ml-3">[*book of %s:::yy]</span></div>%end;
    %if;(e.data!="xx")</a>%end;
  </div>
%end;

%define;other_books()
  %if;(e.data="")<div class="h3 mb-3">[*book/books]1</div>%end;
  <div class="d-flex flex-column mr-2">
    %apply;list_of("fn",[first name/first names]1,"child")
    %apply;list_of("sn",[surname/surnames]1,"signature")
    %apply;list_of("pubn",[public name/public names]1,"pen")
    %apply;list_of("qual",[qualifier/qualifiers]1,"comment")
    %apply;list_of("alias",[alias/aliases]1,"mask")
  %if;(e.data!="")</div><div class="d-flex flex-column mr-2">%end;
    %apply;list_of("occu",[occupation/occupations]1,"user-doctor")
    %apply;list_of("place",[place/places]1,"map-location-dot")
    %apply;list_of("src",[source/sources]1,"box-archive")
    %apply;list_of("title",[title/titles]1,"crown")
    %apply;list_of("domain",[domain/domains]1,"chess-rook")
  </div>
%end;
  <a tabindex="4" class="sr-only sr-only-focusable" href="#main-content">[*skip to main content]</a>
  %let;len_s;%if;(e.s!="")%e.length.s;%else;0%end;%in;
  %let;nb_max;%if;(b.book_max_results!="" and b.book_max_results>0)%b.book_max_results;%else;1000%end;%in;
  <nav class="navbar sticky-top bg-white justify-content-start py-1 mt-1 mb-0 px-1 mx-0" aria-labelledby="sub-caracter-selection-heading" id="fixed-nav">
    <h2 id="sub-caracter-selection-heading" class="sr-only">
      %if;(e.s="")[*select a letter]%else;[*hierarchical navigation]%end;
    </h2>
    <div class="btn-group" role="toolbar" aria-label="sub-caracter-selection-heading" id="book-navigation">
      <div class="d-flex flex-column flex-sm-row list-group list-group-horizontal user-select-none font-weight-bold user-select-none ml-2">
        <div class="d-inline-flex flex-wrap align-self-center mt-2 mt-sm-0 order-3 text-monospace">
          %if;(nb_results>=1)
            %reset_count;
            %foreach;entry;
              %if;(entry_ini!=e.s)
                %incr_count;
                <div class="list-group-item list-group-item-action list-group-item-info w-auto px-3 position-relative sup-char-div" tabindex="%expr(len_s+(2*cnt)+5)">
                  <a class="stretched-link sup-char" href="%prefix;m=MOD_DATA&data=%e.data;&s=%html_encode.entry_ini;"
                      title="[*search/case sensitive]0 “%entry_ini;”" >%entry_ini;</a>
                    %if;(max>0 and nb_results<nb_max)%nn;
                      <span class="bottom-book-arrow">
                        <a href="#_%entry_ini;" title="%apply;subsection%with;“%entry_ini;”%end;"
                          aria-label="%apply;subsection%with;“%entry_ini;”%end;" tabindex="%expr(len_s+(2*cnt)+6)">
                          <i class="fa-solid fa-sort-down fa-2xs p-0 book-arrow"></i>
                        </a>
                      </span>
                    %end;
                </div>
              %end;
            %end;
          %end;
        </div>
        <div class="d-flex col-xs-12 order-1">
          <div class="d-flex flex-row align-self-center">
            %if;(e.s="")%apply;other_books()%end;
            %if;(e.data!="" and e.s="")
              <div class="align-self-center text-center mx-3">
                <h1 class="h3 mt-0 ">[*book/books]0</h1>
                <h2 class="h4 mt-0 text-nowrap">%subtitle;</h2>
              </div>
            %end;
          </div>
          %if;(e.s!="")<a tabindex="5" role="button" class="btn-link border-0 align-self-center mt-1 mb-2 sub-char"
            href="%prefix;m=MOD_DATA&data=%e.data;" title="[*back to index and books]">
              <span class="fa-stack mb-1">
                <i class="fa fa-a fa-stack-2x pr-3"></i>
                <i class="fa-solid fa-z fa-2x fa-stack-1x text-success pt-2 pl-3"></i>
              </span>
            </a>
          %end;
          <div class="d-flex flex-grow align-self-sm-center%if;(e.s!="") ml-2%end;" id="subinit">
            %if;(e.s!="")
              %for;z;1;6;%apply;subinit(z)%end; %(5 first entries %)
              %if;(len_s>7)<i class="fa-solid fa-ellipsis align-self-center ml-1"></i>
              %(%elseif;(len_s<5)<i class="fa-solid fa-caret-right align-self-center ml-1"></i>%)
              %end;
              %(%foreach;substr.s;
                <a class="d-flex flex-column flex-sm-row list-group-item list-group-item-action"
                  href="%prefix;m=MOD_DATA&data=%e.data;&s=%substr;">%substr;</a>
              %end; not used because full print is too long when len_s increases, but the function is working %)
              <div class="list-group-item list-group-item-success user-select-all%if;(len_s>1) ml-1%end;">%e.s;</div>
            %end;
          </div>
          <div class="d-flex flex-fill align-self-center order-2 d-xs-none">
            %if;(e.s!="" and count!=0)
              <i class="fa-solid fa-caret-right align-self-center mx-1"></i>
            %end;
          </div>
        </div>
      </div>
    </div>
  </nav>
  <div class="d-flex flex-column justify-content-center mx-2">
    %if;(e.key!="")
      <div class="alert alert-warning w-auto text-center my-2 mx-3 mx-lg-5" role="alert">
        <i class="fas fa-hat-wizard fa-fw text-danger mr-1"></i>[*help modify data]%nn;
        <i class="fas fa-hat-wizard fa-fw text-danger ml-1"></i>
      </div>
    %end;
  </div>
  %if;(e.data!="" and e.s!="")
    <h1 class="text-sm-center mt-0 mt-sm-1 h3">%title;</h1>
    <h2 class="text-sm-center mt-0 h4">%subtitle;</h2>
    <div class="mt-2 mt-sm-3 mx-1 mx-sm-3 px-sm-3">
      <form class="form-inline" method="get" action="%action;" aria-labelledby="search_s">
        %hidden;
        <input type="hidden" name="m" value="MOD_DATA">
        <input type="hidden" name="data" value="%e.data;">
        <div class="form-group mb-0">
          <label class="user-select-none mb-0 mb-sm-1 ml-1 ml-sm-3" for="search_s" title="[*search/case sensitive]0 (R)">[*search/case sensitive]0</label>
          <input type="search" accesskey="R" class="form-control ml-2 ml-sm-3" name="s" id="search_s">
        </div>
        <button type="submit" class="btn btn-primary ml-2 align-self-end" title="[*validate/delete]0" aria-label="[*validate/delete]0 [search/case sensitive]0">Ok</button>
      </form>
    </div>
  %end;
  %( liste des entrées et formulaire d'édition %)
  %if;(nb_results<nb_max)
    <ul class="list-group mt-1 mt-sm-2" id="main-content">
      %foreach;entry;
        <li class="list-group-item list-group-action d-flex p-0 mt-1 align-items-center border-0"  id="_%entry_ini;">
          <div class="d-flex align-items-center justify-content-center position-relative top-book-arrow w-10 h-100 border-0 justify-content-center">
            <a role="button" class="stretched-link w-100 mx-3" href="#top" title="[*return to top]" tabindex="-1" title="^"><i class="fa-solid fa-sort-up ml-sm-1 mt-1"></i></a>%nn;
          </div>
          <div class="list-group-item-%if;(entry_ini=e.s)success%else;info%end; position-relative w-100 border font-weight-bold text-monospace">
            %if;(entry_ini!=e.s)
            <a class="stretched-link ml-3" href="%prefix;m=MOD_DATA&data=%e.data;&s=%html_encode.entry_ini;" title="[*search/case sensitive]0 “%entry_ini;”">%else;<span class="ml-3">%end;%entry_ini;%nn;
            %if;(entry_ini!=e.s)</a>%else;</span>%end;
          </div>
        </li>
        <li class="list-unstyled mt-1 pl-0">
          <ul class="list-group src-list-bg my-1">
            %foreach;value;
              <li class="list-unstyled ml-sm-1 pl-0" id="k%entry_key;">
                <div class="d-flex%if;(is_modified) my-2 my-sm-0%end; mx-2">
                  %if;(e.data!="src")
                    %(TODO: Fix URL encoding for escape.printable.suburb/other ! %)
                    <div class="d-flex flex-column justify-content-center">
                      <a href="https://www.wikidata.org/w/index.php?search=%nn;
                        %if;(e.data!="place")%encode.escape.entry_value;%nn;
                        %else;
                          %if;(not first and suburb!="")%encode.escape.printable.suburb;%else;%encode.other;%end;
                        %end;"
                        role="button" class="btn btn-link p-0 ml-1"
                        title="%apply;wikidata%with;%if;(e.data!="place")%escape.entry_value;%else;%if;(not first and suburb!="")%escape.printable.suburb;%else;%escape.printable.other;%end;%end;%end;"
                        target="_blank" rel="noreferrer, noopener" tabindex="-1">
                        <i class="fab fa-wikipedia-w fa-sm"></i>
                      </a>%if;(suburb!="")</span>%end;
                      %if;(first and suburb!="")
                        <a href="https://www.wikidata.org/w/index.php?search=%encode.escape.printable.suburb;"
                          role="button" class="btn btn-link p-0 ml-1"
                          title="%apply;wikidata(escape.printable.suburb)"
                          target="_blank" rel="noreferrer, noopener" tabindex="-1">
                          <i class="fab fa-wikipedia-w fa-sm"></i>
                        </a>
                      %end;
                    </div>
                  %else;
                    <div class="px-3 mx-0 bg-white"> </div>
                  %end;
                  %if;is_modified;
                    <div class="d-flex d-sm-inline-flex flex-column flex-sm-row px-0%if;(e.data!="place") ml-sm-1%end;">
                      <div class="d-flex d-sm-inline-flex flex-row flex-sm-column align-self-start align-self-sm-center ml-5 ml-sm-4 mb-0 ">
                        <div class="font-weight-bold">[*modify]</div>
                        <div class="text-nowrap align-self-sm-center ml-2 ml-sm-0">%p_list;</div>
                      </div>
                  %end;
                  <div class="d-flex d-sm-inline-flex flex-column flex-sm-row px-2 px-sm-1%if;(e.data!="place") ml-2%end;">
                    <div class="flex-column flex-sm-row ml-sm-2%if;is_modified; my-2%end;">
                      %if;is_modified;
                        <div class="pl-3 pr-sm-3 text-muted">
                      %else;
                        <a role="button" class="ml-2"
                           href="%prefix;m=MOD_DATA&data=%e.data;&key=%entry_key;&s=%encode.e.s;" data-entry="%escape.printable.entry_value_unsort;">%nn;
                      %end;
                      %if;(e.data="place" and suburb!="")
                        %if;is_modified;%escape.entry_value;
                        %else;
                          %if;(first)
                            %escape.other;<br><span class="ml-4">%escape.suburb;</span>
                          %else;
                            <span class="sr-only">%escape.printable.other (</span>
                            <span class="ml-4">%escape.suburb;</span>
                            <span class="sr-only">)</span>
                          %end;
                        %end;
                      %else;
                        %escape.entry_value;
                      %end;
                      %if;is_modified;</div>%else;</a>%end;
                      %if;is_modified;
                        <form class="mt-1 needs-validation" method="post" action="%action;" novalidate>
                          %hidden;
                          <input type="hidden" name="key" value="%entry_key;">
                          <input type="hidden" name="m" value="MOD_DATA_OK">
                          <input type="hidden" name="data" value="%e.data;">
                          <input type="hidden" name="s" value="%e.s;">
                          <input type="hidden" name="k" value="kkk">
                          <div class="d-flex flex-column px-1">
                            %if;(b.notextarea="yes" or e.data="fn" or e.data="sn" or e.data="place")
                              <input type="text" class="form-control flex-grow-1" id="nx_input" name="nx_input"
                                     maxlength="%if;(e.data="src" or e.data="occu" or e.data="place")1000%else;200%end;"
                                     value="%escape.printable.entry_value_unsort;" placeholder="%escape.printable.entry_value_unsort;"
                                     %if;(e.data!="fn" or e.data!="sn") autofocus%end; aria-label="Recipient's username" required>
                            %else;
                              <textarea class="form-control" id="nx_input" name="nx_input" rows="1"
                                        maxlength="%if;(e.data="src" or e.data="occu" or e.data="place")1000%else;200%end;"
                                        placeholder="%escape.printable.entry_value;"%if;(e.data!="fn" or e.data!="sn") autofocus%end; required>%escape.printable.entry_value;</textarea>
                            %end;
                            %(%if;(e.data="place" and suburb="")
                              <div class="custom-control custom-checkbox mx-md-2 pr-3">
                                %( TODO: wip rename all places %)
                                <input type="checkbox" class="custom-control-input ml-3" name="all" id="all" value="on" checked>
                                <label class="custom-control-label my-2" title="!! [*apply to same places with suburb] (WIP) !!"
                                       for="all">[*all]</label>
                              </div>
                            %end;%)
                            %if;(e.data="fn")
                              <div class="form-check form-check-inline ml-sm-2">
                                <label class="form-check-label">
                                  <input class="form-check-input w-auto" type="checkbox" id="first_name_aliases" name="first_name_aliases" value="yes"> [*add the previous name as a first name alias]
                                </label>
                              </div>
                            %end;
                            %if;(e.data="sn")
                              <div class="form-check form-check-inline mt-2 mt-sm-0 ml-sm-2">
                                <label class="form-check-label">
                                  <input class="form-check-input w-auto" type="checkbox" id="surname_aliases" name="surname_aliases" value="yes"> [*add the previous name as a surname alias]
                                </label>
                              </div>
                            %end;
                          </div>
                          <div class="valid-feedback">must be different!</div>
                        </div>
                        <button type="submit" class="btn btn-primary ml-2 my-sm-2" title="[*modify]">OK</button>
                      </form>
                      </div>
                    %end;
                  </div>
                </div>
              </li>
            %end;
          </ul>
        </li>
      %end;
    </ul>
  %else;
    <div class="alert alert-warning my-3">[*too much results]
      (> %if;(b.book_max_results!="")<abbr title="book_max_results">%b.book_max_results;</abbr>%else;%nb_max%end;).
      %if;(e.s!="")[*specify]%else;[*select a letter]%end;.</div>
  %end;
%base_trailer;
%include;copyr
</div>
%include;js
<script>
  document.addEventListener('DOMContentLoaded', function () {
    var navbarHeight = document.getElementById('fixed-nav').offsetHeight;
    var scrollPaddingTop = navbarHeight + 4;
    document.getElementById('book').style.scrollPaddingTop = scrollPaddingTop + 'px';
    
    const linkTrm = document.querySelectorAll('.sub-char');
    const linkAdd = document.querySelectorAll('.sup-char');
    let iTrm = -1;
    let iAdd = -1;
    document.addEventListener('keydown', (event) => {
      if (event.altKey && event.key === 't' || event.key === 't' && event.target.tagName.toLowerCase() !== 'input') {
        event.preventDefault();
        let len = linkTrm.length;
        if (iTrm === -1) {
          iTrm = len - 1;
          linkTrm[iTrm].focus();
        } else {
        linkTrm[iTrm].blur();
        iTrm = (iTrm + len - 1) % len;
        linkTrm[iTrm].focus();
        }
      }
      if (event.altKey && event.key === 'd' || event.key === 'd' && event.target.tagName.toLowerCase() !== 'input') {
        event.preventDefault();
        if (iAdd === -1) {
          iAdd = 0;
          linkAdd[iAdd].parentNode.focus();
        } else {
          linkAdd[iAdd].parentNode.blur();
          iAdd = (iAdd + 1) % linkAdd.length;
          linkAdd[iAdd].parentNode.focus();
        }
      }
    });
    document.querySelectorAll('.sup-char-div').forEach((div) => {
      div.addEventListener('keydown', (event) => {
        if (event.key === 'Enter') {
          const hyperlink = div.querySelector('a:first-child');
          if (hyperlink) {
            hyperlink.click();
          }
        }
      });
    });
  });

// Removing overlay when “key̛” parameter is present
document.addEventListener('DOMContentLoaded', function() {
    const urlParams = new URLSearchParams(window.location.search);
    if (urlParams.has('key') || (!urlParams.has('s1'))) {
        const overlay = document.getElementById('loading-overlay');
        if (overlay) { overlay.style.display = 'none'; }
    }
});

function autoSelectLink() {
    const urlParams = new URLSearchParams(window.location.search);
    if (urlParams.has('key') || (!urlParams.has('s1') && !urlParams.has('s2'))) return;
    const sParam = urlParams.get('s');
    const s1Param = urlParams.get('s1');
    const s2Param = urlParams.get('s2');
    const value = s1Param !== null && s1Param !== '' ? s1Param : sParam;
    if (s2Param) { localStorage.setItem('s2Tmp', decodeURIComponent(s2Param)); }
    if (value) {
        const link = Array.from(document.getElementsByTagName('a')).find(
            a => a.getAttribute('data-entry') === decodeURIComponent(value) && a.href.includes('key')
        );
        if (link) { link.click(); }
    }
}

function updateInputField() {
    const s2 = localStorage.getItem('s2Tmp');
    if (s2 && window.location.href.includes('key=')) {
        const input = document.getElementById('nx_input');
        if (input) {
            input.value = s2;
            localStorage.removeItem('s2Tmp');
        }
    }
}

window.addEventListener('load', autoSelectLink);
window.addEventListener('DOMContentLoaded', updateInputField);
</script>

%if;(e.s="")
<script>
// Highlight greek and cyrillic initials to avoid confusion with similar latin letters
const {regex} = Regex;
const scripts = ['Arabic', 'Armenian', 'Cyrillic', 'Ethiopic', 'Georgian', 'Greek', 'Hebrew', 'Khmer'];

function highlightNonLatinChars() {
  const divs = document.querySelectorAll('.sup-char-div');

  divs.forEach(div => {
    const link = div.querySelector('.sup-char');
    if (!link) return;

    const char = link.textContent.trim();

    scripts.forEach(script => {
      if (regex`\p{Script=${script}}`.test(char)) {
        scriptName = script.toLowerCase();
        div.classList.add(`${scriptName}-char`);
        link.title += ` (${scriptName})`;
      }
    });
  });
}
document.addEventListener('DOMContentLoaded', highlightNonLatinChars);
</script>
%end;
</body>
</html>
