1AUI().ready( 2 3 /* 4 This function gets loaded when all the HTML, not including the portlets, is 5 loaded. 6 */ 7 8 function() { 9 } 10); 11 12Liferay.Portlet.ready( 13 14 /* 15 This function gets loaded after each and every portlet on the page. 16 17 portletId: the current portlet's id 18 node: the Alloy Node object of the current portlet 19 */ 20 21 function(portletId, node) { 22 } 23); 24 25Liferay.on( 26 'allPortletsReady', 27 28 /* 29 This function gets loaded when everything, including the portlets, is on 30 the page. 31 */ 32 33 function() { 34 } 35); 36 37 38(function($) { 39 $(function() { 40 var laptop = window.matchMedia( "(min-width: 1024px)"); 41 42 if ( laptop.matches ){ 43 44 // Add arrow navigation to YJA Content Carousel 45 var carousel = $('.carousel'); 46 var page_width = $('.carousel').width(); 47 var firstItem = jQuery('.carousel-wrapper ul li:first'); 48 var extraWidth = parseInt(firstItem.css('paddingRight')) * 2; 49 var dataNum = 0; 50 page_width = page_width + extraWidth; 51 52 // Check if Carousel Content is loaded 53 if (carousel.length > 0) { 54 var totalSlides = Math.ceil($('.carousel-wrapper ul').children('li').length / 5); 55 56 if (totalSlides > 1 ) { 57 carousel.append('<div class="controller--arrows"><a href="#" data-page="0" class="js-control-prev"></a><a href="#" data-page="1" class="js-control-next"></a></div>'); 58 59 // Remove default actions from links 60 $('.controller--arrows a').click(function(e){ 61 e.preventDefault(); 62 63 // Move selected marker on default pagination depending on click 64 if( $(this).hasClass('js-control-next') ) { 65 if ( !$('.position-nav').children('li:last-child').hasClass('selected') ) { 66 $('.position-nav').children('li.selected').removeClass('selected').next('li').addClass('selected'); 67 dataNum++; 68 moveToPage(dataNum); 69 } 70 } else { 71 if (!$('.position-nav li:first-child').hasClass('selected')) { 72 $('.position-nav').children('li.selected').removeClass('selected').prev('li').addClass('selected'); 73 dataNum--; 74 moveToPage(dataNum); 75 } 76 } 77 }); 78 } 79 } 80 function moveToPage(page_num) { 81 $('.carousel-wrapper ul').animate({ 82 left: -1 * page_num * page_width 83 }, 600, function() {} 84 ); 85 } 86 87 /** 88 * http://stackoverflow.com/questions/3971841/how-to-resize-images-proportionally-keeping-the-aspect-ratio 89 * Conserve aspect ratio of the orignal region. Useful when shrinking/enlarging 90 * images to fit into a certain area. 91 * 92 * @param {Number} srcWidth Source area width 93 * @param {Number} srcHeight Source area height 94 * @param {Number} maxWidth Fittable area maximum available width 95 * @param {Number} maxHeight Fittable area maximum available height 96 * @return {Object} { width, heigth } 97 */ 98 function calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) { 99 100 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 101 102 return { width: srcWidth*ratio, height: srcHeight*ratio }; 103 } 104 105 106 } 107 108 // YJAOM-629 add aria-current to sidemenu 109 $('.list-menu li a.selected').attr('aria-current', 'page'); 110 111 // YJAOM-1123 trim spans and remove last commas from contact-list-portlet contacts "labels" 112 if(document.getElementsByClassName('contact-list-portlet').length) { 113 let spanNodeList = document.querySelectorAll('.contact-list-portlet span[itemprop="worksFor"]'); 114 spanNodeList.forEach((current) => { 115 current.querySelectorAll('span').forEach((cur) => { cur.innerText = cur.innerText.trim() }) 116 if(current.querySelector('.ministry')) { 117 current.querySelector('.ministry').innerText = current.querySelector('.ministry').innerText.replace(/,([^,]*)$/, '') 118 } 119 if(current.querySelector('.department')) { 120 current.querySelector('.department').innerText = current.querySelector('.department').innerText.replace(/,([^,]*)$/, '') 121 } 122 }); 123 } 124 }); 125})(jQuery);
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.