1/* 2 * https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview 3 */ 4 5(function ($, Drupal, drupalSettings) { 6 'use strict'; 7 Drupal.behaviors.componentLibraryInitialization = { 8 attach: function (context, settings) { 9 const $context = $(context); 10 var $owl = $(".path-frontpage #it-block-inprimopiano .owl-carousel"); 11 if ($owl && $owl.length) { 12 var carouselsSettings = (drupalSettings.res_admin && drupalSettings.res_admin.carousels) || {}; 13 var autoplayTimeout = parseInt(carouselsSettings.inprimopiano_autoplay_timeout, 10) || 8000; 14 var autoplayEnabled = !carouselsSettings.inprimopiano_autoplay_disabled; 15 $owl.owlCarousel({ 16 nav: true, 17 loop: false, 18 margin: 24, 19 items: 1, 20 navText: ['<svg class="icon"><use xlink:href="/themes/custom/res/assets/icons/sprite.svg#it-chevron-left"></use></svg>', '<svg class="icon"><use xlink:href="/themes/custom/res/assets/icons/sprite.svg#it-chevron-right"></use></svg>'], 21 navSpeed: 300, 22 smartSpeed: 500, 23 dotsSpeed: 200, 24 navElement: 'button', 25 dotElement: 'button', 26 controlsAriaHidden: true, 27 mouseDrag: true, 28 touchDrag: true, 29 dots: false, 30 slideBy: 'page', 31 stagePadding: 0, 32 responsive: { 33 0: { 34 nav: false, 35 dots: true, 36 items: 1, 37 stagePadding: 0, 38 margin: 24, 39 }, 40 768: { 41 nav: true, 42 dots: true, 43 stagePadding: 0, 44 items: 1, 45 margin: 24, 46 }, 47 992: { 48 nav: true, 49 dots: true, 50 items: 1, 51 stagePadding: 0, 52 margin: 0, 53 }, 54 1200: { 55 nav: true, 56 dots: true, 57 stagePadding: 0, 58 items: 1, 59 margin: 0, 60 }, 61 }, 62 onInitialized: function(event) { 63 $(event.target) 64 .find('.owl-dot') 65 .each(function(index) { 66 $(this).attr('aria-labelledby', 'owl-dot-' + index) 67 }) 68 }, 69 autoplay: autoplayEnabled, 70 autoplayTimeout: autoplayTimeout, 71 autoplayHoverPause: true, 72 }); 73 74 $owl.on('translated.owl.carousel', function(event) { 75 if (!autoplayEnabled) { 76 return; 77 } 78 if (event.item.index === event.item.count - 1) { 79 setTimeout(function() { 80 $owl.trigger('to.owl.carousel', [0, 300]); 81 $owl.trigger('play.owl.autoplay', [autoplayTimeout]); 82 }, autoplayTimeout); 83 } 84 }); 85 } 86 } 87 }; 88 89})(jQuery, Drupal, drupalSettings);
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.