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