1'use strict'; 2 3(function( $ ) { 4 5 // post gallery popup 6 if (typeof magnificPopup === "function") { 7 $('.gallery-item').magnificPopup({ 8 delegate: 'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"]', // child items selector, by clicking on it popup will open 9 type: 'image', 10 gallery: { 11 enabled: true, 12 preload: [0,2], 13 navigateByImgClick: true, 14 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', // markup of an arrow button 15 tCounter: '<span class="mfp-counter">%curr% of %total%</span>' // markup of counter 16 } 17 }); 18 } 19 20 // remove unused slides 21 22 $('.__item_to_be_removed__').remove(); 23 $('.btSingleItemColumnInner:empty').remove(); 24 $('.slick-slider').each(function( i, slider ) { 25 $(slider).addClass( 'bt_slider_childs_' + $(slider).find('.bt_bb_content_slider_item').length ); 26 }); 27 28 29 // add slider navigation 30 31 $('.bt_bb_show_dots_bottom > .slick-slider').each(function( i, slider ) { 32 if( $(slider).parent().parent().hasClass("btMediaBox") ) return; 33 var j = 0; 34 $(slider).on( 'init', function( event, slick ) { 35 $(slider).find('ul.slick-dots li').each(function( j, dot ) { 36 var temp_slide = $(slider).find('.slick-list .bt_bb_content_slider_item:eq('+j+')'); 37 var thumb_temp = $(temp_slide).data('thumb'); 38 var title_temp = $(temp_slide).find('.bt_bb_headline_content a').html(); 39 var date_temp = $(temp_slide).find('.btArticleDate').html(); 40 if ( date_temp === undefined ) { 41 var date_temp = $(temp_slide).find('.btArticleStarRating').html(); 42 } 43 var data_output = ''; 44 var thumb_output = ''; 45 var date_output = ''; 46 var title_output = ''; 47 if ( thumb_temp != 'undefined' ) { 48 thumb_output = '<div class="btSlickDotImage"><img src="' + thumb_temp + '" title="' + title_temp + '"/></div>'; 49 } else { 50 thumb_output = ''; 51 } 52 if ( title_temp !== 'undefined' ) { 53 title_output = '<div class="btSlickDotTitle">' + title_temp + '</div>'; 54 } else { 55 title_output = ''; 56 } 57 if ( date_temp !== undefined ) { 58 date_output = '<div class="btSlickDotDate">' + date_temp + '</div>'; 59 } else { 60 date_output = ''; 61 } 62 if ( date_output != '' || title_output != '' ) { 63 data_output = '<div class="btSlickDotData">' + title_output + date_output + '</div>'; 64 } 65 if ( thumb_output != '' ) { 66 data_output = thumb_output + data_output ; 67 } 68 if ( data_output != '' ) { 69 $(dot).html( data_output ); 70 } 71 }); 72 }); 73 }); 74 75 // Move mega menu before regular drop down 76 77 $( 'li.btMenuWideDropdown' ).each(function() { 78 var maxChildItems = 0; 79 $(this).find( '.sub-menu.bt_mega_menu_content > li.bt_mega_menu_content_inner' ).each(function( index ) { 80 var destination = $(this).parent().next( '.sub-menu:not(.bt_mega_menu_content)' ); 81 if ( destination.length > 0 ) { 82 var source = $(this); 83 $(this).parent().remove(); 84 source.prependTo( destination ); 85 //alert($(this).parent().html()); 86 } 87 }); 88 }); 89 90 // Remove togglers 91 92 $( '.menuPort ul ul.sub-menu.bt_mega_menu_content' ).parent().find( '.subToggler' ).remove(); 93 94 // Load images on scroll 95 96 function isOnScreen( elem ) { 97 var element = elem.get( 0 ); 98 if ( element == undefined ) return false; 99 var bounds = element.getBoundingClientRect(); 100 return bounds.top + 75 < window.innerHeight && bounds.bottom > 0; 101 } 102 103 function bt_load_images () { 104 var $images = $( '.btPostImageHolder > a > img.bt_src_load:not(.bt_src_loading):not(.bt_src_loaded)' ); 105 $images.each(function() { 106 var $image = $( this ); 107 if ( isOnScreen( $image ) ) { 108 var downloadingImage = new Image(); 109 downloadingImage.onload = function () { 110 $image.attr( 'src', this.src ); 111 $image.addClass( 'bt_src_loaded' ); 112 }; 113 downloadingImage.src = $image.data( 'src' ); 114 $image.addClass( 'bt_src_loading' ); 115 } 116 }); 117 } 118 119 /* Custom more buttons */ 120 121 jQuery( '.loadMore' ).click(function(event){ 122 event.preventDefault(); 123 jQuery( this ).closest( '.bt_bb_section' ).addClass('btShowHidden'); 124 }); 125 126 /* Load images delay */ 127 128 $( window ).on( 'scroll', function() { 129 bt_load_images (); 130 }); 131 132 bt_load_images (); 133 134})( jQuery ); 135
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.