<!-- $Id: js.txt v7.1 04/11/2023 04:24:52 $ -->
%if;(evar.templ="")
  %if;(bvar.use_cdn="yes")
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
      integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" 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://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"
        integrity="sha512-4MvcHwcbqXKUHB6Lx3Zb5CEAVoE9u84qN+ZSMM6s7z8IeJriExrV3ND5zRze9mxNlABJ6k864P/Vl8m0Sd3DtQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
      <script src="https://cdn.jsdelivr.net/npm/maximize-select2-height@1.0/maximize-select2-height.min.js"
        integrity="sha512-NHHjSaRwEJ7OOPdQlvxa0gYbL9Np67IYbl+yJ3jDCTUxCCGKhCNlX77eacvuKmf4RszZBA8Elh71V26SKmElWA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    %end;
  %else;
    <script src="%static_path;js/jquery.min.js?version=3.7.1"></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?version=1.0.4"></script>
    %end;
  %end;
  %if;(e.m="A" and e.t="T" and e.t1="CT")
    <script src="%static_path;js/jquery.line.js"></script>
  %end;
  %if;(e.m!="MOD_DATA")
  <script>
    $('#load_once_p_mod').one('click', function() {
      $.getScript('%static_path;js/p_mod.min.js');
    });
    $('#load_once_copylink').one('click', function() {
      $.getScript('%static_path;js/copylink.js');
    });
  </script>
  %end;
  %if;wizard;
    %if;(e.m="MOD_DATA_OK" and e.data!="")
      <script>
        var htmlTitle = document.title;
        if (htmlTitle == "[*modification successful]" ||
            htmlTitle == "[*no modification]") {
          document.getElementById("reference").focus();
        }
      </script>
    %end;
    %if;(e.m="MOD_IND_OK" or e.m="MOD_FAM_OK"
       or e.m="ADD_FAM_OK" or e.m="DEL_FAM_OK"
       or e.m="SND_IMAGE_OK" or e.m="DEL_IMAGE_OK"
       or e.m="CHG_EVT_IND_ORD_OK" or e.m="CHG_EVT_FAM_ORD_OK"
       or e.m="CHG_CHN_OK"
       or (e.m="MOD_DATA_OK" and e.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%e.i;").focus();
        }
        else if (htmlTitle == "[*family modified]" ||
                 htmlTitle == "[*family added]"    ||
                 htmlTitle == "[*family deleted]"  ||
                 htmlTitle == "[*children's names changed]") {
            document.getElementById("i%e.ip;").focus();
        }
      </script>
    %end;
    %if;(e.m="MOD_IND" or e.m="MOD_IND_OK"
    or e.m="MOD_FAM" or e.m="MOD_FAM_OK"
    or e.m="ADD_FAM" or e.m="ADD_PAR" or e.m="ADD_FAM_OK")
      <script>$('body').scrollspy({ target: '#banner' })</script>
    %end;
  %end;
%end;
%if;(e.m="MOD_IND" or e.m="MOD_IND_OK"
    or e.m="MOD_FAM" or e.m="MOD_FAM_OK"
    or e.m="ADD_FAM" or e.m="ADD_PAR" or e.m="ADD_FAM_OK" or e.m="MOD_NOTES" or (e.m="MOD_DATA" and e.data="source"))
  %if;(b.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;(e.templ="")
<script><!-- focus on found autofocus input in opening BS modal -->
  $('.modal').on('shown.bs.modal', function() {
  $(this).find('[autofocus]').focus();
});
</script>
%end;
%if;((e.m="A" and e.t="H") or (e.m="D" and e.t="D"))
<script%if;(e.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;
