PageSourceSearch

https://www.personaldefensenetwork.com/js/carousels.js?ver=1790878950

js personaldefensenetwork.com collected 2026-10-03 22:54:53 UTC 2,997 bytes, 94 lines download raw bytes

1(function($) {
2	function initCarousel(carousel) {
3		jQuery(document).ready(function () {
4			if (typeof $.fn.slick !== 'function') {
5				return;
6			}
7
8			const $carousel = $(carousel);
9			const carouselId = $carousel.attr('id');
10
11			if ($carousel.hasClass('init') || ! carouselId) {
12				return;
13			}
14
15			const $slickSlider = $carousel.find('.slick-carousel');
16			const $prev = $carousel.find('.slick-prev');
17			const $next = $carousel.find('.slick-next');
18			const is_cwc = $carousel.data('carouselType') === 'continue-watching';
19			const hideEmpty = $carousel.data('hide-empty');
20
21			$slickSlider.slick({
22				speed: 600,
23				accessibility: true,
24				infinite: false,
25				mobileFirst: true,  // sets breakpoints to be calculated using max width.
26				respondTo: 'slider',
27				slidesToShow: 1.1, // for phones.
28				slidesToScroll: 1, // for phones.
29				prevArrow: $prev,
30				nextArrow: $next,
31				responsive: [
32					// these need to stay n'sync with the breakpoints for the .skeleton-carousel in:
33					// sites/web/app/themes/vidstore-core/assets/sass/vidstore-core/modules/_slick_slider.scss
34					{
35						breakpoint: 539,
36						settings: {
37							slidesToShow: is_cwc ? 1.5 : 2.2,
38							slidesToScroll: is_cwc ? 1 : 2,
39						}
40					},
41					{
42						breakpoint: 768, // bulma tablet  - 1
43						settings: {
44							slidesToShow: is_cwc ? 2.5 : 3.3,
45							slidesToScroll: is_cwc ? 1 : 3,
46						}
47					},
48					{
49						breakpoint: 1175, // bulma widescreen  - 1
50						settings: {
51							slidesToShow: is_cwc ? 2.5 : 4.4,
52							slidesToScroll: is_cwc ? 2 : 4,
53						}
54					}
55				],
56			}).on('setPosition');
57
58			// Slick adds tabindex="0" to each slide container for arrow-key navigation.
59			// That creates a "dead" tab stop where Enter does nothing. Activate the card
60			// link on Enter so keyboard users don't need a second Tab to get into the card.
61			$slickSlider.on('keydown', '.list-article', function(e) {
62				// Only handle Enter on the slide container itself (slick's tabindex="0" dead tab stop).
63				// Without this guard, the keydown bubbles from any focusable descendant (e.g. the
64				// overflow-menu button) and triggers unwanted navigation.
65				if (e.key === 'Enter' && e.target === this) {
66					const link = $(this).find('a[href]').first()[0];
67					if (link) {
68						link.click();
69					}
70				}
71			});
72
73			$carousel.addClass('init');
74
75			let minItems = $carousel.data('carousel-min-items');
76			let $items = $carousel.find('.slick-carousel .slick-slide');
77
78			if (hideEmpty && $items.length < minItems) {
79				$carousel.hide();
80			}
81
82			if ( ( is_cwc && $items.length <= 2) || ( ! is_cwc && $items.length <= 4) ) {
83				$prev.attr('style', 'display: none !important');
84				$next.attr('style', 'display: none !important');
85			}
86
87			$prev.prop('disabled', true);
88			$carousel.on('afterChange', currentSlide => $prev.prop('disabled', currentSlide === 0));
89
90			$carousel.addClass('loaded');
91		});
92	}
93	Livewire.on("carouselUpdated", (carouselId) => initCarousel($("#" + carouselId)));
94})(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.