<commit_before>extends layout

block headers
  script(src="http://code.jquery.com/jquery-1.8.2.js")
  script(src="http://geographiclib.sf.net/scripts/geographiclib.js")
  script(src="#{host}/js/libplanconverter.js")

block content
  header
    h3 planconverterjs demo application
  #main
    form(id="upload_form",enctype='multipart/form-data')
      p
        | Load flight plan: 
        input(type='file', name='f')
        input(type='button', id="upload_button", value='Upload')

  #answer
    h3 flight plan
    #ans
    form(id="fp_form", action='#{host}/jsontopln', method='POST')
      p
        | FP type: 
        select(name='fs')
          option(value='fsx') fsx
          option(value='fs9') fs9
        br
        | Filename 
        input(type='text', name='fn', value='plan.pln')
        br
        input(type='hidden', name='fp', id='fp_form_fp')
        input(type='submit', id='fp_submit', value='Download')


  script(type="text/javascript").
    var global_fp = null;
    $("#upload_button").click(function() {
      $("#ans").html("")
      planconverterjs.get_data($("#upload_form")[0],
        function(fp,err) {
          if (err !== null) {
            alert("error");
          } else {
            $("#ans").append(fp.to_table("table"));
            var svurl = fp.to_skyvector_url();
            console.log(svurl);
            var linkelem = $('<a/>', { 'href' : svurl } )
            linkelem.text("Skyvector");
            $("#ans").append(linkelem);
            global_fp = fp;
          }
        }
      );
    });
    $("#fp_form").submit(function () {
      $("#fp_form_fp").val(JSON.stringify(global_fp));
    });<commit_msg>Remove debug print.<commit_after>extends layout

block headers
  script(src="http://code.jquery.com/jquery-1.8.2.js")
  script(src="http://geographiclib.sf.net/scripts/geographiclib.js")
  script(src="#{host}/js/libplanconverter.js")

block content
  header
    h3 planconverterjs demo application
  #main
    form(id="upload_form",enctype='multipart/form-data')
      p
        | Load flight plan: 
        input(type='file', name='f')
        input(type='button', id="upload_button", value='Upload')

  #answer
    h3 flight plan
    #ans
    form(id="fp_form", action='#{host}/jsontopln', method='POST')
      p
        | FP type: 
        select(name='fs')
          option(value='fsx') fsx
          option(value='fs9') fs9
        br
        | Filename 
        input(type='text', name='fn', value='plan.pln')
        br
        input(type='hidden', name='fp', id='fp_form_fp')
        input(type='submit', id='fp_submit', value='Download')


  script(type="text/javascript").
    var global_fp = null;
    $("#upload_button").click(function() {
      $("#ans").html("")
      planconverterjs.get_data($("#upload_form")[0],
        function(fp,err) {
          if (err !== null) {
            alert("error");
          } else {
            $("#ans").append(fp.to_table("table"));
            var svurl = fp.to_skyvector_url();
            var linkelem = $('<a/>', { 'href' : svurl } )
            linkelem.text("Skyvector");
            $("#ans").append(linkelem);
            global_fp = fp;
          }
        }
      );
    });
    $("#fp_form").submit(function () {
      $("#fp_form_fp").val(JSON.stringify(global_fp));
    });
{'fraction_non_alphanumeric': 0.18371670702179177, 'fraction_numerical': 0.004842615012106538, 'mean_word_length': 2.4002057613168724, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2528742', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1067, 'n_words': 165}