PageSourceSearch

https://www.logogenio.it/v2/js/scrollbars.js

js logogenio.it collected 2026-10-08 21:33:28 UTC 2,545 bytes, 101 lines download raw bytes

1/**
2 * ng-scrollbars 0.0.9
3 */
4(function () {
5  'use strict';
6
7  function ScrollBarsProvider() {
8    this.defaults = {
9      scrollButtons: {
10        enable: true //enable scrolling buttons by default
11      },
12      axis: 'yx' //enable 2 axis scrollbars by default
13    };
14
15    // TODO: can we do this without jquery?
16    $.mCustomScrollbar.defaults.scrollButtons = this.defaults.scrollButtons;
17    $.mCustomScrollbar.defaults.axis = this.defaults.axis;
18
19    this.$get = function ScrollBarsProvider() {
20      return {
21        defaults: this.defaults
22      }
23    }
24  }
25
26  function render(defaults, configuredDefaults, elem, scope) {
27    elem.mCustomScrollbar('destroy');
28
29    var config = {};
30    if (scope.ngScrollbarsConfig) {
31      config = scope.ngScrollbarsConfig;
32    }
33
34    // apply configured provider defaults only if the scope's config isn't defined (it has priority in that case)
35    for (var setting in defaults) {
36      if (defaults.hasOwnProperty(setting)) {
37
38        switch (setting) {
39
40          case 'scrollButtons':
41            if (!config.hasOwnProperty(setting)) {
42              configuredDefaults.scrollButtons = defaults[setting];
43            }
44            break;
45
46          case 'axis':
47            if (!config.hasOwnProperty(setting)) {
48              configuredDefaults.axis = defaults[setting];
49            }
50            break;
51
52          default:
53            if (!config.hasOwnProperty(setting)) {
54              config[setting] = defaults[setting];
55            }
56            break;
57
58        }
59      }
60    }
61
62    elem.mCustomScrollbar(config);
63  }
64
65  function ScrollBarsDirective(ScrollBars) {
66    return {
67      scope: {
68        ngScrollbarsConfig: '=?',
69        ngScrollbarsUpdate: '=?',
70        element: '=?'
71      },
72      link: function (scope, elem, attrs) {
73
74        scope.elem = elem;
75
76        var defaults = ScrollBars.defaults;
77        var configuredDefaults = $.mCustomScrollbar.defaults;
78
79        scope.ngScrollbarsUpdate = function () {
80          elem.mCustomScrollbar.apply(elem, arguments);
81        };
82
83        scope.$watch('ngScrollbarsConfig', function (newVal, oldVal) {
84          if (newVal !== undefined) {
85            render(defaults, configuredDefaults, elem, scope);
86          }
87        });
88
89        render(defaults, configuredDefaults, elem, scope);
90      }
91    };
92  }
93
94  angular.module('ngScrollbars', [])
95    .provider('ScrollBars', ScrollBarsProvider)
96    .directive('ngScrollbars', ScrollBarsDirective);
97
98  ScrollBarsProvider.$inject = [];
99  ScrollBarsDirective.$inject = ['ScrollBars'];
100
101})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.