Browse code

Refactor and rewrite as contao bundle

Benjamin Roth authored on04/11/2022 22:32:32
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,64 @@
1
+"use strict";
2
+
3
+exports.__esModule = true;
4
+exports.isObject = isObject;
5
+exports.extend = extend;
6
+exports.needsNavigation = needsNavigation;
7
+exports.needsPagination = needsPagination;
8
+exports.needsScrollbar = needsScrollbar;
9
+exports.uniqueClasses = uniqueClasses;
10
+
11
+function isObject(o) {
12
+  return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object;
13
+}
14
+
15
+function extend(target, src) {
16
+  Object.keys(src).forEach(function (key) {
17
+    if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
18
+      extend(target[key], src[key]);
19
+    } else {
20
+      target[key] = src[key];
21
+    }
22
+  });
23
+}
24
+
25
+function needsNavigation(params) {
26
+  if (params === void 0) {
27
+    params = {};
28
+  }
29
+
30
+  return params.navigation && typeof params.navigation.nextEl === 'undefined' && typeof params.navigation.prevEl === 'undefined';
31
+}
32
+
33
+function needsPagination(params) {
34
+  if (params === void 0) {
35
+    params = {};
36
+  }
37
+
38
+  return params.pagination && typeof params.pagination.el === 'undefined';
39
+}
40
+
41
+function needsScrollbar(params) {
42
+  if (params === void 0) {
43
+    params = {};
44
+  }
45
+
46
+  return params.scrollbar && typeof params.scrollbar.el === 'undefined';
47
+}
48
+
49
+function uniqueClasses(classNames) {
50
+  if (classNames === void 0) {
51
+    classNames = '';
52
+  }
53
+
54
+  var classes = classNames.split(' ').map(function (c) {
55
+    return c.trim();
56
+  }).filter(function (c) {
57
+    return !!c;
58
+  });
59
+  var unique = [];
60
+  classes.forEach(function (c) {
61
+    if (unique.indexOf(c) < 0) unique.push(c);
62
+  });
63
+  return unique.join(' ');
64
+}
0 65
\ No newline at end of file