<commit_before>"use strict";
(function($)
{
  var api_prefix = localStorage && localStorage.ftaPortalAPIEndpoint || 'https://api.ftaportal.dfat.gov.au/api/v2/json';
  
  // main api calling method
  $.invoke = function(url, callback, error)
  {
    var requestURL = api_prefix + url;
    $.getJSON(requestURL).done(function(data)
    {
      if (data.deprecated)
      {
        console.error(data.deprecated);
      }
      callback(data.results);
    }).error(error || function(){});
  };
  
  // common data items
  var hierarchy = null;
  var agreements = null;
  var startCallback = null;
  
  $.startExample = function(callback)
  {
    startCallback = callback;
    // wait for page to load
    $(document).ready(function()
    {
      // preload commonly used data items
      $.invoke('/version', function(dataVersion)
      {
        // Experimental feature.
        // Put data version before API access.
        // This will increase caching TTL when versions match or fail miserably.
        // TODO: Does not work for api.* host.
        // api_prefix = api_prefix.replace(/.au\/api/, '.au/' + dataVersion + '/api')
        $.invoke('/tariffs/agreements', function(agreements_)
        {
          agreements = agreements_;
          $.invoke('/tariffs/hierarchy', function(hierarchy_)
          {
            hierarchy = hierarchy_;
            (startCallback || function(){})(hierarchy, agreements);
          });
        });
      });
    });
  };
  
  // get common data items  <commit_msg>Re-enable experimental feature to see if it works.<commit_after>"use strict";
(function($)
{
  var api_prefix = localStorage && localStorage.ftaPortalAPIEndpoint || 'https://api.ftaportal.dfat.gov.au/api/v2/json';
  
  // main api calling method
  $.invoke = function(url, callback, error)
  {
    var requestURL = api_prefix + url;
    $.getJSON(requestURL).done(function(data)
    {
      if (data.deprecated)
      {
        console.error(data.deprecated);
      }
      callback(data.results);
    }).error(error || function(){});
  };
  
  // common data items
  var hierarchy = null;
  var agreements = null;
  var startCallback = null;
  
  $.startExample = function(callback)
  {
    startCallback = callback;
    // wait for page to load
    $(document).ready(function()
    {
      // preload commonly used data items
      $.invoke('/version', function(dataVersion)
      {
        // Optional experimental feature.
        // Put data version before API access.
        // This will increase caching TTL when versions match or fail miserably.
        api_prefix = api_prefix.replace(/.au\/api/, '.au/' + dataVersion + '/api')
        $.invoke('/tariffs/agreements', function(agreements_)
        {
          agreements = agreements_;
          $.invoke('/tariffs/hierarchy', function(hierarchy_)
          {
            hierarchy = hierarchy_;
            (startCallback || function(){})(hierarchy, agreements);
          });
        });
      });
    });
  };
  
  // get common data items  
{'fraction_non_alphanumeric': 0.13612217795484727, 'fraction_numerical': 0.0006640106241699867, 'mean_word_length': 2.267895878524946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1390331', 'n_tokens_mistral': 854, 'n_tokens_neox': 852, 'n_words': 205}