<commit_before>{% extends 'crike_django/lesson_base.html' %}
{% load staticfiles %}

{% block subcontent %}
<script>
  $(document).ready(function () {
    $('.step-links').hide();
    $('#FillForm').find( "input[name='answer']" ).focus();
  });

  var numoftry = 0;

  $(function(){
    var form = $('#FillForm');
    $('#counter').countdown({
       image: "{% static 'countdown/img/digits.png' %}",
       startTime: '01:00',
       timerEnd: function(){ 
        $('#popup')
        .html("<label style='font-size:300%'>时间到.. <i style='color:orange' class='fa fa-frown-o'></i></label>")
        .show()
        $('#overlay').show()
        $('<input>').attr({name:'num', value:numoftry, hidden:'true'}).appendTo(form);
        $('<input>').attr({name:'ret', value:'false', hidden:'true'}).appendTo(form);
        setTimeout( function () { $(form).submit(); }, 1000);
       },
       format: 'mm:ss'
    });
  });
 
  function onSubmit(e) {

    numoftry++;

    var form = $('#FillForm');
    var ques = $(form).find( "input[name='question']" ).prop('value');
    var ans = $(form).find( "input[name='answer']" ).prop('value');

    if (ques == ans)
    {
      e.preventDefault();
      $('#popup')
      .html("<label style='font-size:300%'><i style='color:green' class='fa fa-check'></i> 你真棒 <i style='color:orange' class='fa fa-smile-o'/></label>")
      .show()
      $('#overlay').show()
      $('<input>').attr({name:'num', value:numoftry, hidden:'true'}).appendTo(form);
      $('<input>').attr({name:'ret', value:'true', hidden:'true'}).appendTo(form);
      setTimeout( function () { $(form).submit(); }, 2000);
    } else {
      var showtimer = null;
      var cb = "$('#popup').hide();$('#overlay').hide()"
      e.preventDefault();
      $('#popup')
      .html("<label style='font-size:300%'><i style='color:red' class='fa fa-times'></i> 不对哦，再想一想 <i style='color:orange' class='fa fa-frown-o'/></label>")
      .show()
      $('#overlay').show()
      shotimer = setTimeout(cb, 2000)
      $('input[name="answer"]').prop('value', '');<commit_msg>Answer notice after three tries for lesson fill<commit_after>{% extends 'crike_django/lesson_base.html' %}
{% load staticfiles %}

{% block subcontent %}
<script>
  $(document).ready(function () {
    $('.step-links').hide();
    $('#FillForm').find( "input[name='answer']" ).focus();
  });

  var numoftry = 0;

  $(function(){
    var form = $('#FillForm');
    $('#counter').countdown({
       image: "{% static 'countdown/img/digits.png' %}",
       startTime: '01:00',
       timerEnd: function(){ 
        $('#popup')
        .html("<label style='font-size:300%'>时间到.. <i style='color:orange' class='fa fa-frown-o'></i></label>")
        .show()
        $('#overlay').show()
        $('<input>').attr({name:'num', value:numoftry, hidden:'true'}).appendTo(form);
        $('<input>').attr({name:'ret', value:'false', hidden:'true'}).appendTo(form);
        setTimeout( function () { $(form).submit(); }, 1000);
       },
       format: 'mm:ss'
    });
  });
 
  function onSubmit(e) {

    numoftry++;

    var form = $('#FillForm');
    var ques = $(form).find( "input[name='question']" ).prop('value');
    var ans = $(form).find( "input[name='answer']" ).prop('value');

    if (ques == ans)
    {
      e.preventDefault();
      $('#popup')
      .html("<label style='font-size:300%'><i style='color:green' class='fa fa-check'></i> 你真棒 <i style='color:orange' class='fa fa-smile-o'/></label>")
      .show()
      $('#overlay').show()
      $('<input>').attr({name:'num', value:numoftry, hidden:'true'}).appendTo(form);
      $('<input>').attr({name:'ret', value:'true', hidden:'true'}).appendTo(form);
      setTimeout( function () { $(form).submit(); }, 2000);
    } else {
      var showtimer = null;
      var cb = "$('#popup').hide();$('#overlay').hide()"
      e.preventDefault();
      if (numoftry < 3) {
        $('#popup')
        .html("<label style='font-size:300%'><i style='color:red' class='fa fa-times'></i> 不对哦，再想一想 <i style='color:orange' class='fa fa-frown-o'/></label>")
        .show();
      } else {
        $('#popup')
        .html("<label style='font-size:200%'>正确答案:<br>"+ques+ " </label>")
        .show();
      }
      $('#overlay').show()
      shotimer = setTimeout(cb, 2000)
      $('input[name="answer"]').prop('value', '');
{'fraction_non_alphanumeric': 0.25877192982456143, 'fraction_numerical': 0.012927054478301015, 'mean_word_length': 3.2522080471050048, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2371162', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1461, 'n_words': 250}