well-waterfall 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/waterfall.js +1 -1
- package/package.json +1 -1
- package/src/waterfall.js +27 -11
package/dist/waterfall.js
CHANGED
|
@@ -136,7 +136,7 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem
|
|
|
136
136
|
\**************************/
|
|
137
137
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
138
138
|
|
|
139
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/bundle */ \"./node_modules/swiper/swiper-bundle.mjs\");\n/* harmony import */ var swiper_css_bundle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! swiper/css/bundle */ \"./node_modules/swiper/swiper-bundle.css\");\nconsole.log(\"🚿 Hello from Wellflow Waterfall\");\n\n\n\n\nconst sliders = [];\n\nfunction parseBool(attr) {\n return attr === \"true\";\n}\n\nfunction getAttrOrDefault(el, attrName, defaultValue) {\n return $(el).attr(attrName) || defaultValue;\n}\n\n$(\"[waterfall]\").each(function (index) {\n const $this = $(this);\n const name = getAttrOrDefault($this, \"waterfall\", `Swiper ${index}`);\n const debug = getAttrOrDefault($this, \"debugMode\", false);\n\n function printDebug(str, el) {\n if (!debug) return;\n console.log(str, \": \", el);\n }\n\n const swiperConfig = {\n slidesPerView: getAttrOrDefault($this, \"portraitSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"portraitCenteredSlides\", false)),\n direction: getAttrOrDefault($this, \"direction\", \"horizontal\"),\n loop: parseBool(getAttrOrDefault($this, \"loopMode\", false)),\n effect: getAttrOrDefault($this, \"effect\", \"slide\"),\n speed: parseInt(getAttrOrDefault($this, \"speed\", 700), 10),\n spaceBetween: parseInt(getAttrOrDefault($this, \"spaceBetween\", 0), 10),\n allowTouchMove: parseBool(getAttrOrDefault($this, \"allowTouchMove\", false)),\n breakpoints: {\n 478: {\n slidesPerView: getAttrOrDefault($this, \"landscapeSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"landscapeCenteredSlides\", false)),\n },\n 767: {\n slidesPerView: getAttrOrDefault($this, \"tabletSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"tabletCenteredSlides\", false)),\n },\n 991: {\n slidesPerView: getAttrOrDefault($this, \"slides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"centeredSlides\", false)),\n },\n }\n };\n\n
|
|
139
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/bundle */ \"./node_modules/swiper/swiper-bundle.mjs\");\n/* harmony import */ var swiper_css_bundle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! swiper/css/bundle */ \"./node_modules/swiper/swiper-bundle.css\");\nconsole.log(\"🚿 Hello from Wellflow Waterfall\");\n\n\n\n\nconst sliders = [];\n\nfunction parseBool(attr) {\n return attr === \"true\";\n}\n\nfunction getAttrOrDefault(el, attrName, defaultValue) {\n return $(el).attr(attrName) || defaultValue;\n}\n\n$(\"[waterfall]\").each(function (index) {\n const $this = $(this);\n const name = getAttrOrDefault($this, \"waterfall\", `Swiper ${index}`);\n const debug = getAttrOrDefault($this, \"debugMode\", false);\n\n function printDebug(str, el) {\n if (!debug) return;\n console.log(str, \": \", el);\n }\n\n const swiperConfig = {\n slidesPerView: getAttrOrDefault($this, \"portraitSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"portraitCenteredSlides\", false)),\n direction: getAttrOrDefault($this, \"direction\", \"horizontal\"),\n loop: parseBool(getAttrOrDefault($this, \"loopMode\", false)),\n effect: getAttrOrDefault($this, \"effect\", \"slide\"),\n speed: parseInt(getAttrOrDefault($this, \"speed\", 700), 10),\n spaceBetween: parseInt(getAttrOrDefault($this, \"spaceBetween\", 0), 10),\n allowTouchMove: parseBool(getAttrOrDefault($this, \"allowTouchMove\", false)),\n breakpoints: {\n 478: {\n slidesPerView: getAttrOrDefault($this, \"landscapeSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"landscapeCenteredSlides\", false)),\n },\n 767: {\n slidesPerView: getAttrOrDefault($this, \"tabletSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"tabletCenteredSlides\", false)),\n },\n 991: {\n slidesPerView: getAttrOrDefault($this, \"slides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"centeredSlides\", false)),\n },\n }\n };\n\n //------- Modules --------------------------------\n const autoplayMode = parseBool(getAttrOrDefault($this, \"autoplayMode\", false));\n printDebug(\"AUTOPLAY MODE\", autoplayMode);\n\n const paginationMode = parseBool(getAttrOrDefault($this, \"paginationMode\", false));\n printDebug(\"PAGINATION MODE\", paginationMode);\n\n const navigationMode = parseBool(getAttrOrDefault($this, \"navigationMode\", false));\n printDebug('NAVIGATION MODE', navigationMode);\n\n const scrollbarMode = parseBool(getAttrOrDefault($this, \"scrollbarMode\", false));\n printDebug(\"SCROLLBAR MODE\", scrollbarMode);\n\n\n\n // AUTOPLAY\n\n if (autoplayMode) {\n swiperConfig.autoplay = {\n delay: parseInt(getAttrOrDefault($this, \"delay\", 0), 10),\n disableOnInteraction: parseBool(getAttrOrDefault($this, \"disableOnInteraction\", false)),\n reverseDirection: parseBool(getAttrOrDefault($this, \"reverseDirection\", false)),\n pauseOnMouseEnter: parseBool(getAttrOrDefault($this, \"pauseOnMouseEnter\", false)),\n stopOnLastSlide: parseBool(getAttrOrDefault($this, \"stopOnLastSlide\", false)),\n };\n }\n\n // PAGINATION\n const paginationEl = $this.find(\"[waterfall-el='pagination']\")[0];\n printDebug(\"PAGINATION\", paginationEl);\n\n if (paginationMode) {\n swiperConfig.pagination = {\n el: paginationEl,\n clickable: parseBool(getAttrOrDefault($this, \"paginationClickable\", true)),\n bulletClass: $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"),\n bulletActiveClass: $this.find(\"[waterfall-pagination-active-class]\").attr(\"waterfall-pagination-active-class\"),\n type: \"bullets\",\n dynamicBullets: false,\n };\n }\n\n // NAVIGATION\n if (navigationMode) {\n swiperConfig.navigation = {\n nextEl: $this.find(\"[waterfall-el='next']\")[0],\n prevEl: $this.find(\"[waterfall-el='prev']\")[0],\n };\n printDebug(\"NEXT BUTTON\", swiperConfig.navigation.nextEl);\n printDebug(\"PREV BUTTON\", swiperConfig.navigation.prevEl);\n }\n\n // SCROLLBAR\n const scrollbarEl = $this.find(\"[waterfall-el='scrollbar']\")[0];\n printDebug(\"SCROLLBAR\", scrollbarEl);\n const scrollbarDrag = $(scrollbarEl).find(\"[waterfall-el='scrollbar-drag']\")[0];\n printDebug(\"SCROLLBAR DRAG\", scrollbarDrag);\n\n if (scrollbarMode) {\n swiperConfig.scrollbar = {\n dragClass: scrollbarDrag.attr(\"class\"),\n dragSize: \"auto\",\n draggable: false,\n el: \".\" + scrollbarEl.attr(\"class\"),\n enabled: true,\n hide: false,\n horizontalClass: \"swiper-scrollbar-horizontal\",\n lockClass: \"swiper-scrollbar-lock\",\n scrollbarDisabledClass: \"swiper-scrollbar-disabled\",\n snapOnRelease: false,\n verticalClass: \"swiper-scrollbar-vertical\",\n };\n }\n\n // Initialize swiper\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find(\".swiper\")[0], swiperConfig);\n\n sliders.push({ name, slider: swiper });\n});\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.js?");
|
|
140
140
|
|
|
141
141
|
/***/ }),
|
|
142
142
|
|
package/package.json
CHANGED
package/src/waterfall.js
CHANGED
|
@@ -48,8 +48,24 @@ $("[waterfall]").each(function (index) {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
//------- Modules --------------------------------
|
|
52
|
+
const autoplayMode = parseBool(getAttrOrDefault($this, "autoplayMode", false));
|
|
53
|
+
printDebug("AUTOPLAY MODE", autoplayMode);
|
|
54
|
+
|
|
55
|
+
const paginationMode = parseBool(getAttrOrDefault($this, "paginationMode", false));
|
|
56
|
+
printDebug("PAGINATION MODE", paginationMode);
|
|
57
|
+
|
|
58
|
+
const navigationMode = parseBool(getAttrOrDefault($this, "navigationMode", false));
|
|
59
|
+
printDebug('NAVIGATION MODE', navigationMode);
|
|
60
|
+
|
|
61
|
+
const scrollbarMode = parseBool(getAttrOrDefault($this, "scrollbarMode", false));
|
|
62
|
+
printDebug("SCROLLBAR MODE", scrollbarMode);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// AUTOPLAY
|
|
67
|
+
|
|
68
|
+
if (autoplayMode) {
|
|
53
69
|
swiperConfig.autoplay = {
|
|
54
70
|
delay: parseInt(getAttrOrDefault($this, "delay", 0), 10),
|
|
55
71
|
disableOnInteraction: parseBool(getAttrOrDefault($this, "disableOnInteraction", false)),
|
|
@@ -59,10 +75,11 @@ $("[waterfall]").each(function (index) {
|
|
|
59
75
|
};
|
|
60
76
|
}
|
|
61
77
|
|
|
62
|
-
//
|
|
78
|
+
// PAGINATION
|
|
63
79
|
const paginationEl = $this.find("[waterfall-el='pagination']")[0];
|
|
64
80
|
printDebug("PAGINATION", paginationEl);
|
|
65
|
-
|
|
81
|
+
|
|
82
|
+
if (paginationMode) {
|
|
66
83
|
swiperConfig.pagination = {
|
|
67
84
|
el: paginationEl,
|
|
68
85
|
clickable: parseBool(getAttrOrDefault($this, "paginationClickable", true)),
|
|
@@ -73,9 +90,7 @@ $("[waterfall]").each(function (index) {
|
|
|
73
90
|
};
|
|
74
91
|
}
|
|
75
92
|
|
|
76
|
-
//
|
|
77
|
-
const navigationMode = parseBool(getAttrOrDefault($this, "navigationMode", false));
|
|
78
|
-
printDebug('NAVIGATION', navigationMode);
|
|
93
|
+
// NAVIGATION
|
|
79
94
|
if (navigationMode) {
|
|
80
95
|
swiperConfig.navigation = {
|
|
81
96
|
nextEl: $this.find("[waterfall-el='next']")[0],
|
|
@@ -85,12 +100,13 @@ $("[waterfall]").each(function (index) {
|
|
|
85
100
|
printDebug("PREV BUTTON", swiperConfig.navigation.prevEl);
|
|
86
101
|
}
|
|
87
102
|
|
|
88
|
-
//
|
|
89
|
-
const scrollbarEl = $this.find("[waterfall-el='scrollbar']");
|
|
90
|
-
const scrollbarDrag = $(scrollbarEl).find("[waterfall-el='scrollbar-drag']");
|
|
103
|
+
// SCROLLBAR
|
|
104
|
+
const scrollbarEl = $this.find("[waterfall-el='scrollbar']")[0];
|
|
91
105
|
printDebug("SCROLLBAR", scrollbarEl);
|
|
106
|
+
const scrollbarDrag = $(scrollbarEl).find("[waterfall-el='scrollbar-drag']")[0];
|
|
92
107
|
printDebug("SCROLLBAR DRAG", scrollbarDrag);
|
|
93
|
-
|
|
108
|
+
|
|
109
|
+
if (scrollbarMode) {
|
|
94
110
|
swiperConfig.scrollbar = {
|
|
95
111
|
dragClass: scrollbarDrag.attr("class"),
|
|
96
112
|
dragSize: "auto",
|