<commit_before>'use strict';

/**
 * @ngdoc function
 * @name ratemycoopApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * Controller of the ratemycoopApp
 */
angular.module('ratemycoopApp')
  .controller('MainCtrl', ['$scope', 'Company', '$location', 'User', 'deviceDetector', function ($scope, Company, $location, User, deviceDetector) {

    /**
     * Quick function check if logged in
     * @returns {boolean}
     */
    $scope.isLoggedIn = function () {
      return User.isAuthenticated();
    };

    // OMG API TO ACCESS STUFF SO EASY
    $scope.companies = Company.find({},
      function (success) {// Search trigger
        var searchable = [];
        angular.forEach(success, function (value) {
          var newVal = value;
          newVal['title'] = value.name;
          newVal['url'] = "/#/company/" + value.name;
          if (value.description && value.description.length >= 230) {
            newVal['description'] = value.description.substr(0, 230) + "...";
          }
          if (value.description === null) { // For when the desciption is null
            newVal['description'] = "";
          }
          if (newVal.verified) {
            searchable.push(newVal);
          }
        });
        $("#searchInput").search({
          source: searchable,
          onSelect: function (result, res) {
            $location.path("/company/" + result.name);
            $scope.$apply();
          }
        });

      }
    );


    /**
     * Check if browser is a mobile device
     * if so don't render the video
     * initially set it to false
     */
    $scope.video = {
      show: false
    };

    /**
     * if the device is not
     */
    if(!deviceDetector["raw"]["os"]["ios"] && !deviceDetector["raw"]["os"]["android"] && !deviceDetector["raw"]["os"]["windows-phone"]) {
      $scope.video.show = true;
    }



    /**
     * Searching Functionality
     */
    $scope.searchCompanyField = '';
    $scope.handleSearchChange = function () {
      if ($scope.searchCompanyField === '') {
        $('#mainSearch').css({'top': '50%'});
      } else {
        $('#mainSearch').css({'top': '20%'});
      }
    };

    /**
     * Semantic Triggers .ready() block.
     */
    $(document).ready(function () {
      $('#coopDefinition').popup({position: 'bottom center'});
      $('button').popup({position: 'bottom center'});

      $('#searchField').focus();


    });
  }]);
<commit_msg>Removed unnecessary newlines.<commit_after>'use strict';

/**
 * @ngdoc function
 * @name ratemycoopApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * Controller of the ratemycoopApp
 */
angular.module('ratemycoopApp')
  .controller('MainCtrl', ['$scope', 'Company', '$location', 'User', 'deviceDetector', function ($scope, Company, $location, User, deviceDetector) {

    /**
     * Quick function check if logged in
     * @returns {boolean}
     */
    $scope.isLoggedIn = function () {
      return User.isAuthenticated();
    };

    // OMG API TO ACCESS STUFF SO EASY
    $scope.companies = Company.find({},
      function (success) {// Search trigger
        var searchable = [];
        angular.forEach(success, function (value) {
          var newVal = value;
          newVal['title'] = value.name;
          newVal['url'] = "/#/company/" + value.name;
          if (value.description && value.description.length >= 230) {
            newVal['description'] = value.description.substr(0, 230) + "...";
          }
          if (value.description === null) { // For when the desciption is null
            newVal['description'] = "";
          }
          if (newVal.verified) {
            searchable.push(newVal);
          }
        });
        $("#searchInput").search({
          source: searchable,
          onSelect: function (result, res) {
            $location.path("/company/" + result.name);
            $scope.$apply();
          }
        });

      }
    );

    /**
     * Check if browser is a mobile device
     * if so don't render the video
     * initially set it to false
     */
    $scope.video = {
      show: false
    };

    /**
     * if the device is not
     */
    if(!deviceDetector["raw"]["os"]["ios"] && !deviceDetector["raw"]["os"]["android"] && !deviceDetector["raw"]["os"]["windows-phone"]) {
      $scope.video.show = true;
    }

    /**
     * Searching Functionality
     */
    $scope.searchCompanyField = '';
    $scope.handleSearchChange = function () {
      if ($scope.searchCompanyField === '') {
        $('#mainSearch').css({'top': '50%'});
      } else {
        $('#mainSearch').css({'top': '20%'});
      }
    };

    /**
     * Semantic Triggers .ready() block.
     */
    $(document).ready(function () {
      $('#coopDefinition').popup({position: 'bottom center'});
      $('button').popup({position: 'bottom center'});

      $('#searchField').focus();


    });
  }]);
{'fraction_non_alphanumeric': 0.17870332375871975, 'fraction_numerical': 0.004513746409519901, 'mean_word_length': 2.1862745098039214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2633934', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1437, 'n_words': 298}