1 2jQuery(document).ready(function() { 3 4 slick_callers.push(theme_slick); 5 6 loadSlickCond(); 7 8 9 // lightgallery 10 jQuery(".edinet_gallery .row").lightGallery({ selector: ".col"}); 11 12 // init delle conversioni 13 jQuery("a.edinet_generate_event").click(generateEventOnClick); 14 jQuery("a.edinet_generate_conversion").click(generateConversionOnClick); 15 16}); 17 18function loadSlickCond() 19{ 20 if ((jQuery(".slick-needed").length>0) && (typeof jQuery().slick != 'function')) { 21 22 edinet_loadScript('/wp-content/plugins/edinet-necrologie/lib/node_modules/slick-carousel/slick/slick.js') 23 24 .then(function() { 25 26 console.log("Slick loaded"); 27 executeCallers(slick_callers); 28 29 }) 30 31 .catch(function() { 32 33 console.error("Slick not loaded"); 34 35 }); 36 37 } else { 38 39 if (typeof jQuery().slick == 'function') { 40 41 executeCallers(slick_callers); 42 43 } 44 45 } 46 47} 48 49function generateEventOnClick() { 50 51 if (typeof gtag == "function") { 52 53 var eventCategory = jQuery(this).attr("data-event-category"); 54 var eventLabel = jQuery(this).attr("data-event-label"); 55 56 gtag('event', 'click', { 57 'event_category': eventCategory, 58 'event_label': eventLabel 59 }); 60 } 61} 62 63function generateConversionOnClick() 64{ 65 66 if (typeof gtag == "function") { 67 68 var conversion_label = jQuery(this).attr("data-conversion-label"); 69 70 gtag('event', 'conversion', {'send_to': conversion_label}); 71 } 72 73} 74 75function theme_slick() 76{ 77 if (jQuery("header .edinet_carousel.edinet_carousel_single").length>0) { 78 79 jQuery("header .edinet_carousel.edinet_carousel_single").not(".slick-slider").slick({ 80 81 dots: header_carousel_dots, 82 arrows: header_carousel_arrows, 83 accessibility: true, 84 autoplay: true, 85 autoplaySpeed: header_carousel_duration, // defined normally in footer 86 infinite: true, 87 speed: header_carousel_speed, // defined normally in footer 88 slidesToShow: 1, 89 slidesToScroll: 1, 90 91 92 }); 93 } 94 95 jQuery(".edinet_carousel.edinet_carousel_single").not(".slick-slider").each(function() { 96 97 if (typeof jQuery(this).attr("data-self-init") == "undefined") { 98 99 let optionDots = (jQuery(this).attr("data-dots") == "true"); 100 let optionArrows = (jQuery(this).attr("data-hide-arrows") != "true"); 101 let optionAutoplay = !(jQuery(this).attr("data-no-autoplay") == "true"); 102 let optionAutoplaySpeed = Number(jQuery(this).attr("data-duration")); 103 let optionSpeed = Number(jQuery(this).attr("data-speed")); 104 let optionCenterMode = (jQuery(this).attr("data-center-mode") == "true"); 105 let optionCenterPadding = jQuery(this).attr("data-center-padding"); 106 107 console.log(optionAutoplay); 108 109 if (isNaN(optionAutoplaySpeed) || optionAutoplaySpeed==0) optionAutoplaySpeed=4000; 110 if (isNaN(optionSpeed) || optionSpeed==0) optionSpeed=1000; 111 112 jQuery(this).slick({ 113 114 dots: optionDots, 115 arrows: optionArrows, 116 accessibility: true, 117 autoplay: optionAutoplay, 118 autoplaySpeed: optionAutoplaySpeed, 119 infinite: true, 120 speed: optionSpeed, 121 slidesToShow: 1, 122 slidesToScroll: 1, 123 centerMode: optionCenterMode, 124 centerPadding: optionCenterPadding, 125 126 127 }); 128 129 } 130 131 }); 132} 133 134// setobject / getobject for localstorage 135 136Storage.prototype.setObject = function(key, value) { 137 this.setItem(key, JSON.stringify(value)); 138} 139 140Storage.prototype.getObject = function(key) { 141 var value = this.getItem(key); 142 return value && JSON.parse(value); 143} 144 145function throttle(func, wait, options) { 146 var context, args, result; 147 var timeout = null; 148 var previous = 0; 149 if (!options) options = {}; 150 var later = function() { 151 previous = options.leading === false ? 0 : Date.now(); 152 timeout = null;
153 result = func.apply(context, args); 154 if (!timeout) context = args = null; 155 }; 156 return function() { 157 var now = Date.now(); 158 if (!previous && options.leading === false) previous = now; 159 var remaining = wait - (now - previous); 160 context = this; 161 args = arguments; 162 if (remaining <= 0 || remaining > wait) { 163 if (timeout) { 164 clearTimeout(timeout); 165 timeout = null; 166 } 167 previous = now; 168 result = func.apply(context, args); 169 if (!timeout) context = args = null; 170 } else if (!timeout && options.trailing !== false) { 171 timeout = setTimeout(later, remaining); 172 } 173 return result; 174 }; 175}; 176 177function debounce(func, wait, immediate) { 178 var timeout; 179 return function() { 180 var context = this, args = arguments; 181 var later = function() { 182 timeout = null; 183 if (!immediate) func.apply(context, args); 184 }; 185 var callNow = immediate && !timeout; 186 clearTimeout(timeout); 187 timeout = setTimeout(later, wait); 188 if (callNow) func.apply(context, args); 189 }; 190};
191 192function executeCallers(callers_object) 193{ 194 if ((typeof callers_object == "object") && callers_object.length>0) { 195 196 callers_object.forEach(element => element()); 197 } 198} 199 200 201function edinetBackgroundForIe(element) 202{ 203 204 curSrc=getImageSrc(element); 205 jQuery(element).parent().attr("style", jQuery(element).parent().attr("style") + "; background-image:url(" + curSrc + "); background-repeat:no-repeat; background-size:cover; background-position:center center;"); 206 jQuery(element).hide(); 207} 208 209 210 211function getImageSrc(element) 212{ 213 var parentPicture = jQuery(element).parent(); 214 215 var curSrc=jQuery(element).get(0).currentSrc; 216 217 if (typeof curSrc==='undefined') { 218 219 // il browser non supporta l'automatismo di picture 220 // proviamo con matchmedia 221 222 var arrSources=jQuery("source",parentPicture); 223 224 if (arrSources.length>0) { 225 226 for (var i in arrSources) { 227 228 if (window.matchMedia(jQuery(arrSources[i]).attr("media")).matches) { 229 curSrc = jQuery(arrSources[i]).attr("srcset"); 230 // il primo che troviamo va bene; 231 //console.log("match media says "+i+" "+curSrc); 232 break; 233 } 234 235 236 } 237 } 238 239 // se ancora nulla -> fallback 240 if (typeof curSrc==='undefined') { 241 242 //console.log("fallback") 243 curSrc=jQuery("img",element).attr('src'); 244 } 245 246 } 247 return curSrc; 248} 249 250/** 251 * detect IE 252 * returns version of IE or false, if browser is not Internet Explorer 253 */ 254function detectIE() { 255 var ua = window.navigator.userAgent; 256 257 // Test values; Uncomment to check result ⦠258 259 // IE 10 260 // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'; 261 262 // IE 11 263 // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; 264 265 // Edge 12 (Spartan) 266 // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'; 267 268 // Edge 13 269 // ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586'; 270 271 var msie = ua.indexOf('MSIE '); 272 if (msie > 0) { 273 // IE 10 or older => return version number 274 return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 275 } 276 277 var trident = ua.indexOf('Trident/'); 278 if (trident > 0) { 279 // IE 11 => return version number 280 var rv = ua.indexOf('rv:'); 281 return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 282 } 283 284 var edge = ua.indexOf('Edge/'); 285 if (edge > 0) { 286 // Edge (IE 12+) => return version number 287 return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); 288 } 289 290 // other browser 291 return false; 292}
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.