{"size": 1199, "ext": "js", "max_stars_repo_path": "lxpp/directives/scrollbar.js", "max_stars_repo_name": "FernandoFranco/lumx-pp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lxpp/directives/scrollbar.js", "max_issues_repo_name": "FernandoFranco/lumx-pp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lxpp/directives/scrollbar.js", "max_forks_repo_name": "FernandoFranco/lumx-pp", "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": 26.0652173913, "max_line_length": 108, "alphanum_fraction": 0.3869891576}
/**
 * Fernando Franco
 * Directive Scrollbar
 */
(function (angular) {
    'use strict';
    angular.module('lxpp').directive('lxScroll', lxScroll);

    lxScroll.$inject = ['$timeout'];

    function lxScroll($timeout) {
        return {
            link: _link,
            restrict: 'A'
        };

        ////////////////////////////////////////////////////////////////////////////////////////////////////

        function _link($scope, $element, $attrs, $ctrl, $transclude) {
            $scope.$watch(_checkWidthChange, _onResize);
            $scope.$watch(_checkHeightChange, _onResize);

            _init();

            ////////////////////////////////////////////////////////////////////////////////////////////////

            function _init() {
                $timeout(function() {
                    $element.scrollbar();
                }, 1000);
            }

            function _checkWidthChange() {
                return $element.width();
            }

            function _checkHeightChange() {
                return $element.height();
            }

            function _onResize() {
                $element.scrollbar();
            }
        }
    }
})(angular);