Browse code

Refactor and rewrite as contao bundle

Benjamin Roth authored on04/11/2022 22:32:32
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,176 +0,0 @@
1
-"use strict";
2
-
3
-exports.__esModule = true;
4
-exports.default = void 0;
5
-
6
-var _dom = _interopRequireDefault(require("../../utils/dom"));
7
-
8
-var _utils = require("../../utils/utils");
9
-
10
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
-function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
13
-
14
-var Navigation = {
15
-  update: function update() {
16
-    // Update Navigation Buttons
17
-    var swiper = this;
18
-    var params = swiper.params.navigation;
19
-    if (swiper.params.loop) return;
20
-    var _swiper$navigation = swiper.navigation,
21
-        $nextEl = _swiper$navigation.$nextEl,
22
-        $prevEl = _swiper$navigation.$prevEl;
23
-
24
-    if ($prevEl && $prevEl.length > 0) {
25
-      if (swiper.isBeginning) {
26
-        $prevEl.addClass(params.disabledClass);
27
-      } else {
28
-        $prevEl.removeClass(params.disabledClass);
29
-      }
30
-
31
-      $prevEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
32
-    }
33
-
34
-    if ($nextEl && $nextEl.length > 0) {
35
-      if (swiper.isEnd) {
36
-        $nextEl.addClass(params.disabledClass);
37
-      } else {
38
-        $nextEl.removeClass(params.disabledClass);
39
-      }
40
-
41
-      $nextEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
42
-    }
43
-  },
44
-  onPrevClick: function onPrevClick(e) {
45
-    var swiper = this;
46
-    e.preventDefault();
47
-    if (swiper.isBeginning && !swiper.params.loop) return;
48
-    swiper.slidePrev();
49
-  },
50
-  onNextClick: function onNextClick(e) {
51
-    var swiper = this;
52
-    e.preventDefault();
53
-    if (swiper.isEnd && !swiper.params.loop) return;
54
-    swiper.slideNext();
55
-  },
56
-  init: function init() {
57
-    var swiper = this;
58
-    var params = swiper.params.navigation;
59
-    if (!(params.nextEl || params.prevEl)) return;
60
-    var $nextEl;
61
-    var $prevEl;
62
-
63
-    if (params.nextEl) {
64
-      $nextEl = (0, _dom.default)(params.nextEl);
65
-
66
-      if (swiper.params.uniqueNavElements && typeof params.nextEl === 'string' && $nextEl.length > 1 && swiper.$el.find(params.nextEl).length === 1) {
67
-        $nextEl = swiper.$el.find(params.nextEl);
68
-      }
69
-    }
70
-
71
-    if (params.prevEl) {
72
-      $prevEl = (0, _dom.default)(params.prevEl);
73
-
74
-      if (swiper.params.uniqueNavElements && typeof params.prevEl === 'string' && $prevEl.length > 1 && swiper.$el.find(params.prevEl).length === 1) {
75
-        $prevEl = swiper.$el.find(params.prevEl);
76
-      }
77
-    }
78
-
79
-    if ($nextEl && $nextEl.length > 0) {
80
-      $nextEl.on('click', swiper.navigation.onNextClick);
81
-    }
82
-
83
-    if ($prevEl && $prevEl.length > 0) {
84
-      $prevEl.on('click', swiper.navigation.onPrevClick);
85
-    }
86
-
87
-    (0, _utils.extend)(swiper.navigation, {
88
-      $nextEl: $nextEl,
89
-      nextEl: $nextEl && $nextEl[0],
90
-      $prevEl: $prevEl,
91
-      prevEl: $prevEl && $prevEl[0]
92
-    });
93
-  },
94
-  destroy: function destroy() {
95
-    var swiper = this;
96
-    var _swiper$navigation2 = swiper.navigation,
97
-        $nextEl = _swiper$navigation2.$nextEl,
98
-        $prevEl = _swiper$navigation2.$prevEl;
99
-
100
-    if ($nextEl && $nextEl.length) {
101
-      $nextEl.off('click', swiper.navigation.onNextClick);
102
-      $nextEl.removeClass(swiper.params.navigation.disabledClass);
103
-    }
104
-
105
-    if ($prevEl && $prevEl.length) {
106
-      $prevEl.off('click', swiper.navigation.onPrevClick);
107
-      $prevEl.removeClass(swiper.params.navigation.disabledClass);
108
-    }
109
-  }
110
-};
111
-var _default = {
112
-  name: 'navigation',
113
-  params: {
114
-    navigation: {
115
-      nextEl: null,
116
-      prevEl: null,
117
-      hideOnClick: false,
118
-      disabledClass: 'swiper-button-disabled',
119
-      hiddenClass: 'swiper-button-hidden',
120
-      lockClass: 'swiper-button-lock'
121
-    }
122
-  },
123
-  create: function create() {
124
-    var swiper = this;
125
-    (0, _utils.bindModuleMethods)(swiper, {
126
-      navigation: _extends({}, Navigation)
127
-    });
128
-  },
129
-  on: {
130
-    init: function init(swiper) {
131
-      swiper.navigation.init();
132
-      swiper.navigation.update();
133
-    },
134
-    toEdge: function toEdge(swiper) {
135
-      swiper.navigation.update();
136
-    },
137
-    fromEdge: function fromEdge(swiper) {
138
-      swiper.navigation.update();
139
-    },
140
-    destroy: function destroy(swiper) {
141
-      swiper.navigation.destroy();
142
-    },
143
-    click: function click(swiper, e) {
144
-      var _swiper$navigation3 = swiper.navigation,
145
-          $nextEl = _swiper$navigation3.$nextEl,
146
-          $prevEl = _swiper$navigation3.$prevEl;
147
-      var targetEl = e.target;
148
-
149
-      if (swiper.params.navigation.hideOnClick && !(0, _dom.default)(targetEl).is($prevEl) && !(0, _dom.default)(targetEl).is($nextEl)) {
150
-        if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
151
-        var isHidden;
152
-
153
-        if ($nextEl) {
154
-          isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
155
-        } else if ($prevEl) {
156
-          isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
157
-        }
158
-
159
-        if (isHidden === true) {
160
-          swiper.emit('navigationShow');
161
-        } else {
162
-          swiper.emit('navigationHide');
163
-        }
164
-
165
-        if ($nextEl) {
166
-          $nextEl.toggleClass(swiper.params.navigation.hiddenClass);
167
-        }
168
-
169
-        if ($prevEl) {
170
-          $prevEl.toggleClass(swiper.params.navigation.hiddenClass);
171
-        }
172
-      }
173
-    }
174
-  }
175
-};
176
-exports.default = _default;
177 0
\ No newline at end of file
Browse code

swiper.js version 6.5.0

Benjamin Roth authored on14/03/2021 15:29:46
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,176 @@
1
+"use strict";
2
+
3
+exports.__esModule = true;
4
+exports.default = void 0;
5
+
6
+var _dom = _interopRequireDefault(require("../../utils/dom"));
7
+
8
+var _utils = require("../../utils/utils");
9
+
10
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
13
+
14
+var Navigation = {
15
+  update: function update() {
16
+    // Update Navigation Buttons
17
+    var swiper = this;
18
+    var params = swiper.params.navigation;
19
+    if (swiper.params.loop) return;
20
+    var _swiper$navigation = swiper.navigation,
21
+        $nextEl = _swiper$navigation.$nextEl,
22
+        $prevEl = _swiper$navigation.$prevEl;
23
+
24
+    if ($prevEl && $prevEl.length > 0) {
25
+      if (swiper.isBeginning) {
26
+        $prevEl.addClass(params.disabledClass);
27
+      } else {
28
+        $prevEl.removeClass(params.disabledClass);
29
+      }
30
+
31
+      $prevEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
32
+    }
33
+
34
+    if ($nextEl && $nextEl.length > 0) {
35
+      if (swiper.isEnd) {
36
+        $nextEl.addClass(params.disabledClass);
37
+      } else {
38
+        $nextEl.removeClass(params.disabledClass);
39
+      }
40
+
41
+      $nextEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
42
+    }
43
+  },
44
+  onPrevClick: function onPrevClick(e) {
45
+    var swiper = this;
46
+    e.preventDefault();
47
+    if (swiper.isBeginning && !swiper.params.loop) return;
48
+    swiper.slidePrev();
49
+  },
50
+  onNextClick: function onNextClick(e) {
51
+    var swiper = this;
52
+    e.preventDefault();
53
+    if (swiper.isEnd && !swiper.params.loop) return;
54
+    swiper.slideNext();
55
+  },
56
+  init: function init() {
57
+    var swiper = this;
58
+    var params = swiper.params.navigation;
59
+    if (!(params.nextEl || params.prevEl)) return;
60
+    var $nextEl;
61
+    var $prevEl;
62
+
63
+    if (params.nextEl) {
64
+      $nextEl = (0, _dom.default)(params.nextEl);
65
+
66
+      if (swiper.params.uniqueNavElements && typeof params.nextEl === 'string' && $nextEl.length > 1 && swiper.$el.find(params.nextEl).length === 1) {
67
+        $nextEl = swiper.$el.find(params.nextEl);
68
+      }
69
+    }
70
+
71
+    if (params.prevEl) {
72
+      $prevEl = (0, _dom.default)(params.prevEl);
73
+
74
+      if (swiper.params.uniqueNavElements && typeof params.prevEl === 'string' && $prevEl.length > 1 && swiper.$el.find(params.prevEl).length === 1) {
75
+        $prevEl = swiper.$el.find(params.prevEl);
76
+      }
77
+    }
78
+
79
+    if ($nextEl && $nextEl.length > 0) {
80
+      $nextEl.on('click', swiper.navigation.onNextClick);
81
+    }
82
+
83
+    if ($prevEl && $prevEl.length > 0) {
84
+      $prevEl.on('click', swiper.navigation.onPrevClick);
85
+    }
86
+
87
+    (0, _utils.extend)(swiper.navigation, {
88
+      $nextEl: $nextEl,
89
+      nextEl: $nextEl && $nextEl[0],
90
+      $prevEl: $prevEl,
91
+      prevEl: $prevEl && $prevEl[0]
92
+    });
93
+  },
94
+  destroy: function destroy() {
95
+    var swiper = this;
96
+    var _swiper$navigation2 = swiper.navigation,
97
+        $nextEl = _swiper$navigation2.$nextEl,
98
+        $prevEl = _swiper$navigation2.$prevEl;
99
+
100
+    if ($nextEl && $nextEl.length) {
101
+      $nextEl.off('click', swiper.navigation.onNextClick);
102
+      $nextEl.removeClass(swiper.params.navigation.disabledClass);
103
+    }
104
+
105
+    if ($prevEl && $prevEl.length) {
106
+      $prevEl.off('click', swiper.navigation.onPrevClick);
107
+      $prevEl.removeClass(swiper.params.navigation.disabledClass);
108
+    }
109
+  }
110
+};
111
+var _default = {
112
+  name: 'navigation',
113
+  params: {
114
+    navigation: {
115
+      nextEl: null,
116
+      prevEl: null,
117
+      hideOnClick: false,
118
+      disabledClass: 'swiper-button-disabled',
119
+      hiddenClass: 'swiper-button-hidden',
120
+      lockClass: 'swiper-button-lock'
121
+    }
122
+  },
123
+  create: function create() {
124
+    var swiper = this;
125
+    (0, _utils.bindModuleMethods)(swiper, {
126
+      navigation: _extends({}, Navigation)
127
+    });
128
+  },
129
+  on: {
130
+    init: function init(swiper) {
131
+      swiper.navigation.init();
132
+      swiper.navigation.update();
133
+    },
134
+    toEdge: function toEdge(swiper) {
135
+      swiper.navigation.update();
136
+    },
137
+    fromEdge: function fromEdge(swiper) {
138
+      swiper.navigation.update();
139
+    },
140
+    destroy: function destroy(swiper) {
141
+      swiper.navigation.destroy();
142
+    },
143
+    click: function click(swiper, e) {
144
+      var _swiper$navigation3 = swiper.navigation,
145
+          $nextEl = _swiper$navigation3.$nextEl,
146
+          $prevEl = _swiper$navigation3.$prevEl;
147
+      var targetEl = e.target;
148
+
149
+      if (swiper.params.navigation.hideOnClick && !(0, _dom.default)(targetEl).is($prevEl) && !(0, _dom.default)(targetEl).is($nextEl)) {
150
+        if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
151
+        var isHidden;
152
+
153
+        if ($nextEl) {
154
+          isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
155
+        } else if ($prevEl) {
156
+          isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
157
+        }
158
+
159
+        if (isHidden === true) {
160
+          swiper.emit('navigationShow');
161
+        } else {
162
+          swiper.emit('navigationHide');
163
+        }
164
+
165
+        if ($nextEl) {
166
+          $nextEl.toggleClass(swiper.params.navigation.hiddenClass);
167
+        }
168
+
169
+        if ($prevEl) {
170
+          $prevEl.toggleClass(swiper.params.navigation.hiddenClass);
171
+        }
172
+      }
173
+    }
174
+  }
175
+};
176
+exports.default = _default;
0 177
\ No newline at end of file