PageSourceSearch

https://aspekty.net/wp-content/themes/bingo/assets/js/theme-script.js?ver=3.3

js aspekty.net collected 2026-10-02 18:19:12 UTC 114,369 bytes, 2,782 lines download raw bytes

1/*--------------------------------------------------------------
2 BINGO MAIN SCRIPT
3 --------------------------------------------------------------*/
4var bingo_ruby_to_top;
5var bingo_ruby_to_top_mobile;
6var bingo_ruby_site_smooth_scroll;
7var bingo_ruby_social_tooltip;
8var bingo_ruby_single_image_popup;
9var bingo_ruby_site_bg_link;
10var bingo_ruby_tfooter_instagram_popup;
11var bingo_ruby_sb_instagram_popup;
12
13(function($) {
14    "use strict";
15    var bingo_ruby = {
16
17        window: $(window),
18        html: $('html, body'),
19        document: $(document),
20        body: $('body'),
21        touch: Modernizr.touch,
22        ios: /(iPad|iPhone|iPod)/g.test(navigator.userAgent),
23
24        //  block filter
25        window_last_pos: 0,
26        direction: '',
27        ajax_filter_item_last_width: [],
28        waypoint_item: [],
29
30        //  slider
31        auto_play: true,
32        auto_play_speed: 5000,
33        play_speed: 200,
34        resize_timer: '',
35        slider_next: '<div class="ruby-slider-next ruby-slider-nav"><i class="fa fa-angle-right" aria-hidden="true"></i></div>',
36        slider_prev: '<div class="ruby-slider-prev ruby-slider-nav"><i class="fa fa-angle-left" aria-hidden="true"></i></div>',
37        slider_popup_next: '<div class="ruby-slider-popup-next ruby-slider-popup-nav"><i class="fa fa-angle-right" aria-hidden="true"></i></div>',
38        slider_popup_prev: '<div class="ruby-slider-popup-prev ruby-slider-popup-nav"><i class="fa fa-angle-left" aria-hidden="true"></i></div>',
39
40        //  Header Background parrallax
41        header_parallax_class: $('#header-image-parallax'),
42        header_parallax_image: $('#background-image-url').attr('src'),
43        is_parallax: $('.is-header-parallax'),
44        header_animation_frame: false,
45
46        //  ajax
47        ajax: {},
48
49        //  document ready
50        document_ready: function() {
51
52            bingo_ruby.enable_sticky_navigation();
53            bingo_ruby.breaking_news();
54            bingo_ruby.subscribe_popup();
55            bingo_ruby.search_popup();
56            bingo_ruby.enable_sticky_sidebar();
57            bingo_ruby.block_dropdown_filter();
58            bingo_ruby.enable_header_parallax();
59            bingo_ruby.enable_smooth_scroll();
60            bingo_ruby.SmoothScrollTOC();
61            bingo_ruby.click_body();
62            bingo_ruby.show_social();
63            bingo_ruby.tooltips_social();
64            bingo_ruby.off_canvas_toggle();
65
66            bingo_ruby.footer_instagram_thumb_popup();
67            bingo_ruby.sb_instagram_thumb_popup();
68
69            bingo_ruby.fw_block_1_slider();
70            bingo_ruby.fw_block_2_slider();
71            bingo_ruby.fw_block_3_slider();
72            bingo_ruby.fw_block_4_slider();
73            bingo_ruby.fw_block_5_slider();
74            bingo_ruby.fw_block_6_slider();
75            bingo_ruby.fw_block_7_slider();
76
77            bingo_ruby.block_related_video_slider();
78            bingo_ruby.block_mini_slider();
79            bingo_ruby.widget_tab_nav();
80            bingo_ruby.single_scroll_to_comment();
81
82            bingo_ruby.ajax_data_term();
83            bingo_ruby.ajax_header_search();
84            bingo_ruby.ajax_dropdown_filter();
85            bingo_ruby.ajax_pagination();
86            bingo_ruby.ajax_loadmore();
87            bingo_ruby.ajax_mega_cat_sub();
88
89        },
90
91        //  document load
92        document_load: function() {
93            bingo_ruby.window.load(function() {
94                bingo_ruby.body.addClass('ruby-js-loaded');
95            });
96        },
97
98        document_reload: function() {
99
100            bingo_ruby.back_to_top();
101            bingo_ruby.site_smooth_display();
102            bingo_ruby.ajax_infinite_scroll();
103            bingo_ruby.block_popup_gallery();
104            bingo_ruby.iframe_responsive();
105            bingo_ruby.post_thumbnail_gallery_slider();
106            bingo_ruby.post_thumbnail_gallery_grid();
107            bingo_ruby.post_thumbnail_gallery_popup();
108            bingo_ruby.post_thumbnail_video_popup();
109            bingo_ruby.iframe_playlist_autoplay();
110            bingo_ruby.single_post_box_comment();
111            bingo_ruby.animation_review_progress_bar();
112            bingo_ruby.single_thumb_popup();
113            bingo_ruby.single_video_responsive();
114            bingo_ruby.single_post_video_popup();
115            bingo_ruby.ajax_video_playlist();
116            bingo_ruby.ajax_single_box_related();
117            bingo_ruby.waypoint_refresh();
118        },
119
120
121        document_resize: function() {
122            bingo_ruby.window.resize(function() {
123
124                clearTimeout(bingo_ruby.resize_timer);
125                bingo_ruby.resize_timer = setTimeout(function() {
126                    bingo_ruby.block_dropdown_filter();
127                }, 150);
128            })
129        },
130
131        //  site smooth scroll
132        enable_smooth_scroll: function() {
133            if (1 == bingo_ruby_site_smooth_scroll) {
134                ruby_smooth_scroll();
135            }
136        },
137
138        /** smooth scroll TOC */
139        SmoothScrollTOC: function() {
140            var TOC = $('#ruby-table-contents');
141            if (TOC.hasClass('rb-smooth-scroll')) {
142                this.html.css('scroll-behavior', 'smooth');
143            }
144        },
145
146        //  click on body
147        click_body: function() {
148            if (bingo_ruby_site_bg_link != undefined) {
149                bingo_ruby.body.on('click', function(e) {
150                    if (e.target != this) {
151                        return;
152                    }
153                    window.open(bingo_ruby_site_bg_link, '_blank');
154                });
155            }
156        },
157
158        //  Back to top
159        back_to_top: function() {
160            if (1 == bingo_ruby_to_top) {
161                if (1 == bingo_ruby_to_top_mobile) {
162                    $().UItoTop({
163                        containerID: 'ruby-back-top', //  fading element id
164                        easingType: 'easeOutQuart',
165                        text: '<i class="fa fa-angle-up"></i>',
166                        containerHoverID: 'ruby-back-top-inner',
167                        scrollSpeed: 800
168                    });
169                } else {
170                    if (false === bingo_ruby.touch) {
171                        $().UItoTop({
172                            containerID: 'ruby-back-top', //  fading element id
173                            easingType: 'easeOutQuart',
174                            text: '<i class="fa fa-angle-up"></i>',
175                            containerHoverID: 'ruby-back-top-inner',
176                            scrollSpeed: 800
177                        });
178                    }
179                }
180            }
181        },
182
183        //  single iframe responsive
184        iframe_responsive: function() {
185            var entry = $('.single-entry.entry');
186            if (entry.length > 0) {
187                entry.each(function() {
188                    var entry_el = $(this);
189                    if (!entry_el.hasClass('iframe-loaded')) {
190                        entry_el.fitVids();
191                        entry_el.addClass('iframe-loaded')
192                    }
193                })
194            }
195        },
196
197        //  get width of item
198        get_width: function(item) {
199            return item.width();
200        },
201
202        //  subscribe form popup
203        subscribe_popup: function() {
204            var top_subscribe_popup = $('#ruby-subscribe');
205            top_subscribe_popup.magnificPopup({
206                type: 'inline',
207                preloader: false,
208                focus: '#name',
209                closeBtnInside: false,
210                removalDelay: 500,
211                callbacks: {
212                    beforeOpen: function() {
213                        this.st.mainClass = this.st.el.attr('data-effect');
214                        if (jQuery(window).width() < 768) {
215                            this.st.focus = false;
216                        }
217                    }
218                }
219            });
220        },
221
222        //  breaking new
223        breaking_news: function() {
224            var breaking_news = $('#ruby-breaking-news');
225            if (breaking_news.length > 0) {
226
227                breaking_news.on('init', function() {
228                    breaking_news.prev('.breaking-news-loader').fadeOut(600, function() {
229                        $(this).remove();
230                        breaking_news.removeClass('slider-init');
231                    });
232                });
233
234                if (bingo_ruby.body.hasClass('is-style-rtl')) {
235                    breaking_news.attr('dir', 'rtl');
236                    breaking_news.slick({
237                        dots: false,
238                        fade: true,
239                        rtl: true,
240                        infinite: true,
241                        autoplay: bingo_ruby.auto_play,
242                        autoplaySpeed: bingo_ruby.auto_play_speed,
243                        speed: 0,
244                        adaptiveHeight: true,
245                        arrows: true,
246                        prevArrow: bingo_ruby.slider_prev,
247                        nextArrow: bingo_ruby.slider_next
248                    });
249                } else {
250                    breaking_news.slick({
251                        dots: false,
252                        fade: true,
253                        infinite: true,
254                        autoplay: bingo_ruby.auto_play,
255                        autoplaySpeed: bingo_ruby.auto_play_speed,
256                        speed: 0,
257                        adaptiveHeight: true,
258                        arrows: true,
259                        prevArrow: bingo_ruby.slider_prev,
260                        nextArrow: bingo_ruby.slider_next
261                    });
262                }
263            }
264        },
265
266        //  off canvas toggle
267        off_canvas_toggle: function() {
268            var off_canvas_btn = $('.ruby-trigger');
269            var btn_close = $('#ruby-off-canvas-close-btn');
270            var site_mask = $('.main-site-mask');
271
272            off_canvas_btn.click(function() {
273                bingo_ruby.body.toggleClass('mobile-js-menu');
274                return false;
275            });
276
277            site_mask.click(function() {
278                bingo_ruby.body.toggleClass('mobile-js-menu');
279                return false;
280            });
281
282            btn_close.click(function() {
283                bingo_ruby.body.toggleClass('mobile-js-menu');
284                return false;
285            });
286
287            //  show hide sub off canvas menu
288            var off_canvas_nav = $('.off-canvas-nav-wrap');
289            var off_canvas_nav_sub_a = off_canvas_nav.find('li.menu-item-has-children >a');
290            off_canvas_nav_sub_a.append('<span class="explain-menu"><span class="explain-menu-inner"><i class="fa fa-angle-down" aria-hidden="true"></i></span></span>');
291            var explain_mobile_menu = $('.explain-menu');
292            explain_mobile_menu.click(function() {
293                $(this).closest('.menu-item-has-children ').toggleClass('show-sub-menu');
294                return false;
295            });
296        },
297
298        //  show social
299        show_social: function() {
300            var social_show = $('.navbar-social > .show-social');
301            var social_close = $('.navbar-social > .close-social');
302            social_show.click(function() {
303                var social = $(this).parent().parent('.navbar-social-wrap');
304                if (!social.hasClass('extend-social')) {
305                    social.addClass('extend-social');
306                    social_close.click(function() {
307                        social.removeClass('extend-social');
308                    })
309                }
310            })
311        },
312
313        //  ruby tooltips
314        tooltips_social: function() {
315            if (1 == bingo_ruby_social_tooltip) {
316                var social_tootips = $('.social-tooltips');
317                social_tootips.find('a').tipsy({ fade: true });
318            }
319        },
320
321        //  search popup
322        search_popup: function() {
323            var search_btn = $('.navbar-right .navbar-search > a');
324            var search_close = $('.ruby-close-search .ruby-close-btn');
325            var search_form = $('#ruby-header-search-popup');
326
327            search_btn.on('click', function(e) {
328                e.preventDefault();
329                search_form.fadeIn('200');
330                search_form.find('form input').focus();
331            });
332
333            search_close.on('click', function(e) {
334                e.preventDefault();
335                search_form.fadeOut('200');
336            });
337        },
338
339        //  enable header parallax
340        enable_header_parallax: function() {
341
342            if (bingo_ruby.header_parallax_class.length > 0 && bingo_ruby.header_parallax_image.length > 0) {
343
344                //  background image responsive
345                bingo_ruby.header_parallax_class.backstretch(bingo_ruby.header_parallax_image, {
346                    fade: 1250,
347                    centeredY: false
348                });
349
350                //  check & enable parallax
351                if ((bingo_ruby.touch === false || bingo_ruby.window.width() > 1024) && bingo_ruby.is_parallax.length > 0) {
352                    bingo_ruby.window.scroll(function() {
353                        bingo_ruby.header_parralax_background();
354                    });
355                }
356            }
357        },
358
359        //  Header Background parrallax
360        header_parralax_background: function() {
361            if (bingo_ruby.header_animation_frame === false) {
362                window.requestAnimationFrame(bingo_ruby.header_parallax_animation)
363            }
364            bingo_ruby.header_animation_frame = true;
365        },
366
367        //  Header parallax animation function
368        header_parallax_animation: function() {
369
370            var header_image_class = bingo_ruby.header_parallax_class.find('img')[0];
371            var bingo_ruby_scroll_top = $(document).scrollTop();
372
373            if (bingo_ruby_scroll_top < 820) {
374                var parallax_move = Math.round(bingo_ruby_scroll_top / 3.5);
375                //  move the bg
376                var translate = 'translate3d(0px,' + parallax_move + 'px, 0px)';
377                header_image_class.style.transform = translate;
378                header_image_class.style['-webkit-transform'] = translate;
379                header_image_class.style['-moz-transform'] = translate;
380                header_image_class.style['-ms-transform'] = translate;
381                header_image_class.style['-o-transform'] = translate;
382            }
383            bingo_ruby.header_animation_frame = false;
384        },
385
386        //  navigation sticky
387        enable_sticky_navigation: function() {
388
389            var sticky_menu = $('.is-navbar-sticky .navbar-outer');
390            if (sticky_menu.length > 0) {
391                var menu_wrap = sticky_menu.find('.navbar-wrap');
392                if (menu_wrap.length > 0) {
393
394                    //  add height holder for nav outer
395                    var menu_height = menu_wrap.height();
396                    var top_spacing = 0;
397
398                    sticky_menu.css('min-height', menu_height);
399
400                    bingo_ruby.window.resize(function() {
401                        menu_height = menu_wrap.height();
402                        sticky_menu.css('min-height', menu_height);
403                    });
404
405                    if (bingo_ruby.body.hasClass('admin-bar')) {
406                        top_spacing = 32;
407                    }
408
409                    //  enable sticky
410                    if (bingo_ruby.body.hasClass('is-smart-sticky')) {
411                        menu_wrap.sticky({
412                            className: 'is-stick',
413                            topSpacing: top_spacing,
414                            smartSticky: true,
415                            zIndex: 9800
416                        });
417                    } else {
418                        menu_wrap.sticky({
419                            className: 'is-stick',
420                            topSpacing: top_spacing,
421                            zIndex: 9800
422                        });
423                    }
424
425                    //  smart sticky
426                    if (bingo_ruby.body.hasClass('is-smart-sticky')) {
427                        menu_wrap.on('sticky-start', function() {
428
429                            //  var flag
430                            var flag_up = true;
431                            var flag_down = true;
432
433                            //  check scrolling
434                            bingo_ruby.window.bind('scroll.ruby_menu_sticky', function() {
435                                window.requestAnimationFrame(function() {
436
437                                    var scroll_top = bingo_ruby.window.scrollTop();
438                                    if (scroll_top !== bingo_ruby.window_last_pos) {
439                                        if (scroll_top > bingo_ruby.window_last_pos) {
440                                            bingo_ruby.direction = 'down';
441                                        } else {
442                                            bingo_ruby.direction = 'up';
443                                        }
444                                        bingo_ruby.window_last_pos = scroll_top;
445                                    }
446
447                                    //  scrolling down
448                                    if (true === flag_down && 'down' == bingo_ruby.direction) {
449
450                                        menu_wrap.css({
451                                            '-webkit-transform': 'translate3d(0px,' + '-' + menu_height + 'px, 0px)',
452                                            '-moz-transform': 'translate3d(0px,' + '-' + menu_height + 'px, 0px)',
453                                            'transform': 'translate3d(0px,' + '-' + menu_height + 'px, 0px)',
454                                            '-webkit-transition': 'transform 0.1s',
455                                            '-moz-transition': 'transform 0.1s',
456                                            'transition': 'transform 0.1s'
457                                        });
458
459                                        //  set flags
460                                        flag_down = false;
461                                        flag_up = true;
462                                    }
463
464                                    //  scrolling up
465                                    if (true === flag_up && 'up' == bingo_ruby.direction) {
466                                        menu_wrap.css({
467                                            '-webkit-transform': 'translate3d(0px, 0px, 0px)',
468                                            '-moz-transform': 'translate3d(0px, 0px, 0px)',
469                                            'transform': 'translate3d(0px, 0px, 0px)',
470                                            '-webkit-transition': 'transform 0.2s',
471                                            '-moz-transition': 'transform 0.2s',
472                                            'transition': 'transform 0.2s'
473                                        });
474
475                                        //  set flags
476                                        flag_down = true;
477                                        flag_up = false;
478                                    }
479                                })
480                            });
481                        });
482
483                        menu_wrap.on('sticky-end', function() {
484                            bingo_ruby.window.unbind('.ruby_menu_sticky');
485                            menu_wrap.css({
486                                '-webkit-transform': 'none',
487                                '-moz-transform': 'none',
488                                'transform': 'none',
489                                '-webkit-transition': 'none',
490                                '-moz-transition': 'none',
491                                'transition': 'none'
492                            });
493                        });
494                    }
495                }
496
497            }
498        },
499
500        // sidebar sticky
501        enable_sticky_sidebar: function() {
502            bingo_ruby.window.load(function() {
503                var sidebars = $('.ruby-sidebar-sticky');
504                if (sidebars.length > 0) {
505                    if (bingo_ruby.get_width(bingo_ruby.window) < 992 || (bingo_ruby.get_width(bingo_ruby.window) < 1024 && true === bingo_ruby.touch) || true == bingo_ruby.ios) {
506                        ruby_sticky_sidebar.is_enable = false;
507                    }
508                    ruby_sticky_sidebar.sticky_sidebar(sidebars);
509                }
510            })
511        },
512
513        // block filter
514        block_dropdown_filter: function() {
515
516            var block_ajax_filter_wrap = $('.block-ajax-filter-wrap');
517            if (block_ajax_filter_wrap.length > 0) {
518                block_ajax_filter_wrap.each(function() {
519
520                    var block_ajax_filter = $(this);
521                    var block_ajax_filter_id = block_ajax_filter.attr('id');
522                    var dropdown_counter = 1;
523                    var list_counter = 1;
524                    var header_inner = block_ajax_filter.parent('.block-header-inner');
525                    var header_title = header_inner.find('.block-title');
526                    var block_ajax_filter_max_width = bingo_ruby.get_width(header_inner) - bingo_ruby.get_width(header_title);
527                    var block_ajax_filter_width = bingo_ruby.get_width(block_ajax_filter);
528
529                    if (block_ajax_filter_width > block_ajax_filter_max_width * 0.6) {
530
531                        // add list filter to dropdown
532                        while ((block_ajax_filter_width > block_ajax_filter_max_width * 0.6) && (dropdown_counter < 200)) {
533                            var dropdown_flag = bingo_ruby.block_dropdown_filter_add_el(block_ajax_filter);
534
535                            // break if empty element
536                            if (0 == dropdown_flag) {
537                                break;
538                            }
539                            block_ajax_filter_width = bingo_ruby.get_width(block_ajax_filter);
540                            dropdown_counter++;
541                        }
542                    } else {
543                        if ('undefined' == typeof bingo_ruby.ajax_filter_item_last_width[block_ajax_filter_id]) {
544
545                            // hide more if list filter is too short
546                            bingo_ruby.block_filter_hide_more(block_ajax_filter);
547
548                        } else {
549
550                            // get latest element width
551                            var ajax_filter_el_last_width = bingo_ruby.ajax_filter_item_last_width[block_ajax_filter_id];
552                            while ((block_ajax_filter_width + ajax_filter_el_last_width < block_ajax_filter_max_width * 0.6) && (list_counter < 200)) {
553                                var list_flag = bingo_ruby.block_list_filter_add_el(block_ajax_filter);
554
555                                // break if return false
556                                if (0 == list_flag) {
557                                    break;
558                                }
559                                // re-calculate width
560                                block_ajax_filter_width = bingo_ruby.get_width(block_ajax_filter);
561                                list_counter++;
562                            }
563                        }
564                    }
565                })
566            }
567        },
568
569        // add filter el
570        block_dropdown_filter_add_el: function(block_ajax_filter) {
571            var block_ajax_filter_id = block_ajax_filter.attr('id');
572            var list_ajax_filter = block_ajax_filter.find('.ajax-filter-list');
573            var dropdown_ajax_filter = block_ajax_filter.find('.ajax-filter-dropdown-list');
574            var list_ajax_filter_last_el = list_ajax_filter.children().last(
574);
575
576            // add to dropdown
577            if (list_ajax_filter_last_el.length > 0) {
578                // set with for latest item
579                bingo_ruby.ajax_filter_item_last_width[block_ajax_filter_id] = list_ajax_filter_last_el.width();
580                bingo_ruby.block_filter_show_more(block_ajax_filter);
581                list_ajax_filter_last_el.detach().prependTo(dropdown_ajax_filter);
582                return 1;
583            } else {
584                return 0;
585            }
586        },
587
588        // block add filter into list
589        block_list_filter_add_el: function(block_ajax_filter) {
590            var block_ajax_filter_id = block_ajax_filter.attr('id');
591            var list_ajax_filter = block_ajax_filter.find('.ajax-filter-list');
592            var dropdown_ajax_filter = block_ajax_filter.find('.ajax-filter-dropdown-list');
593            var dropdown_ajax_filter_first_el = dropdown_ajax_filter.children().first();
594
595            // add to list
596            if (dropdown_ajax_filter_first_el.length > 0) {
597                dropdown_ajax_filter_first_el.css('opacity', '.1');
598                dropdown_ajax_filter_first_el.detach().appendTo(list_ajax_filter);
599
600                setTimeout(function() {
601                    // hide more if empty content
602                    if (dropdown_ajax_filter.children().length == 0) {
603                        bingo_ruby.block_filter_hide_more(block_ajax_filter)
604                    }
605                    dropdown_ajax_filter_first_el.css('opacity', '1');
606                }, 50);
607
608                // set with for latest item
609                bingo_ruby.ajax_filter_item_last_width[block_ajax_filter_id] = dropdown_ajax_filter_first_el.width();
610
611                return 1;
612            } else {
613                return 0;
614            }
615        },
616
617        // hide if over width
618        block_filter_hide_more: function(block_ajax_filter) {
619            var block_ajax_filter_btn = block_ajax_filter.find('.ajax-filter-dropdown');
620            if (block_ajax_filter_btn.css('display') == 'inline-block') {
621                block_ajax_filter_btn.hide();
622            }
623        },
624
625        block_filter_show_more: function(block_ajax_filter) {
626            var block_ajax_filter_btn = block_ajax_filter.find('.ajax-filter-dropdown');
627            if (block_ajax_filter_btn.css('display') == 'none') {
628                block_ajax_filter_btn.show(350);
629            }
630        },
631
632        // gallery slider
633        post_thumbnail_gallery_slider: function() {
634            var gallery_slider = $('.post-thumb-gallery-slider');
635            if (gallery_slider.length > 0) {
636                gallery_slider.each(function() {
637                    var gallery_slider_el = $(this);
638                    if (!gallery_slider_el.hasClass('gallery-loaded')) {
639                        gallery_slider_el.on('init', function() {
640                            gallery_slider_el.imagesLoaded(function() {
641                                gallery_slider_el.prev('.slider-loader').fadeOut(200, function() {
642                                    $(this).remove();
643                                    gallery_slider_el.removeClass('slider-init');
644                                    gallery_slider_el.addClass('gallery-loaded');
645                                });
646                            });
647                        });
648
649                        if (bingo_ruby.body.hasClass('is-style-rtl')) {
650                            gallery_slider_el.attr('dir', 'rtl');
651                            gallery_slider_el.slick({
652                                dots: true,
653                                centerMode: false,
654                                rtl: true,
655                                autoplay: bingo_ruby.auto_play,
656                                speed: bingo_ruby.play_speed,
657                                adaptiveHeight: false,
658                                arrows: true,
659                                lazyLoad: 'progressive',
660                                prevArrow: bingo_ruby.slider_prev,
661                                nextArrow: bingo_ruby.slider_next
662                            });
663                        } else {
664                            gallery_slider_el.slick({
665                                dots: true,
666                                centerMode: false,
667                                autoplay: bingo_ruby.auto_play,
668                                speed: bingo_ruby.play_speed,
669                                adaptiveHeight: false,
670                                arrows: true,
671                                lazyLoad: 'progressive',
672                                prevArrow: bingo_ruby.slider_prev,
673                                nextArrow: bingo_ruby.slider_next
674                            });
675                        }
676                    }
677                })
678            }
679        },
680
681        // post classic gallery grid
682        post_thumbnail_gallery_grid: function() {
683            var gallery_grid = $('.post-thumb-gallery-grid');
684            if (gallery_grid.length > 0) {
685                gallery_grid.each(function() {
686                    var gallery_grid_el = $(this);
687                    gallery_grid_el.fadeIn(300).justifiedGallery({
688                        lastRow: 'justify',
689                        rowHeight: 168,
690                        maxRowHeight: 300,
691                        rel: 'gallery',
692                        waitThumbnailsLoad: true,
693                        margins: 4,
694                        captions: false,
695                        refreshTime: 250,
696                        imagesAnimationDuration: 300,
697                        randomize: false,
698                        sizeRangeSuffixes: { lt100: "", lt240: "", lt320: "", lt500: "", lt640: "", lt1024: "" }
699                    }).on('jg.complete', function() {
700                        // remove loading class
701                        gallery_grid_el.imagesLoaded(function() {
702                            gallery_grid_el.removeClass('slider-init');
703                            gallery_grid_el.prev('.slider-loader').fadeOut(200, function() {
704                                $(this).remove();
705
706                            });
707                        });
708                    });
709                });
710            }
711        },
712
713
714        // thumbnail gallery popup
715        post_thumbnail_gallery_popup: function() {
716            var thumbnail_popup = $('.ruby-thumb-galley-popup');
717            if (thumbnail_popup.length > 0) {
718                thumbnail_popup.each(function() {
719
720                    var thumbnail_popup_el = $(this);
721                    var thumbnail_popup_el_index = thumbnail_popup_el.data('post_index');
722                    if ('undefined' == typeof thumbnail_popup_el_index) {
723                        thumbnail_popup_el_index = 0;
724                    }
725
726                    thumbnail_popup_el.magnificPopup({
727                        type: 'inline',
728                        preloader: false,
729                        focus: '#name',
730                        closeBtnInside: true,
731                        removalDelay: 500,
732                        callbacks: {
733                            beforeOpen: function() {
734                                this.st.mainClass = this.st.el.attr('data-effect');
735                                if (bingo_ruby.get_width(bingo_ruby.window) < 768) {
736                                    this.st.focus = false;
737                                }
738                            },
739                            open: function() {
740                                var popup_content = this.content;
741                                var slider = popup_content.find('.popup-thumbnail-slider');
742                                setTimeout(function() {
743                                    bingo_ruby.post_thumbnail_popup_gallery_slider(slider, thumbnail_popup_el_index);
744                                }, 500);
745                            },
746
747                            beforeClose: function() {
748                                var popup_content = this.content;
749                                var slider = popup_content.find('.popup-thumbnail-slider');
750                                // unslick
751                                if (slider.hasClass('slick-initialized')) {
752                                    setTimeout(function() {
753                                        slider.slick('unslick');
754                                        slider.addClass('slider-init');
755                                        slider.before('<div class="slider-loader"></div>');
756                                    }, 500);
757                                }
758                            }
759                        }
760                    });
761                });
762            }
763        },
764
765        // slider on gallery popup
766        post_thumbnail_popup_gallery_slider: function(gallery_slider, thumbnail_popup_el_index) {
767            var gallery_slider_nav = gallery_slider.next('.slider-nav');
768            // unlick
769            if (gallery_slider.hasClass('slick-initialized')) {
770                gallery_slider.slick('unslick');
771            }
772            if (gallery_slider_nav.hasClass('slick-initialized')) {
773                gallery_slider_nav.slick('unslick');
774            }
775
776            gallery_slider.on('init', function() {
777                gallery_slider.imagesLoaded(function() {
778                    gallery_slider.prev('.slider-loader').fadeOut(200, function() {
779                        $(this).remove();
780                        gallery_slider.removeClass('slider-init');
781                    });
782                });
783            });
784
785            gallery_slider_nav.on('init', function() {
786                gallery_slider_nav.imagesLoaded(function() {
787                    gallery_slider_nav.removeClass('slider-init');
788                });
789            });
790
791            if (bingo_ruby.body.hasClass('is-style-rtl')) {
792                gallery_slider.attr('dir', 'rtl');
793                gallery_slider.slick({
794                    dots: true,
795                    infinite: true,
796                    rtl: true,
797                    autoplay: bingo_ruby.auto_play,
798                    autoplaySpeed: bingo_ruby.auto_play_speed,
799                    speed: bingo_ruby.play_speed,
800                    adaptiveHeight: false,
801                    arrows: true,
802                    initialSlide: thumbnail_popup_el_index,
803                    lazyLoad: 'progressive',
804                    asNavFor: gallery_slider_nav,
805                    prevArrow: bingo_ruby.slider_prev,
806                    nextArrow: bingo_ruby.slider_next
807                });
808            } else {
809                gallery_slider.slick({
810                    dots: true,
811                    infinite: true,
812                    autoplay: bingo_ruby.auto_play,
813                    autoplaySpeed: bingo_ruby.auto_play_speed,
814                    speed: bingo_ruby.play_speed,
815                    adaptiveHeight: false,
816                    arrows: true,
817                    initialSlide: thumbnail_popup_el_index,
818                    lazyLoad: 'progressive',
819                    asNavFor: gallery_slider_nav,
820                    prevArrow: bingo_ruby.slider_prev,
821                    nextArrow: bingo_ruby.slider_next
822                });
823            }
824
825            if (bingo_ruby.body.hasClass('is-style-rtl')) {
826                gallery_slider_nav.attr('dir', 'rtl');
827                gallery_slider_nav.slick({
828                    slidesToShow: 6,
829                    slidesToScroll: 1,
830                    rtl: true,
831                    arrows: false,
832                    dots: false,
833                    variableWidth: true,
834                    adaptiveHeight: false,
835                    asNavFor: gallery_slider,
836                    centerMode: false,
837                    focusOnSelect: true
838                });
839            } else {
840                gallery_slider_nav.slick({
841                    slidesToShow: 6,
842                    slidesToScroll: 1,
843                    arrows: false,
844                    dots: false,
845                    variableWidth: true,
846                    adaptiveHeight: false,
847                    asNavFor: gallery_slider,
848                    centerMode: false,
849                    focusOnSelect: true
850                });
851            }
852        },
853
854
855        // video popup
856        post_thumbnail_video_popup: function() {
857            var post_popup = $('.post-popup-video');
858            if (post_popup.length > 0) {
859                post_popup.each(function() {
860
861                    var post_popup_el = $(this);
862                    var post_thumb = post_popup_el.find('.post-thumb-outer .post-format-wrap');
863                    var popup_src = post_popup_el.find('.popup-thumbnail-video-outer');
864
865                    if (popup_src.length > 0) {
866                        post_thumb.magnificPopup({
867                            items: {
868                                src: popup_src,
869                                type: 'inline',
870                                preloader: false,
871                                removalDelay: 500
872                            },
873                            callbacks: {
874                                beforeOpen: function() {
875                                    this.st.mainClass = 'mpf-ruby-effect';
876                                }
877                            }
878                        });
879                    }
880                });
881            }
882        },
883
884
885        // video play
886        iframe_playlist_autoplay: function() {
887            var auto_play = $('.video-playlist-autoplay');
888            if (auto_play.length > 0) {
889                auto_play.each(function() {
890                    var auto_play_el = $(this);
891                    bingo_ruby.waypoint_item['iframe'] = new Waypoint({
892                        element: auto_play_el,
893                        handler: function() {
894                            var iframe = auto_play_el.find('iframe');
895                            bingo_ruby.iframe_autoplay_process(iframe);
896                            auto_play_el.removeClass('video-playlist-autoplay');
897                            this.destroy();
898                        },
899                        offset: '80%'
900                    });
901                })
902            }
903        },
904
905        // add autoplay
906        iframe_autoplay_process: function(item) {
907            if (item.length > 0 && 'undefined' != item[0]) {
908                var src = item[0].src;
909                if (src.indexOf('?') > -1) {
910                    item[0].src += "&autoplay=1";
911                } else {
912                    item[0].src += "?autoplay=1";
913                }
914            }
915        },
916
917
918        // single video responsive
919        single_video_responsive: function() {
920            var entry_content = $('.entry');
921            entry_content.fitVids();
922        },
923
924        // single video popup on thumbnail
925        single_post_video_popup: function() {
926            var video_btn = $('.single-post-popup-video-btn');
927            if (video_btn.length > 0) {
928                video_btn.each(function() {
929                    var video_btn_el = $(this);
930                    var video_popup_el = video_btn_el.next('.single-post-popup-video');
931                    if (video_popup_el.length > 0) {
932                        var iframe_thumb = video_popup_el.find('.post-thumb');
933                        var iframe_thumb_html = iframe_thumb.html();
934
935                        video_btn_el.magnificPopup({
936                            items: {
937                                src: video_popup_el,
938                                type: 'inline',
939                                preloader: false,
940                                removalDelay: 500
941                            },
942                            callbacks: {
943                                beforeOpen: function() {
944                                    this.st.mainClass = 'mpf-ruby-effect';
945                                },
946                                open: function() {
947                                    var iframe = iframe_thumb.find('iframe');
948                                    bingo_ruby.iframe_playlist_autoplay(iframe);
949                                },
950                                close: function() {
951                                    // reset iframe
952                                    iframe_thumb.html(iframe_thumb_html);
953                                }
954                            }
955                        });
956                    }
957                })
958            }
959        },
960
961        // single comment box
962        single_post_box_comment: function() {
963            var comment_btn = $('.box-comment-btn');
964            if (comment_btn.length > 0) {
965
966                var comment_btn_wrap = comment_btn.parent('.box-comment-btn-wrap');
967                var comment_content = comment_btn_wrap.next('.box-comment-content');
968
969                $('.meta-info-comment').find('a').on('click', function() {
970                    $('html, body').scrollTop(comment_btn.offset().top);
971                    bingo_ruby.single_post_show_box_comment(comment_btn_wrap, comment_content);
972                });
973
974                comment_btn.on('click', function() {
975                    bingo_ruby.single_post_show_box_comment(comment_btn_wrap, comment_content);
976                    return false;
977                })
978            }
979        },
980
981        // scroll to comment
982        single_scroll_to_comment: function() {
983            var comment_btn = $('.box-comment-btn');
984            if (comment_btn.length > 0) {
985                var hash = window.location.hash;
986                if ('#respond' == hash || '#comment' == hash.substring(0, 8)) {
987                    var comment_btn_wrap = comment_btn.parent('.box-comment-btn-wrap');
988                    var comment_content = comment_btn_wrap.next('.box-comment-content');
989
990                    $('html, body').scrollTop(comment_btn.offset().top);
991                    bingo_ruby.single_post_show_box_comment(comment_btn_wrap, comment_content);
992                }
993
994            }
995        },
996
997        // show comment box
998        single_post_show_box_comment: function(comment_btn_wrap, comment_content) {
999            comment_btn_wrap.fadeOut(200, function() {
1000                comment_btn_wrap.remove();
1001            });
1002            comment_content.delay(220).show().animate({ opacity: 1 }, 200);
1003            return false;
1004        },
1005
1006        // review progress bar animation
1007        animation_review_progress_bar: function() {
1008
1009            var progress_bar = $('.score-bar');
1010            progress_bar.each(function() {
1011                $(this).addClass('score-remove');
1012            });
1013
1014            progress_bar.each(function() {
1015                var that = $(this);
1016                that.waypoint({
1017                        handler: function() {
1018                            that.removeClass('score-remove');
1019                            that.addClass('score-animation');
1020                        },
1021                        offset: '85%'
1022                    }
1023                )
1024            });
1025        },
1026
1027        /** -------------------------------------------------------------------------------------------------------------------------
1028         * site smooth display
1029         */
1030        site_smooth_display: function() {
1031
1032            if (bingo_ruby.body.hasClass('is-site-smooth-display')) {
1033                bingo_ruby.animated_image();
1034            }
1035        },
1036
1037
1038        /** -------------------------------------------------------------------------------------------------------------------------
1039         * animating images
1040         */
1041        animated_image: function() {
1042            $('.ruby-animated-image').each(function() {
1043                var that = $(this);
1044                if (!that.hasClass('animated-loaded')) {
1045                    var delay = 50 + (that.offset().left / 3.5);
1046                    that.waypoint({
1047                        handler: function() {
1048                            setTimeout(function() {
1049                                that.addClass('ruby-animation animated-loaded');
1050                            }, delay);
1051                        },
1052                        offset: '100%',
1053                        triggerOnce: true
1054                    });
1055                }
1056            })
1057        },
1058
1059        // gallery single popup
1060        single_thumb_popup: function() {
1061
1062            if (1 == bingo_ruby_single_image_popup) {
1063                var bingo_ruby_single_entry = $('.single .single-content-wrap');
1064
1065                if (bingo_ruby_single_entry.length > 0) {
1066                    var bingo_ruby_single_popup_last_item = null;
1067
1068                    bingo_ruby_single_entry.find('a img').each(function() {
1069                        var image_wrap = $(this).parent();
1070                        var image_link = image_wrap.attr('href');
1071                        if (image_link.indexOf('wp-content/uploads') > 0) {
1072                            image_wrap.addClass('single-popup');
1073                        }
1074                    })
1075                }
1076
1077                bingo_ruby_single_entry.magnificPopup({
1078                    type: 'image',
1079                    removalDelay: 500,
1080                    mainClass: 'mfp-fade ruby-single-popup-image',
1081                    delegate: '.single-popup',
1082                    closeOnContentClick: true,
1083                    closeBtnInside: true,
1084                    gallery: {
1085                        enabled: true
1086                    },
1087                    zoom: {
1088                        enabled: true,
1089                        duration: 500, //  duration of the effect, in milliseconds
1090                        easing: 'ease' //  CSS transition easing function
1091                    },
1092                    callbacks: {
1093                        change: function(item) {
1094                            bingo_ruby_single_popup_last_item = item.el;
1095                            bingo_ruby.single_popup_scroll_view(item.el);
1096                        },
1097                        beforeClose: function() {
1098                            if (bingo_ruby_single_popup_last_item) {
1099                                bingo_ruby.single_popup_scroll_view(bingo_ruby_single_popup_last_item);
1100                            }
1101                        }
1102                    }
1103                });
1104
1105            }
1106        },
1107
1108        // sb instagram single popup
1109        sb_instagram_thumb_popup: function() {
1110
1111            if (1 == bingo_ruby_sb_instagram_popup) {
1112                $('.sb-instagram-widget .instagram-popup-el').magnificPopup({
1113                    type: 'image',
1114                    removalDelay: 200,
1115                    mainClass: 'mfp-fade',
1116                    closeOnContentClick: true,
1117                    closeBtnInside: true,
1118                    gallery: {
1119                        enabled: true,
1120                        navigateByImgClick: true,
1121                        preload: [0, 1]
1122                    }
1123                });
1124            }
1125
1126        },
1127
1128        // footer instagram single popup
1129        footer_instagram_thumb_popup: function() {
1130
1131            if (1 == bingo_ruby_tfooter_instagram_popup) {
1132                $('.top-footer-widget-instagram .instagram-popup-el').magnificPopup({
1133                    type: 'image',
1134                    removalDelay: 200,
1135                    mainClass: 'mfp-fade',
1136                    closeOnContentClick: true,
1137                    closeBtnInside: true,
1138                    gallery: {
1139                        enabled: true,
1140                        navigateByImgClick: true,
1141                        preload: [0, 1]
1142                    }
1143                });
1144            }
1145
1146        },
1147
1148        single_popup_scroll_view: function(element) {
1149
1150            if (true === bingo_ruby.touch && bingo_ruby.html.width() < 992) {
1151                return;
1152            }
1153
1154            bingo_ruby.html.stop();
1155            bingo_ruby.body.stop();
1156
1157            var destination = element.offset().top;
1158            destination = destination - 160;
1159
1160            var distance = Math.abs(bingo_ruby.html.scrollTop() - destination);
1161
1162            var scrolling_time = distance / 5;
1163
1164            // go to destination
1165            bingo_ruby.body.animate(
1166                { scrollTop: destination },
1167                {
1168                    duration: 700 + scrolling_time,
1169                    easing: 'easeInOutQuart'
1170                }
1171            );
1172        },
1173
1174
1175        // gallery popup
1176        block_popup_gallery: function() {
1177
1178            // post gallery popup
1179            var post_gallery = $('.post-gallery');
1180
1181            post_gallery.each(function() {
1182
1183                var post_gallery_el = $(this);
1184                var post_gallery_el_index = post_gallery_el.data('post_gallery_index');
1185                if ('undefined' == typeof post_gallery_el_index) {
1186                    post_gallery_el_index = 0;
1187                }
1188
1189                post_gallery_el.magnificPopup({
1190                    type: 'inline',
1191                    preloader: false,
1192                    focus: '#name',
1193                    closeBtnInside: true,
1194                    disableOn: 992,
1195                    removalDelay: 500,
1196                    callbacks: {
1197                        beforeOpen: function() {
1198                            this.st.mainClass = this.st.el.attr('data-effect');
1199                            if (bingo_ruby.get_width(bingo_ruby.window) < 768) {
1200                                this.st.focus = false;
1201                            }
1202                        },
1203                        open: function() {
1204                            var popup_content = this.content;
1205                            var post_slider = popup_content.find('.popup-post-gallery-slider');
1206                            if (post_slider.length > 0) {
1207                                post_slider.each(function() {
1208                                    var post_slider_el = $(this);
1209                                    bingo_ruby.block_popup_gallery_post_slider(post_slider_el);
1210                                })
1211                            }
1212
1213                            // setup slider
1214                            var slider = popup_content.find('.popup-slider-gallery');
1215                            setTimeout(function() {
1216                                bingo_ruby.block_popup_gallery_slider(slider, post_gallery_el_index);
1217                            }, 200);
1218                        },
1219
1220                        beforeClose: function() {
1221                            var popup_content = this.content;
1222                            var slider = popup_content.find('.popup-slider-gallery');
1223                            // unslick
1224                            if (slider.hasClass('slick-initialized')) {
1225                                setTimeout(function() {
1226                                    slider.slick('unslick');
1227                                    slider.addClass('slider-init');
1228                                    slider.before('<div class="slider-loader"></div>');
1229                                }, 500);
1230                            }
1231                        }
1232                    }
1233                });
1234            });
1235        },
1236
1237
1238        // popup gallery slider (slider for posts)
1239        block_popup_gallery_slider: function(slider, post_gallery_el_index) {
1240
1241            slider.on('init', function() {
1242                slider.imagesLoaded(function() {
1243                    setTimeout(function() {
1244                        slider.prev('.slider-loader').fadeOut(200, function() {
1245                            $(this).remove();
1246                            slider.removeClass('slider-init');
1247                        });
1248                    }, 500);
1249                });
1250            });
1251
1252
1253            if (bingo_ruby.body.hasClass('is-style-rtl')) {
1254                slider.attr('dir', 'rtl');
1255                slider.slick({
1256                    dots: true,
1257                    autoplay: false,
1258                    rtl: true,
1259                    speed: bingo_ruby.play_speed,
1260                    initialSlide: post_gallery_el_index,
1261                    adaptiveHeight: false,
1262                    arrows: true,
1263                    swipe: false,
1264                    swipeToSlide: false,
1265                    touchMove: false,
1266                    infinite: false,
1267                    prevArrow: bingo_ruby.slider_popup_prev,
1268                    nextArrow: bingo_ruby.slider_popup_next
1269                });
1270            } else {
1271                slider.slick({
1272                    dots: true,
1273                    autoplay: false,
1274                    speed: bingo_ruby.play_speed,
1275                    initialSlide: post_gallery_el_index,
1276                    adaptiveHeight: false,
1277                    arrows: true,
1278                    swipe: false,
1279                    swipeToSlide: false,
1280                    touchMove: false,
1281                    infinite: false,
1282                    prevArrow: bingo_ruby.slider_popup_prev,
1283                    nextArrow: bingo_ruby.slider_popup_next
1284                });
1285            }
1286        },
1287
1288        // slider for post gallery
1289        block_popup_gallery_post_slider: function(post_slider) {
1290            var post_slider_nav = post_slider.next('.slider-nav');
1291
1292            // unlick
1293            if (post_slider.hasClass('slick-initialized')) {
1294                post_slider.slick('unslick');
1295            }
1296            if (post_slider_nav.hasClass('slick-initialized')) {
1297                post_slider_nav.slick('unslick');
1298            }
1299
1300            if (bingo_ruby.body.hasClass('is-style-rtl')) {
1301                post_slider.attr('dir', 'rtl');
1302                post_slider.slick({
1303                    dots: true,
1304                    infinite: true,
1305                    rtl: true,
1306                    autoplay: bingo_ruby.auto_play,
1307                    autoplaySpeed: bingo_ruby.auto_play_speed,
1308                    speed: bingo_ruby.play_speed,
1309                    adaptiveHeight: false,
1310                    arrows: true,
1311                    lazyLoad: 'progressive',
1312                    asNavFor: post_slider_nav,
1313                    prevArrow: bingo_ruby.slider_prev,
1314                    nextArrow: bingo_ruby.slider_next
1315                });
1316            } else {
1317                post_slider.slick({
1318                    dots: true,
1319                    infinite: true,
1320                    autoplay: bingo_ruby.auto_play,
1321                    autoplaySpeed: bingo_ruby.auto_play_speed,
1322                    speed: bingo_ruby.play_speed,
1323                    adaptiveHeight: false,
1324                    arrows: true,
1325                    lazyLoad: 'progressive',
1326                    asNavFor: post_slider_nav,
1327                    prevArrow: bingo_ruby.slider_prev,
1328                    nextArrow: bingo_ruby.slider_next
1329                });
1330            }
1331
1332            if (bingo_ruby.body.hasClass('is-style-rtl')) {
1333                post_slider_nav.attr('dir', 'rtl');
1334                post_slider_nav.slick({
1335                    slidesToShow: 4,
1336                    slidesToScroll: 1,
1337                    rtl: true,
1338                    arrows: false,
1339                    dots: false,
1340                    adaptiveHeight: false,
1341                    asNavFor: post_slider,
1342                    centerMode: false,
1343                    focusOnSelect: true
1344                });
1345            } else {
1346                post_slider_nav.slick({
1347                    slidesToShow: 4,
1348                    slidesToScroll: 1,
1349                    arrows: false,
1350                    dots: false,
1351                    adaptiveHeight: false,
1352                    asNavFor: post_slider,
1353                    centerMode: false,
1354                    focusOnSelect: true
1355                });
1356            }
1357        },
1358
1359        // full-width block 1 slider
1360        fw_block_1_slider: function() {
1361            var slider = $('.fw-block-1-slider');
1362            if (slider.length > 0) {
1363                slider.each(function() {
1364
1365                    var slider_el = $(this);
1366
1367                    slider_el.imagesLoaded(function() {
1368                        slider_el.prev('.slider-loader').fadeOut(200, function() {
1369                            $(this).remove();
1370                            slider_el.removeClass('slider-init');
1371                        });
1372                    });
1373
1374                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1375                        slider_el.attr('dir', 'rtl');
1376                        slider_el.slick({
1377                            dots: true,
1378                            rtl: true,
1379                            infinite: true,
1380                            autoplay: bingo_ruby.auto_play,
1381                            autoplaySpeed: bingo_ruby.auto_play_speed,
1382                            speed: bingo_ruby.play_speed,
1383                            adaptiveHeight: false,
1384                            arrows: true,
1385                            prevArrow: bingo_ruby.slider_prev,
1386                            nextArrow: bingo_ruby.slider_next
1387                        });
1388                    } else {
1389                        slider_el.slick({
1390                            dots: true,
1391                            infinite: true,
1392                            autoplay: bingo_ruby.auto_play,
1393                            autoplaySpeed: bingo_ruby.auto_play_speed,
1394                            speed: bingo_ruby.play_speed,
1395                            adaptiveHeight: false,
1396                            arrows: true,
1397                            prevArrow: bingo_ruby.slider_prev,
1398                            nextArrow: bingo_ruby.slider_next
1399                        });
1400                    }
1401                });
1402            }
1403        },
1404
1405        // full-width block 2 slider
1406        fw_block_2_slider: function() {
1407            var slider = $('.fw-block-2-slider');
1408            if (slider.length > 0) {
1409                slider.each(function() {
1410
1411                    var slider_el = $(this);
1412
1413                    slider_el.imagesLoaded(function() {
1414                        slider_el.prev('.slider-loader').fadeOut(200, function() {
1415                            $(this).remove();
1416                            slider_el.removeClass('slider-init');
1417                        });
1418                    });
1419
1420                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1421                        slider_el.attr('dir', 'rtl');
1422                        slider_el.slick({
1423                            dots: true,
1424                            rtl: true,
1425                            infinite: true,
1426                            autoplay: bingo_ruby.auto_play,
1427                            autoplaySpeed: bingo_ruby.auto_play_speed,
1428                            speed: bingo_ruby.play_speed,
1429                            adaptiveHeight: false,
1430                            arrows: true,
1431                            prevArrow: bingo_ruby.slider_prev,
1432                            nextArrow: bingo_ruby.slider_next
1433                        });
1434                    } else {
1435                        slider_el.slick({
1436                            dots: true,
1437                            infinite: true,
1438                            autoplay: bingo_ruby.auto_play,
1439                            autoplaySpeed: bingo_ruby.auto_play_speed,
1440                            speed: bingo_ruby.play_speed,
1441                            adaptiveHeight: false,
1442                            arrows: true,
1443                            prevArrow: bingo_ruby.slider_prev,
1444                            nextArrow: bingo_ruby.slider_next
1445                        });
1446                    }
1447
1448                });
1449            }
1450        },
1451
1452        // full-width block 3 slider
1453        fw_block_3_slider: function() {
1454            var slider = $('.fw-block-3-slider');
1455            if (slider.length > 0) {
1456                slider.each(function() {
1457
1458                    var slider_el = $(this);
1459
1460                    slider_el.imagesLoaded(function() {
1461                        slider_el.prev('.slider-loader').fadeOut(200, function() {
1462                            $(this).remove();
1463                            slider_el.removeClass('slider-init');
1464                        });
1465                    });
1466
1467                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1468                        slider_el.attr('dir', 'rtl');
1469                        slider_el.slick({
1470                            dots: false,
1471                            infinite: true,
1472                            rtl: true,
1473                            autoplay: bingo_ruby.auto_play,
1474                            autoplaySpeed: bingo_ruby.auto_play_speed,
1475                            speed: bingo_ruby.play_speed,
1476                            adaptiveHeight: false,
1477                            arrows: true,
1478                            prevArrow: bingo_ruby.slider_prev,
1479                            nextArrow: bingo_ruby.slider_next
1480                        });
1481                    } else {
1482                        slider_el.slick({
1483                            dots: false,
1484                            infinite: true,
1485                            autoplay: bingo_ruby.auto_play,
1486                            autoplaySpeed: bingo_ruby.auto_play_speed,
1487                            speed: bingo_ruby.play_speed,
1488                            adaptiveHeight: false,
1489                            arrows: true,
1490                            prevArrow: bingo_ruby.slider_prev,
1491                            nextArrow: bingo_ruby.slider_next
1492                        });
1493                    }
1494                });
1495            }
1496        },
1497
1498        // full-width block 4 slider
1499        fw_block_4_slider: function() {
1500            var slider = $('.fw-block-4-slider');
1501            if (slider.length > 0) {
1502                slider.each(function() {
1503
1504                    var slider_el = $(this);
1505
1506                    slider_el.on('init', function() {
1507                        slider_el.imagesLoaded(function() {
1508                            slider_el.prev('.slider-loader').fadeOut(200, function() {
1509                                $(this).remove();
1510                                slider_el.removeClass('slider-init');
1511                            });
1512                        });
1513                    });
1514
1515                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1516                        slider_el.attr('dir', 'rtl');
1517                        slider_el.slick({
1518                            dots: true,
1519                            infinite: true,
1520                            rtl: true,
1521                            autoplay: bingo_ruby.auto_play,
1522                            autoplaySpeed: bingo_ruby.auto_play_speed,
1523                            speed: bingo_ruby.play_speed,
1524                            adaptiveHeight: false,
1525                            arrows: true,
1526                            fade: true,
1527                            prevArrow: bingo_ruby.slider_prev,
1528                            nextArrow: bingo_ruby.slider_next
1529                        });
1530                    } else {
1531                        slider_el.slick({
1532                            dots: true,
1533                            infinite: true,
1534                            autoplay: bingo_ruby.auto_play,
1535                            autoplaySpeed: bingo_ruby.auto_play_speed,
1536                            speed: bingo_ruby.play_speed,
1537                            adaptiveHeight: false,
1538                            arrows: true,
1539                            fade: true,
1540                            prevArrow: bingo_ruby.slider_prev,
1541                            nextArrow: bingo_ruby.slider_next
1542                        });
1543                    }
1544
1545                });
1546            }
1547        },
1548
1549        // full-width block 5 slider
1550        fw_block_5_slider: function() {
1551            var slider = $('.fw-block-5-slider');
1552
1553            if (slider.length > 0) {
1554                slider.each(function() {
1555
1556                    var slider_el = $(this);
1557
1558                    slider_el.imagesLoaded(function() {
1559                        slider_el.prev('.slider-loader').fadeOut(200, function() {
1560                            $(this).remove();
1561                            slider_el.removeClass('slider-init');
1562                        });
1563                    });
1564
1565                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1566                        slider_el.attr('dir', 'rtl');
1567                        slider_el.slick({
1568                            dots: true,
1569                            infinite: true,
1570                            rtl: true,
1571                            autoplay: bingo_ruby.auto_play,
1572                            autoplaySpeed: bingo_ruby.auto_play_speed,
1573                            speed: bingo_ruby.play_speed,
1574                            adaptiveHeight: false,
1575                            arrows: true,
1576                            prevArrow: bingo_ruby.slider_prev,
1577                            nextArrow: bingo_ruby.slider_next
1578                        });
1579                    } else {
1580                        slider_el.slick({
1581                            dots: true,
1582                            infinite: true,
1583                            autoplay: bingo_ruby.auto_play,
1584                            autoplaySpeed: bingo_ruby.auto_play_speed,
1585                            speed: bingo_ruby.play_speed,
1586                            adaptiveHeight: false,
1587                            arrows: true,
1588                            prevArrow: bingo_ruby.slider_prev,
1589                            nextArrow: bingo_ruby.slider_next
1590                        });
1591                    }
1592                });
1593            }
1594        },
1595
1596        // full-width block 6
1597        fw_block_6_slider: function() {
1598            var slider = $('.fw-block-6-slider');
1599            if (slider.length > 0) {
1600                slider.each(function() {
1601
1602                    var slider_el = $(this);
1603
1604                    slider_el.on('init', function() {
1605                        slider_el.imagesLoaded(function() {
1606                            slider_el.prev('.slider-loader').fadeOut(200, function() {
1607                                $(this).remove();
1608                                slider_el.removeClass('slider-init');
1609                            });
1610                        });
1611                    });
1612
1613                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1614                        slider_el.attr('dir', 'rtl');
1615                        slider_el.slick({
1616                            dots: true,
1617                            rtl: true,
1618                            infinite: true,
1619                            autoplay: bingo_ruby.auto_play,
1620                            autoplaySpeed: bingo_ruby.auto_play_speed,
1621                            speed: bingo_ruby.play_speed,
1622                            adaptiveHeight: false,
1623                            arrows: true,
1624                            prevArrow: bingo_ruby.slider_prev,
1625                            nextArrow: bingo_ruby.slider_next
1626                        });
1627                    } else {
1628                        slider_el.slick({
1629                            dots: true,
1630                            infinite: true,
1631                            autoplay: bingo_ruby.auto_play,
1632                            autoplaySpeed: bingo_ruby.auto_play_speed,
1633                            speed: bingo_ruby.play_speed,
1634                            adaptiveHeight: false,
1635                            arrows: true,
1636                            prevArrow: bingo_ruby.slider_prev,
1637                            nextArrow: bingo_ruby.slider_next
1638                        });
1639                    }
1640                });
1641            }
1642        },
1643
1644        // full-width block 7 slider
1645        fw_block_7_slider: function() {
1646            var slider = $('.fw-block-7-slider');
1647            if (slider.length > 0) {
1648                slider.each(function() {
1649
1650                    var slider_el = $(this);
1651
1652                    slider_el.imagesLoaded(function() {
1653                        slider_el.prev('.slider-loader').fadeOut(200, function() {
1654                            $(this).remove();
1655                            slider_el.removeClass('slider-init');
1656                        });
1657                    });
1658
1659                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1660                        slider_el.attr('dir', 'rtl');
1661                        slider_el.slick({
1662                            slidesToShow: 3,
1663                            slidesToScroll: 3,
1664                            dots: true,
1665                            infinite: true,
1666                            rtl: true,
1667                            autoplay: bingo_ruby.auto_play,
1668                            autoplaySpeed: bingo_ruby.auto_play_speed,
1669                            speed: bingo_ruby.play_speed,
1670                            adaptiveHeight: false,
1671                            arrows: true,
1672                            prevArrow: bingo_ruby.slider_prev,
1673                            nextArrow: bingo_ruby.slider_next,
1674                            responsive: [
1675                                {
1676                                    breakpoint: 992,
1677                                    settings: {
1678                                        slidesToShow: 2,
1679                                        slidesToScroll: 2
1680                                    }
1681                                },
1682                                {
1683                                    breakpoint: 768,
1684                                    settings: {
1685                                        slidesToShow: 1,
1686                                        slidesToScroll: 1
1687                                    }
1688                                }
1689                            ]
1690                        });
1691                    } else {
1692                        slider_el.slick({
1693                            slidesToShow: 3,
1694                            slidesToScroll: 3,
1695                            dots: true,
1696                            infinite: true,
1697                            autoplay: bingo_ruby.auto_play,
1698                            autoplaySpeed: bingo_ruby.auto_play_speed,
1699                            speed: bingo_ruby.play_speed,
1700                            adaptiveHeight: false,
1701                            arrows: true,
1702                            prevArrow: bingo_ruby.slider_prev,
1703                            nextArrow: bingo_ruby.slider_next,
1704                            responsive: [
1705                                {
1706                                    breakpoint: 992,
1707                                    settings: {
1708                                        slidesToShow: 2,
1709                                        slidesToScroll: 2
1710                                    }
1711                                },
1712                                {
1713                                    breakpoint: 768,
1714                                    settings: {
1715                                        slidesToShow: 1,
1716                                        slidesToScroll: 1
1717                                    }
1718                                }
1719      
1719                      ]
1720                        });
1721                    }
1722                });
1723            }
1724
1725        },
1726
1727        // block related video
1728        block_related_video_slider: function() {
1729            var slider = $('.related-video-slider');
1730            if (slider.length > 0) {
1731                slider.each(function() {
1732
1733                    var slider_el = $(this);
1734
1735                    slider_el.on('init', function() {
1736                        slider_el.imagesLoaded(function() {
1737                            slider_el.prev('.slider-loader').fadeOut(200, function() {
1738                                $(this).remove();
1739                                slider_el.removeClass('slider-init');
1740                            });
1741                        });
1742                    });
1743
1744                    if (slider_el.hasClass('related-video-1')) {
1745                        if (bingo_ruby.body.hasClass('is-style-rtl')) {
1746                            slider_el.slick({
1747                                slidesToShow: 3,
1748                                slidesToScroll: 1,
1749                                rtl: true,
1750                                dots: false,
1751                                infinite: true,
1752                                autoplay: bingo_ruby.auto_play,
1753                                autoplaySpeed: bingo_ruby.auto_play_speed,
1754                                speed: bingo_ruby.play_speed,
1755                                adaptiveHeight: false,
1756                                arrows: true,
1757                                prevArrow: bingo_ruby.slider_prev,
1758                                nextArrow: bingo_ruby.slider_next,
1759                                responsive: [
1760                                    {
1761                                        breakpoint: 768,
1762                                        settings: {
1763                                            slidesToShow: 2
1764                                        }
1765                                    }
1766                                ]
1767                            });
1768                        } else {
1769                            slider_el.slick({
1770                                slidesToShow: 3,
1771                                slidesToScroll: 1,
1772                                dots: false,
1773                                infinite: true,
1774                                autoplay: bingo_ruby.auto_play,
1775                                autoplaySpeed: bingo_ruby.auto_play_speed,
1776                                speed: bingo_ruby.play_speed,
1777                                adaptiveHeight: false,
1778                                arrows: true,
1779                                prevArrow: bingo_ruby.slider_prev,
1780                                nextArrow: bingo_ruby.slider_next,
1781                                responsive: [
1782                                    {
1783                                        breakpoint: 768,
1784                                        settings: {
1785                                            slidesToShow: 2
1786                                        }
1787                                    }
1788                                ]
1789                            });
1790                        }
1791
1792                    } else {
1793                        if (bingo_ruby.body.hasClass('is-style-rtl')) {
1794                            slider_el.slick({
1795                                slidesToShow: 5,
1796                                slidesToScroll: 1,
1797                                rtl: true,
1798                                dots: false,
1799                                infinite: true,
1800                                autoplay: bingo_ruby.auto_play,
1801                                autoplaySpeed: bingo_ruby.auto_play_speed,
1802                                speed: bingo_ruby.play_speed,
1803                                adaptiveHeight: false,
1804                                arrows: true,
1805                                prevArrow: bingo_ruby.slider_prev,
1806                                nextArrow: bingo_ruby.slider_next,
1807                                responsive: [
1808                                    {
1809                                        breakpoint: 768,
1810                                        settings: {
1811                                            slidesToShow: 3
1812                                        }
1813                                    },
1814                                    {
1815                                        breakpoint: 480,
1816                                        settings: {
1817                                            slidesToShow: 2
1818                                        }
1819                                    }
1820                                ]
1821                            });
1822                        } else {
1823                            slider_el.slick({
1824                                slidesToShow: 5,
1825                                slidesToScroll: 1,
1826                                dots: false,
1827                                infinite: true,
1828                                autoplay: bingo_ruby.auto_play,
1829                                autoplaySpeed: bingo_ruby.auto_play_speed,
1830                                speed: bingo_ruby.play_speed,
1831                                adaptiveHeight: false,
1832                                arrows: true,
1833                                prevArrow: bingo_ruby.slider_prev,
1834                                nextArrow: bingo_ruby.slider_next,
1835                                responsive: [
1836                                    {
1837                                        breakpoint: 768,
1838                                        settings: {
1839                                            slidesToShow: 3
1840                                        }
1841                                    },
1842                                    {
1843                                        breakpoint: 480,
1844                                        settings: {
1845                                            slidesToShow: 2
1846                                        }
1847                                    }
1848                                ]
1849                            });
1850                        }
1851                    }
1852                });
1853            }
1854        },
1855
1856        // feat slider mini
1857        block_mini_slider: function() {
1858            var slider = $('.ruby-mini-slider');
1859            if (slider.length > 0) {
1860                slider.each(function() {
1861
1862                    var slider_el = $(this);
1863
1864                    slider_el.imagesLoaded(function() {
1865                        slider_el.prev('.slider-loader').fadeOut(200, function() {
1866                            $(this).remove();
1867                            slider_el.removeClass('slider-init');
1868                        });
1869                    });
1870
1871                    if (bingo_ruby.body.hasClass('is-style-rtl')) {
1872                        slider_el.slick({
1873                            dots: false,
1874                            infinite: true,
1875                            rtl: true,
1876                            autoplay: bingo_ruby.auto_play,
1877                            autoplaySpeed: bingo_ruby.auto_play_speed,
1878                            speed: bingo_ruby.play_speed,
1879                            adaptiveHeight: false,
1880                            arrows: true,
1881                            prevArrow: bingo_ruby.slider_prev,
1882                            nextArrow: bingo_ruby.slider_next
1883                        });
1884                    } else {
1885                        slider_el.slick({
1886                            dots: false,
1887                            infinite: true,
1888                            autoplay: bingo_ruby.auto_play,
1889                            autoplaySpeed: bingo_ruby.auto_play_speed,
1890                            speed: bingo_ruby.play_speed,
1891                            adaptiveHeight: false,
1892                            arrows: true,
1893                            prevArrow: bingo_ruby.slider_prev,
1894                            nextArrow: bingo_ruby.slider_next
1895                        });
1896                    }
1897                });
1898            }
1899        },
1900
1901        // widget tabs nav
1902        widget_tab_nav: function() {
1903            var widget_tab = $('.widget-tab-nav a');
1904            widget_tab.click(function(e) {
1905                e.preventDefault();
1906                $(this).tab('show');
1907            })
1908        },
1909
1910
1911        // ajax
1912        ajax_cache: {
1913
1914            // set data
1915            data: {},
1916
1917            // get cache
1918            get: function(id) {
1919                return bingo_ruby.ajax_cache.data[id];
1920            },
1921
1922            // set cache
1923            set: function(id, data) {
1924                bingo_ruby.ajax_cache.remove(id);
1925                bingo_ruby.ajax_cache.data[id] = data;
1926            },
1927
1928            // remove cache
1929            remove: function(id) {
1930                delete bingo_ruby.ajax_cache.data[id];
1931            },
1932
1933            // empty cache
1934            exist: function(id) {
1935                return bingo_ruby.ajax_cache.data.hasOwnProperty(id) && bingo_ruby.ajax_cache.data[id] !== null;
1936            }
1937        },
1938
1939        // store default data for ajax
1940        ajax_data_term: function() {
1941            $('.ruby-block-wrap').each(function() {
1942                var block = $(this);
1943                var block_id = block.attr('id');
1944
1945                if ('undefined' != typeof block_id) {
1946                    bingo_ruby.ajax[block_id + '_category_id'] = block.data('category_id');
1947                    bingo_ruby.ajax[block_id + '_category_ids'] = block.data('category_ids');
1948                    bingo_ruby.ajax[block_id + '_tags'] = block.data('tags');
1949                    bingo_ruby.ajax[block_id + '_orderby'] = block.data('orderby');
1950                    bingo_ruby.ajax[block_id + '_post_id'] = block.data('post_id');
1951                }
1952
1953                // check first load
1954                bingo_ruby.ajax_pagination_check(block);
1955                bingo_ruby.ajax_loadmore_check(block);
1956                bingo_ruby.ajax_infinite_scroll_check(block);
1957            })
1958        },
1959
1960        // re initiate all function after ajax
1961        ajax_reinitiate_function: function() {
1962
1963            // remove event handle
1964            bingo_ruby.html.off();
1965            bingo_ruby.document.off();
1966
1967            // reload function
1968            bingo_ruby.document_reload();
1969        },
1970
1971        // refreshAll waypoint
1972        waypoint_refresh: function() {
1973            bingo_ruby.body.imagesLoaded(function() {
1974                setTimeout(function() {
1975                    Waypoint.refreshAll();
1976                }, 200);
1977            })
1978        },
1979
1980        ajax_header_search: function() {
1981
1982            var delay = (function() {
1983                var timer = 0;
1984                return function(callback, ms) {
1985                    clearTimeout(timer);
1986                    timer = setTimeout(callback, ms);
1987                };
1988            })();
1989
1990            var search_result_wrapper = $('.header-search-result');
1991            $('#ruby-search-input').keyup(function() {
1992                var param = $(this).val();
1993
1994                delay(function() {
1995                    if (param) {
1996                        search_result_wrapper.fadeIn(300).html('<div class="ajax-loader"></div>');
1997                        var data = {
1998                            action: 'bingo_ruby_ajax_search',
1999                            s: param
2000                        };
2001                        $.post(bingo_ruby_ajax_url, data, function(data_response) {
2002                            data_response = $.parseJSON(data_response);
2003                            search_result_wrapper.hide().empty().html(data_response).css('height', 'auto').fadeIn(300).css('height', search_result_wrapper.height());
2004                        });
2005                    } else  search_result_wrapper.fadeOut(300, function() {
2006                        $(this).empty().css('height', 'auto');
2007                    });
2008
2009                }, 450);
2010            })
2011        },
2012
2013        ajax_block_data: function(block) {
2014            var param = {};
2015            param.block_id = block.data('block_id');
2016            param.block_name = block.data('block_name');
2017            param.posts_per_page = block.data('posts_per_page');
2018            param.ajax_dropdown = block.data('ajax_dropdown');
2019            param.block_page_max = block.data('block_page_max');
2020            param.block_page_current = block.data('block_page_current');
2021            param.category_id = block.data('category_id');
2022            param.category_ids = block.data('category_ids');
2023            param.orderby = block.data('orderby');
2024            param.authors = block.data('authors');
2025            param.tags = block.data('tags');
2026            param.post_id = block.data('post_id');
2027            param.offset = block.data('offset');
2028            param.excerpt = block.data('excerpt');
2029            param.excerpt_classic = block.data('excerpt_classic');
2030            param.block_style = block.data('block_style');
2031            param.thumb_position = block.data('thumb_position');
2032            param.summary_type = block.data('summary_type');
2033
2034            return param;
2035        },
2036
2037        ajax_dropdown_filter: function() {
2038
2039            $('.ajax-filter-link').off('click').on('click', function(e) {
2040
2041                e.preventDefault();
2042                e.stopPropagation();
2043
2044                var filter_link = $(this);
2045                var block = filter_link.parents('.ruby-block-wrap');
2046                var block_id = block.attr('id');
2047
2048                if (true == bingo_ruby.ajax[block_id + '_processing']) {
2049                    return;
2050                }
2051
2052                var filter_link_val = filter_link.data('ajax_filter_val');
2053                bingo_ruby.ajax[block_id + '_processing'] = true;
2054
2055                // disable other link
2056                block.find('.ajax-link').removeClass('is-active');
2057                block.find('.ajax-link').not(this).addClass('is-disable');
2058                block.find('.ajax-filter-more').addClass('is-disable');
2059                filter_link.addClass('is-active');
2060
2061                // add animation
2062                bingo_ruby.ajax_animation_start(block);
2063
2064                // set param
2065                var param = bingo_ruby.ajax_block_data(block);
2066                bingo_ruby.ajax_dropdown_reset_param(block, param, filter_link_val);
2067
2068                // processing ajax
2069                setTimeout(function() {
2070                    bingo_ruby.ajax_dropdown_filter_process(block, param);
2071                }, 500);
2072
2073            });
2074        },
2075
2076        // reset param when filter
2077        ajax_dropdown_reset_param: function(block, param, filter_link_val) {
2078
2079            param.block_page_current = 1;
2080
2081            block.data('block_page_current', 1);
2082            var block_id = block.attr('id');
2083
2084            if ('category' == param.ajax_dropdown) {
2085
2086                // remove category id
2087                if ('undefined' == typeof (bingo_ruby.ajax[block_id + '_category_id'])) {
2088                    bingo_ruby.ajax[block_id + '_category_id'] = 0;
2089                }
2090
2091                if (0 == filter_link_val) {
2092                    param.category_id = bingo_ruby.ajax[block_id + '_category_id'];
2093                    param.category_ids = bingo_ruby.ajax[block_id + '_category_ids'];
2094
2095                    block.data('category_id', bingo_ruby.ajax[block_id + '_category_id']);
2096                    block.data('category_ids', bingo_ruby.ajax[block_id + '_category_ids']);
2097                } else {
2098
2099                    param.category_id = filter_link_val;
2100                    param.category_ids = 0;
2101
2102                    block.data('category_id', filter_link_val);
2103                    block.data('category_ids', 0);
2104                }
2105            }
2106
2107            if ('tag' == param.ajax_dropdown) {
2108                param.tags = filter_link_val;
2109                block.data('tags', filter_link_val);
2110            }
2111
2112            if ('author' == param.ajax_dropdown) {
2113                param.authors = filter_link_val;
2114                block.data('authors', filter_link_val);
2115            }
2116
2117            if ('popular' == param.ajax_dropdown) {
2118
2119                // store orderby
2120                block.data('orderby_term', block.data('orderby'));
2121
2122                if ('featured' == filter_link_val) {
2123                    param.tags = 'featured';
2124                    block.data('tags', 'featured');
2125                    block.data('orderby', 'date_post');
2126                }
2127
2128                if ('popular' == filter_link_val) {
2129                    param.tags = null;
2130                    param.orderby = 'popular';
2131                    block.data('orderby', 'popular');
2132                    block.data('tags', '');
2133                }
2134
2135                if (0 == filter_link_val) {
2136                    param.tags = bingo_ruby.ajax[block_id + '_tags'];
2137                    param.orderby = bingo_ruby.ajax[block_id + '_orderby'];
2138                    block.data('tags', bingo_ruby.ajax[block_id + '_tags']);
2139                    block.data('orderby', bingo_ruby.ajax[block_id + '_orderby']);
2140                }
2141            }
2142        },
2143
2144        // request ajax dropdown
2145        ajax_dropdown_filter_process: function(block, param) {
2146            // create cache id
2147            var param_cache = param;
2148            delete param_cache.block_page_max;
2149            var cache_id = JSON.stringify(param_cache);
2150
2151            // check cache
2152            if (bingo_ruby.ajax_cache.exist(cache_id)) {
2153                var data = bingo_ruby.ajax_cache.get(cache_id);
2154                if ('undefined' != data.block_page_max) {
2155                    block.data('block_page_max', data.block_page_max);
2156                }
2157
2158                bingo_ruby.ajax_animation_end(block, data.content);
2159                return false;
2160            }
2161
2162            $.ajax({
2163                type: 'POST',
2164                url: bingo_ruby_ajax_url,
2165                data: {
2166                    action: 'bingo_ruby_ajax_filter_data',
2167                    data: param
2168                },
2169                success: function(data) {
2170                    // parse data
2171                    data = $.parseJSON(data);
2172
2173                    if ('undefined' != data.block_page_max) {
2174                        block.data('block_page_max', data.block_page_max);
2175                    }
2176
2177                    // set cache
2178                    bingo_ruby.ajax_cache.set(cache_id, data);
2179
2180                    // append content
2181                    bingo_ruby.ajax_animation_end(block, data.content);
2182                }
2183            });
2184        },
2185
2186        // add animation at start
2187        ajax_animation_start: function(block) {
2188
2189            var content_wrap = block.find('.block-content-wrap');
2190            var content_inner = content_wrap.find('.block-content-inner');
2191
2192            // hide content
2193            content_inner.stop();
2194            $('.ajax-loader').remove();
2195
2196            // add height for ajax
2197            var content_inner_height = content_inner.height();
2198            content_inner.css('height', content_inner_height);
2199
2200            // add loading tag
2201            content_wrap.prepend('<div class="ajax-loader">');
2202            content_inner.addClass('is-overflow');
2203            content_inner.fadeTo('500', 0.05, 'easeInOutCubic');
2204        },
2205
2206
2207        // add animation and append
2208        ajax_animation_end: function(block, content) {
2209
2210            block.delay(100).queue(function() {
2211
2212                // remove disable
2213                block.find('.ajax-link').removeClass('is-disable');
2214                block.find('.ajax-filter-more').removeClass('is-disable');
2215
2216                var block_id = block.attr('id');
2217                var content_wrap = block.find('.block-content-wrap');
2218                var content_inner = content_wrap.find('.block-content-inner');
2219
2220                content_wrap.find('.ajax-loader').remove();
2221                content_inner.stop();
2222                content_inner.html(content);
2223
2224                // append content
2225                content_inner.fadeTo(500, 1, function() {
2226                    bingo_ruby.site_smooth_display();
2227                });
2228
2229                content_inner.removeClass('is-overflow');
2230                setTimeout(function() {
2231                    content_inner.css('height', 'auto');
2232                }, 100);
2233
2234                // set ajax
2235                bingo_ruby.ajax[block_id + '_processing'] = false;
2236
2237                // check ajax after load
2238                bingo_ruby.ajax_pagination_check(block);
2239                bingo_ruby.ajax_loadmore_check(block);
2240                bingo_ruby.ajax_infinite_scroll_check(block);
2241
2242                block.dequeue();
2243            });
2244        },
2245
2246
2247        ajax_pagination: function() {
2248
2249            $('.ajax-pagination-link').off('click').on('click', function(e) {
2250
2251                e.preventDefault();
2252                e.stopPropagation();
2253
2254                var link = $(this);
2255                var block = link.parents('.ruby-block-wrap');
2256                var block_id = block.attr('id');
2257
2258                if (true == bingo_ruby.ajax[block_id + '_processing']) {
2259                    return;
2260                }
2261
2262                // disable click on button
2263                bingo_ruby.ajax[block_id + '_processing'] = true;
2264
2265                // disable block
2266                block.find('.ajax-link').not(this).addClass('is-disable');
2267                block.find('.ajax-filter-more').addClass('is-disable');
2268
2269                var pagination_link_val = link.data('ajax_pagination_link');
2270                var param = bingo_ruby.ajax_block_data(block);
2271
2272                // start animation
2273                bingo_ruby.ajax_animation_start(block);
2274
2275                // processing ajax
2276                setTimeout(function() {
2277                    bingo_ruby.ajax_pagination_process(block, param, pagination_link_val);
2278                }, 200);
2279            });
2280        },
2281
2282        // ajax pagination processing
2283        ajax_pagination_process: function(block, param, pagination_link_val) {
2284
2285            var page_current = param.block_page_current;
2286            if ('prev' == pagination_link_val) {
2287                --page_current;
2288            } else {
2289                ++page_current
2290            }
2291
2292            // set next page
2293            param.block_page_next = page_current;
2294
2295            // set cache
2296            var param_cache = param;
2297            delete param_cache.block_page_max;
2298            param_cache.block_page_current = page_current;
2299
2300            var cache_id = JSON.stringify(param_cache);
2301            // check cache
2302            if (bingo_ruby.ajax_cache.exist(cache_id)) {
2303                var data = bingo_ruby.ajax_cache.get(cache_id);
2304
2305                // set current page
2306                if ('undefined' != data.block_page_current) {
2307                    block.data('block_page_current', data.block_page_current);
2308                }
2309                bingo_ruby.ajax_animation_end(block, data.content);
2310                return false;
2311            }
2312
2313            // ajax request
2314            $.ajax({
2315                type: 'POST',
2316                url: bingo_ruby_ajax_url,
2317                data: {
2318                    action: 'bingo_ruby_pagination_data',
2319                    data: param
2320                },
2321
2322                success: function(data) {
2323                    // parse data
2324                    data = $.parseJSON(data);
2325
2326                    // set current page
2327                    if ('undefined' != data.block_page_current) {
2328                        block.data('block_page_current', data.block_page_current);
2329                    }
2330
2331                    // set cache
2332                    bingo_ruby.ajax_cache.set(cache_id, data);
2333
2334                    // append content
2335                    bingo_ruby.ajax_animation_end(block, data.content);
2336                }
2337            });
2338        },
2339
2340        // check enable or disable next prev
2341        ajax_pagination_check: function(block) {
2342
2343            var param = bingo_ruby.ajax_block_data(block);
2344
2345            // disable if max page < 2
2346            if (param.block_page_max < 2) {
2347                block.find('.ajax-pagination-link').addClass('is-disable');
2348            }
2349
2350            if (param.block_page_current >= param.block_page_max) {
2351                block.find('.ajax-next').addClass('is-disable');
2352            }
2353
2354            if (param.block_page_current <= 1) {
2355                block.find('.ajax-prev').addClass('is-disable');
2356            }
2357        },
2358
2359        ajax_loadmore: function() {
2360
2361            //  on click initialize ajax pagination
2362            $('.ajax-loadmore-link').off('click').on('click', function(e) {
2363
2364                e.preventDefault();
2365                e.stopPropagation();
2366
2367                var link = $(this);
2368                var block = link.parents('.ruby-block-wrap');
2369                var block_id = block.attr('id');
2370
2371                if (true == bingo_ruby.ajax[block_id + '_processing']) {
2372                    return;
2373                }
2374
2375                var param = bingo_ruby.ajax_block_data(block);
2376
2377                // check return
2378                if (param.block_page_current >= param.block_page_max) {
2379                    return;
2380                }
2381
2382                // disable click on button
2383                bingo_ruby.ajax[block_id + '_processing'] = true;
2384
2385                var animation = link.next('.ajax-animation');
2386
2387                // animation button
2388                link.animate({ opacity: 0 }, 200);
2389
2390                setTimeout(function() {
2391                    animation.css({ 'display': 'block' });
2392                    animation.css({ 'visibility': 'visible' });
2393                    animation.delay(200).animate({ opacity: 1 }, 200);
2394                }, 100);
2395
2396                setTimeout(function() {
2397                    bingo_ruby.ajax_loadmore_process(block, param);
2398                }, 200);
2399            })
2400        },
2401
2402        // ajax load more processing
2403        ajax_loadmore_process: function(block, param) {
2404
2405            var block_id = block.attr('id');
2406            var page_current = param.block_page_current;
2407            var page_next = ++page_current;
2408
2409            // set next page
2410            param.block_page_next = page_next;
2411
2412            // ajax request
2413            if (page_next <= param.block_page_max) {
2414
2415                $.ajax({
2416                    type: 'POST',
2417                    url: bingo_ruby_ajax_url,
2418                    data: {
2419                        action: 'bingo_ruby_pagination_data',
2420                        data: param
2421                    },
2422
2423                    success: function(data) {
2424                        // parse data
2425                        data = $.parseJSON(data);
2426
2427                        // set current page
2428                        if ('undefined' != data.block_page_current) {
2429                            block.data('block_page_current', data.block_page_current);
2430                        }
2431
2432                        // append content
2433                        block.find('.block-content-inner').append(data.content);
2434
2435                        // disable click on button
2436                        bingo_ruby.ajax[block_id + '_processing'] = false;
2437
2438                        // reload
2439                        setTimeout(function() {
2440                            bingo_ruby.ajax_reinitiate_function();
2441                        }, 400);
2442
2443                        // show load more
2444                        if (data.block_page_current < param.block_page_max) {
2445
2446                            // hide loading
2447                            var animation = block.find('.ajax-animation');
2448                            animation.css({ 'display': 'none' });
2449                            animation.css({ 'visibility': 'hidden' });
2450                            animation.css({ 'opacity': 0 });
2451
2452                            // show link
2453                            block.find('.ajax-loadmore-link').delay(100).animate({ opacity: .4 }, 200);
2454                        } else {
2455                            // check loadmore
2456                            block.find('.ajax-loadmore-link').hide();
2457                            block.find('.ajax-animation').hide();
2458                        }
2459                    }
2460                });
2461            }
2462        },
2463
2464        // check enable or disable loadmore
2465        ajax_loadmore_check: function(block) {
2466
2467            var param = bingo_ruby.ajax_block_data(block);
2468            if (param.block_page_current >= param.block_page_max || param.block_page_max <= 1) {
2469                block.find('.ajax-loadmore-link').hide();
2470                block.find('.ajax-animation').hide();
2471            } else {
2472                block.find('.ajax-loadmore-link').css('opacity', .4);
2473                block.find('.ajax-loadmore-link').show();
2474            }
2475        },
2476
2477        ajax_infinite_scroll: function() {
2478
2479            var infinite_scroll = $('.ajax-infinite-scroll');
2480            if (infinite_scroll.length > 0) {
2481
2482                infinite_scroll.each(function() {
2483                    var infinite_scroll_el = $(this);
2484                    if (!infinite_scroll_el.hasClass('is-disable')) {
2485                        var animation = infinite_scroll_el.find('.ajax-animation');
2486                        var block = infinite_scroll_el.parents('.ruby-block-wrap');
2487                        var block_id = block.attr('id');
2488                        bingo_ruby.waypoint_item['infinite_scroll'] = new Waypoint({
2489
2490                            element: infinite_scroll_el,
2491                            handler: function(direction) {
2492                                if ('down' == direction) {
2493
2494                                    var param = bingo_ruby.ajax_block_data(block);
2495
2496                                    // check return
2497                                    if (param.block_page_current >= param.block_page_max) {
2498                                        infinite_scroll_el.remove();
2499                                        return;
2500                                    }
2501
2502                                    if (true == bingo_ruby.ajax[block_id + '_processing']) {
2503                                        return;
2504                                    }
2505
2506                                    // disable click on button
2507                                    bingo_ruby.ajax[block_id + '_processing'] = true;
2508
2509                                    // animation button
2510                                    setTimeout(function() {
2511                                        animation.css({ 'display': 'block' });
2512                                        animation.css({ 'visibility': 'visible' });
2513                                        animation.animate({ opacity: 1 }, 200);
2514                                    }, 100);
2515
2516                                    setTimeout(function() {
2517                                        bingo_ruby.ajax_loadmore_process(block, param);
2518                                        bingo_ruby.waypoint_item['infinite_scroll'].destroy();
2519                                    }, 200);
2520                                }
2521                            },
2522                            offset: '99%'
2523                        })
2524                    }
2525                });
2526            }
2527        },
2528
2529        // check enable or disable infinite scroll
2530        ajax_infinite_scroll_check: function(block) {
2531            var param = bingo_ruby.ajax_block_data(block);
2532            if (param.block_page_current >= param.block_page_max || param.block_page_max <= 1) {
2533                block.find('.ajax-infinite-scroll').addClass('is-disable');
2534            } else {
2535                block.find('.ajax-infinite-scroll').removeClass('is-disable');
2536            }
2537        },
2538
2539        ajax_mega_cat_sub: function() {
2540            // set param
2541            var hover_timer;
2542            var cat_sub = $('.mega-category-menu .menu-item');
2543            cat_sub.hover(function(event) {
2544
2545                event.stopPropagation();
2546                cat_sub = $(this);
2547                cat_sub.addClass('is-current-sub').siblings().removeClass('is-current-sub current-menu-item');
2548                var wrapper = cat_sub.parents('.mega-category-menu');
2549                var block = wrapper.find('.block-mega-menu-sub');
2550                hover_timer = setTimeout(function() {
2551                    bingo_ruby.ajax_cat_sub_process(cat_sub, block);
2552                }, 200);
2553            }, function(event) {
2554                clearTimeout(hover_timer);
2555            });
2556        },
2557
2558        // ajax subcategory processing
2559        ajax_cat_sub_process: function(cat_sub, block) {
2560
2561            var param = bingo_ruby.ajax_block_data(block);
2562            // get param
2563            param.category_id = cat_sub.data('mega_sub_filter');
2564            param.block_page_current = 1;
2565
2566            // set block id
2567            block.data('category_id', param.category_id);
2568            block.data('block_page_current', param.block_page_current);
2569            // add animation
2570            bingo_ruby.ajax_animation_start(block);
2571
2572            // processing ajax
2573            setTimeout(function() {
2574                bingo_ruby.ajax_dropdown_filter_process(block, param);
2575            }, 250);
2576        },
2577
2578        ajax_video_playlist: function() {
2579
2580            var video_iframe_nav = $('.video-playlist-iframe-nav-el .post-wrap');
2581            video_iframe_nav.off('click').on('click', function(e) {
2582
2583                if ($(e.target).hasClass('post-title-link')) {
2584
2585                    // navigate if lick on title
2586                    e.stopPropagation();
2587                } else {
2588
2589                    e.preventDefault();
2590                    e.stopPropagation();
2591
2592                    var data = '';
2593                    var post_nav = $(this).parents('.video-playlist-iframe-nav-el');
2594                    var post_id = post_nav.data('post_video_nav_id');
2595                    var playlist = post_nav.parents('.video-playlist-wrap');
2596                    var cache_id = 'video_playlist_' + post_id;
2597
2598                    // star animation
2599                    bingo_ruby.ajax_video_playlist_animation_start(playlist);
2600
2601                    if (bingo_ruby.ajax_cache.exist(cache_id)) {
2602
2603                        data = bingo_ruby.ajax_cache.get(cache_id);
2604                        bingo_ruby.ajax_video_playlist_process(playlist, data)
2605                    } else {
2606                        // ajax request
2607                        $.ajax({
2608                            type: 'POST',
2609                            url: bingo_ruby_ajax_url,
2610                            data: {
2611                                action: 'bingo_ruby_ajax_playlist_video',
2612                                post_id: post_id
2613                            },
2614
2615                            success: function(data) {
2616                                // parse data
2617                                data = $.parseJSON(data);
2618                                // set cache
2619                                bingo_ruby.ajax_cache.set(cache_id, data);
2620                                bingo_ruby.ajax_video_playlist_process(playlist, data)
2621                            }
2622                        });
2623                    }
2624                    return false;
2625                }
2626            })
2627        },
2628
2629
2630        // ajax video playlist processing
2631        ajax_video_playlist_process: function(playlist, data) {
2632
2633            var playlist_iframe = playlist.find('.video-playlist-iframe');
2634            // append html
2635            var iframe_outer = playlist.find('.video-playlist-iframe-el');
2636            iframe_outer.html(data);
2637
2638            var iframe = iframe_outer.find('iframe');
2639            if (iframe.length > 0 && 'undefined' != iframe[0]) {
2640                var src = iframe[0].src;
2641                if (src.indexOf('?') > -1) {
2642                    iframe[0].src += "&autoplay=1";
2643                } else {
2644                    iframe[0].src += "?autoplay=1";
2645                }
2646            }
2647
2648            // remove loader
2649            setTimeout(function() {
2650                playlist_iframe.find('.video-loader').fadeTo(500, .05, function() {
2651                    $(this).remove();
2652                });
2653                playlist_iframe.css('height', 'auto');
2654            }, 100)
2655        },
2656
2657        // video playlist animation start
2658        ajax_video_playlist_animation_start: function(playlist) {
2659
2660            var playlist_iframe = playlist.find('.video-playlist-iframe');
2661            var iframe_outer = playlist.find('.video-playlist-iframe-el');
2662            var iframe_height = playlist_iframe.height();
2663
2664            playlist_iframe.css('height', iframe_height);
2665            playlist_iframe.prepend('<div class="video-loader"></div>');
2666            iframe_outer.empty();
2667        },
2668
2669
2670        ajax_single_box_related: function() {
2671
2672            var related_scroll = $('.related-infinite-scroll');
2673            if (related_scroll.length > 0) {
2674
2675                var block = related_scroll.parents('.single-post-box-related');
2676                var param = {};
2677                var animation = related_scroll.find('.ajax-animation');
2678
2679                param.related_style = block.data('related_style');
2680                param.related_page_current = block.data('related_page_current');
2681                param.related_page_max = block.data('related_page_max');
2682                param.related_post_id = block.data('related_post_id');
2683
2684                bingo_ruby.waypoint_item['related_scroll'] = new Waypoint({
2685                    element: related_scroll,
2686                    handler: function(direction) {
2687                        if ('down' == direction) {
2688
2689                            // check return
2690                            if (param.related_page_current >= param.related_page_max) {
2691                                related_scroll.remove();
2692                                return;
2693                            }
2694
2695                            if (true == bingo_ruby.ajax['ajax_related_processing']) {
2696                                return;
2697                            }
2698
2699                            // disable click on button
2700                            bingo_ruby.ajax['ajax_related_processing'] = true;
2701
2702                            // animation button
2703                            setTimeout(function() {
2704                                animation.css({ 'display': 'block' });
2705                                animation.css({ 'visibility': 'visible' });
2706                                animation.animate({ opacity: 1 }, 200);
2707                            }, 100);
2708
2709                            setTimeout(function() {
2710                                bingo_ruby.ajax_single_box_related_process(block, param);
2711                                bingo_ruby.waypoint_item['related_scroll'].destroy();
2712                            }, 200);
2713                        }
2714                    },
2715                    offset: '99%'
2716                })
2717            }
2718        },
2719
2720        // ajax single related processing
2721        ajax_single_box_related_process: function(block, param) {
2722
2723            // set next page
2724            var page_current = param.related_page_current;
2725            var page_next = ++page_current;
2726            param.related_page_next = page_next;
2727
2728            // ajax request
2729            if (page_next <= param.related_page_max) {
2730                $.ajax({
2731                    type: 'POST',
2732                    url: bingo_ruby_ajax_url,
2733                    data: {
2734                        action: 'bingo_ruby_related_data',
2735                        data: param
2736                    },
2737
2738                    success: function(data) {
2739                        // parse data
2740                        data = $.parseJSON(data);
2741
2742                        // set current page
2743                        if ('undefined' != data.related_page_current) {
2744                            block.data('related_page_current', data.related_page_current);
2745                        }
2746
2747                        // append content
2748                        block.find('.box-related-content').append(data.content);
2749
2750                        // reload
2751                        setTimeout(function() {
2752                            bingo_ruby.ajax_reinitiate_function();
2753                        }, 400);
2754
2755                        // disable click on button
2756                        bingo_ruby.ajax['ajax_related_processing'] = false;
2757                        if (data.related_page_current < param.related_page_max) {
2758                            // hide loading
2759                            var animation = block.find('.ajax-animation');
2760                            animation.css({ 'display': 'none' });
2761                            animation.css({ 'visibility': 'hidden' });
2762                            animation.css({ 'opacity': 0 });
2763
2764                        } else {
2765                            block.find('.ajax-animation').hide();
2766                        }
2767                    }
2768                });
2769            }
2770        }
2771
2772        // end of object
2773    };
2774
2775    $(document).ready(function() {
2776        bingo_ruby.document_ready();
2777        bingo_ruby.document_load();
2778        bingo_ruby.document_reload();
2779        bingo_ruby.document_resize();
2780    });
2781
2782})(jQuery);

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.