1function selectBillingModel() 2{ 3 (function($){ 4 let radioModel = $('input[name="ad_model"]:checked'); 5 let radioValues = $(".bsaProInputsValues"); 6 let radioValuesCPC = $(".bsaProInputsValuesCPC"); 7 let radioValuesCPM = $(".bsaProInputsValuesCPM"); 8 let radioValuesCPD = $(".bsaProInputsValuesCPD"); 9 $('input[name="ad_limit_cpc"]').prop('checked', false); 10 $('input[name="ad_limit_cpm"]').prop('checked', false); 11 $('input[name="ad_limit_cpd"]').prop('checked', false); 12 $('input[name="ad_model"]').on('click', function() { 13 $('.bsaInputInnerModel').removeClass('bsaSelected'); 14 }); 15 radioValues.slideUp(); 16 if ( radioModel.val() === 'cpc' ) { 17 radioValuesCPC.slideDown(); 18 radioModel.parent(1).addClass('bsaSelected'); 19 } else if ( radioModel.val() === 'cpm' ) { 20 radioValuesCPM.slideDown(); 21 radioModel.parent(1).addClass('bsaSelected'); 22 } else if ( radioModel.val() === 'cpd' ) { 23 radioValuesCPD.slideDown(); 24 radioModel.parent(1).addClass('bsaSelected'); 25 } 26 })(jQuery); 27} 28(function($){ 29 let bsaProItem = $('.bsaProItem'); 30 $(document).ready(function(){ 31 // order form redirection 32 if ( $('#bsaSuccessProRedirect').length ) { 33 let getRedirectUrl = $('#bsa_payment_url').val(); 34 setTimeout(function() { 35 window.location.replace(getRedirectUrl); 36 }, 2000); 37 } 38 // agency redirection 39 if ( $('#bsaSuccessProAgencyRedirect').length ) { 40 let getAgencyRedirectUrl = $('#bsa_payment_agency_url').val(); 41 setTimeout(function() { 42 window.location.replace(getAgencyRedirectUrl); 43 }, 2000); 44 } 45 // viewable layer 46 let bsaPopupLayer = $('.bsaPopupLayer'); 47 bsaPopupLayer.each(function() { 48 let child = $(this).first('.bsaProItem'); 49 let childId = $(this).first('.bsaProItem').data('item-id'); 50 if ( childId ) { 51 child.removeClass('bsaProItem').hide(); 52 $(this).attr('data-item-id', childId).addClass('bsaProItem'); 53 } 54 }); 55 // show ads 56 bsaProItem.each(function () { 57 if ($(this).data('animation') != null && $(this).data('animation') !== 'none') { 58 $(this).addClass('bsaToAnimate'); 59 } else { 60 $(this).fadeIn(500).removeClass('bsaHidden'); 61 } 62 }); 63 setTimeout(function() { 64 bsaProItem = $('.bsaProItem'); 65 bsaProItem.each(function () { 66 if ( $(this).hasClass('bsaToAnimate') && $(this).itemViewableScreen() === true ) { 67 $(this).addClass('animated ' + $(this).data('animation')).removeClass('bsaHidden bsaToAnimate'); 68 } 69 }); 70 }, 100); 71 // viewable screen 72 $.fn.itemViewableScreen = function(){ 73 let win = $(window); 74 let viewport = { 75 top : win.scrollTop(), 76 left : win.scrollLeft() 77 }; 78 viewport.right = viewport.left + win.width(); 79 viewport.bottom = viewport.top + win.height(); 80 81 let bounds = this.offset(); 82 bounds.right = bounds.left + this.outerWidth(); 83 bounds.bottom = bounds.top + this.outerHeight(); 84 return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom)); 85 }; 86 if ( $('body').hasClass('bsa-pro-is-admin') === false ) { 87 // set timeout 88 let vis = (function(){ 89 let stateKey, eventKey, keys = { 90 hidden: "visibilitychange", 91 webkitHidden: "webkitvisibilitychange", 92 mozHidden: "mozvisibilitychange", 93 msHidden: "msvisibilitychange" 94 }; 95 for (stateKey in keys) { 96 if (stateKey in document) { 97 eventKey = keys[stateKey]; 98 break; 99 } 100 } 101 return function(c) { 102 if (c) document.addEventListener(eventKey, c); 103 return !document[stateKey]; 104 } 105 })(); 106 let myTimeout = setInterval(itemViewableChecker, 1000); 107 document.addEventListener('visibilitychange', function (event) { 108 if (document.hidden) { 109 clearInterval(myTimeout); 110 } else { 111 myTimeout = setInterval(itemViewableChecker, 1000); 112 } 113 }); 114 // viewable checker 115 let ads = {}; 116 let counter = 0; 117 function itemViewableChecker() { 118 counter++; 119 let unique = {}; 120 bsaProItem = $('.bsaProItem'); 121 bsaProItem.each(function() { 122 if ( $(this).hasClass('bsaHidden') === false && $(this).hasClass('inactiveItem') === false ) { 123 let $id = $(this).data('item-id'); 124 // $(this).offset().top 125 // $(window).height() 126 if ($id > 0 && $(this).itemViewableScreen() === true && vis() === true && $(this).height() > 0 || 127 $id > 0 && $(this).attr('data-layer-id') > 0 && $(this).hasClass('animated') || 128 $id > 0 && $(this).attr('data-background-id') > 0 ) 129 { 130 // set times 131 ads['time' + $id] = (ads['time' + $id] > 0 ? ads['time' + $id] + 1 : 1); 132 ads['timeOut' + $id] = (ads['timeOut' + $id] > 0 ? ads['timeOut' + $id] : 1); 133 // timeout items 134 if ( ads['time' + $id] > ads['timeOut' + $id] && ads['timeOut' + $id] < 20 ) { 135 // unique items 136 if ( !unique[$id] ) { 137 unique[$id] = 1; 138 // console.log('ID: ' + $id); 139 // console.log('TIME: ' + ads['time' + $id]); 140 // console.log('TIMEOUT: ' + ads['timeOut' + $id]); 141 // console.log('- - - -'); 142 $.post(bsa_object.ajax_url, {action:'bsa_viewable_callback', a_id: $id, seconds: ads['timeOut' + $id]}, function(result) { 143 // correct post, reset counters 144 if ( result > 0 ) { 145 ads['timeOut' + $id] = (parseInt(ads['time' + $id]) + parseInt(result)); 146 ads['time' + $id] = 0; 147 } 148 });
149 } 150 } 151 } 152 } 153 }); 154 } 155 } 156 }); 157 // animation trigger 158 $(window).on('scroll', function () { 159 let scrollTop = $(window).scrollTop(); 160 let windowSize = $(window).height(); 161 bsaProItem = $('.bsaProItem'); 162 bsaProItem.each(function () { 163 let prev = $(this).offset(); 164 // console.log($(this).attr('data-item-id')); 165 // console.log(scrollTop + windowSize); 166 // console.log(prev.top); 167 if ( $(this).hasClass('bsaToAnimate') && (scrollTop + windowSize - prev.top) > 10 ) { 168 $(this).addClass('animated ' + $(this).data('animation')).removeClass('bsaHidden bsaToAnimate'); 169 } 170 }); 171 }).scroll(); 172})(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.