<commit_before>/**
 * jspsych.js
 * <NAME>
 *
 * documentation: docs.jspsych.org
 *
 **/
window.jsPsych = (function() {

  var core = {};

  core.version = function() { return "6.3.0" };

  //
  // private variables
  //

  // options
  var opts = {};
  // experiment timeline
  var timeline;
  // flow control
  var global_trial_index = 0;
  var current_trial = {};
  var current_trial_finished = false;
  // target DOM element
  var DOM_container;
  var DOM_target;
  // time that the experiment began
  var exp_start_time;
  // is the experiment paused?
  var paused = false;
  var waiting = false;
  // done loading?
  var loaded = false;
  var loadfail = false;
  // is the page retrieved directly via file:// protocol (true) or hosted on a server (false)?
  var file_protocol = false;

  // storing a single webaudio context to prevent problems with multiple inits
  // of jsPsych
  core.webaudio_context = null;
  // temporary patch for Safari
  if (typeof window !== 'undefined' && window.hasOwnProperty('webkitAudioContext') && !window.hasOwnProperty('AudioContext')) {
    window.AudioContext = webkitAudioContext;
  }
  // end patch
  core.webaudio_context = (typeof window !== 'undefined' && typeof window.AudioContext !== 'undefined') ? new AudioContext() : null;

  // enumerated variables for special parameter types
  core.ALL_KEYS = 'allkeys';
  core.NO_KEYS = 'none';

  //
  // public methods
  //

  core.init = function(options) {
    function init() {
      if(typeof options.timeline === 'undefined'){
        console.error('No timeline declared in jsPsych.init. Cannot start experiment.')
      }
  
      if(options.timeline.length == 0){
        console.error('No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment.')
      }
  
      // reset variables
      timeline = null;
      global_trial_index = 0;
      current_trial = {};
      current_trial_finished = false;
      paused = false;
      waiting = false;
      loaded = false;
      loadfail = false;
      file_protocol = false;
      jsPsych.data.reset();
  
      var defaults = {
        'display_element': undefined,
        'on_finish': function(data) {
          return undefined;
        },
        'on_trial_start': function(trial) {
          return undefined;
        },
        'on_trial_finish': function() {
          return undefined;
        },
        'on_data_update': function(data) {
          return undefined;
        },
        'on_interaction_data_update': function(data){
          return undefined;
        },
        'on_close': function(){
          return undefined;
        },
        'use_webaudio': true,
        'exclusions': {},
        'show_progress_bar': false,
        'message_progress_bar': 'Completion Progress',
        'auto_update_progress_bar': true,        
        'default_iti': 0,
        'minimum_valid_rt': 0,
        'experiment_width': null,
        'override_safe_mode': false,
        'case_sensitive_responses': false
      };

      // detect whether page is running in browser as a local file, and if so, disable web audio and video preloading to prevent CORS issues
      if (window.location.protocol == 'file:' && (options.override_safe_mode === false || typeof options.override_safe_mode == 'undefined')) {
        options.use_webaudio = false;
        file_protocol = true;
        console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. "+
          "To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. "+
          "If you would like to override this setting, you can set 'override_safe_mode' to 'true' in jsPsych.init. "+
          "For more information, see: https://www.jspsych.org/overview/running-experiments");
      }

      // override default options if user specifies an option
      opts = Object.assign({}, defaults, options);<commit_msg>fix missing default value<commit_after>/**
 * jspsych.js
 * <NAME>
 *
 * documentation: docs.jspsych.org
 *
 **/
window.jsPsych = (function() {

  var core = {};

  core.version = function() { return "6.3.0" };

  //
  // private variables
  //

  // options
  var opts = {};
  // experiment timeline
  var timeline;
  // flow control
  var global_trial_index = 0;
  var current_trial = {};
  var current_trial_finished = false;
  // target DOM element
  var DOM_container;
  var DOM_target;
  // time that the experiment began
  var exp_start_time;
  // is the experiment paused?
  var paused = false;
  var waiting = false;
  // done loading?
  var loaded = false;
  var loadfail = false;
  // is the page retrieved directly via file:// protocol (true) or hosted on a server (false)?
  var file_protocol = false;

  // storing a single webaudio context to prevent problems with multiple inits
  // of jsPsych
  core.webaudio_context = null;
  // temporary patch for Safari
  if (typeof window !== 'undefined' && window.hasOwnProperty('webkitAudioContext') && !window.hasOwnProperty('AudioContext')) {
    window.AudioContext = webkitAudioContext;
  }
  // end patch
  core.webaudio_context = (typeof window !== 'undefined' && typeof window.AudioContext !== 'undefined') ? new AudioContext() : null;

  // enumerated variables for special parameter types
  core.ALL_KEYS = 'allkeys';
  core.NO_KEYS = 'none';

  //
  // public methods
  //

  core.init = function(options) {
    function init() {
      if(typeof options.timeline === 'undefined'){
        console.error('No timeline declared in jsPsych.init. Cannot start experiment.')
      }
  
      if(options.timeline.length == 0){
        console.error('No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment.')
      }
  
      // reset variables
      timeline = null;
      global_trial_index = 0;
      current_trial = {};
      current_trial_finished = false;
      paused = false;
      waiting = false;
      loaded = false;
      loadfail = false;
      file_protocol = false;
      jsPsych.data.reset();
  
      var defaults = {
        'display_element': undefined,
        'on_finish': function(data) {
          return undefined;
        },
        'on_trial_start': function(trial) {
          return undefined;
        },
        'on_trial_finish': function() {
          return undefined;
        },
        'on_data_update': function(data) {
          return undefined;
        },
        'on_interaction_data_update': function(data){
          return undefined;
        },
        'on_close': function(){
          return undefined;
        },
        'use_webaudio': true,
        'exclusions': {},
        'show_progress_bar': false,
        'message_progress_bar': 'Completion Progress',
        'auto_update_progress_bar': true,        
        'default_iti': 0,
        'minimum_valid_rt': 0,
        'experiment_width': null,
        'override_safe_mode': false,
        'case_sensitive_responses': false,
        'extensions': []
      };

      // detect whether page is running in browser as a local file, and if so, disable web audio and video preloading to prevent CORS issues
      if (window.location.protocol == 'file:' && (options.override_safe_mode === false || typeof options.override_safe_mode == 'undefined')) {
        options.use_webaudio = false;
        file_protocol = true;
        console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. "+
          "To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. "+
          "If you would like to override this setting, you can set 'override_safe_mode' to 'true' in jsPsych.init. "+
          "For more information, see: https://www.jspsych.org/overview/running-experiments");
      }

      // override default options if user specifies an option
      opts = Object.assign({}, defaults, options);
{'fraction_non_alphanumeric': 0.11125158027812895, 'fraction_numerical': 0.00202275600505689, 'mean_word_length': 2.5603060306030603, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1713249', 'n_tokens_mistral': 2285, 'n_tokens_neox': 2174, 'n_words': 675}