1$(document).ready(function () { 2 /* --- brand logo --- */ 3 // $(window).on('scroll', function () { 4 // if ($(this).scrollTop() > 50) { 5 // $('header').addClass('shrink'); 6 // } else { 7 // $('header').removeClass('shrink'); 8 // } 9 // }); 10 11 /* --- lazy load --- */ 12 $(window).on('load', function () { 13 function isInViewport($el) { 14 let elementTop = $el.offset().top; 15 let elementBottom = elementTop + $el.height(); 16 17 let viewportTop = $(window).scrollTop(); 18 let viewportBottom = viewportTop + $(window).height(); 19 20 return elementBottom > viewportTop && elementTop < viewportBottom; 21 } 22 23 function loadVisibleImages() { 24 $('img[data-src]').each(function () { 25 let $img = $(this); 26 if (isInViewport($img)) { 27 $img.attr('src', $img.data('src')).removeAttr('data-src'); 28 } 29 }); 30 } 31 32 loadVisibleImages(); 33 34 $(window).on('scroll resize', loadVisibleImages); 35 }); 36 37 /* --- mobile menu --- */ 38 $('#mobile-menu-button').on('click', function (e) { 39 const $icon = $(this).find('i'); 40 41 if ($icon.hasClass('fa-bars')) { 42 $icon.fadeOut(150, function () { 43 $icon.removeClass('fa-bars').addClass('fa-xmark').fadeIn(150); 44 }); 45 } else { 46 $icon.fadeOut(150, function () { 47 $icon.removeClass('fa-xmark').addClass('fa-bars').fadeIn(150); 48 }); 49 } 50 51 $('header nav.nav').toggleClass('show'); 52 }); 53 54 $('.mobile-close-icon').on('click', function (e) { 55 $('.submenu-container').removeClass('show') 56 }); 57 58 /* --- menu & submenu --- */ 59 let hideTimeout = null; 60 61 if ($(window).width() <= 1024) { 62 $('.nav-list-item.has-submenu a').on('click', function (e) { 63 e.preventDefault(); 64 }); 65 } 66 67 $('li.has-submenu:not(.nav-item-search)').on('mouseenter', function () { 68 clearTimeout(hideTimeout); 69 70 const submenuSelector = $(this).data('submenu'); 71 72 $('.submenu-container').removeClass('show'); 73 $('li.has-submenu').removeClass('active'); 74 75 $(submenuSelector).addClass('show'); 76 $('header').addClass('submenu-opened'); 77 78 $(".section-icon").each(function () { 79 var $img = $(this); 80 81 if (!$img.attr("src")) { 82 $img.attr("src", $img.data("src")); 83 } 84 85 $img.show(); 86 87 }); 88 89 $(this).addClass('active'); 90 }); 91 92 $('li.nav-item-search, #mobile-menu-search-button').on('click', function (e) { 93 const submenuSelector = $(this).data('submenu'); 94 95 $(submenuSelector).toggleClass('show'); 96 $(this).toggleClass('active'); 97 $('header').toggleClass('submenu-opened'); 98 99 $('#search-field').focus(); 100 }); 101 102 $('.submenu-container:not(.submenu-container-search)').on('mouseenter', function () { 103 clearTimeout(hideTimeout); 104 }); 105 106 $('li.has-submenu:not(.nav-item-search), .submenu-container:not(.submenu-container-search)').on('mouseleave', function () { 107 hideTimeout = setTimeout(() => { 108 $('.submenu-container').removeClass('show'); 109 $('li.has-submenu').removeClass('active'); 110 $('header').removeClass('submenu-opened'); 111 }, 200); 112 }); 113 114 $('li.has-submenu-l3 > a').on('click', function (e) { 115 e.preventDefault(); 116 e.stopPropagation(); 117 118 const $li = $(this).parent(); 119 120 console.log($li); 121 122 $('li.has-submenu-l3').not($li).removeClass('active'); 123 $li.toggleClass('active'); 124 125 }); 126 127 /* --- share --- */ 128 const $menu = $('.article-share-menu'); 129 const $toggle = $('.social__btn--share'); 130 const $facebookShare = $('.social__share__btn--facebook'); 131 const $xShare = $('.social__share__btn--twitter'); 132 const $whatsappShare = $('.social__share__btn--whatsapp'); 133 const $copyLinkShare = $('.social__share__btn--copy-link'); 134 135 $facebookShare.on('click', function (e) { 136 e.stopPropagation(); 137 window.open('https://facebook.com/sharer/sharer.php?u='+window.location.href, '_blank'); 138 }); 139 140 $xShare.on('click', function (e) { 141 e.stopPropagation(); 142 window.open('https://twitter.com/intent/tweet/?text='+encodeURIComponent($(this).data('text'))+'&url='+window.location.href, '_blank'); 143 }); 144 145 $whatsappShare.on('click', function (e) { 146 e.stopPropagation();
147 window.open('https://web.whatsapp.com/send?text='+encodeURIComponent($(this).data('text')+' '+window.location.href), '_blank'); 148 }); 149 150 $copyLinkShare.on('click', function (e) { 151 e.stopPropagation(); 152 153 var $btn = $(this); 154 var url = window.location.href; 155 156 navigator.clipboard.writeText(url).then(function () { 157 $btn.find('.copy-tooltip').remove(); 158 159 var tooltip = $('<div class="copy-tooltip"><i class="fa-solid fa-check" style="font-size: 12px"></i> Link copiat!</div>'); 160 $btn.css('position', 'relative'); 161 $btn.append(tooltip); 162 163 setTimeout(() => tooltip.addClass('show'), 10); 164 165 setTimeout(() => { 166 tooltip.removeClass('show'); 167 setTimeout(() => tooltip.remove(), 300); 168 }, 2000); 169 }); 170 171 }); 172 173 174 $toggle.on('click', function (e) { 175 e.stopPropagation(); 176 $menu.toggleClass('open'); 177 }); 178 179 $menu.on('click', function (e) { 180 e.stopPropagation(); 181 }); 182 183 $(document).on('click', function () { 184 $menu.removeClass('open'); 185 }); 186 187 /* --- tabs --- */ 188 $('.tab-btn').on('click', function () { 189 $('.tab-btn').removeClass('active'); 190 $(this).addClass('active'); 191 192 const tabId = $(this).data('tab'); 193 $('.tab-content').removeClass('active'); 194 $('#' + tabId).addClass('active'); 195 }); 196 197 198 $(".slider").each(function(index){ 199 var id = "slider"; 200 var autoplay = 0; 201 var pause_on_hover = 0; 202 var interval = 5000; 203 var effect = "scroll"; 204 var easing = "easeInOutQuint"; 205 var duration = 750; 206 var elementClasses = $(this).attr('class').split(' '); 207 for(var i=0; i<elementClasses.length; i++) 208 { 209 if(elementClasses[i].indexOf('id-')!==-1) 210 id = elementClasses[i].replace('id-', ''); 211 if(elementClasses[i].indexOf('autoplay-')!==-1) 212 autoplay = elementClasses[i].replace('autoplay-', ''); 213 if(elementClasses[i].indexOf('pause_on_hover-')!==-1) 214 pause_on_hover = elementClasses[i].replace('pause_on_hover-', ''); 215 if(elementClasses[i].indexOf('interval-')!==-1) 216 interval = elementClasses[i].replace('interval-', ''); 217 } 218 var carouselOptions = { 219 responsive: false, 220 width: "100%", 221 items: { 222 start: (config.is_rtl ? -2 : -1), 223 visible: 3, 224 minimum: 3 225 }, 226 scroll: { 227 items: 1, 228 easing: easing, 229 duration: parseInt(duration), 230 fx: effect 231 }, 232 auto: { 233 play: (!!parseInt(autoplay)), 234 timeoutDuration: parseInt(interval), 235 pauseDuration: parseInt(interval), 236 pauseOnHover: (!!parseInt(pause_on_hover)) 237 } 238 }; 239 $(this).carouFredSel(carouselOptions, 240 { 241 transition: true/*, 242 wrapper: { 243 classname: "caroufredsel_wrapper caroufredsel_wrapper_slider" 244 }*/ 245 }); 246 if($(this).children().length>1) 247 { 248 $(this).sliderControl({ 249 appendTo: $(".slider_content_box"), 250 listContainer: $("#" + id + ".slider_posts_list_container"), 251 listItems: 4 252 }); 253 } 254 }); 255 256 function init_carousel_owl(){ 257 $('.init-carousel-owl').each(function(){ 258 259 var items = $(this).data('items') ? $(this).data('items') : 5; 260 var items_lg = $(this).data('items_lg') ? $(this).data('items_lg') : 4; 261 var items_md = $(this).data('items_md') ? $(this).data('items_md') : 3; 262 var items_sm = $(this).data('items_sm') ? $(this).data('items_sm') : 2; 263 var items_xs = $(this).data('items_xs') ? $(this).data('items_xs') : 1; 264 var loop = $(this).data('loop') ? $(this).data('loop') : false; 265 var speed = $(this).data('speed') ? $(this).data('speed') : 200; 266 var auto_play = $(this).data('auto_play') ? $(this).data('auto_play') : false; 267 var auto_play_speed = $(this).data('auto_play_speed') ? $(this).data('auto_play_speed') : false; 268 var auto_play_timeout = $(this).data('auto_play_timeout') ? $(this).data('auto_play_timeout') : 1000; 269 var auto_play_hover = $(this).data('auto_play_hover') ? $(this).data('auto_play_hover') : false; 270 var navigation = $(this).data('navigation') ? $(this).data('navigation') : false; 271 var rewind_nav = $(this).data('rewind_nav') ? $(this).data('rewind_nav') : false;
272 var pagination = $(this).data('pagination') ? $(this).data('pagination') : false; 273 var mouse_drag = $(this).data('mouse_drag') ? $(this).data('mouse_drag') : false; 274 var touch_drag = $(this).data('touch_drag') ? $(this).data('touch_drag') : false; 275 if(items == 1 ) items_lg = items_md = items_sm = items_xs = 1; 276 277 $(this).owlCarousel({ 278 nav: true, 279 autoplay: false, 280 // autoplayTimeout: auto_play_timeout, 281 // autoplaySpeed: auto_play_speed, 282 // autoplayHoverPause: auto_play_hover, 283 navText: [ '<i class="fa-solid fa-chevron-left"></i>', '<i class="fa-solid fa-chevron-right"></i>' ], 284 autoHeight: false, 285 loop: loop, 286 dots: false, 287 rewind: rewind_nav, 288 smartSpeed: speed, 289 mouseDrag: mouse_drag, 290 touchDrag: touch_drag, 291 margin: 20, 292 responsive : { 293 0 : { 294 items: items_xs, 295 }, 296 480 : { 297 items : items_xs 298 }, 299 768 : { 300 items : items_sm 301 }, 302 992: { 303 items : items_md 304 }, 305 1200: { 306 items: items_lg 307 }, 308 1400: { 309 items: items 310 } 311 } 312 }); 313 314 var owl = $(this); 315 316 // setTimeout(function() { 317 // owl.trigger('play.owl.autoplay', [auto_play_timeout]); 318 // }, 10000); 319 }); 320 } 321 322 init_carousel_owl(); 323 324 //vertical carousel 325 var verticalCarousel = function() { 326 $(".vertical_carousel").each(function(index){ 327 $(this).addClass("pr_preloader_vl_" + index); 328 329 330 //caroufred 331 var visible = 3; 332 var autoplay = 1; 333 var pause_on_hover = 0; 334 var scroll = 1; 335 var effect = "scroll"; 336 var easing = "easeInOutQuint"; 337 var duration = 750; 338 var navigation = 1; 339 var elementClasses = $(".pr_preloader_vl_" + index).attr('class').split(' '); 340 for(var i=0; i<elementClasses.length; i++) { 341 if(elementClasses[i].indexOf('visible-')!==-1) 342 visible = elementClasses[i].replace('visible-', ''); 343 if(elementClasses[i].indexOf('autoplay-')!==-1) 344 autoplay = elementClasses[i].replace('autoplay-', ''); 345 if(elementClasses[i].indexOf('pause_on_hover-')!==-1) 346 pause_on_hover = elementClasses[i].replace('pause_on_hover-', ''); 347 if(elementClasses[i].indexOf('scroll-')!==-1) 348 scroll = elementClasses[i].replace('scroll-', ''); 349 if(elementClasses[i].indexOf('effect-')!==-1) 350 effect = elementClasses[i].replace('effect-', ''); 351 if(elementClasses[i].indexOf('easing-')!==-1) 352 easing = elementClasses[i].replace('easing-', ''); 353 if(elementClasses[i].indexOf('duration-')!==-1) 354 duration = elementClasses[i].replace('duration-', ''); 355 if(elementClasses[i].indexOf('navigation-')!==-1) 356 navigation = elementClasses[i].replace('navigation-', ''); 357 /*if(elementClasses[i].indexOf('threshold-')!=-1) 358 var threshold = elementClasses[i].replace('threshold-', '');*/ 359 } 360 var length = $(".pr_preloader_vl_" + index).children().length; 361 if(length<visible) 362 visible = length; 363 var carouselOptions = { 364 direction: "up", 365 items: { 366 visible: parseInt(visible) 367 }, 368 scroll: { 369 items: parseInt(scroll), 370 fx: effect, 371 easing: easing, 372 duration: parseInt(duration), 373 pauseOnHover: (parseInt(pause_on_hover) ? true : false) 374 }, 375 auto: { 376 items: parseInt(scroll), 377 play: (!!parseInt(autoplay)), 378 fx: effect, 379 easing: easing, 380 duration: parseInt(duration), 381 pauseOnHover: (parseInt(pause_on_hover) ? true : false) 382 } 383 }; 384 $(".pr_preloader_vl_" + index).carouFredSel(carouselOptions,{ 385 wrapper: { 386 classname: "caroufredsel_wrapper caroufredsel_wrapper_vertical_carousel" 387 } 388 }); 389 if(navigation) 390 { 391 $(".pr_preloader_vl_" + index).parent().before("<a class='slider_control up slider_control_" + index + "' href='#' title='prev'></a>"); 392 $(".pr_preloader_vl_" + index).parent().after("<a class='slider_control down slider_control_" + index + "' href='#' title='next'></a>"); 393 $(".pr_preloader_vl_" + index).parent().parent().hover(function(){ 394 $(".vertical_carousel_container .up.slider_control_" + index).removeClass("slideDownBack").addClass("slideDown"); 395 $(".vertical_carousel_container .down.slider_control_" + index).removeClass("slideUpBack").addClass("slideUp"); 396 }, 397 function(){ 398 $(".vertical_carousel_container .up.slider_control_" + index).removeClass("slideDown").addClass("slideDownBack"); 399 $(".vertical_carousel_container .down.slider_control_" + index).removeClass("slideUp").addClass("slideUpBack"); 400 }); 401 } 402 $(".pr_preloader_vl_" + index).trigger('configuration', ['prev', {button: $(".vertical_carousel_container .up.slider_control_" + index)}, false]); 403 $(".pr_preloader_vl_" + index).trigger('configuration', ['next', {button: $(".vertical_carousel_container .down.slider_control_" + index)}, false]); 404 $(".pr_preloader_vl_" + index + " li img").css("display", "block"); 405 $(".pr_preloader_vl_" + index + " li .icon").css("display", "block"); 406 $(".pr_preloader_vl_" + index).trigger('configuration', ['debug', false, true]); //for width 407 $(window).trigger("resize"); 408 $(".pr_preloader_vl_" + index).trigger('configuration', ['debug', false, true]); //for height 409 410 }); 411 }; 412 413 $(document).ready(function () { 414 let observer = new IntersectionObserver(function (entries, obs) {
415 entries.forEach(function (entry) { 416 if (entry.isIntersecting) { 417 verticalCarousel(); 418 obs.unobserve(entry.target); 419 } 420 }); 421 }, { threshold: 0.1 }); 422 423 $(".vertical_carousel").each(function () { 424 observer.observe(this); 425 }); 426 }); 427 428 429 /* -- video articles -- */ 430 431 $('.video-wrapper').on('click', function () { 432 const $wrapper = $(this); 433 434 if ($wrapper.hasClass('active')) return; 435 436 const type = $wrapper.data('type'); 437 const src = $wrapper.data('src'); 438 439 if (type === 'youtube') { 440 const $iframe = $('<iframe>', { 441 src: src + '?autoplay=1', 442 allow: 'autoplay; encrypted-media', 443 frameborder: 0 444 }); 445 $wrapper.append($iframe); 446 } else if (type === 'upload') { 447 const $video = $('<video>', { 448 src: src, 449 controls: true, 450 autoplay: true 451 }).attr('controlsList', 'nodownload'); 452 $wrapper.append($video); 453 } else if (type === 'truvid') { 454 $('.truvid-player').css('opacity', '1'); 455 $('.truvid-player').css('z-index', '1'); 456 } 457 458 $wrapper.addClass('active'); 459 }); 460 461});
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.