1(function($) { 2 "use strict"; 3 Drupal.behaviors.nc_alerts = { 4 attach: function (context, settings) { 5 6 7 8 once('alertLoad', 'body').forEach(function (element) { 9 10 $(element).find('#alerts').each(function (i) { 11 12 // DC-4552 add alert telephone link color for visibility 13 $(this).find('a[href^="tel:"]').css('color', 'white'); 14 15 // remove controls if only one alert 16 let alertCount = $('.alert-item').length; 17 let alerts = new bootstrap.Carousel($(this)); 18 if (alertCount < 2) { 19 $(this).find('.carousel-control-prev').remove(); 20 $(this).find('.carousel-control-next').remove(); 21 $(this).find('.carousel-play').remove() 22 } 23 else { 24 // Check if Alerts have been paused 25 let alertPause = getAlertPause(); 26 if(alertPause === "Pause") { 27 $(this).find('.carousel-play').show() 28 $(this).find('.carousel-pause').hide() 29 alerts.pause(); 30 } 31 else { 32 $(this).find('.carousel-play').hide() 33 $(this).find('.carousel-pause').show() 34 // start alert autoplay 35 alerts.cycle(); 36 } 37 } 38 39 // pause button 40 $(this).find('.carousel-pause').on('click', () => { 41 $(this).find('.carousel-play').show() 42 $(this).find('.carousel-pause').hide() 43 alerts.pause(); 44 localStorage.setItem("alertPause", "Pause"); 45 }); 46 47 // play button 48 $(this).find('.carousel-play').on('click', () => { 49 $(this).find('.carousel-play').hide() 50 $(this).find('.carousel-pause').show() 51 alerts.cycle(); 52 localStorage.setItem("alertPause", "Play"); 53 }); 54 55 // DC-2954 hide alerts until carousel is rendered 56 $('#alerts').show(); 57 }); 58 }); 59 60 function getAlertPause() { 61 let ap = localStorage.getItem("alertPause"); 62 return (ap === null) ? "Play" : ap; 63 } 64 } 65 }; 66}(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.