<commit_before>-# Common scripts and styles
= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.0/jquery.qtip.min.css"
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.0/jquery.qtip.min.js"

- blockly_path = "blockly/"
= stylesheet_link_tag "/#{blockly_path}css/common.css"
= stylesheet_link_tag "/#{blockly_path}css/#{app}.css"

= javascript_include_tag "/#{blockly_path}js/#{js_locale}/vendor.js"
= javascript_include_tag "/#{blockly_path}js/#{js_locale}/#{app}.js"

- @instructions = data_t('level.instructions', "#{@level.game.app}_#{@level.level_num}")
- @instructions ||= data_t('level.instructions', "#{@level.game.name}_#{@level.level_num}")

:javascript
  var nextRedirect;
  var sendReport = function(report) {
    var httpRequest = new XMLHttpRequest();
    httpRequest.onload = function() {
      var response = JSON.parse(httpRequest.responseText);
      nextRedirect = response['redirect'];
      if (report.onComplete) {
        report.onComplete(response);
      }
    };
    httpRequest.open('POST', '#{@callback}');
    httpRequest.setRequestHeader('Content-Type',
        'application/x-www-form-urlencoded');
    var query = [];
    for (var key in report) {
      query.push(key + '=' + report[key]);
    }
    query = query.join('&');
    httpRequest.send(query);
  };
  #{app}Main({
    locale: '#{js_locale}',
    containerId: 'blocklyApp',
    baseUrl: '#{root_url}#{blockly_path}',
    onAttempt: function(report) {
      sendReport(report);
    },
    onContinue: function() {
      if (nextRedirect) {
        window.location.href = nextRedirect;
      }
    },
    Dialog: Dialog,
    levelId: '#{@level.level_num}',
    level: {
      puzzle_number: #{@script_level ? @script_level.game_chapter : 1},
      stage_total: #{@level.game.levels.count},
      instructions: '#{escape_javascript(@instructions)}',
      #{start_blocks(current_user, @level)}
    },<commit_msg>Temporairly disable caching for mooc assets<commit_after>-# Common scripts and styles
= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.0/jquery.qtip.min.css"
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.0/jquery.qtip.min.js"

- blockly_path = "#{root_url}blockly/"
= stylesheet_link_tag "#{blockly_path}css/common.css"
= stylesheet_link_tag "#{blockly_path}css/#{app}.css"

= javascript_include_tag "#{blockly_path}js/#{js_locale}/vendor.js"
= javascript_include_tag "#{blockly_path}js/#{js_locale}/#{app}.js"

- @instructions = data_t('level.instructions', "#{@level.game.app}_#{@level.level_num}")
- @instructions ||= data_t('level.instructions', "#{@level.game.name}_#{@level.level_num}")

:javascript
  var nextRedirect;
  var sendReport = function(report) {
    var httpRequest = new XMLHttpRequest();
    httpRequest.onload = function() {
      var response = JSON.parse(httpRequest.responseText);
      nextRedirect = response['redirect'];
      if (report.onComplete) {
        report.onComplete(response);
      }
    };
    httpRequest.open('POST', '#{@callback}');
    httpRequest.setRequestHeader('Content-Type',
        'application/x-www-form-urlencoded');
    var query = [];
    for (var key in report) {
      query.push(key + '=' + report[key]);
    }
    query = query.join('&');
    httpRequest.send(query);
  };
  #{app}Main({
    locale: '#{js_locale}',
    containerId: 'blocklyApp',
    baseUrl: '#{blockly_path}',
    onAttempt: function(report) {
      sendReport(report);
    },
    onContinue: function() {
      if (nextRedirect) {
        window.location.href = nextRedirect;
      }
    },
    Dialog: Dialog,
    levelId: '#{@level.level_num}',
    level: {
      puzzle_number: #{@script_level ? @script_level.game_chapter : 1},
      stage_total: #{@level.game.levels.count},
      instructions: '#{escape_javascript(@instructions)}',
      #{start_blocks(current_user, @level)}
    },
{'fraction_non_alphanumeric': 0.17257318952234207, 'fraction_numerical': 0.004622496147919877, 'mean_word_length': 3.832506203473945, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1347250', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1336, 'n_words': 189}