{"size": 1158, "ext": "js", "max_stars_repo_path": "assets/js/moj/moj.modules/moj.dashboard.js", "max_stars_repo_name": "ministryofjustice/opg-lpa-front", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "assets/js/moj/moj.modules/moj.dashboard.js", "max_issues_repo_name": "ministryofjustice/opg-lpa-front", "max_issues_repo_issues_event_min_datetime": "2016-12-12T10:44:26.000Z", "max_issues_repo_issues_event_max_datetime": "2019-07-25T10:19:13.000Z", "max_forks_repo_path": "assets/js/moj/moj.modules/moj.dashboard.js", "max_forks_repo_name": "ministryofjustice/opg-lpa-front", "max_forks_repo_forks_event_min_datetime": "2016-04-07T16:42:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-11T06:42:35.000Z"}
{"max_stars_count": null, "max_issues_count": 19, "max_forks_count": 3, "avg_line_length": 27.5714285714, "max_line_length": 83, "alphanum_fraction": 0.518134715}
// Dependencies: moj, _, jQuery

(function () {
  'use strict';

  moj.Modules.Dashboard = {

    init: function () {
      this.changeMobileActions();
      this.searchFocus();
    },
    changeMobileActions: function(){
      // In list view on mobile, disable DETAILS and show all actions
      if (moj.Helpers.isMobileWidth()) {
        $('tr .lpa-actions').each(function(){
          $('.lpa-manage details', this).before($('.lpa-manage details ul', this));
          $('.lpa-manage details').addClass('hidden');
        });
      }
    },
    searchFocus:function(){
      // Add .focus class if there's text already there (on load)
      if ($('.js-search-focus').val() !== '') {
        $('.js-search-focus').addClass('focus');
      }
      // Add .focus class when input gets focus
      $('.js-search-focus').on('focus', function(){
        if (!$(this).hasClass('focus')){
          $(this).addClass('focus');
        }
      });
      // Remove .focus class if input is blurred
      $('.js-search-focus').on('blur', function(){
        if ($(this).val() === '') {
          $(this).removeClass('focus');
        }
      });
    }
  };
  
})();
