mod-build 4.0.2 → 4.0.3
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mod-build",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Share components for S3 sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "export NODE_ENV=qa.modernize.com IS_LOCAL=true && vite",
|
|
8
8
|
"build": "export NODE_ENV=modernize.com && vite build",
|
|
9
|
-
"preview": "export NODE_ENV=modernize.com && vite preview"
|
|
9
|
+
"preview": "export NODE_ENV=modernize.com && vite build && vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@rollup/plugin-inject": "^5.0.5",
|
|
13
12
|
"@vituum/vite-plugin-handlebars": "^1.1.0",
|
|
14
13
|
"axios": "^1.6.2",
|
|
15
|
-
"del": "^7.1.0",
|
|
16
|
-
"eslint": "^8.55.0",
|
|
17
14
|
"glob": "^10.3.10",
|
|
18
15
|
"gulp": "^4.0.2",
|
|
19
16
|
"gulp-handlebars-file-include": "^1.0.0",
|
|
20
17
|
"gulp-hash": "^4.2.2",
|
|
21
18
|
"gulp-replace": "^1.1.4",
|
|
22
19
|
"gulp-tap": "^2.0.0",
|
|
23
|
-
"husky": "^8.0.3",
|
|
24
20
|
"lodash.merge": "^4.6.2",
|
|
25
21
|
"lodash.mergewith": "^4.6.2",
|
|
26
22
|
"sass": "^1.69.5",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const preventRageClicks = (steps = '.step', swiperEl = '.swiper') => {
|
|
2
|
+
const $allButtons = document.querySelectorAll('button');
|
|
3
|
+
const $steps = document.querySelectorAll(steps);
|
|
4
|
+
const swiper = document.querySelector(swiperEl).swiper;
|
|
5
|
+
|
|
6
|
+
if ($allButtons && swiper && $steps) {
|
|
7
|
+
let isTransitionStart = false;
|
|
8
|
+
let clickHandler = (e) => {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
swiper.on('slideChange', () => {
|
|
14
|
+
isTransitionStart = true;
|
|
15
|
+
|
|
16
|
+
$allButtons.forEach((button) => {
|
|
17
|
+
button.addEventListener('click', clickHandler);
|
|
18
|
+
button.disabled = true;
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
swiper.on('slideChangeTransitionEnd', () => {
|
|
23
|
+
if (isTransitionStart) {
|
|
24
|
+
isTransitionStart = false;
|
|
25
|
+
|
|
26
|
+
$allButtons.forEach((button) => {
|
|
27
|
+
button.disabled = false;
|
|
28
|
+
button.removeEventListener('click', clickHandler);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
$steps.forEach((step) => {
|
|
32
|
+
step.classList.remove(window.modForm.opts.stepActiveCls);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
document
|
|
36
|
+
.querySelector(`${steps}.swiper-slide-active`)
|
|
37
|
+
.classList.add(window.modForm.opts.stepActiveCls);
|
|
38
|
+
|
|
39
|
+
document
|
|
40
|
+
.querySelector(`${steps}.step[aria-hidden="false"]`)
|
|
41
|
+
.focus();
|
|
42
|
+
|
|
43
|
+
swiper.update();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
package/src/scripts/globals.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useDynamicGtm } from './default/use-dynamic-gtm.js';
|
|
2
2
|
import { loadAdditionalAssets } from './default/additional-assets.js';
|
|
3
3
|
import { updateFooterLinkPaths } from './default/update-link-paths.js';
|
|
4
|
+
import { preventRageClicks } from './default/rage-clicking.js';
|
|
4
5
|
|
|
5
6
|
function globalFunctions(config) {
|
|
6
7
|
useDynamicGtm(config);
|
|
@@ -8,4 +9,4 @@ function globalFunctions(config) {
|
|
|
8
9
|
updateFooterLinkPaths();
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export { globalFunctions };
|
|
12
|
+
export { globalFunctions, preventRageClicks };
|