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