@total_onion/onion-library 2.0.250 → 2.0.254
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/components/block-single-responsive-image-v3/single-responsive-image-v3.twig +1 -4
- package/components/component-buy-now-button-v3/buy-now-buttons-v3.twig +69 -0
- package/components/component-responsive-image-v3/responsive-image-v3.twig +26 -93
- package/components/component-responsive-picture-element-v3/responsive-picture-element-v3.twig +35 -0
- package/components/webc-counter-display/counter-display.css +2 -0
- package/components/webc-counter-display/counter-display.html +5 -0
- package/components/webc-counter-display/counter-display.js +30 -0
- package/components/webc-counter-display/index.html +30 -0
- package/components/webc-post-carousel-display-module/index.html +30 -0
- package/components/webc-post-carousel-display-module/post-carousel-display-module.css +36 -0
- package/components/webc-post-carousel-display-module/post-carousel-display-module.html +5 -0
- package/components/webc-post-carousel-display-module/post-carousel-display-module.js +48 -0
- package/components/webc-post-filter-module-no-group/index.html +30 -0
- package/components/webc-post-filter-module-no-group/post-filter-module-no-group.css +59 -0
- package/components/webc-post-filter-module-no-group/post-filter-module-no-group.html +13 -0
- package/components/webc-post-filter-module-no-group/post-filter-module-no-group.js +312 -0
- package/components/webc-ptfg-9000/index.html +9 -8
- package/components/webc-ptfg-9000/ptfg-9000.html +1 -1
- package/components/webc-ptfg-9000/ptfg-9000.js +2 -0
- package/package.json +2 -2
|
@@ -11,12 +11,9 @@
|
|
|
11
11
|
{{sectionStyles}}
|
|
12
12
|
}
|
|
13
13
|
</style>
|
|
14
|
-
<section
|
|
15
|
-
{{block.anchor ? "id=" ~ block.anchor : ''}} class="{{blockClassName}} {{fields.section_class}} {{classNameEntryPoint}} lazy-fade {{block.id}}" data-jsload="false" {{dataAttributeEntryPoint}} data-blockid="{{block.id}}" data-assetkey="{{blockClassName}}">
|
|
14
|
+
<section {{block.anchor ? "id=" ~ block.anchor : ''}} class="{{blockClassName}} {{fields.section_class}} {{classNameEntryPoint}} lazy-fade {{block.id}}" data-jsload="false" {{dataAttributeEntryPoint}} data-blockid="{{block.id}}" data-assetkey="{{blockClassName}}">
|
|
16
15
|
|
|
17
|
-
<!--pattern-replace-start:component/responsive-image -->
|
|
18
16
|
{{ include('components/responsive-image-v3.twig', { fields, block, blockClassName }, with_context = false) }}
|
|
19
|
-
<!--pattern-replace-end:component/responsive-image -->
|
|
20
17
|
|
|
21
18
|
{% if fields.animations.enable_animations %}
|
|
22
19
|
{{ include('components/animations-style-v3.twig', { fields, block, blockClassName }, with_context = false) }}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{% set product = post %}
|
|
2
|
+
{% set buyNowOptionSelect = product.meta('buy_now_option_select') %}
|
|
3
|
+
{% if buyNowOptionSelect|ru == 'link' %}
|
|
4
|
+
{% set productDirectLink = product.meta('direct_link') %}
|
|
5
|
+
{% set directLinkTarget = '_blank' %}
|
|
6
|
+
<a href="{{productDirectLink.url}}" class="{{blockClassName|default('default-class')}}__cta cmpl-cta-style-{{cta.cta_style|ru}}" target="{{directLinkTarget}}" title="{{productDirectLink.title}}">{{productDirectLink.title}}</a>
|
|
7
|
+
{% endif %}
|
|
8
|
+
{% if buyNowOptionSelect|ru == 'ctb' %}
|
|
9
|
+
{% if cta.cta_buy_now_text is not empty %}
|
|
10
|
+
{% set productCtbPimid = product.meta('click_to_buy_pim_id') %}
|
|
11
|
+
<a href="#" class="{{blockClassName|default('default-class')}}__cta cmpl-cta-style-{{cta.cta_style|ru}}" data-ctbuy data-ctbuy-variant="{{productCtbPimid}}" data-ctbuy-country="" data-ctbuy-lang="" data-ctbuy-default-view="" data-ctbuy-customquerystring="" data-ctbuy-direct-link="" title="{{cta.cta_buy_now_text}}">{{cta.cta_buy_now_text}}</a>
|
|
12
|
+
{% endif %}
|
|
13
|
+
{% endif %}
|
|
14
|
+
{% if buyNowOptionSelect|ru == "ctb-pricespider" %}
|
|
15
|
+
{% set enablePricespider = attribute(market_settings['e-shop_settings'], 'enable_pricespider') %}
|
|
16
|
+
{% set productCtbPriceSpicerSku = product.meta('pricespider_sku_id') %}
|
|
17
|
+
{% if enablePricespider and productCtbPriceSpicerSku is not empty %}
|
|
18
|
+
<a class="ps-widget {{blockClassName|default('default-class')}}__cta cmpl-cta-style-{{cta.cta_style|ru}}" ps-sku="{{productCtbPriceSpicerSku}}"></a>
|
|
19
|
+
{% endif %}
|
|
20
|
+
{% endif %}
|
|
21
|
+
{% if buyNowOptionSelect|ru == 'wtb' %}
|
|
22
|
+
{% if cta.cta_buy_now_text is not empty %}
|
|
23
|
+
{% set productPimDebrainId = product.meta('debrain_pim_id') %}
|
|
24
|
+
<a href="#" class="dloc-link {{blockClassName|default('default-class')}}__cta cmpl-cta-style-{{cta.cta_style|ru}}" data-action="where-to-buy" data-filter="{{productPimDebrainId}}">{{cta.cta_buy_now_text}}</a>
|
|
25
|
+
{% endif %}
|
|
26
|
+
{% endif %}
|
|
27
|
+
{% if buyNowOptionSelect|ru == 'wtb-v2' %}
|
|
28
|
+
{% set productDebrainSkuId = product.meta('debrain_sku_id') %}
|
|
29
|
+
{% if productDebrainSkuId is not empty %}
|
|
30
|
+
<wtb-button sku={{productDebrainSkuId}} class="{{blockClassName|default('default-class')}}__cta cmpl-cta-style-{{cta.cta_style|ru}}">{{cta.cta_buy_now_text}}</wtb-button>
|
|
31
|
+
{% endif %}
|
|
32
|
+
{% endif %}
|
|
33
|
+
{% if buyNowOptionSelect|ru == 'mikmak' %}
|
|
34
|
+
{% set productEANs = product.meta('mikmak_ean_ids') %}
|
|
35
|
+
{% set relatedProducts = product.meta('related_products') %}
|
|
36
|
+
{% set drawer_widget_id = attribute(market_settings['e-shop_settings'], 'mikmak_ctb_drawer_widget_id') %}
|
|
37
|
+
|
|
38
|
+
{% set relatedProductEANs = '' %}
|
|
39
|
+
{% for post in relatedProducts %}
|
|
40
|
+
{% set relatedProduct = get_post(post) %}
|
|
41
|
+
{% set relatedProductEANs = relatedProductEANs ~ ',' ~ relatedProduct.meta('mikmak_ean_ids')|trim(',') %}
|
|
42
|
+
{% endfor %}
|
|
43
|
+
{% set relatedProductEANs = relatedProductEANs|trim(',') %}
|
|
44
|
+
|
|
45
|
+
{% if productEANs is not empty and drawer_widget_id is not empty %}
|
|
46
|
+
{% set totalProductEANs = productEANs ~ (relatedProductEANs is not empty ? ',' ~ relatedProductEANs : '') %}
|
|
47
|
+
<a href="#" data-mm-wtbid="{{drawer_widget_id}}" data-mm-ids="{{totalProductEANs}}" class="{{blockClassName|default('default-class')}}__cta cmpl-cta-style-{{cta.cta_style|ru}} mikmak-buy-now">{{cta.cta_buy_now_text}}</a>
|
|
48
|
+
{% endif %}
|
|
49
|
+
{% endif %}
|
|
50
|
+
{% if buyNowOptionSelect|ru == 'reservebar' %}
|
|
51
|
+
{% if cta.cta_buy_now_text is not empty %}
|
|
52
|
+
{% set reserveBarLiquidId = product.meta('reserve_bar_liquid_grouping_id') %}
|
|
53
|
+
<a href="#" class="{{blockClassName|default('default-class')}}__cta cmpl-cta-style-{{cta.cta_style|ru}} reservebar-popup-trigger" reservebar-liquid-id="{{reserveBarLiquidId}}">{{cta.cta_buy_now_text}}</a>
|
|
54
|
+
{% endif %}
|
|
55
|
+
{% endif %}
|
|
56
|
+
{% if buyNowOptionSelect|ru == 'shopify' %}
|
|
57
|
+
{% if product.shopify_id is not empty %}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
<div class="shopify-wrapper shopify-integration has-shop shop-shopify" data-extraclasses="{{style_classes}}" data-pim="{{product.shopify_id}}" data-label="{{product.meta.buy_now_button_text|default("Add to cart")}}" data-cask-name="{{product.cask_name}}" data-vol="{{product.volume}}"></div>
|
|
61
|
+
{% endif %}
|
|
62
|
+
{% if product.shopify_id_engraved is not empty %}
|
|
63
|
+
|
|
64
|
+
<div class="shopify-wrapper shopify-integration has-shop shop-shopify engraved" data-extraclasses="{{style_classes}}" data-pim="{{product.shopify_id_engraved}}" data-label="{{product.buy_now_button_text_alt|default(" buy engraved")}}" data-cask-name="{{product.cask_name}}" data-vol="{{product.volume}}"></div>
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
{% endif %}
|
|
68
|
+
|
|
69
|
+
{% endif %}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{% if fields.enable_image|default(fields.image_enabled) %}
|
|
2
|
-
{% set renderDynamic = fields.child_patterns.render_dynamic|default(0) %}
|
|
3
|
-
{% set suffix = fields.child_patterns.suffix %}
|
|
4
|
-
|
|
5
|
-
{% set desktopType = fields.desktop_image_aspect_ratio|ru|default('original') %}
|
|
6
|
-
{% set tabletType = fields.tablet_image_aspect_ratio|ru|default('original') %}
|
|
7
|
-
{% set mobileType = fields.mobile_image_aspect_ratio|ru|default('original') %}
|
|
8
2
|
|
|
9
3
|
{% set desktopImage = get_image(fields.desktop_image) %}
|
|
10
4
|
{% set tabletImage = get_image(fields.tablet_image)|default(desktopImage) %}
|
|
11
5
|
{% set mobileImage = get_image(fields.mobile_image) %}
|
|
12
6
|
|
|
7
|
+
{% set renderDynamic = fields.child_patterns.render_dynamic|default(0) %}
|
|
8
|
+
{% set suffix = fields.child_patterns.suffix %}
|
|
9
|
+
|
|
10
|
+
{% set selectedAspectRatioDesktop = fields.desktop_custom_aspect_ratio|default(desktopImage.width ~ '/' ~ desktopImage.height)|replace({'/' : 'x', ':' : 'x'}) %}
|
|
11
|
+
{% set selectedAspectRatioTablet = fields.tablet_custom_aspect_ratio|default(desktopImage.width ~ '/' ~ desktopImage.height)|replace({'/' : 'x', ':' : 'x'}) %}
|
|
12
|
+
{% set selectedAspectRatioMobile = fields.mobile_custom_aspect_ratio|default(desktopImage.width ~ '/' ~ desktopImage.height)|replace({'/' : 'x', ':' : 'x'}) %}
|
|
13
|
+
|
|
13
14
|
{% set imageSizes = fields.custom_image_sizes %}
|
|
14
|
-
{% set sizes = imageSizes|default('(min-width: 1440px) 100vw, (min-width: 1024px) 1024px, (min-width: 768px) 768px, (min-width: 500px) 100vw, 250px') %}
|
|
15
|
+
{% set sizes = imageSizes|default('auto, (min-width: 1440px) 100vw, (min-width: 1024px) 1024px, (min-width: 768px) 768px, (min-width: 500px) 100vw, 250px') %}
|
|
15
16
|
|
|
16
17
|
{% set imageFitStyle = '--image-fit-style:' ~ (fields.image_fit_style|ru|default('cover')) ~ ';' %}
|
|
17
18
|
{% set imageObjectPositionAlign = '--image-object-position-align:' ~ (fields.image_object_position_align|ru) ~ ';' %}
|
|
@@ -23,9 +24,6 @@
|
|
|
23
24
|
{% set imagePosition = '--image-position:' ~ fields.image_position|ru ~ ';' %}
|
|
24
25
|
{% set imageGridArea = '--image-grid-area:' ~ fields.image_grid_area|ru|default('main') ~ ';' %}
|
|
25
26
|
{% set imageBorderRadius = '--image-border-radius:' ~ fields.image_border_radius ~ ';' %}
|
|
26
|
-
{% set imageAspectRatioDesktop = '--image-aspect-ratio-desktop:' ~ fields.image_aspect_ratio_desktop ~ ';' %}
|
|
27
|
-
{% set imageAspectRatioPortrait = '--image-aspect-ratio-portrait:' ~ fields.image_aspect_ratio_portrait ~ ';' %}
|
|
28
|
-
{% set imageAspectRatioMobile = '--image-aspect-ratio-mobile:' ~ fields.image_aspect_ratio_mobile ~ ';' %}
|
|
29
27
|
{% set imageOffsetVert = '--image-offset-vert:' ~ fields.image_offset_vertical ~ '%;' %}
|
|
30
28
|
{% set imageOffsetHoriz = '--image-offset-horiz:' ~ fields.image_offset_horizontal ~ '%;' %}
|
|
31
29
|
{% set enableImageBorder = fields.enable_image_border %}
|
|
@@ -41,98 +39,33 @@
|
|
|
41
39
|
{% set pictureStylesString = imageFitStyle ~ imageObjectPositionAlign ~ imageWidth ~ imageWidthMobile ~ imageWidthPortrait ~ imageOpacity ~ imageAspectRatioDesktop ~ imageAspectRatioPortrait ~ imageAspectRatioMobile ~ imageOffsetVert ~ imageOffsetHoriz ~ imageBorderRadius ~ imagePosition ~ imageGridArea ~ imageMinHeightMobile ~ imageMinHeightDesktop ~ subtractHeaderHeight ~ imageZIndex %}
|
|
42
40
|
{% set enableEagerLoading = fields.enable_eager_image_loading ? 'loading="eager" fetchpriority="high"' : 'loading="lazy"' %}
|
|
43
41
|
|
|
44
|
-
{% set selectedAspectRatioDesktop = fields.desktop_image_aspect_ratio|ru %}
|
|
45
|
-
{% set selectedAspectRatioTablet = fields.tablet_image_aspect_ratio|ru %}
|
|
46
|
-
{% set selectedAspectRatioMobile = fields.mobile_image_aspect_ratio|ru %}
|
|
47
|
-
|
|
48
|
-
{% if selectedAspectRatioDesktop == 'original' %}
|
|
49
|
-
{% set isSVG = desktopImage.post_mime_type == 'image/svg+xml' %}
|
|
50
|
-
{% set selectedAspectRatioDesktop = null %}
|
|
51
|
-
{% set mainImageSrc = isSVG ? desktopImage.src : gt_image_mainsrc(desktopImage) %}
|
|
52
|
-
{% set desktopSrcset = isSVG ? desktopImage.src : gt_image_srcset(desktopImage) %}
|
|
53
|
-
{% elseif selectedAspectRatioDesktop == 'custom_aspect_ratio' %}
|
|
54
|
-
{% set isSVG = desktopImage.post_mime_type == 'image/svg+xml' %}
|
|
55
|
-
{% set customAspectRatio = fields.desktop_custom_aspect_ratio %}
|
|
56
|
-
{% set mainImageSrc = isSVG ? desktopImage.src : gt_image_mainsrc(desktopImage, {"aspect_ratio": customAspectRatio|replace({'/' : 'x', ':' : 'x'})}) %}
|
|
57
|
-
{% set desktopSrcset = isSVG ? desktopImage.src : gt_image_srcset(desktopImage, {"aspect_ratio": customAspectRatio|replace({'/' : 'x', ':' : 'x'})}) %}
|
|
58
|
-
{% else %}
|
|
59
|
-
{% set isSVG = desktopImage.post_mime_type == 'image/svg+xml' %}
|
|
60
|
-
{% set mainImageSrc = isSVG ? desktopImage.src : gt_image_mainsrc(desktopImage, {"aspect_ratio" : selectedAspectRatioDesktop}) %}
|
|
61
|
-
{% set desktopSrcset = isSVG ? desktopImage.src : gt_image_srcset(desktopImage, {"aspect_ratio" : selectedAspectRatioDesktop}) %}
|
|
62
|
-
{% endif %}
|
|
63
|
-
|
|
64
|
-
{% if selectedAspectRatioTablet == 'original' %}
|
|
65
|
-
{% set isSVG = tabletImage.post_mime_type == 'image/svg+xml' %}
|
|
66
|
-
{% set selectedAspectRatioTablet = null %}
|
|
67
|
-
{% set tabletSrcset = isSVG ? tabletImage.src : gt_image_srcset(tabletImage)%}
|
|
68
|
-
{% elseif selectedAspectRatioTablet == 'custom_aspect_ratio' %}
|
|
69
|
-
{% set isSVG = tabletImage.post_mime_type == 'image/svg+xml' %}
|
|
70
|
-
{% set customAspectRatio = fields.tablet_custom_aspect_ratio %}
|
|
71
|
-
{% set mainImageSrc = isSVG ? tabletImage.src : gt_image_mainsrc(tabletImage, {"aspect_ratio": customAspectRatio|replace({'/' : 'x', ':' : 'x'})}) %}
|
|
72
|
-
{% set tabletSrcset = isSVG ? tabletImage.src : gt_image_srcset(tabletImage, {"aspect_ratio": customAspectRatio|replace({'/' : 'x', ':' : 'x'})}) %}
|
|
73
|
-
{% else %}
|
|
74
|
-
{% set isSVG = tabletImage.post_mime_type == 'image/svg+xml' %}
|
|
75
|
-
{% set tabletSrcset = isSVG ? tabletImage.src : gt_image_srcset(tabletImage, {"aspect_ratio" : selectedAspectRatioTablet})%}
|
|
76
|
-
{% endif %}
|
|
77
|
-
|
|
78
|
-
{% if selectedAspectRatioMobile == 'original' %}
|
|
79
|
-
{% set isSVG = mobileImage.post_mime_type == 'image/svg+xml' %}
|
|
80
|
-
{% set selectedAspectRatioMobile = null %}
|
|
81
|
-
{% set mobileSrcset = isSVG ? mobileImage.src : gt_image_srcset(mobileImage) %}
|
|
82
|
-
{% elseif selectedAspectRatioMobile == 'custom_aspect_ratio' %}
|
|
83
|
-
{% set isSVG = mobileImage.post_mime_type == 'image/svg+xml' %}
|
|
84
|
-
{% set customAspectRatio = fields.mobile_custom_aspect_ratio %}
|
|
85
|
-
{% set mainImageSrc = isSVG ? mobileImage.src : gt_image_mainsrc(mobileImage, {"aspect_ratio": customAspectRatio|replace({'/' : 'x', ':' : 'x'})}) %}
|
|
86
|
-
{% set mobileSrcset = isSVG ? mobileImage.src : gt_image_srcset(mobileImage, {"aspect_ratio": customAspectRatio|replace({'/' : 'x', ':' : 'x'})}) %}
|
|
87
|
-
{% else %}
|
|
88
|
-
{% set isSVG = mobileImage.post_mime_type == 'image/svg+xml' %}
|
|
89
|
-
{% set mobileSrcset = isSVG ? mobileImage.src : gt_image_srcset(mobileImage, {"aspect_ratio" : selectedAspectRatioMobile})%}
|
|
90
|
-
{% endif %}
|
|
91
42
|
{% set parallaxEnabled = fields.parallax_enabled %}
|
|
92
43
|
{% if parallaxEnabled %}
|
|
93
44
|
{% set parallaxDepth = 'data-depth=' ~ fields.parallax_depth ~ " " %}
|
|
94
45
|
{% set parallaxOffsetY = 'data-y-offset=' ~ fields.parallax_offset_y ~ " " %}
|
|
95
46
|
{% endif %}
|
|
47
|
+
{% set picture_id = block.id %}
|
|
96
48
|
|
|
97
49
|
<style>
|
|
98
|
-
.{{
|
|
50
|
+
.single-responsive-image-v3__picture.{{picture_id|default(block.id)}}{
|
|
99
51
|
{{pictureStylesString}}
|
|
100
52
|
{{imageBorderString}}
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{% endif %}
|
|
108
|
-
|
|
109
|
-
{% if selectedAspectRatioTablet == 'custom_aspect_ratio' %}
|
|
110
|
-
--image-aspect-ratio-portrait: {{fields.tablet_custom_aspect_ratio}}
|
|
111
|
-
;
|
|
112
|
-
{% elseif selectedAspectRatioTablet %}
|
|
113
|
-
--image-aspect-ratio-portrait: {{selectedAspectRatioTablet|replace({'x': '/'})}}
|
|
114
|
-
;
|
|
115
|
-
{% endif %}
|
|
116
|
-
|
|
117
|
-
{% if selectedAspectRatioMobile == 'custom_aspect_ratio' %}
|
|
118
|
-
--image-aspect-ratio-mobile: {{fields.mobile_custom_aspect_ratio}}
|
|
119
|
-
;
|
|
120
|
-
{% elseif selectedAspectRatioMobile %}
|
|
121
|
-
--image-aspect-ratio-mobile: {{selectedAspectRatioMobile|replace({'x': '/'})}}
|
|
122
|
-
;
|
|
123
|
-
{% endif %}
|
|
53
|
+
--image-aspect-ratio-desktop: {{selectedAspectRatioDesktop|replace({'x': '/'})}}
|
|
54
|
+
;
|
|
55
|
+
--image-aspect-ratio-portrait: {{selectedAspectRatioTablet|replace({'x': '/'})}}
|
|
56
|
+
;
|
|
57
|
+
--image-aspect-ratio-mobile: {{selectedAspectRatioMobile|replace({'x': '/'})}}
|
|
58
|
+
;
|
|
124
59
|
}
|
|
125
60
|
</style>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
<img data-type="srcGeneral" data-elementname="main-image" data-pattern-suffix="{{suffix}}" data-pattern-dynamic="{{renderDynamic}}" {{ enableEagerLoading }} class="{{ blockClassName|default('cbl-image') }}__image" src="{{mainImageSrc}}" alt="{{ desktopImage.alt }}" {{ parallaxDepth }} {{ parallaxOffsetY }}/>
|
|
137
|
-
</picture>
|
|
61
|
+
|
|
62
|
+
<!--pattern-replace-var:selectedAspectRatioDesktop={{selectedAspectRatioDesktop}}-->
|
|
63
|
+
<!--pattern-replace-var:selectedAspectRatioTablet={{selectedAspectRatioTablet}}-->
|
|
64
|
+
<!--pattern-replace-var:selectedAspectRatioMobile={{selectedAspectRatioMobile}}-->
|
|
65
|
+
<!--pattern-replace-var:sizes={{sizes}}-->
|
|
66
|
+
<!--pattern-replace-var:picture_id={{picture_id}}-->
|
|
67
|
+
|
|
68
|
+
<!--pattern-include-start:components/responsive-picture-element-v3-->
|
|
69
|
+
{{ include('components/responsive-picture-element-v3.twig') }}
|
|
70
|
+
<!--pattern-include-end:components/responsive-picture-element-v3-->
|
|
138
71
|
{% endif %}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{% set desktopImage = get_image(fields.image_desktop|default(fields.desktop_image)) %}
|
|
2
|
+
{% set tabletImage = get_image(fields.image_portrait|default(fields.tablet_image))|default(desktopImage) %}
|
|
3
|
+
|
|
4
|
+
{% set mobileImage = get_image(fields.image_mobile|default(fields.mobile_image)) %}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{% set isSVG = desktopImage.post_mime_type == 'image/svg+xml' %}
|
|
8
|
+
{% set customAspectRatioDesktop = selectedAspectRatioDesktop %}
|
|
9
|
+
{% set aspectRatioParamDesktop = {"aspect_ratio": customAspectRatioDesktop} %}
|
|
10
|
+
{% set mainImageSrc = isSVG ? desktopImage.src : gt_image_mainsrc(desktopImage, aspectRatioParamDesktop) %}
|
|
11
|
+
{% set desktopSrcset = isSVG ? desktopImage.src : gt_image_srcset(desktopImage, aspectRatioParamDesktop) %}
|
|
12
|
+
|
|
13
|
+
{% set isSVG = tabletImage.post_mime_type == 'image/svg+xml' %}
|
|
14
|
+
{% set customAspectRatioTablet = selectedAspectRatioTablet|default(tabletImage.width ~ '/' ~ tabletImage.height)|replace({'/' : 'x', ':' : 'x'}) %}
|
|
15
|
+
|
|
16
|
+
{% set aspectRatioParamTablet = {"aspect_ratio": customAspectRatioTablet} %}
|
|
17
|
+
{% set tabletSrcset = isSVG ? tabletImage.src : gt_image_srcset(tabletImage, aspectRatioParamTablet) %}
|
|
18
|
+
|
|
19
|
+
{% set isSVG = mobileImage.post_mime_type == 'image/svg+xml' %}
|
|
20
|
+
{% set customAspectRatioMobile = selectedAspectRatioMobile|default(mobileImage.width ~ '/' ~ mobileImage.height)|replace({'/' : 'x', ':' : 'x'}) %}
|
|
21
|
+
{% set aspectRatioParamMobile = {"aspect_ratio": customAspectRatioMobile} %}
|
|
22
|
+
{% set mobileSrcset = isSVG ? mobileImage.src : gt_image_srcset(mobileImage, aspectRatioParamMobile) %}
|
|
23
|
+
|
|
24
|
+
<picture class="single-responsive-image-v3__picture {{picture_id|default(block.id)}}" data-pattern-suffix="{{suffix}}" data-pattern-dynamic="{{renderDynamic}}" data-assetkey="responsive-image" data-enableparallax="{{ parallaxEnabled }}">
|
|
25
|
+
{% if desktopImage %}
|
|
26
|
+
<source data-type="srcSetDesktop" data-pattern-suffix="{{suffix}}" media="(min-width: 1024px)" class="single-responsive-image-v3__source single-responsive-image-v3--desktop" width="{{ desktopImage.width }}" height="{{ desktopImage.height }}" srcset="{{desktopSrcset}}"/>
|
|
27
|
+
{% endif %}
|
|
28
|
+
{% if tabletImage %}
|
|
29
|
+
<source data-type="srcSetTablet" data-pattern-suffix="{{suffix}}" media="(min-width: 768px)" width="{{ tabletImage.width }}" height="{{ tabletImage.height }}" class="single-responsive-image-v3__source single-responsive-image-v3--tablet" srcset="{{ tabletSrcset }}"/>
|
|
30
|
+
{% endif %}
|
|
31
|
+
{% if mobileImage %}
|
|
32
|
+
<source data-type="srcSetMobile" data-pattern-suffix="{{suffix}}" class="single-responsive-image-v3__source single-responsive-image-v3__source--mobile" width="{{ mobileImage.width }}" height="{{ mobileImage.height }}" srcset="{{ mobileSrcset }}"/>
|
|
33
|
+
{% endif %}
|
|
34
|
+
<img data-type="srcGeneral" data-elementname="main-image" data-pattern-suffix="{{suffix}}" data-pattern-dynamic="{{renderDynamic}}" {{ enableEagerLoading }} sizes="{{ sizes }}" class="single-responsive-image-v3__image" src="{{mainImageSrc}}" alt="{{ desktopImage.alt }}" {{ parallaxDepth }} {{ parallaxOffsetY }}/>
|
|
35
|
+
</picture>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default function counterDisplayJs(options = {}) {
|
|
2
|
+
try {
|
|
3
|
+
if (!customElements.get('counter-display')) {
|
|
4
|
+
customElements.define(
|
|
5
|
+
'counter-display',
|
|
6
|
+
class extends HTMLElement {
|
|
7
|
+
static observedAttributes = ['data-count'];
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
connectedCallback() {
|
|
12
|
+
console.log('Display module added to page.');
|
|
13
|
+
this.classList.add('loaded');
|
|
14
|
+
}
|
|
15
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
16
|
+
console.log(
|
|
17
|
+
'🚀 ~ attributeChangedCallback ~ name:',
|
|
18
|
+
name
|
|
19
|
+
);
|
|
20
|
+
console.log('count', this.dataset.count);
|
|
21
|
+
|
|
22
|
+
this.innerText = `${this.dataset.countertext} ${this.dataset.count}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error(error);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="stylesheet" href="../../public/publicBundleBase.css" />
|
|
7
|
+
<link rel="stylesheet" href="./counter-display.css" />
|
|
8
|
+
<title>PTFG</title>
|
|
9
|
+
<style>
|
|
10
|
+
body {
|
|
11
|
+
background-color: #e7b8b8;
|
|
12
|
+
}
|
|
13
|
+
main {
|
|
14
|
+
max-width: 600px;
|
|
15
|
+
margin-inline: auto;
|
|
16
|
+
padding: 50px;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<main class="main-container"></main>
|
|
22
|
+
<script async type="module">
|
|
23
|
+
const template = await fetch("./counter-display.html");
|
|
24
|
+
const html = await template.text();
|
|
25
|
+
document.querySelector(".main-container").innerHTML = html;
|
|
26
|
+
import blockjs from "./counter-display.js";
|
|
27
|
+
blockjs();
|
|
28
|
+
</script>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="stylesheet" href="../../public/publicBundleBase.css" />
|
|
7
|
+
<link rel="stylesheet" href="./post-filter-module.css" />
|
|
8
|
+
<title>PTFG</title>
|
|
9
|
+
<style>
|
|
10
|
+
body {
|
|
11
|
+
background-color: #e7b8b8;
|
|
12
|
+
}
|
|
13
|
+
main {
|
|
14
|
+
max-width: 600px;
|
|
15
|
+
margin-inline: auto;
|
|
16
|
+
padding: 50px;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<main class="main-container"></main>
|
|
22
|
+
<script async type="module">
|
|
23
|
+
const template = await fetch("./post-grid-display-module.html");
|
|
24
|
+
const html = await template.text();
|
|
25
|
+
document.querySelector(".main-container").innerHTML = html;
|
|
26
|
+
import blockjs from "./post-grid-display-module.js";
|
|
27
|
+
blockjs();
|
|
28
|
+
</script>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
post-carousel-display-module {
|
|
2
|
+
grid-area: display;
|
|
3
|
+
display: grid;
|
|
4
|
+
.post-carousel-display-module__grid-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
overflow: scroll;
|
|
7
|
+
flex-wrap: nowrap;
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
.post-carousel-display-module__post-container {
|
|
11
|
+
display: grid;
|
|
12
|
+
place-items: stretch;
|
|
13
|
+
grid-template-rows: max-content;
|
|
14
|
+
min-width: 300px;
|
|
15
|
+
.post-carousel-display-module__post-title {
|
|
16
|
+
color: white;
|
|
17
|
+
grid-row: 2;
|
|
18
|
+
text-box-edge: unset;
|
|
19
|
+
line-height: 120%;
|
|
20
|
+
text-transform: uppercase;
|
|
21
|
+
text-align: center;
|
|
22
|
+
font-size: 36px;
|
|
23
|
+
.font-secondary {
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
.post-carousel-display-module__post-image {
|
|
28
|
+
grid-row: 1;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: auto;
|
|
31
|
+
place-self: stretch;
|
|
32
|
+
object-fit: cover;
|
|
33
|
+
aspect-ratio: 9 / 11;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export default function postFilterDisplayJS(options = {}) {
|
|
2
|
+
try {
|
|
3
|
+
if (!customElements.get('post-carousel-display-module')) {
|
|
4
|
+
customElements.define(
|
|
5
|
+
'post-carousel-display-module',
|
|
6
|
+
class extends HTMLElement {
|
|
7
|
+
static observedAttributes = ['data-posts'];
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
const gridContainer = document.createElement('div');
|
|
11
|
+
gridContainer.className =
|
|
12
|
+
'post-carousel-display-module__grid-container';
|
|
13
|
+
this.appendChild(gridContainer);
|
|
14
|
+
this.gridContainer = this.querySelector(
|
|
15
|
+
'.post-carousel-display-module__grid-container'
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
console.log('Display module added to page.');
|
|
20
|
+
this.classList.add('loaded');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
24
|
+
// console.log(`Attribute ${name} has changed.`);
|
|
25
|
+
this.gridContainer.innerHTML = '';
|
|
26
|
+
if (newValue) {
|
|
27
|
+
const posts = JSON.parse(newValue);
|
|
28
|
+
|
|
29
|
+
posts.forEach((post) => {
|
|
30
|
+
const postContent = `
|
|
31
|
+
<div class="post-carousel-display-module__post-container">
|
|
32
|
+
<h2 class="post-carousel-display-module__post-title">${post.name}</h2>
|
|
33
|
+
<img loading="lazy" class="post-carousel-display-module__post-image" src="${post.image?.src}" srcset="${post.image?.srcset}" alt="${post.image?.alt}"></div>
|
|
34
|
+
`;
|
|
35
|
+
this.gridContainer.insertAdjacentHTML(
|
|
36
|
+
'beforeend',
|
|
37
|
+
postContent
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error(error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="stylesheet" href="../../public/publicBundleBase.css" />
|
|
7
|
+
<link rel="stylesheet" href="./post-filter-module-no-group.css" />
|
|
8
|
+
<title>PTFG</title>
|
|
9
|
+
<style>
|
|
10
|
+
body {
|
|
11
|
+
background-color: #e7b8b8;
|
|
12
|
+
}
|
|
13
|
+
main {
|
|
14
|
+
max-width: 600px;
|
|
15
|
+
margin-inline: auto;
|
|
16
|
+
padding: 50px;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<main class="main-container"></main>
|
|
22
|
+
<script async type="module">
|
|
23
|
+
const template = await fetch("./post-filter-module-no-group.html");
|
|
24
|
+
const html = await template.text();
|
|
25
|
+
document.querySelector(".main-container").innerHTML = html;
|
|
26
|
+
import blockjs from "./post-filter-module-no-group.js";
|
|
27
|
+
blockjs();
|
|
28
|
+
</script>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
post-filter-module-no-group {
|
|
2
|
+
grid-area: filter;
|
|
3
|
+
transform: translateX(-100%);
|
|
4
|
+
@starting-style {
|
|
5
|
+
transform: translateX(-100%);
|
|
6
|
+
}
|
|
7
|
+
position: fixed;
|
|
8
|
+
inset: 0;
|
|
9
|
+
background-color: black;
|
|
10
|
+
right: unset;
|
|
11
|
+
display: block;
|
|
12
|
+
width: 100vw;
|
|
13
|
+
z-index: 99;
|
|
14
|
+
max-width: 414px;
|
|
15
|
+
transition: transform ease-in-out 0.3s;
|
|
16
|
+
|
|
17
|
+
&.active {
|
|
18
|
+
transform: translateX(0%);
|
|
19
|
+
}
|
|
20
|
+
@media (min-width: 768px) {
|
|
21
|
+
max-width: unset;
|
|
22
|
+
width: 475px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.post-filter-module-no-group__clear-filters-button {
|
|
26
|
+
border: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.post-filter-module-no-group__grouping-category-button {
|
|
30
|
+
text-transform: uppercase;
|
|
31
|
+
border: none;
|
|
32
|
+
color: var(--theme-primary-text-colour);
|
|
33
|
+
font-family: var(--secondary-font-family);
|
|
34
|
+
font-size: 24;
|
|
35
|
+
|
|
36
|
+
&.active {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.post-filter-module-no-group__filter-category-container {
|
|
40
|
+
height: 0px;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
transition: height ease-out 0.3s;
|
|
43
|
+
}
|
|
44
|
+
.post-filter-module-no-group__filter-category-button {
|
|
45
|
+
color: var(--theme-primary-text-colour);
|
|
46
|
+
font-family: var(--primary-font-family);
|
|
47
|
+
border: 1px solid transparent;
|
|
48
|
+
font-size: 14;
|
|
49
|
+
}
|
|
50
|
+
.post-filter-module-no-group__filter-category-button.active-cat {
|
|
51
|
+
color: var(--primary-gold-100);
|
|
52
|
+
}
|
|
53
|
+
.post-filter-module-no-group__clear-filters-button {
|
|
54
|
+
color: var(--theme-primary-text-colour);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
post-filter-module-no-group.active {
|
|
58
|
+
transform: translateX(0%);
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<post-filter-module-no-group
|
|
2
|
+
id="filter-module"
|
|
3
|
+
data-dataobjectid=""
|
|
4
|
+
data-dev=""
|
|
5
|
+
data-devdatalocation="local"
|
|
6
|
+
data-clearfilterstext="Reset All"
|
|
7
|
+
data-postsperpagedesktop="8"
|
|
8
|
+
data-postsperpagemobile="6"
|
|
9
|
+
data-loadmoretriggerclass="loadmore-trigger"
|
|
10
|
+
data-textinputclass="text-input-trigger"
|
|
11
|
+
class="post-filter-module-no-group"
|
|
12
|
+
>
|
|
13
|
+
</post-filter-module-no-group>
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
export default function postfiltermoduleJs(options = {}) {
|
|
2
|
+
try {
|
|
3
|
+
if (!customElements.get('post-filter-module-no-group')) {
|
|
4
|
+
customElements.define(
|
|
5
|
+
'post-filter-module-no-group',
|
|
6
|
+
class extends HTMLElement {
|
|
7
|
+
static observedAttributes = ['data-devcontent'];
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.enableLogs = true;
|
|
11
|
+
this.filterState = {
|
|
12
|
+
enableLogs: false,
|
|
13
|
+
allposts: [],
|
|
14
|
+
filteredposts: [],
|
|
15
|
+
activefilters: new Set(),
|
|
16
|
+
allcategories: [],
|
|
17
|
+
groupingcategories: [],
|
|
18
|
+
filtercategories: [],
|
|
19
|
+
postsperpagedesktop: 8,
|
|
20
|
+
postsperpagemobile: 6,
|
|
21
|
+
pagenumber: 1,
|
|
22
|
+
setActiveFilters: function (newState) {
|
|
23
|
+
Object.assign(this.filterState, newState);
|
|
24
|
+
this.filterPosts.bind(this)();
|
|
25
|
+
},
|
|
26
|
+
setFilteredPosts: function (newState) {
|
|
27
|
+
Object.assign(this.filterState, newState);
|
|
28
|
+
this.dispatchEvent(
|
|
29
|
+
new CustomEvent('filteredposts-updated')
|
|
30
|
+
);
|
|
31
|
+
this.enableLogs &&
|
|
32
|
+
console.log(
|
|
33
|
+
'🚀 filter state: ',
|
|
34
|
+
this.filterState
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
this.filterState.postsperpagedesktop =
|
|
40
|
+
this.dataset.postsperpagedesktop || 8;
|
|
41
|
+
this.filterState.postsperpagedesktop =
|
|
42
|
+
this.dataset.postsperpagedesktop || 6;
|
|
43
|
+
|
|
44
|
+
this.loadMoreTriggers = document.querySelectorAll(
|
|
45
|
+
`.${this.dataset.loadmoretriggerclass}`
|
|
46
|
+
);
|
|
47
|
+
this.loadMoreTriggers.forEach((trigger) => {
|
|
48
|
+
trigger.addEventListener('loadmore', () => {
|
|
49
|
+
this.filterState.pagenumber =
|
|
50
|
+
this.filterState.pagenumber + 1;
|
|
51
|
+
this.filterPosts();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
this.textSearchTriggers = document.querySelectorAll(
|
|
56
|
+
`.${this.dataset.textinputclass}`
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
this.textSearchTriggers.forEach((trigger) => {
|
|
60
|
+
trigger.addEventListener('textinput', (e) => {
|
|
61
|
+
const inputText =
|
|
62
|
+
e.target.querySelector('input')?.value;
|
|
63
|
+
|
|
64
|
+
console.log(
|
|
65
|
+
'🚀 ~ constructor ~ inputEl:',
|
|
66
|
+
inputText
|
|
67
|
+
);
|
|
68
|
+
this.filterPosts();
|
|
69
|
+
const searchPosts =
|
|
70
|
+
this.filterState.filteredposts.filter(
|
|
71
|
+
(post) => {
|
|
72
|
+
if (
|
|
73
|
+
post.name
|
|
74
|
+
?.toLowerCase()
|
|
75
|
+
.includes(
|
|
76
|
+
inputText.toLowerCase()
|
|
77
|
+
)
|
|
78
|
+
) {
|
|
79
|
+
return post;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
this.filterState.setFilteredPosts.bind(this)({
|
|
85
|
+
filteredposts: searchPosts
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
const postFilterContainer =
|
|
90
|
+
document.createElement('div');
|
|
91
|
+
postFilterContainer.className =
|
|
92
|
+
'post-filter-module-no-group__filter-container';
|
|
93
|
+
this.appendChild(postFilterContainer);
|
|
94
|
+
this.postFilterContainer = this.querySelector(
|
|
95
|
+
'.post-filter-module-no-group__filter-container'
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const postFilterCatsDisplay =
|
|
99
|
+
document.createElement('div');
|
|
100
|
+
postFilterCatsDisplay.className =
|
|
101
|
+
'post-filter-module-no-group__filter-categories-display';
|
|
102
|
+
this.postFilterContainer.appendChild(
|
|
103
|
+
postFilterCatsDisplay
|
|
104
|
+
);
|
|
105
|
+
this.filterCategoriesDisplay = this.querySelector(
|
|
106
|
+
'.post-filter-module-no-group__filter-categories-display'
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const clearFilters = document.createElement('button');
|
|
110
|
+
clearFilters.className =
|
|
111
|
+
'post-filter-module-no-group__clear-filters-button';
|
|
112
|
+
clearFilters.innerText =
|
|
113
|
+
this.dataset.clearfilterstext || 'Clear Filters';
|
|
114
|
+
this.postFilterContainer.appendChild(clearFilters);
|
|
115
|
+
this.clearFiltersButton = this.querySelector(
|
|
116
|
+
'.post-filter-module-no-group__clear-filters-button'
|
|
117
|
+
);
|
|
118
|
+
this.clearFiltersButton.addEventListener(
|
|
119
|
+
'click',
|
|
120
|
+
this.clearFilters.bind(this)
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
this.devModeContent = this.dataset.devcontent;
|
|
124
|
+
}
|
|
125
|
+
async connectedCallback() {
|
|
126
|
+
console.log('Filter Module element added to page.');
|
|
127
|
+
let data;
|
|
128
|
+
if (
|
|
129
|
+
this.dataset.dev === 'true' ||
|
|
130
|
+
this.dataset.devcontent === 'dev-petz' ||
|
|
131
|
+
this.classList.contains('dev-pets') //Easter Egg :D
|
|
132
|
+
) {
|
|
133
|
+
await this.getDevContent();
|
|
134
|
+
} else {
|
|
135
|
+
data = globalThis[this.dataset.dataobjectid];
|
|
136
|
+
this.enableLogs &&
|
|
137
|
+
console.log('🚀 dataobject: ', data);
|
|
138
|
+
if (data) {
|
|
139
|
+
this.filterState.allposts = data[`posts`];
|
|
140
|
+
this.filterState.allcategories =
|
|
141
|
+
data[`categories`];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (this.filterState.allcategories.length > 0) {
|
|
146
|
+
this.filterState.allcategories.forEach(
|
|
147
|
+
(category) => {
|
|
148
|
+
this.filterState.filtercategories.push(
|
|
149
|
+
category
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
this.filterState.filtercategories.forEach(
|
|
156
|
+
(category) => {
|
|
157
|
+
this.filterCategoriesDisplay.insertAdjacentHTML(
|
|
158
|
+
'beforeend',
|
|
159
|
+
`<button class="post-filter-module-no-group__filter-category-button" data-categoryid="${category.id}">${category.name}</button>`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
this.categorybuttons = this.querySelectorAll(
|
|
165
|
+
'.post-filter-module-no-group__filter-category-button'
|
|
166
|
+
);
|
|
167
|
+
this.categorybuttons.forEach((button) => {
|
|
168
|
+
button.addEventListener('click', () => {
|
|
169
|
+
if (
|
|
170
|
+
this.filterState.activefilters.has(
|
|
171
|
+
Number(button.dataset.categoryid)
|
|
172
|
+
)
|
|
173
|
+
) {
|
|
174
|
+
const newActiveFilters = new Set(
|
|
175
|
+
this.filterState.activefilters
|
|
176
|
+
);
|
|
177
|
+
button.classList.remove('active-cat');
|
|
178
|
+
newActiveFilters.delete(
|
|
179
|
+
Number(button.dataset.categoryid)
|
|
180
|
+
);
|
|
181
|
+
this.filterState.setActiveFilters.bind(
|
|
182
|
+
this
|
|
183
|
+
)({
|
|
184
|
+
activefilters: newActiveFilters
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
const newActiveFilters = new Set(
|
|
188
|
+
this.filterState.activefilters
|
|
189
|
+
);
|
|
190
|
+
button.classList.add('active-cat');
|
|
191
|
+
newActiveFilters.add(
|
|
192
|
+
Number(button.dataset.categoryid)
|
|
193
|
+
);
|
|
194
|
+
this.filterState.setActiveFilters.bind(
|
|
195
|
+
this
|
|
196
|
+
)({
|
|
197
|
+
activefilters: newActiveFilters
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
const groupingButtons = this.querySelectorAll(
|
|
203
|
+
'.post-filter-module-no-group__grouping-category-button'
|
|
204
|
+
);
|
|
205
|
+
const categoryContainers = this.querySelectorAll(
|
|
206
|
+
'.post-filter-module-no-group__filter-category-container'
|
|
207
|
+
);
|
|
208
|
+
groupingButtons.forEach((button) => {
|
|
209
|
+
button.addEventListener('click', () => {
|
|
210
|
+
const container =
|
|
211
|
+
button.parentElement.querySelector(
|
|
212
|
+
'.post-filter-module-no-group__filter-category-container'
|
|
213
|
+
);
|
|
214
|
+
if (button.classList.contains('active')) {
|
|
215
|
+
button.classList.remove('active');
|
|
216
|
+
container.classList.remove('active');
|
|
217
|
+
container.style.height = '0px';
|
|
218
|
+
} else {
|
|
219
|
+
groupingButtons.forEach((btn) => {
|
|
220
|
+
btn.classList.remove('active');
|
|
221
|
+
});
|
|
222
|
+
categoryContainers.forEach(
|
|
223
|
+
(categoryContainer) => {
|
|
224
|
+
categoryContainer.style.height =
|
|
225
|
+
'0px';
|
|
226
|
+
categoryContainer.classList.remove(
|
|
227
|
+
'active'
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
container.style.height =
|
|
232
|
+
container.scrollHeight + 'px';
|
|
233
|
+
button.classList.add('active');
|
|
234
|
+
container.classList.add('active');
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
this.filterPosts();
|
|
240
|
+
this.classList.add('loaded');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
244
|
+
console.log(`Attribute ${name} has changed.`);
|
|
245
|
+
if (newValue) {
|
|
246
|
+
this.getDevContent();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
async getDevContent() {
|
|
250
|
+
// this.enableLogs && console.log('Getting dev content..');
|
|
251
|
+
// const data = await import(
|
|
252
|
+
// `./dev-content/dev-content${this.dataset.devdatalocation}.js`
|
|
253
|
+
// );
|
|
254
|
+
// this.filterState.allposts = data[`devContentPets`];
|
|
255
|
+
// this.filterState.allcategories =
|
|
256
|
+
// data[`devContentCategories`];
|
|
257
|
+
this.filterPosts();
|
|
258
|
+
}
|
|
259
|
+
filterPosts(event) {
|
|
260
|
+
if (this.filterState.allposts.length == 0) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (this.filterState.activefilters.size === 0) {
|
|
264
|
+
const numberPosts =
|
|
265
|
+
Number(this.filterState.postsperpagedesktop) *
|
|
266
|
+
Number(this.filterState.pagenumber);
|
|
267
|
+
this.filterState.setFilteredPosts.bind(this)({
|
|
268
|
+
filteredposts: this.filterState.allposts.slice(
|
|
269
|
+
0,
|
|
270
|
+
numberPosts
|
|
271
|
+
)
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
if (
|
|
275
|
+
this.filterState.filteredposts.length >=
|
|
276
|
+
this.filterState.allposts.length
|
|
277
|
+
) {
|
|
278
|
+
this.loadMoreTriggers.forEach((trigger) => {
|
|
279
|
+
trigger.classList.add('hide');
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const newFilteredPosts =
|
|
286
|
+
this.filterState.allposts.filter((post) => {
|
|
287
|
+
return (
|
|
288
|
+
this.filterState.activefilters.intersection(
|
|
289
|
+
new Set(post.categories)
|
|
290
|
+
).size > 0
|
|
291
|
+
);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
this.filterState.setFilteredPosts.bind(this)({
|
|
295
|
+
filteredposts: newFilteredPosts
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
clearFilters(event) {
|
|
299
|
+
this.categorybuttons.forEach((button) => {
|
|
300
|
+
button.classList.remove('active-cat');
|
|
301
|
+
});
|
|
302
|
+
this.filterState.setActiveFilters.bind(this)({
|
|
303
|
+
activefilters: new Set()
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
} catch (error) {
|
|
310
|
+
console.error(error);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/>
|
|
15
15
|
<link
|
|
16
16
|
rel="stylesheet"
|
|
17
|
-
href="../webc-post-
|
|
17
|
+
href="../webc-post-carousel-display-module/post-carousel-display-module.css"
|
|
18
18
|
/>
|
|
19
19
|
<title>PTFG</title>
|
|
20
20
|
</head>
|
|
@@ -44,11 +44,12 @@
|
|
|
44
44
|
</post-filter-module>
|
|
45
45
|
<text-input-trigger id="text-input-trigger" class="text-input-trigger"></text-input-trigger>
|
|
46
46
|
<toggle-trigger id="toggle-trigger" data-toggletext="Filter" data-toggletarget="#filter-module" data-toggleclass="active" class="toggle-trigger"></toggle-trigger>
|
|
47
|
-
<post-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
<post-carousel-display-module
|
|
48
|
+
id="display-module"
|
|
49
|
+
data-posts=""
|
|
50
|
+
class="post-carousel-display-module cmpl-block-padding cmpl-block-settings"
|
|
51
|
+
>
|
|
52
|
+
</post-carousel-display-module>
|
|
52
53
|
<loadmore-trigger id="loadmore-trigger" data-buttontext="Load More" class="loadmore-trigger"></loadmore-trigger>
|
|
53
54
|
</ptfg-9000>
|
|
54
55
|
|
|
@@ -66,8 +67,8 @@
|
|
|
66
67
|
import loadmoreTrigger from "../webc-loadmore-trigger/loadmore-trigger.js";
|
|
67
68
|
loadmoreTrigger();
|
|
68
69
|
|
|
69
|
-
import
|
|
70
|
-
|
|
70
|
+
import blockcarouseljs from "../webc-post-carousel-display-module/post-carousel-display-module.js";
|
|
71
|
+
blockcarouseljs();
|
|
71
72
|
|
|
72
73
|
import blockptfgjs from "./ptfg-9000.js";
|
|
73
74
|
blockptfgjs();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<ptfg-9000 class="ptfg-9000 ptfg-9000__main-container"
|
|
1
|
+
<ptfg-9000 class="ptfg-9000 ptfg-9000__main-container"></ptfg-9000>
|
|
@@ -9,6 +9,7 @@ export default function ptfg9000js(options = {}) {
|
|
|
9
9
|
this.data = this.dataset;
|
|
10
10
|
this.filterModule =
|
|
11
11
|
this.querySelector('#filter-module');
|
|
12
|
+
|
|
12
13
|
this.displayModule =
|
|
13
14
|
this.querySelector('#display-module');
|
|
14
15
|
}
|
|
@@ -26,6 +27,7 @@ export default function ptfg9000js(options = {}) {
|
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
}
|
|
30
|
+
|
|
29
31
|
this.classList.add('loaded');
|
|
30
32
|
}
|
|
31
33
|
attributeChangedCallback(name, oldValue, newValue) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@total_onion/onion-library",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.254",
|
|
4
4
|
"description": "Component library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@total_onion/onion-modalcontroller": "^1.0.5",
|
|
22
22
|
"@total_onion/onion-utils": "^1.0.10",
|
|
23
|
-
"@total_onion/onion-videocontroller": "^1.1.
|
|
23
|
+
"@total_onion/onion-videocontroller": "^1.1.8",
|
|
24
24
|
"autoprefixer": "^10.4.21",
|
|
25
25
|
"compressing": "^2.0.0",
|
|
26
26
|
"cpy": "^9.0.1",
|