PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
← All changes | public/assets/js/scripts.js +149 -162 4.0.8 → 2.2.10 View file →
@@ -1,164 +1,151 @@
1 -(function ($) {
2 - function SpPostShowCarouselInit() {
3 - if ($('.pcp-carousel-wrapper').length > 0) {
4 - function swiperSlide(selector, options) {
5 - if (1 === parseInt(pcp_vars.swiperEnqueue)) {
6 - return new PCPSwiper(selector, options);
7 - } else {
8 - return new Swiper(selector, options);
9 - }
10 - }
11 - $('.pcp-carousel-wrapper').each(function () {
12 - var pcp_container = $(this),
13 - pcp_container_id = pcp_container.attr('id'),
14 - pcpCarousel = $('#' + pcp_container_id + ' .sp-pcp-carousel:not(.swiper-initialized)'),
15 - pcpCarouselData = pcpCarousel.data('carousel');
16 - if (pcpCarousel.length > 0) {
17 - // Carousel Swiper for Standard mode.
18 - var pcpSwiper = swiperSlide('#' + pcp_container_id + ' .sp-pcp-carousel', {
19 - speed: pcpCarouselData.speed,
20 - slidesPerView: pcpCarouselData.slidesPerView.mobile,
21 - spaceBetween: pcpCarouselData.spaceBetween,
22 - loop: pcpCarouselData.loop,
23 - loopFillGroupWithBlank: true,
24 - autoHeight: pcpCarouselData.autoHeight,
25 - simulateTouch: pcpCarouselData.simulateTouch,
26 - freeMode: pcpCarouselData.freeMode,
27 - allowTouchMove: pcpCarouselData.allowTouchMove,
28 - centeredSlides: pcpCarouselData.center_mode,
29 - mousewheel: pcpCarouselData.slider_mouse_wheel,
30 - lazy: pcpCarouselData.lazy,
31 - //grabCursor: true,
32 - pagination:
33 - pcpCarouselData.pagination == true
34 - ? {
35 - el: '.swiper-pagination',
36 - clickable: true,
37 - dynamicBullets: pcpCarouselData.dynamicBullets,
38 - renderBullet: function (index, className) {
39 - if (pcpCarouselData.bullet_types == 'number') {
40 - return (
41 - '<span class="' +
42 - className +
43 - '">' +
44 - (index + 1) +
45 - '</span>'
46 - )
47 - } else {
48 - return '<span class="' + className + '"></span>'
49 - }
50 - }
51 - }
52 - : false,
53 - autoplay: {
54 - delay: pcpCarouselData.autoplay_speed
55 - },
56 - navigation:
57 - pcpCarouselData.navigation == true
58 - ? {
59 - nextEl: '.pcp-button-next',
60 - prevEl: '.pcp-button-prev'
61 - }
62 - : false,
63 - breakpoints: {
64 - 576: {
65 - slidesPerView: pcpCarouselData.slidesPerView.mobile_landscape,
66 - navigation:
67 - pcpCarouselData.navigation_mobile == true
68 - ? {
69 - nextEl: '.pcp-button-next',
70 - prevEl: '.pcp-button-prev'
71 - }
72 - : false,
73 - pagination:
74 - pcpCarouselData.pagination_mobile == true
75 - ? {
76 - el: '.swiper-pagination',
77 - clickable: true,
78 - dynamicBullets: pcpCarouselData.dynamicBullets,
79 - renderBullet: function (index, className) {
80 - if (pcpCarouselData.bullet_types == 'number') {
81 - return (
82 - '<span class="' +
83 - className +
84 - '">' +
85 - (index + 1) +
86 - '</span>'
87 - )
88 - } else {
89 - return '<span class="' + className + '"></span>'
90 - }
91 - }
92 - }
93 - : false
94 - },
95 - 768: {
96 - slidesPerView: pcpCarouselData.slidesPerView.tablet,
97 - },
98 - 992: {
99 - slidesPerView: pcpCarouselData.slidesPerView.desktop,
100 - },
101 - 1200: {
102 - slidesPerView: pcpCarouselData.slidesPerView.lg_desktop,
103 - },
104 - },
105 - fadeEffect: {
106 - crossFade: true
107 - },
108 - ally: {
109 - enabled: pcpCarouselData.enabled,
110 - prevSlideMessage: pcpCarouselData.prevSlideMessage,
111 - nextSlideMessage: pcpCarouselData.nextSlideMessage,
112 - firstSlideMessage: pcpCarouselData.firstSlideMessage,
113 - lastSlideMessage: pcpCarouselData.lastSlideMessage,
114 - paginationBulletMessage: pcpCarouselData.paginationBulletMessage
115 - },
116 - keyboard: {
117 - enabled: pcpCarouselData.keyboard === "true" ? true : false,
118 - }
119 - })
120 - if (pcpCarouselData.autoplay === false) {
121 - pcpSwiper.autoplay.stop()
122 - }
123 - if (pcpCarouselData.stop_onHover && pcpCarouselData.autoplay) {
124 - $(pcpCarousel).on({
125 - mouseenter: function () {
126 - pcpSwiper.autoplay.stop();
127 - },
128 - mouseleave: function () {
129 - pcpSwiper.autoplay.start();
130 - }
131 - });
132 - }
133 - $(window).on('resize', function () {
134 - pcpSwiper.update()
135 - })
136 - $(window).trigger("resize")
137 - }
138 - })
139 - }
1 +jQuery(document).ready(function ($) {
2 + if ($('.sp-pcp-container').length > 0) {
3 + $('.sp-pcp-container').each(function () {
140 4
141 - /* Preloader js */
142 - $('.sp-pcp-section').each(function () {
143 - var pcp_container = $(this).attr('id');
144 - var PCP_Wrapper_ID = '#' + pcp_container;
145 - $(".pcp-preloader", PCP_Wrapper_ID).css({ "backgroundImage": "none", "visibility": "hidden" });
146 - })
5 + var pcp_container = $(this),
6 + pcp_container_id = pcp_container.attr('id'),
7 + PCP_Wrapper_ID = '#' + pcp_container_id,
8 + // pc_sid = $(PCP_Wrapper_ID).data('sid'), // The Shortcode ID.
9 + pcpCarousel = $('#' + pcp_container_id + ' .sp-pcp-carousel'),
10 + /* pcpfilter = $('#' + pcp_container_id + '.pcp-filter-wrapper'),
11 + ajaxurl = sppcp.ajaxurl,
12 + nonce = sppcp.nonce, */
13 + pcpCarouselData = pcpCarousel.data('carousel');
14 + if (pcpCarousel.length > 0) {
15 + // Carousel Swiper for Standard mode.
16 + var pcpSwiper = new Swiper('#' + pcp_container_id + ' .sp-pcp-carousel', {
17 + speed: pcpCarouselData.speed,
18 + slidesPerView: pcpCarouselData.slidesPerView.mobile,
19 + spaceBetween: pcpCarouselData.spaceBetween,
20 + loop: pcpCarouselData.loop,
21 + loopFillGroupWithBlank: true,
22 + autoHeight: pcpCarouselData.autoHeight,
23 + simulateTouch: pcpCarouselData.simulateTouch,
24 + allowTouchMove: pcpCarouselData.allowTouchMove,
25 + centeredSlides: pcpCarouselData.center_mode,
26 + mousewheel: pcpCarouselData.slider_mouse_wheel,
27 + lazy: pcpCarouselData.lazy,
28 + //grabCursor: true,
29 + pagination:
30 + pcpCarouselData.pagination == true
31 + ? {
32 + el: '.swiper-pagination',
33 + clickable: true,
34 + dynamicBullets: pcpCarouselData.dynamicBullets,
35 + renderBullet: function (index, className) {
36 + if (pcpCarouselData.bullet_types == 'number') {
37 + return (
38 + '<span class="' +
39 + className +
40 + '">' +
41 + (index + 1) +
42 + '</span>'
43 + )
44 + } else {
45 + return '<span class="' + className + '"></span>'
46 + }
47 + }
48 + }
49 + : false,
50 + autoplay: {
51 + delay: pcpCarouselData.autoplay_speed
52 + },
53 + navigation:
54 + pcpCarouselData.navigation == true
55 + ? {
56 + nextEl: '.pcp-button-next',
57 + prevEl: '.pcp-button-prev'
58 + }
59 + : false,
60 + breakpoints: {
61 + 576: {
62 + slidesPerView: pcpCarouselData.slidesPerView.mobile_landscape,
63 + navigation:
64 + pcpCarouselData.navigation_mobile == true
65 + ? {
66 + nextEl: '.pcp-button-next',
67 + prevEl: '.pcp-button-prev'
68 + }
69 + : false,
70 + pagination:
71 + pcpCarouselData.pagination_mobile == true
72 + ? {
73 + el: '.swiper-pagination',
74 + clickable: true,
75 + dynamicBullets: pcpCarouselData.dynamicBullets,
76 + renderBullet: function (index, className) {
77 + if (pcpCarouselData.bullet_types == 'number') {
78 + return (
79 + '<span class="' +
80 + className +
81 + '">' +
82 + (index + 1) +
83 + '</span>'
84 + )
85 + } else {
86 + return '<span class="' + className + '"></span>'
87 + }
88 + }
89 + }
90 + : false
91 + },
92 + 768: {
93 + slidesPerView: pcpCarouselData.slidesPerView.tablet,
94 + },
95 + 992: {
96 + slidesPerView: pcpCarouselData.slidesPerView.desktop,
97 + },
98 + 1200: {
99 + slidesPerView: pcpCarouselData.slidesPerView.lg_desktop,
100 + },
101 + },
102 + fadeEffect: {
103 + crossFade: true
104 + },
105 + ally: {
106 + enabled: pcpCarouselData.enabled,
107 + prevSlideMessage: pcpCarouselData.prevSlideMessage,
108 + nextSlideMessage: pcpCarouselData.nextSlideMessage,
109 + firstSlideMessage: pcpCarouselData.firstSlideMessage,
110 + lastSlideMessage: pcpCarouselData.lastSlideMessage,
111 + paginationBulletMessage: pcpCarouselData.paginationBulletMessage
112 + },
113 + keyboard: {
114 + enabled: true
115 + }
116 + })
117 + if (pcpCarouselData.autoplay === false) {
118 + pcpSwiper.autoplay.stop()
119 + }
120 + if (pcpCarouselData.stop_onHover && pcpCarouselData.autoplay) {
121 + $(pcpCarousel).hover(
122 + function () {
123 + pcpSwiper.autoplay.stop()
124 + },
125 + function () {
126 + pcpSwiper.autoplay.start()
127 + }
128 + )
129 + }
130 + $(window).resize(function () {
131 + pcpSwiper.update()
132 + })
133 + $(window).trigger("resize")
134 + }
147 135
148 - // Add class for gutenberg block.
149 - $('.sp-pcp-section').addClass('sp-pcp-section-loaded');
150 - };
151 -
152 - // Initialize the carousel when the document is ready
153 - $(document).ready(function () {
154 - SpPostShowCarouselInit();
155 - });
156 -
157 - // Register the handler with Elementor's frontend event.
158 - $(window).on('elementor/frontend/init', function () {
159 - // For general widget
160 - elementorFrontend.hooks.addAction('frontend/element_ready/smart_post_show_pro_shortcode.default', SpPostShowCarouselInit);
161 - // For deprecated widget.
162 - elementorFrontend.hooks.addAction('frontend/element_ready/sp_smart_post_show_free_shortcode.default', SpPostShowCarouselInit);
163 - });
164 -})(jQuery);
136 + /**
137 + * Grid masonry.
138 + */
139 + if ($(PCP_Wrapper_ID).hasClass('pcp-masonry')) {
140 + var $post_wrapper = $('.sp-pcp-row', PCP_Wrapper_ID)
141 + $post_wrapper.imagesLoaded(function () {
142 + $post_wrapper.masonry()
143 + })
144 + }
145 + /* Preloader js */
146 + $(document).ready(function() {
147 + $(".pcp-preloader", PCP_Wrapper_ID).css({ "backgroundImage": "none", "visibility": "hidden" });
148 + });
149 + })
150 + }
151 +})