<!-- $Id: js.txt v7.1 22/12/2022 07:15:46 $ -->
%if;(evar.templ="")
  %if;(bvar.use_cdn="yes")
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"
      integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/js/bootstrap.bundle.min.js" 
      integrity="sha512-igl8WEUuas9k5dtnhKqyyld6TzzRjvMqLC79jkgT3z02FvJyHAuUtyemm/P/jYSne1xwFI06ezQxEwweaiV7VA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    %if;(e.m="A" and e.t="")
      <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/js/select2.min.js"
      integrity="sha512-4MvcHwcbqXKUHB6Lx3Zb5CEAVoE9u84qN+ZSMM6s7z8IeJriExrV3ND5zRze9mxNlABJ6k864P/Vl8m0Sd3DtQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    %end;
  %else;
    <script src="%static_path;js/jquery.min.js?version=3.6.0"></script>
    <script src="%static_path;js/bootstrap.bundle.min.js?version=4.6.1"></script>
    %if;(e.m="A" and e.t="")
      <script src="%static_path;js/select2.min.js?version=4.1.0rc"></script>
      <script src="%static_path;js/select2-maximize-height.min.js"></script>
    %end;
  %end;
  %if;(evar.m!="MOD_DATA")
  <script>
    $('#load_once_p_mod').one('click', function() {
      $.getScript('%static_path;js/p_mod.js');
    });
    $('#load_once_copylink').one('click', function() {
      $.getScript('%static_path;js/copylink.js');
    });
  </script>
  %end;
  %if;wizard;
    %if;(evar.m="MOD_DATA_OK" and evar.data!="")
      <script>
        var htmlTitle = document.title;
        if (htmlTitle == "[*modification successful]" ||
            htmlTitle == "[*no modification]") {
          document.getElementById("reference").focus();
        }
      </script>
    %end;
    %if;(evar.m="MOD_IND_OK" or evar.m="MOD_FAM_OK"
       or evar.m="ADD_FAM_OK" or evar.m="DEL_FAM_OK"
       or evar.m="SND_IMAGE_OK" or evar.m="DEL_IMAGE_OK"
       or evar.m="CHG_EVT_IND_ORD_OK" or evar.m="CHG_EVT_FAM_ORD_OK"
       or evar.m="CHG_CHN_OK"
       or (evar.m="MOD_DATA_OK" and evar.data=""))
      <script>
        var htmlTitle = document.title;
        if (htmlTitle == "[*person modified]" ||
            htmlTitle == "[*person added]"    ||
            htmlTitle == "[*image received]"  ||
            htmlTitle == "[*image deleted]"   ||
            htmlTitle == "[*modification successful]") {
            document.getElementById("i%evar.i;").focus();
        }
        else if (htmlTitle == "[*family modified]" ||
                 htmlTitle == "[*family added]"    ||
                 htmlTitle == "[*family deleted]"  ||
                 htmlTitle == "[*children's names changed]") {
            document.getElementById("i%evar.ip;").focus();
        }
      </script>
    %end;
    %if;(evar.m="MOD_IND" or evar.m="MOD_IND_OK"
    or evar.m="MOD_FAM" or evar.m="MOD_FAM_OK"
    or evar.m="ADD_FAM" or evar.m="ADD_PAR" or evar.m="ADD_FAM_OK")
      <script>$('body').scrollspy({ target: '#banner' })</script>
    %end;
  %end;
%end;
%if;(evar.m="MOD_IND" or evar.m="MOD_IND_OK"
    or evar.m="MOD_FAM" or evar.m="MOD_FAM_OK"
    or evar.m="ADD_FAM" or evar.m="ADD_PAR" or evar.m="ADD_FAM_OK" or evar.m="MOD_NOTES" or (evar.m="MOD_DATA" and evar.data="source"))
  %if;(bvar.use_cdn="yes")
    <script src="https://cdnjs.cloudflare.com/ajax/libs/autosize.js/4.0.2/autosize.min.js" 
      integrity="sha384-gqYjRLBp7SeF6PCEz2XeqqNyvtxuzI3DuEepcrNHbrO+KG3woVNa/ISn/i8gGtW8" crossorigin="anonymous"></script>
  %else;
     <script src="%static_path;js/autosize.min.js?version=4.0.2"></script>
   %end;
  <script>autosize(document.querySelectorAll('textarea'));</script>
%end;
%if;(evar.templ="")
<script><!-- focus on found autofocus input in opening BS modal -->
  $('.modal').on('shown.bs.modal', function() {
  $(this).find('[autofocus]').focus();
});
</script>
%end;
%if;((evar.m="A" and evar.t="H") or (evar.m="D" and evar.t="D"))
<script%if;(evar.templ!="") type="text/javascript"%end;>
 <!--
   $("#btnshowfilter").on("click", function() {
    var nbinput = $('input.filter:text:disabled').length;
    if (nbinput == 5) {
      $('#input1').prop('disabled', false);
      $('#filterbysurname').removeClass("d-none");
      $('#total').addClass("text-muted");
      $('#input1').focus(); }
    else { 
      $('.filter').prop('disabled', true);
      $('#filterbysurname').addClass("d-none");
      $('#total').removeClass("text-muted"); }
  });
  $("#btnplus").on("click", function() {
    var len = $('.filter:text:not(:disabled)').length + 1;
    $('#input'+len).removeClass("d-none").prop('disabled', false).focus();
    if (len == 5) { $("#btnplus").addClass("disabled").attr('tabindex', '-1'); }
  });
  $("#btnclear").on("click", function() {
    $('.extrafilter').val('').addClass("d-none").prop('disabled', true);
    $('#input1').val('').focus();
    $('#btnplus').removeClass('disabled').removeAttr('tabindex');
    $('*[data-surname]').removeClass("d-none");
  });
  $('.filter').on("input", function(e) {
    var input1 = $("#input1").val();
    var input2 = $("#input2").val();
    var input3 = $("#input3").val();
    var input4 = $("#input4").val();
    var input5 = $("#input5").val();
    if (input1 == "") { var input1 = "_"; }
    $('[data-surname]').addClass("d-none");
    $('[data-surname*="' + input1 + '"]').removeClass("d-none");
    $('[data-surname*="' + input2 + '"]').removeClass("d-none");
    $('[data-surname*="' + input3 + '"]').removeClass("d-none");
    $('[data-surname*="' + input4 + '"]').removeClass("d-none");
    $('[data-surname*="' + input5 + '"]').removeClass("d-none");
  });
  function implex(xx) {
    $('[class^="sosa_"]').css("background-color","");
    $('.sosa_'+xx).add('.sosa_implex_'+xx).css("background-color","#CCFFFF");
  }
  function implexdesc(xx) {
    $('a[data-index]').css("background-color","");
    $('a[data-index="' + xx + '"]').css("background-color","#CCFFFF");
  }
  -->
</script>
%end;