1jQuery(document).ready(function () { 2 3 // [[ INIT - Carousel ]] 4 jQuery('#slider_vision_1').slick(); 5 jQuery('#slider_vision_2').slick(); 6 7 /*Emulate click*/ 8 jQuery(document).on('click', '[data-href]', function (e) { 9 e.preventDefault(); 10 e.stopPropagation(); 11 12 const element = jQuery(this); 13 const href = element.attr('data-href'); 14 const target = element.attr('data-href-target'); 15 if (href) { 16 if (target === '_blank' || e.ctrlKey) { 17 window.open(href, '_blank'); 18 } else { 19 window.location.href = href; 20 } 21 } 22 }); 23 24 jQuery(document).on('click', '.carousel-controls .btn-control[data-slider]', function (e) { 25 e.preventDefault(); 26 const element = jQuery(this); 27 _slider(element); 28 }); 29 30 function _slider(element) { 31 const slider = element.attr('data-slider'); 32 const opt = element.attr('data-slider-opt'); 33 const slickSelector = jQuery('#' + slider); 34 if (opt === 'next') { 35 slickSelector.slick('slickNext'); 36 } else if (opt === 'previous') { 37 slickSelector.slick('slickPrev'); 38 } 39 40 return slickSelector; 41 } 42 43 jQuery(".current-menu-item").addClass("active"); 44 /* For News Pagination */ 45 jQuery(document).on('click', '#news-content a.page-link', function (e) { 46 e.preventDefault(); 47 const _this = jQuery(this); 48 const _page = _this.attr('data-page'); 49 ajax_load_news(_page); 50 }); 51 52 function ajax_load_news(_page) { 53 if (!jQuery('body').hasClass('loading-record')) { 54 jQuery('body').addClass('loading-record'); 55 const _year = jQuery('.filter-year button.active').data('filter-year'); 56 jQuery.ajax({ 57 url: factor.ajax_url, 58 method: 'GET', 59 // data: 'action=news_pagination&page=' + escape(_page) + '&year=' + escape(_year) + '&_factor_ajax=' + escape(factor.ajax_nonce), 60 data: 'action=news_pagination&page=' + escape(_page) + '&year=' + escape(_year) + '&_factor_ajax=', 61 }).done(function (response) { 62 jQuery('#news-content').html(response); 63 jQuery('body').removeClass('loading-record'); 64 }); 65 } 66 } 67 68 /* on click filter */ 69 jQuery(document).on('click', '.news-filter button', function (e) { 70 e.preventDefault(); 71 const _this = jQuery(this); 72 _this.parent().parent().find('.active').removeClass('active'); 73 _this.addClass('active'); 74 ajax_load_news(1); 75 }); 76 77 /** 78 * Synchronize two elements to have the same height. 79 * For example 2 paragraphs to keep the same height with different content. 80 * Put the attribute data-sphw-ref for the paragraph that you want to be synchronized, the value of the attr 81 * should be the other element to be synchronized with. 82 * 83 * Take care if you are using padding in your elements given this code use the padding to align them. 84 * */ 85 let resizeProcessTimeOut; 86 synchronizeParagraphHeights(); 87 window.onresize = function () { 88 clearTimeout(resizeProcessTimeOut); 89 resizeProcessTimeOut = setTimeout(synchronizeParagraphHeights, 500); 90 }; 91 92 function synchronizeParagraphHeights() { 93 // synchronize paragraph height with ref 94 const paragraphs = jQuery('[data-sphw-ref]'); 95 if (paragraphs && paragraphs.length > 0) { 96 paragraphs.each(function (i, el) { 97 const element = jQuery(el); 98 const mainEl = jQuery(`#${element?.attr('data-sphw-ref')}`); 99 100 if (element?.length > 0 && mainEl?.length > 0) { 101 102 // remove the adjustment for little screens 103 if (window.innerWidth < 768) { 104 mainEl.css('padding-bottom', 0); 105 element.css('padding-bottom', 0); 106 return; 107 } 108 109 const mainH = mainEl.height(); 110 const elH = element.height(); 111 112 const toSynchronizedEl = mainH > elH ? element : mainEl; 113 const theRef = mainH > elH ? mainEl : element; 114 const refValue = Math.abs(mainH - elH); 115 116 theRef.css('padding-bottom', 0); 117 toSynchronizedEl.css('padding-bottom', refValue); 118 } 119 }); 120 } 121 } 122 123}); 124
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.