1/////////////////////////////////////////////// 2// Root URL 3/////////////////////////////////////////////// 4 5let root = window.location.origin; 6let url = root; 7let dev = 'https://dev.infinite-eye.net'; 8let local = 'https://gicf.local'; 9 10let theme = 'chuckle'; 11 12if ( root === dev ) { 13 url = root + '/gicf'; 14} else if ( root === local ) { 15 url = root; 16} 17console.log(url); 18 19 20 21/////////////////////////////////////////////// 22// Brevo forms - auto-namespace ids 23// 24// Every Brevo form export reuses the same hardcoded ids 25// (#sib-form, #EMAIL, #sib-container, etc.), so if more than 26// one ends up on the same page - the footer subscribe form 27// plus one pasted into a page's content, say - the browser's 28// own <button form="sib-form"> resolution (and Brevo's script) 29// only ever bind to the FIRST form with a given id. This finds 30// every Brevo form on the page and gives each one's ids a 31// unique suffix before Brevo's own (deferred) main.js gets a 32// chance to run. 33// 34// Deliberately outside jQuery(document).ready() - that fires 35// after deferred scripts, which is too late. This file loads 36// un-deferred, in the footer, after all page content, so this 37// block runs synchronously and always wins the race. 38/////////////////////////////////////////////// 39 40document.querySelectorAll('.sib-form-container').forEach(function (wrapper, index) { 41 var uid = 'b' + index + '-' + Date.now().toString(36); 42 var idMap = {}; 43 44 wrapper.querySelectorAll('[id]').forEach(function (el) { 45 var newId = el.id + '-' + uid; 46 idMap[el.id] = newId; 47 el.id = newId; 48 }); 49 wrapper.querySelectorAll('[for]').forEach(function (el) { 50 var f = el.getAttribute('for'); 51 if (idMap[f]) el.setAttribute('for', idMap[f]); 52 }); 53 wrapper.querySelectorAll('[form]').forEach(function (el) { 54 var f = el.getAttribute('form'); 55 if (idMap[f]) el.setAttribute('form', idMap[f]); 56 }); 57}); 58 59 60 61// jQuery - Start scripts 62jQuery(document).ready(function($) { 63 64 // Initial values 65 // var winH = $(window).outerHeight(); 66 // var winW = $(window).outerWidth(); 67 // var headerH = $('header').height(); 68 // var mobileWidth = 768; 69 70 71 //////////////////////////////////////////////////// 72 // 73 // REFRESH SIZING ON ORIENTATION 74 // 75 //////////////////////////////////////////////////// 76 77 $(window).resize(function() { 78 if(this.resizeTO) clearTimeout(this.resizeTO); 79 this.resizeTO = setTimeout(function() { 80 $(this).trigger('resizeEnd'); 81 }, 0); 82 }); 83 84 // $(window).bind('load resizeEnd', function() { 85 // }); 86 87 88 //-- Scroll position 89 var scrollPosition = $(window).scrollTop(); 90 function scrollCheck() { 91 scrollPosition = $(window).scrollTop(); 92 if(scrollPosition > 3) { 93 if($('header').hasClass('fixed')){ 94 $('header').addClass('sticky'); 95 } 96 } else { 97 $('header').removeClass('sticky'); 98 } 99 } 100 101 $(window).on('load scroll', function() { 102 scrollCheck(); 103 }); 104 105 //-- Sticky nav offset: header sticks with only .main-navigation left in view 106 function setNavStickOffset() { 107 var header = document.querySelector('header.banner'); 108 var nav = header && header.querySelector('.main-navigation'); 109 if (!nav) return; 110 header.style.setProperty('--nav-stick-offset', nav.offsetTop + 'px'); 111 } 112 $(window).on('load resize', setNavStickOffset); 113 $(document).ready(setNavStickOffset); 114 115 $(document).ready(function(){ 116 scrollCheck(); 117 }); 118 119 120 121 122 // Waypoints 123 124 //-- Lotties 125 $('div.lottie').each(function() { 126 127 var lottiePlayer = $(this).find('lottie-player'); 128 129 $(this).waypoint(function(direction) { 130 if (direction === 'down') { 131 $(this).addClass('animated-lottie'); 132 lottiePlayer.get(0).play(); 133 // console.log('down'); 134 } 135 }, { 136 offset: '100%' 137 }); 138 139 $(this).waypoint(function(direction) { 140 if (direction === 'up') { 141 $(this).removeClass('animated-lottie'); 142 lottiePlayer.get(0).pause(); 143 // console.log('up'); 144 } 145 }, { 146 offset: '100%' 147 }); 148 149 });
150 151 152 153 // Mobile navigation 154 var headerH = ''; 155 headerH = $('header').innerHeight(); 156 // $('.mobile-menu > div').css({ marginTop : headerH }); 157 158 $('.nav-icon').on('click', function(){ 159 160 $('.nav-icon').toggleClass('open'); 161 $('#nav-icon').toggleClass('open'); 162 163 headerH = $('header').innerHeight(); 164 // $('.mobile-menu > div').css({ marginTop : headerH }); 165 166 if($('.nav-icon').hasClass('open')) { 167 // Add Classes 168 $('.nav-menu').html('Close'); 169 $('body, .wrap, header, footer, .mobile-menu, .site-ad-container, .footer-wrap, footer').addClass('menu-opened'); 170 $('header .main-navigation').hide(); 171 172 $('div.lottie').each(function() { 173 $(this).find('lottie-player').get(0).pause(); 174 }); 175 176 } else { 177 // Remove Classes 178 $('.nav-menu').html('Menu'); 179 $('body, .wrap, header, footer, .mobile-menu, .site-ad-container, .footer-wrap, footer').removeClass('menu-opened'); 180 $('header .main-navigation').show(); 181 182 $('li.download a .download-icon').remove(); 183 184 185 $('div.lottie').each(function() { 186 $(this).find('lottie-player').get(0).play(); 187 }); 188 189 } 190 }); 191 192 193 // header - main navigation 194 const $menu = $('ul#menu-top-navigation'); 195 const $items = $menu.children('li'); 196 197 // Add 'menu-right' class to the last li 198 $items.last().addClass('menu-right'); 199 200 // Set data-nav attribute 201 $items.each(function (i) { 202 $(this).attr('data-nav', i); 203 }); 204 205 function resetMenu() { 206 $items.removeClass('hovered').children('a').removeClass('hovered'); 207 $menu.find('ul.sub-menu').stop(true, true).hide(); 208 } 209 210 function openItem($item) { 211 resetMenu(); 212 $item.addClass('hovered'); 213 214 // Show sub-menu with a fade-in (250ms, same as the original interval) 215 $item.find('ul.sub-menu').first() 216 .css({ display: 'grid', opacity: 0 }) 217 .animate({ opacity: 1 }, 250); 218 } 219 220 // Track the last input type (a touch tap also fires emulated mouse events) 221 let lastPointer = 'mouse'; 222 $menu.on('pointerover pointerdown', function (e) { 223 lastPointer = e.originalEvent.pointerType; 224 }); 225 226 $items.on('mouseenter', function () { 227 if (lastPointer !== 'mouse') return; // touch is handled by the click below 228 openItem($(this)); 229 }); 230 231 $items.on('mouseleave', resetMenu); 232 233 // Touch: first tap opens the sub-menu, second tap follows the link 234 $items.children('a').on('click', function (e) { 235 if (lastPointer === 'mouse') return; 236 237 const $item = $(this).parent(); 238 const hasSubMenu = $item.children('ul.sub-menu').length > 0; 239 if (!hasSubMenu || $item.hasClass('hovered')) return; 240 241 e.preventDefault(); 242 openItem($item); 243 }); 244 245 // Touch: tapping anywhere outside the menu closes it 246 $(document).on('pointerdown', function (e) { 247 if (e.originalEvent.pointerType !== 'mouse' && !$(e.target).closest($menu).length) { 248 resetMenu(); 249 } 250 }); 251 252 253 254 // Selects 255 $('.event-filters select').niceSelect(); 256 257 258 259 // Images 260 261 //-- Get all SVG's images, add an svg class to them, 262 //-- and process them to SVG code with the script below 263 $('img[src$=".svg"]').each(function(){ 264 $(this).addClass('svg'); 265 }); 266 267 // -- Change images with svg class to svg 268 $('img.svg').each(function(){ 269 var $img = jQuery(this); 270 var imgID = $img.attr('id'); 271 var imgClass = $img.attr('class'); 272 var imgURL = $img.attr('src'); 273 jQuery.get(imgURL, function(data) { 274 // Get the SVG tag, ignore the rest 275 var $svg = jQuery(data).find('svg'); 276 // Add replaced image's ID to the new SVG 277 if(typeof imgID !== 'undefined') { 278 $svg = $svg.attr('id', imgID); 279 } 280 // Add replaced image's classes to the new SVG 281 if(typeof imgClass !== 'undefined') { 282 $svg = $svg.attr('class', imgClass+' replaced-svg'); 283 } 284 // Remove any invalid XML tags as per http://validator.w3.org 285 $svg = $svg.removeAttr('xmlns:a'); 286 // Replace image with new SVG 287 $img.replaceWith($svg); 288 }, 'xml'); 289 });
290 291 292 // AJAX Pagination 293 var infinite = new Waypoint.Infinite({ 294 element: $('.infinite-container')[0] 295 }); 296 297 298});
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.