PageSourceSearch

https://www.c2group.it/modules/ybc_blog/views/js/blog.js

js c2group.it collected 2026-09-24 18:55:03 UTC 10,575 bytes, 298 lines download raw bytes

1/**
2 * Copyright ETS Software Technology Co., Ltd
3 *
4 * NOTICE OF LICENSE
5 *
6 * This file is not open source! Each license that you purchased is only available for 1 website only.
7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses.
8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
9 *
10 * DISCLAIMER
11 *
12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
13 * versions in the future.
14 *
15 * @author ETS Software Technology Co., Ltd
16 * @copyright  ETS Software Technology Co., Ltd
17 * @license    Valid for 1 website (or project) for each purchase of license
18 */
19 var height_index_heading = 100;
20
21
22$(document).on('hooksLoaded',function(){
23    runowl();
24});
25$(document).ready(function(){
26    $(document).on('change','#form_blog input[type="file"],.blog-managament-information input[type="file"]',function(){
27        var fileExtension = ['jpeg', 'jpg', 'png', 'gif', 'bmp'];
28        if ($.inArray($(this).val().split('.').pop().toLowerCase(), fileExtension) == -1) {
29            alert(ybc_blog_invalid_file);
30        }
31        else
32        {
33            var file_name = $(this).val().replace('C:\\fakepath\\','');
34            if($(this).closest('.upload_form_custom').find('.file_name').length)
35            {
36                $(this).closest('.upload_form_custom').find('.file_name').html(file_name);
37            }
38            else   
39                $(this).closest('.upload_form_custom').append('<span class="file_name">'+file_name+'</span>'); 
40            readURL(this);            
41        }
42        if($(this).next('.file_name').length>0)
43        {
44           $(this).next('.file_name').html($(this).val().replace('C:\\fakepath\\','')) 
45        }
46    });
47    if ( $('.ybc-blog-rtl').length > 0 ){
48        var rtl_blog = true;
49
50    } else {
51        var rtl_blog = false;
52    }
53
54    function loadLazi(){
55        if($('img.lazyload').length>0)
56        {
57            $('img.lazyload').lazyload({
58                load : function () {
59                    $(this).parent().removeClass('ybc_item_img_ladyload');
60                    $(this).parent().parent().removeClass('ybc_item_img_ladyload');
61                    $(this).addClass('isload');
62                },
63                threshold: 100,
64            });
65        }
66    }
67    $( window ).on('load',function() {
68      loadLazi();
69    });
70    loadLazi();
71
72    $(document).on('click','.owl-next',function(){
73        if($('img.lazyload').length>0)
74        {
75            $('img.lazyload').lazyload();
76        }
77    });
78    $(window).on('scroll',function(){
79         autoLoadBlog();
80    });
81    runowl();
82    autoLoadBlog();
83});
84function autoLoadBlog()
85{
86    var container = '.ybc-blog-wrapper-blog-list.loadmore';
87    if ($(container).length > 0 && $(container+" .blog-paggination a.next").length > 0 && !$(container+" .blog-paggination a.next").hasClass('active') && $(window).scrollTop() + $(window).height() >= $(container).offset().top + $(container).height() ) {
88        $(container+" .blog-paggination a.next").addClass('active');
89          $('.ets_blog_loading.autoload').addClass('active');
90          $.ajax({
91                url:  $(container+" .blog-paggination a.next").attr('href'),
92                data: 'loadajax=1'+($('select[name="ybc_sort_by_posts"]').length ? '&ybc_sort_by_posts='+$('select[name="ybc_sort_by_posts"]').val():''),
93                type: 'post',
94                dataType: 'json',                
95                success: function(json){
96                    if(json.list_blog)
97                        $('.ybc-blog-list').append(json.list_blog);
98                    if(json.list_galleries)
99                    {
100                        $('.ybc-galley-list').append(json.list_galleries);
101                        ybcBlogPrettyPhoto();
102                    }
103                    $('.blog-paggination').html(json.blog_paggination);
104                    if($('img.lazyload').length>0)
105                    {
106                        $('img.lazyload').lazyload({
107                            load : function () {
108                                $(this).parent().removeClass('ybc_item_img_ladyload');
109                                $(this).parent().parent().removeClass('ybc_item_img_ladyload');
110                            },
111                            threshold: 100,
112                        });
113                    }
114                    $('.ets_blog_loading.autoload').removeClass('active');
115                },
116                error: function(error)
117                {
118                   
119                }
120        });         
121    } 
122}
123function runowl()
124{
125    if ( $('.ybc_blog_rtl_mode').length > 0 ){
126        var rtl_blog = true;
127
128    } else {
129        var rtl_blog = false;
130    }
131
132    if ($('.ybc-blog-related-posts.ybc_blog_carousel .ybc-blog-related-posts-list:not(.slick-initialized)').length > 0)
133    {
134        var number_post_related_per_row = $('.ybc-blog-related-posts').attr('data-items');
135        $('.ybc-blog-related-posts.ybc_blog_carousel .ybc-blog-related-posts-list:not(.slick-initialized)').slick({
136            slidesToShow: number_post_related_per_row,
137            arrows: true,
138            rtl: rtl_blog,
139            dots: false,
140            autoplay: false,
141            responsive: [
142                {
143                    breakpoint: 1200,
144                    settings: {
145                        slidesToShow: number_post_related_per_row,
146                    }
147                },
148                {
149                    breakpoint: 992,
150                    settings: {
151                        slidesToShow: 3,
152                    }
153                },
154                {
155                    breakpoint: 768,
156                    settings: {
157                        slidesToShow: 2,
158                    }
159                },
160                {
161                    breakpoint: 400,
162                    settings: {
163                        slidesToShow: 1,
164                    }
165                }
166            ]
167        });
168        $('.ybc-blog-related-posts.ybc_blog_carousel .ybc-blog-related-posts-list').on('changed.etsowl.carousel', function(event) {
169            if($('img.lazyload').length>0)
170            {
171                $('img.lazyload').lazyload();
172            }
173        });
174    }
175    if ($('.ybc_related_products_type_carousel.ybc_blog_carousel:not(.slick-initialized)').length > 0)
176    {
177        $('.ybc_related_products_type_carousel.ybc_blog_carousel:not(.slick-initialized)').slick({
178            slidesToShow: 4,
179            arrows: true,
180            rtl: rtl_blog,
181            dots: false,
182            autoplay: false,
183            responsive: [
184                {
185                    breakpoint: 1200,
186                    settings: {
187                        slidesToShow: 4,
188                    }
189                },
190                {
191                    breakpoint: 992,
192                    settings: {
193                        slidesToShow: 3,
194                    }
195                },
196                {
197                    breakpoint: 768,
198                    settings: {
199                        slidesToShow: 2,
200                    }
201                },
202                {
203                    breakpoint: 400,
204                    settings: {
205                        slidesToShow: 1,
206                    }
207                }
208            ]
209        });
210        $('.ybc-blog-related-posts.ybc_blog_carousel .ybc-blog-related-posts-list').on('changed.etsowl.carousel', function(event) {
211            if($('img.lazyload').length>0)
212            {
213                $('img.lazyload').lazyload();
214            }
215        });
216    }
217    if ($('.ybc_blog_related_posts_type_carousel .blog_type_slider:not(.slick-initialized)').length > 0)
218    {
219        $('.ybc_blog_related_posts_type_carousel .blog_type_slider:not(.slick-initialized)').slick({
220            dots: false,
221            infinite: false,
222            speed: 300,
223            arrows: true,
224            slidesToShow: number_post_related_per_row,
225            slidesToScroll: 4,
226            responsive: [
227                {
228                    breakpoint: 1200,
229                    settings: {
230                        slidesToShow: number_post_related_per_row,
231                        infinite: true,
232                    }
233                },
234                {
235                    breakpoint: 1024,
236                    settings: {
237                        slidesToShow: 3,
238                        infinite: true,
239                    }
240                },
241                {
242                    breakpoint: 600,
243                    settings: {
244                        slidesToShow: 2,
245                    }
246                },
247                {
248                    breakpoint: 480,
249                    settings: {
250                        slidesToShow: 1,
251                    }
252                }
253            ]
254        });
255        $('.ybc_blog_related_posts_type_carousel .blog_type_slider').on('changed.etsowl.carousel', function(event) {
256            if($('img.lazyload').length>0)
257            {
258                $('img.lazyload').lazyload();
259            }
260        });
261    }
262}
263
264function readURL(input) {
265    if (input.files && input.files[0]) {
266        var reader = new FileReader();
267        reader.onload = function (e) {
268            if($(input).closest('.col-md-9').find('.thumb_post').length <= 0)
269            {
270                $(input).closest('.col-md-9').append('<div class="thumb_post"><img src="'+e.target.result+'"/> </div>');
271            }
272            else
273            {
274                $(input).closest('.col-md-9').find('.thumb_post img').eq(0).attr('src',e.target.result);
275            }
276        }
277        reader.readAsDataURL(input.files[0]);
278    }
279}
280
281
282function addLazyLoadAfterSlider(){
283    if( $('.slick-cloned .ybc_item_img_ladyload .isload').length ){
284        $('.slick-cloned .ybc_item_img_ladyload .isload').parent().removeClass('ybc_item_img_ladyload');
285    }
286    $('img.lazyload').each(function(){
287        $(this).lazyload({
288        threshold: 100,
289        afterLoad      : function (element) {
290			$(this).parent().removeClass('ybc_item_img_ladyload');
291            $(this).parent().parent().removeClass('ybc_item_img_ladyload');
292            $(this).addClass('isload');
293		}
294    });
295    });
296}
297
298

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.