1(function ($) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 33 var nextBanner = function (adzone) { 34 var active = adzone.getElementsByClassName('active'), 35 a = adzone.querySelectorAll('[data-adfoxly-banner-id]'), 36 z = 0, 37 x = 0, 38 y, 39 bannerId, 40 intervalTime = 5, 41 dataInterval = adzone.getAttribute('data-adfoxly-interval'); 42 43 if (null != dataInterval && 0 != dataInterval) { 44 intervalTime = dataInterval; 45 } 46 47 var interval = setInterval(function () { 48 49 y = z + 1; 50 if (y > a.length - 1) { 51 y = 0; 52 } 53 54 a[z].setAttribute('class', 'hide'); 55 a[y].setAttribute('class', 'active'); 56 57 if (x < a.length) { 58 bannerId = a[y].getAttribute('data-adfoxly-banner-id'); 59 // saveView(bannerId); 60 // saveView(); 61 x++; 62 } 63 64 z++; 65 66 if (z > a.length - 1) { 67 z = 0; 68 } 69 70 }, intervalTime * 1000); 71 }; 72 73 function Utils() { 74 } 75 Utils.prototype = { 76 constructor: Utils, 77 isElementInView: function (element, fullyInView) { 78 var pageTop = jQuery(window).scrollTop(); 79 var pageBottom = pageTop + jQuery(window).height(); 80 var elementTop = jQuery(element).offset().top; 81 var elementBottom = elementTop + jQuery(element).height(); 82 83 if (fullyInView === true) { 84 return ((pageTop < elementTop) && (pageBottom > elementBottom)); 85 } else { 86 return ((elementTop <= pageBottom) && (elementBottom >= pageTop)); 87 } 88 } 89 }; 90 91 var Utils = new Utils(); 92 93 94 function isVisibleInView() { 95 var $banner_el = jQuery("[data-adfoxly-banner-id]"); 96 $banner_el.each(function( index ) { 97 var isElementInView = Utils.isElementInView($banner_el[index], false); 98 99 if (isElementInView) { 100 if ( $banner_el[index]['classList'][0] === 'active' ) { 101 var $banner_id = $banner_el[index]['dataset']['adfoxlyBannerId']; 102 if (adFoxlyListOfViewed.includes($banner_id)) { 103 } else { 104 if (typeof ga !== 'undefined') { 105 ga("send", "event", "AdFoxly", "View", $banner_id); 106 } 107 adFoxlyListOfViewed.push($banner_id); 108 } 109 } 110 } 111 }); 112 } 113 114 115 var adFoxlyListOfViewed = []; 116 117 document.addEventListener("DOMContentLoaded", function (event) { 118 119 var adzones; 120 adzones = document.querySelectorAll('[data-adfoxly-interval]'); 121 122 for (var j = 0; j < adzones.length; j++) { 123 if (adzones[j].hasChildNodes()) { 124 nextBanner(adzones[j]); 125 } 126 } 127 128 jQuery("a[data-adfoxly-banner-id]").click(function (e) { 129 // var $href = jQuery(this).find("a").attr("data-target"); 130 var $clickedId = jQuery(this).attr('data-adfoxly-banner-id'); 131 if (typeof ga !== 'undefined') { 132 ga("send", "event", "AdFoxly", "Click", $clickedId); 133 } 134 }); 135 136 jQuery(".adfoxly-close").click(function (e) { 137 var $adzoneId = jQuery(this).attr('data-adzone-id'); 138 var $currentNumber = getCookie('adfoxly_number_' + $adzoneId); 139 140 setCookie('adfoxly_' + $adzoneId, 'true', 7); 141 if ($currentNumber !== null) { 142 $currentNumber = parseInt($currentNumber) + 1; 143 setCookie('adfoxly_number_' + $adzoneId, $currentNumber, 7); 144 } else { 145 setCookie('adfoxly_number_' + $adzoneId, 1, 7); 146 } 147 148 }); 149 150 jQuery(".adfoxly-close-sticky-x").click(function (e) {
151 jQuery('.adfoxly-wrapper.sticky.sticky-bottom').hide(); 152 }); 153 154 jQuery(".adfoxly-close-sticky-top-x").click(function (e) { 155 jQuery('.adfoxly-wrapper.sticky.sticky-top').hide(); 156 }); 157 158 jQuery(".adfoxly-close-sticky-left-x").click(function (e) { 159 jQuery('.adfoxly-wrapper.sticky.sticky-left').hide(); 160 }); 161 162 jQuery(".adfoxly-close-sticky-right-x").click(function (e) { 163 jQuery('.adfoxly-wrapper.sticky.sticky-right').hide(); 164 }); 165 166 167 var popupDelayZones; 168 popupDelayZones = document.querySelectorAll('.adfoxly-place-delay'); 169 170 for (var ajr = 0; ajr < popupDelayZones.length; ajr++) { 171 // popupDelayZones[ajr].style.display = "block"; 172 var popupDelayAttr = popupDelayZones[ajr].getAttribute('data-delay'); 173 popupDelayAttr = popupDelayAttr * 1000; 174 175 setTimeout(showPopup, popupDelayAttr); 176 } 177 178 function showPopup() { 179 var popupDelayZones; 180 popupDelayZones = document.querySelectorAll('.adfoxly-place-delay'); 181 182 for (var aj = 0; aj < popupDelayZones.length; aj++) { 183 popupDelayZones[aj].style.display = "block"; 184 } 185 } 186 187 188 189 190 isVisibleInView(); 191 var isScrolling; 192 193 window.addEventListener('scroll', function ( event ) { 194 window.clearTimeout( isScrolling ); 195 isScrolling = setTimeout(function() { 196 isVisibleInView(); 197 }, 66); 198 }, false); 199 200 201 var adfoxlyPopupOverlay = document.getElementsByClassName('adfoxly-overlay'); 202 var closeButtons = document.getElementsByClassName('adfoxly-close-x'); 203 var closeButtonsStickyBottom = document.getElementsByClassName('adfoxly-close-x'); 204 205 function closeOverlay() { 206 for (var i = 0; i < adfoxlyPopupOverlay.length; i++) 207 { 208 adfoxlyPopupOverlay[i].style.display = "none"; 209 } 210 } 211 212 for (var i = 0; i < closeButtons.length; i++) 213 { 214 closeButtons[i].addEventListener("click", closeOverlay); 215 } 216 217 for (var i = 0; i < closeButtons.length; i++) 218 { 219 closeButtons[i].addEventListener("click", closeOverlay); 220 } 221 }); 222 223 224 function setCookie(name,value,days) { 225 var expires = ""; 226 if (days) { 227 var date = new Date(); 228 date.setTime(date.getTime() + (days*24*60*60*1000)); 229 expires = "; expires=" + date.toUTCString(); 230 } 231 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 232 } 233 function getCookie(name) { 234 var nameEQ = name + "="; 235 var ca = document.cookie.split(';'); 236 for(var i=0;i < ca.length;i++) { 237 var c = ca[i]; 238 while (c.charAt(0)==' ') c = c.substring(1,c.length); 239 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 240 } 241 return null; 242 } 243 function eraseCookie(name) { 244 document.cookie = name+'=; Max-Age=-99999999;'; 245 } 246 247 248})(jQuery); 249
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.