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 let bodyTag = $('body'); 87 if ( bodyTag.hasClass('bsa-pro-is-admin') === false && bodyTag.hasClass('viewable-enabled') === true ) { 88 // set timeout 89 let vis = (function(){ 90 let stateKey, eventKey, keys = { 91 hidden: "visibilitychange", 92 webkitHidden: "webkitvisibilitychange", 93 mozHidden: "mozvisibilitychange", 94 msHidden: "msvisibilitychange" 95 }; 96 for (stateKey in keys) { 97 if (stateKey in document) { 98 eventKey = keys[stateKey]; 99 break; 100 } 101 } 102 return function(c) { 103 if (c) document.addEventListener(eventKey, c); 104 return !document[stateKey]; 105 } 106 })(); 107 let myTimeout = setInterval(itemViewableChecker, 1000); 108 document.addEventListener('visibilitychange', function (event) { 109 if (document.hidden) { 110 clearInterval(myTimeout); 111 } else { 112 myTimeout = setInterval(itemViewableChecker, 1000); 113 } 114 }); 115 // viewable checker 116 let ads = {}; 117 let ids = ''; 118 let counter = 0; 119 let limit = 3; 120 function itemViewableChecker() { 121 counter++; 122 let unique = {}; 123 bsaProItem = $('.bsaProItem'); 124 bsaProItem.each(function() { 125 if ( $(this).hasClass('inactiveItem') === false ) { // $(this).hasClass('bsaHidden') === false 126 let $id = $(this).data('item-id'); 127 // $(this).offset().top 128 // $(window).height() 129 if ($id > 0 && $(this).itemViewableScreen() === true && vis() === true && $(this).height() > 0 && $(this).offset().top > 0 || 130 $id > 0 && $(this).attr('data-layer-id') > 0 && $(this).hasClass('animated') || 131 $id > 0 && $(this).attr('data-background-id') > 0 ) 132 { 133 // set times 134 ads['time' + $id] = (ads['time' + $id] > 0 ? ads['time' + $id] + 1 : 1); 135 ads['timeOut' + $id] = (ads['timeOut' + $id] > 0 ? ads['timeOut' + $id] : 1); 136 // timeout items 137 if ( ads['time' + $id] > ads['timeOut' + $id] && ads['timeOut' + $id] < 20 ) { 138 // unique items 139 if ( !unique[$id] ) { 140 // push visible ad id 141 ids += $id + ','; 142 unique[$id] = 1; 143 ads['timeOut' + $id] = 1; 144 ads['time' + $id] = 0; 145 // console.log('ID: ' + $id); 146 // console.log('TIME: ' + ads['time' + $id]); 147 // console.log('TIMEOUT: ' + ads['timeOut' + $id]); 148 // console.log('- - - -'); 149 // $.post(bsa_object.ajax_url, {action:'bsa_viewable_callback', a_id: $id, seconds: ads['timeOut' + $id]}, function(result) { 150 // // correct post, reset counters 151 // if ( result > 0 ) { 152 // ads['timeOut' + $id] = (parseInt(ads['time' + $id]) + parseInt(result)); 153 // ads['time' + $id] = 0; 154 // } 155 // }); 156 } 157 } 158 } 159 } 160 }); 161 // console.log(counter); 162 // console.log(ids); 163 if ( ids !== '' && counter > limit ) { 164 // sent request 165 $.post(bsa_object.ajax_url, {action:'bsa_viewable_callback', a_id: ids, time: counter}, function(result) { 166 // correct post, reset counters 167 if ( result > 0 ) { 168 limit = result; 169 // console.log('sent ' + ids); 170 // reset variables 171 ids = ''; 172 counter = 0; 173 } 174 });
175 } 176 } 177 } 178 }); 179 // animation trigger 180 $(window).on('scroll', function () { 181 let scrollTop = $(window).scrollTop(); 182 let windowSize = $(window).height(); 183 bsaProItem = $('.bsaProItem'); 184 bsaProItem.each(function () { 185 let prev = $(this).offset(); 186 // console.log($(this).attr('data-item-id')); 187 // console.log(scrollTop + windowSize); 188 // console.log(prev.top); 189 if ( $(this).hasClass('bsaToAnimate') && (scrollTop + windowSize - prev.top) > 10 ) { 190 $(this).addClass('animated ' + $(this).data('animation')).removeClass('bsaHidden bsaToAnimate'); 191 } 192 }); 193 }).scroll(); 194})(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.