{"size": 1228, "ext": "js", "max_stars_repo_path": "js/tygh/order_management_events.js", "max_stars_repo_name": "threefoldtech/3node_marketplace", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "js/tygh/order_management_events.js", "max_issues_repo_name": "threefoldtech/3node_marketplace", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/tygh/order_management_events.js", "max_forks_repo_name": "threefoldtech/3node_marketplace", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 43.8571428571, "max_line_length": 155, "alphanum_fraction": 0.5912052117}
(function (_, $) {
  $.ceEvent('one', 'ce.commoninit', function () {
    $(document).on('click', '.select2-search__field', function (event) {
      var isMobile = $('body').hasClass('screen--xs') || $('body').hasClass('screen--xs-large') || $('body').hasClass('screen--sm');

      if (isMobile) {
        var self = $(event.target);
        var topBlock = $('.btn-bar.btn-toolbar.dropleft.pull-right');
        var offset = topBlock.offset().top + topBlock.height() - 15;
        $.scrollToElm('#product_add');
      }
    });
  });
  $.ceEvent('on', 'ce.formcheckfailed_om_cart_form', function ($form) {
    var $elemHavingError = $form.find('.order-management-options-content .control-group.error'),
        hasError = $elemHavingError.length > 0;

    if (hasError) {
      $elemHavingError.each(function () {
        var $parent = $(this).closest('td'),
            cart_id = $parent.find('[name="appearance[id]"]').val(),
            product_id = $parent.find("[name=\"cart_products[".concat(cart_id, "][product_id]\"]")).val(); //expand the list of options if validation error

        $form.find("#on_product_options_".concat(cart_id, "_").concat(product_id, ":visible")).click();
      });
    }
  });
})(Tygh, Tygh.$);