{"size": 2532, "ext": "js", "max_stars_repo_path": "app/assets/javascripts/wallaby/setup.js", "max_stars_repo_name": "reinteractive/wallaby", "max_stars_repo_stars_event_min_datetime": "2016-05-06T00:00:17.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-24T06:28:38.000Z", "max_issues_repo_path": "app/assets/javascripts/wallaby/setup.js", "max_issues_repo_name": "reinteractive-open/wallaby", "max_issues_repo_issues_event_min_datetime": "2019-10-24T15:57:53.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-14T17:21:44.000Z", "max_forks_repo_path": "app/assets/javascripts/wallaby/setup.js", "max_forks_repo_name": "reinteractive-open/wallaby", "max_forks_repo_forks_event_min_datetime": "2016-05-06T04:56:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-08-05T20:45:04.000Z"}
{"max_stars_count": 199, "max_issues_count": 35, "max_forks_count": 15, "avg_line_length": 34.6849315068, "max_line_length": 116, "alphanum_fraction": 0.5667456556}
/* global jQuery */

(function (jQuery) {
  'use strict';

  window.readyPrefix = function readyPrefix(namespace) {
    if (typeof Turbolinks === "object") {
      return "turbolinks:load" + namespace;
    } else {
      return "ready" + namespace;
    }
  }

  jQuery(document).off(readyPrefix('.wallaby')).on(readyPrefix('.wallaby'), function () {
    // for tooltip
    jQuery('[data-toggle="tooltip"]').tooltip({ container: 'body' })

    // for modal
    jQuery('#imodal').on('show.bs.modal', function (event) {
      var $button = jQuery(event.relatedTarget),
          $this = jQuery(this);
      $this.find('.modal-title').html($button.siblings('.modaler__title').html());
      $this.find('.modal-body').html($button.siblings('.modaler__body').html());
    })

    jQuery('.index').each(function() {
      // add styling for query input box
      jQuery('.query', this).each(function () {
        var $this = jQuery(this);
        jQuery('input:visible', this).on('focus.modifier', function () {
          $this.addClass('query--focus');
        }).on('blur', function () {
          $this.removeClass('query--focus');
        })
      })

      jQuery('.resources').each(function () {
        var $this = jQuery(this);

        // let's clone the actions, just for styling
        jQuery('.resources__data', this).each(function () {
          var $actions_table = jQuery('<table></table>').addClass('resources__actions'),
              $thead = jQuery('<thead><tr><th><span>&nbsp;</span></th></tr></thead>'),
              $tbody = jQuery('<tbody></tbody>'),
              $tr = jQuery('<tr></tr>');

          jQuery('.resource__actions', this).each(function () {
            $tbody.append($tr.clone().append(jQuery(this).clone()));
          })

          $actions_table.append($thead, $tbody);
          jQuery('> section', $this).append($actions_table);
        })

        // to show double arrows
        jQuery('.resources__container').on('scroll', function () {
          var $container = jQuery(this),
              $th = jQuery('.resources__actions thead th', $this),
              $data_table = jQuery('.resources__data', $this);

          $th.toggleClass('resources--backward', $container.scrollLeft() > 0);
          $th.toggleClass('resources--forward', $container.scrollLeft() + $container.width() < $data_table.width());
        }).trigger('scroll');
      })
    })

    if (CodeMirror) {
      CodeMirror.defaults.theme = "mdn-like";
      CodeMirror.defaults.lineNumbers = true;
    }
  })
})(jQuery);
