PageSourceSearch

https://www.siller.consulting/wp-content/plugins/g-business-reviews-rating/wp/js/js.js?ver=6.1

js siller.consulting collected 2026-10-10 01:53:44 UTC 24,561 bytes, 687 lines download raw bytes

1'use strict';
2
3function google_business_reviews_rating(e, i) {
4	if (e == undefined) {
5		e = null;
6	}
7	else if (typeof e == 'string' && /^\d+$/.test(e)) {
8		e = parseInt(e, 10);
9	}
10
11	if (i == undefined) {
12		i = null;
13	}
14	else if (typeof i == 'string') {
15		i = parseInt(i.replace(/[^\d]/, ''), 10);
16	}
17	
18	if ((typeof e == 'number' || typeof e == 'object' || typeof e == 'string') && typeof i == 'number') {
19		const containers = [...document.querySelectorAll('.google-business-reviews-rating')];
20
21		if (typeof e == 'object' && e != null) {
22			e = containers.indexOf(e);
23		}
24		else if (typeof e == 'string') {
25			e = containers.indexOf(document.getElementById(e));
26		}
27
28		const li = containers[e]?.querySelectorAll('li')?.[i],
29		      full_text = li?.querySelector('.review-full-text');
30
31		if (!li) {
32			return;
33		}
34
35		if (full_text) {
36			full_text.style.display = 'inline';
37		}
38
39		li.querySelector('.review-more-link')?.remove();
40		return;
41	}
42
43	const safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent),
44	      clear_styles = document.getElementById('stylesheet-none')?.checked ?? false,
45	      is_rtl = document.body.classList.contains('rtl'),
46	      observer = new IntersectionObserver(entries => {
47		entries.forEach(entry => {
48			if (entry.isIntersecting) {
49				entry.target.classList.add('animation-start');
50				return;
51			}
52
53			entry.target.classList.remove('animation-pause');
54		});
55	}, { threshold: 0.5 });
56
57	document.querySelectorAll('.google-business-reviews-rating').forEach((review, index) => {
58		const view = (review.classList.contains('carousel') && parseInt(review.dataset.view) >= 1 && parseInt(review.dataset.view) <= 50) ? parseInt(review.dataset.view) : null,
59		      star_html = review.classList.contains('stars-html') || /\bversion[_-]?1\b/i.test(review.className),
60		      star_css = !star_html && (review.classList.contains('stars-css') || review.classList.contains('stars-gray-css')),
61		      star_inline = !star_html && !star_css && review.dataset.stars != null && /^inline|inline$/i.test(review.dataset.stars),
62		      number_element = review.querySelector('.number'),
63		      rating = (number_element) ? parseFloat(number_element.textContent.replace(/,/g, '.').replace(/(\d+(?:\.\d+)?)/, '$1')) : null,
64		      href_data = review.dataset.href,
65		      overall_link = (href_data != null && href_data.length && !review.querySelector('.buttons') && !review.querySelector('.listing > *')) ? href_data : null,
66		      all_stars_element = review.querySelector('.all-stars'),
67		      placeholders = review.querySelectorAll('.review-more-placeholder'),
68		      listing_element = review.querySelector('.listing');
69
70		let stars_width_multiplier = 0.196,
71		    reviews_window = null,
72		    star_color = !star_html && !star_css && !star_inline && (review.dataset.stars != null || review.dataset.starsGray != null);
73
74		if (clear_styles) {
75			review.removeAttribute('class');
76		}
77		else if (!review.id) {
78			review.id = `google-business-reviews-rating${(index > 1) ? `-${index}` : ''}`;
79		}
80
81		if (!clear_styles && review.classList.contains?.('no-styles')) {
82			review.removeAttribute('class');
83		}
84
85		if (review.classList?.contains('link')) {
86			if (overall_link != null) {
87				review.addEventListener('click', event => {
88					if (!event.target.matches('a')) {
89						event.preventDefault();
90						event.stopPropagation();
91
92						if (/^\//.test(overall_link)) {
93							document.location.href = overall_link;
94							return;
95						}
96
97						reviews_window = window.open(overall_link, '_blank');
98						reviews_window.focus();
99					}
100				});
101			}
102			else {
103				review.classList.remove('link');
104			}
105
106			delete review.dataset.href;
107		}
108
109		if (review.dataset.animate == 'immediate') {
110			review.querySelector(':scope .all-stars.animate')?.classList.add('animation-start');
111		}
112		else {
113			const animate_stars_element = review.querySelector(':scope .all-stars.animate');
114
115			if (animate_stars_element) {
116				observer.observe(animate_stars_element);
117			}
118		}
119
120		if (!star_html && all_stars_element?.querySelector('.star')) {
121			if (star_css) {
122				if (!review.querySelector('.rating-stars')) {
123					all_stars_element.insertAdjacentHTML('beforeend', '<span class="rating-stars star temporary" style="display: none;">.</span>');
124				}
125
126				if (!review.querySelector('.star.gray')) {
127					all_stars_element.insertAdjacentHTML('beforeend', '<span class="star gray temporary" style="display: none;">.</span>');
128				}
129
130				const gray_star_color = getComputedStyle(review.querySelector('.star.gray'))?.color ?? null,
131				      rating_stars_color = getComputedStyle(review.querySelector('.rating-stars'))?.color ?? null;
132
133				if (gray_star_color && !/#(?:F7B\d0\d|E7711B)|rgba?\s*\(23[12],\s*11[34],\s*2[78]/i.test(rating_stars_color)) {
134					review.dataset.stars = rating_stars_color;
135					star_color = true;
136				}
137
138				const default_gray_pattern = (review.classList.contains('dark')) ? /^(?:#B4B4B4|rgba?\s*\(180,\s*180,\s*180(?:,\s*0?\.8)?\))$/i : /^(?:#(?:A4A4A4|C1C1C1|C9C9C9)|rgba?\s*\(193,\s*193,\s*193(?:,\
138s*1(?:\.0+)?)?\))$/i;
139
140				if (gray_star_color && !default_gray_pattern.test(gray_star_color)) {
141					review.dataset.starsGray = gray_star_color;
142					star_color = true;
143				}
144
145				all_stars_element.querySelectorAll('.temporary').forEach(temp_element => temp_element.remove());
146			}
147
148			const stars_data = review.dataset.stars,
149			      stars_gray_data = review.dataset.starsGray,
150			      has_custom_stars = stars_data != null && stars_data.length && !/^#(?:F7B\d0\d|E7711B)$/i.test(stars_data),
151			      has_custom_gray = stars_gray_data != null && stars_gray_data.length && !/^#(?:A4A4A4|C1C1C1|C9C9C9)$/i.test(stars_gray_data);
152
153			if (star_color && (has_custom_stars || has_custom_gray)) {
154				if (star_css && (stars_gray_data == null || stars_gray_data == 'css') && !all_stars_element.querySelector('.star.gray')) {
155					all_stars_element.insertAdjacentHTML('beforeend', '<span class="temporary" style="display: none;">.</span>');
156				}
157
158				all_stars_element.querySelectorAll('.star').forEach(star => {
159					try {
160						let star_svg = atob(getComputedStyle(star).backgroundImage.replace(/^url\(["']data:image\/svg\+xml;charset=UTF-8;base64,(.+)["']\)$/, '$1'));
161
162						if (has_custom_stars) {
163							star_svg = star_svg.replace(/#(?:F7B\d0\d|E7711B)/g, stars_data);
164						}
165
166						if (has_custom_gray) {
167							star_svg = star_svg.replace(/#(?:A4A4A4|C1C1C1|C9C9C9)/g, stars_gray_data);
168						}
169
170						star.style.backgroundImage = `url('data:image/svg+xml;charset=UTF-8;base64,${btoa(star_svg)}')`;
171					}
172					catch (_) {}
173				});
174			}
175		}
176
177		if (placeholders.length) {
178			const list_items = [...(review.querySelector('.listing')?.querySelectorAll('li') ?? [])];
179
180			placeholders.forEach(placeholder => {
181				const full_text = placeholder.parentElement?.querySelector('.review-full-text');
182
183				if (full_text && !full_text.innerHTML.length) {
184					placeholder.closest('li')?.classList.remove('text-excerpt');
185					full_text.remove();
186					placeholder.remove();
187					return;
188				}
189
190				const more_link = document.createElement('a');
191				more_link.className = 'review-more-link';
192				more_link.innerHTML = placeholder.innerHTML;
193
194				const author_name = placeholder.closest('li')?.querySelector('.author-name')?.textContent?.trim();
195
196				if (author_name) {
197					more_link.setAttribute('aria-label', `${more_link.textContent.trim()} – ${author_name}`);
198				}
199
200				if (review.classList.contains('js-links')) {
201					const li_index = list_items.indexOf(placeholder.closest('li'));
202					more_link.href = '#';
203					more_link.addEventListener('click', event => {
204						event.preventDefault();
205						event.stopPropagation();
206						google_business_reviews_rating(index, li_index);
207					});
208					placeholder.insertAdjacentElement('afterend', more_link);
209					placeholder.remove();
210					return;
211				}
212
213				more_link.href = `#${review.id || ''}`;
214				more_link.addEventListener('click', event => {
215					event.preventDefault();
216					event.stopPropagation();
217
218					if (more_link.nextElementSibling?.classList.contains('review-full-text')) {
219						more_link.nextElementSibling.style.display = 'inline';
220					}
221
222					if (view == null) {
223						more_link.remove();
224						return;
225					}
226
227					more_link.style.display = 'none';
228					google_business_reviews_rating_carousel(more_link, null);
229				});
230
231				placeholder.insertAdjacentElement('afterend', more_link);
232				placeholder.remove();
233			});
234		}
235
236		if (review.querySelector('.fixed-height') && review.classList.contains('bubble')) {
237			review.querySelectorAll('.text').forEach(text_element => {
238				const prev = text_element.previousElementSibling,
239				      next = text_element.nextElementSibling;
240
241				if (prev && (prev.classList.contains('author-avatar') || (prev.classList.contains('review-meta') && prev.querySelector('.author-name')))) {
242					text_element.insertAdjacentHTML('beforebegin', '<span class="arrow arrow-up"></span>');
243					return;
244				}
245
246				if (next && (next.classList.contains('author-avatar') || (next.classList.contains('review-meta') && next.querySelector('.author-name')))) {
247					text_element.insertAdjacentHTML('afterend', '<span class="arrow arrow-down"></span>');
248				}
249			});
250		}
251
252		if (!star_html && !star_inline && all_stars_element?.classList.contains('animate') && typeof rating == 'number' && rating > 1.5 && number_element) {
253			const all_stars_width = all_stars_element.getBoundingClientRect().width,
254			      backdrop = document.createElement('span');
255			backdrop.classList.add('all-stars', 'backdrop');
256			backdrop.style.inlineSize = `${Math.ceil(all_stars_width + 0.1)}
256px`;
257			backdrop.style.marginInlineStart = `${-all_stars_width - 0.1}px`;
258			backdrop.innerHTML = '<span class="star gray"></span>'.repeat(5);
259			all_stars_element.insertAdjacentElement('afterend', backdrop);
260
261			const backdrop_element = review.querySelector('.all-stars.backdrop');
262
263			if (backdrop_element) {
264				let backdrop_offset = all_stars_element.getBoundingClientRect().top - backdrop_element.getBoundingClientRect().top + parseFloat(getComputedStyle(backdrop_element).marginBlockStart);
265
266				if (backdrop_offset != 0) {
267					backdrop_element.style.marginBlockStart = `${backdrop_offset}px`;
268				}
269			}
270
271			const stars_gray_data = review.dataset.starsGray;
272
273			if (stars_gray_data != null && stars_gray_data.length && !/^#(?:A4A4A4|C1C1C1|C9C9C9)$/i.test(stars_gray_data)) {
274				review.querySelectorAll('.all-stars.backdrop .star').forEach(star => {
275					try {
276						let star_svg = atob(getComputedStyle(star).backgroundImage.replace(/^url\(["']data:image\/svg\+xml;charset=UTF-8;base64,(.+)["']\)$/, '$1'));
277						star_svg = star_svg.replace(/#(?:A4A4A4|C1C1C1|C9C9C9)/g, stars_gray_data);
278						star.style.backgroundImage = `url('data:image/svg+xml;charset=UTF-8;base64,${btoa(star_svg)}')`;
279					}
280					catch (_) {}
281				});
282			}
283
284			const all_star_spans = [...all_stars_element.querySelectorAll('.star')],
285			      last_star = all_star_spans.at(-1);
286
287			if (last_star) {
288				last_star.addEventListener('animationend', () => {
289					const animating_backdrop = last_star.closest('.rating')?.querySelector('.all-stars.backdrop');
290
291					if (animating_backdrop) {
292						animating_backdrop.style.transition = 'opacity 300ms';
293						animating_backdrop.style.opacity = '0';
294						setTimeout(() => animating_backdrop.remove(), 300);
295					}
296				});
297			}
298
299			setTimeout(() => {
300				const timer_backdrop = review.querySelector('.all-stars.backdrop');
301
302				if (timer_backdrop) {
303					timer_backdrop.style.transition = 'opacity 300ms';
304					timer_backdrop.style.opacity = '0';
305					setTimeout(() => timer_backdrop.remove(), 300);
306				}
307			}, 4800);
308		}
309
310		if (star_html && typeof rating == 'number') {
311			if (safari) {
312				all_stars_element?.classList.add('safari');
313			}
314
315			if (rating == 5) {
316				setTimeout(() => {
317					if (all_stars_element) {
318						all_stars_element.style.color = '#0000';
319					}
320				}, 2400);
321			}
322
323			if (rating == 0) {
324				review.querySelector('.rating-stars')?.remove();
325			}
326
327			const rating_stars_element = review.querySelector('.rating-stars');
328
329			if (rating_stars_element && all_stars_element) {
330				const multiplier = rating_stars_element.dataset.multiplier;
331
332				if (multiplier != null) {
333					stars_width_multiplier = parseFloat(multiplier);
334				}
335
336				const all_stars_width = all_stars_element.getBoundingClientRect().width,
337				      rating_width = Math.round(
338				          all_stars_width * rating * stars_width_multiplier
339				          + stars_width_multiplier * 0.05 * Math.sin(rating * 2 * Math.PI)
340				          + 0.5 * stars_width_multiplier * (Math.round(rating + 0.49) - rating)
341				      );
342				rating_stars_element.style.width = `${rating_width}px`;
343				rating_stars_element.style.margin = (is_rtl) ? `0 0 0 ${-rating_width}px` : `0 ${-rating_width}px 0 0`;
344			}
345		}
346
347		if (view == null || !listing_element || view > listing_element.children.length) {
348			return;
349		}
350
351		google_business_reviews_rating_carousel(review);
352	});
353}
354
355function google_business_reviews_rating_carousel(e, i, auto) {
356	if (typeof e != 'object' || e == null) {
357		return;
358	}
359
360	if (typeof i != 'number') {
361		const is_container = e.classList?.contains('google-business-reviews-rating'),
362		      is_more_link = e.classList?.contains('review-more-link'),
363		      bullet_e = (!is_container && !is_more_link) ? e.closest?.('.bullet') : null;
364
365		i = (bullet_e) ? [...bullet_e.parentElement.children].indexOf(bullet_e) : null;
366	}
367
368	if (typeof auto != 'boolean') {
369		auto = false;
370	}
371
372	e = (e.classList?.contains('google-business-reviews-rating')) ? e : e.closest?.('.google-business-reviews-rating');
373
374	if (!e) {
375		return;
376	}
377
378	const is_rtl = document.body.classList.contains('rtl'),
379	      view = (e.classList.contains('carousel') && parseInt(e.dataset.view
379) >= 1 && parseInt(e.dataset.view) <= 50) ? parseInt(e.dataset.view) : null,
380	      iterations = (view != null && isNaN(parseInt(e.dataset.loop)) && parseInt(e.dataset.iterations) >= 1) ? parseInt(e.dataset.iterations) : null,
381	      loop_num = parseInt(e.dataset.loop),
382	      loop = (view != null && e.dataset.loop != null) ? ((e.dataset.loop == 'false') ? false : ((!isNaN(loop_num) && loop_num < 1) ? true : ((!isNaN(loop_num)) ? loop_num : true))) : ((iterations != null) ? Math.round(iterations * view) : false),
383	      interval = (view != null && loop && e.dataset.interval != null) ? parseFloat(e.dataset.interval) : null,
384	      first_listing = e.querySelector('.listing'),
385	      total_children = () => first_listing?.children.length ?? 0,
386	      total_pages = () => Math.ceil(total_children() / view);
387
388	let slide = (view != null && parseInt(e.dataset.slide) >= 2) ? parseInt(e.dataset.slide) : 1,
389	    loop_counter = (view != null && loop && e.dataset.counter != null) ? parseInt(e.dataset.counter) : null,
390	    interval_id = (view != null && loop && e.dataset.intervalId != null) ? parseInt(e.dataset.intervalId) : null,
391	    new_slide = (i != null) ? i + 1 : ((auto) ? slide + 1 : null);
392
393	if (view == null || (new_slide != null && view > total_children()) || (auto && e.matches(':hover'))) {
394		return;
395	}
396
397	if (new_slide != null && (view < 1 || slide == new_slide || (!auto || (auto && (!loop || loop_counter != null && loop_counter > loop))) && (new_slide < 1 || new_slide >
397 total_pages()))) {
398		if (auto && interval_id != null) {
399			clearInterval(interval_id);
400		}
401		return;
402	}
403
404	if (auto && (new_slide < 1 || new_slide > total_pages())) {
405		new_slide = (new_slide < 1) ? total_pages() : 1;
406
407		if (!e.querySelector('.navigation')) {
408			e.dataset.slide = new_slide;
409		}
410	}
411
412	if (new_slide != null) {
413		[...(first_listing?.children ?? [])].forEach(item => {
414			const item_index = parseInt(item.dataset.index);
415
416			if (Math.ceil((item_index + 1) / view) == slide) {
417				const full_text = item.querySelector('.review-full-text'),
418				      more_link = item.querySelector('.review-more-link');
419
420				if (more_link && full_text) {
421					full_text.style.display = 'none';
422					more_link.style.display = '';
423				}
424				item.classList.replace('visible', 'hidden');
425				return;
426			}
427
428			if (Math.ceil((item_index + 1) / view) == new_slide) {
429				item.classList.replace('hidden', 'visible');
430			}
431		});
432
433		const nav = e.querySelector('.navigation'),
434		      target_link = nav?.querySelectorAll('a')?.[new_slide - 1];
435
436		if (target_link) {
437			target_link.parentElement.classList.add('current');
438			target_link.setAttribute('aria-current', 'true');
439			[...target_link.parentElement.parentElement.children].forEach(sibling => {
440				if (sibling == target_link.parentElement) {
441					return;
442				}
443
444				sibling.classList.remove('current');
445				sibling.querySelector('a')?.removeAttribute('aria-current');
446			});
447		}
448
449		slide = new_slide;
450		e.dataset.slide = slide;
451	}
452
453	let list_area = [null, null, null, null],
454	    list_width = 0,
455	    list_height = 0;
456
457	const visibles = [...(first_listing?.querySelectorAll('.visible') ?? [])];
458
459	visibles.forEach(item => {
460		const bounds = item.getBoundingClientRect();
461
462		if (list_area[0] == null || list_area[0] > bounds.top) {
463			list_area[0] = bounds.top;
464		}
465
466		if (list_area[1] == null || list_area[1] < bounds.right) {
467			list_area[1] = bounds.right;
468		}
469
470		if (list_area[2] == null || list_area[2] < bounds.bottom) {
471			list_area[2] = bounds.bottom;
472		}
473
474		if (list_area[3] == null || list_area[3] > bounds.left) {
475			list_area[3] = bounds.left;
476		}
477	});
478
479	if (list_area[0] != null) {
480		const first_visible = visibles[0],
481		      last_visible = visibles.at(-1);
482
483		if (first_visible && last_visible) {
484			const first_visible_style = getComputedStyle(first_visible),
485			      last_visible_style = getComputedStyle(last_visible);
486
487			list_width = parseInt(list_area[1] - list_area[3]) + parseInt(first_visible_style.marginLeft)  + parseInt(last_visible_style.marginRight);
488			list_height = parseInt(list_area[2] - list_area[0]) + parseInt(first_visible_style.marginTop)   + parseInt(last_visible_style.marginBottom);
489		}
490
491		if (list_width == 0 || list_height == 0) {
492			e.querySelector('.navigation')?.querySelectorAll('a').forEach(link_element => {
493				link_element.addEventListener('click', event => {
494					event.preventDefault();
495					event.stopPropagation();
496				});
497			});
498
499			if (e.dataset.reattempt == null || parseInt(e.dataset.reattempt) < 1) {
500				const timeout_id = setTimeout(google_business_reviews_rating_carousel, 10, e);
501				e.dataset.reattempt = timeout_id;
502			}
503			return;
504		}
505	}
506
507	if (auto && typeof loop != 'boolean' && loop >= 1) {
508		loop_counter = (loop_counter == null || loop_counter < 1) ? 1 : loop_counter;
509		loop_counter++;
510		e.dataset.counter = loop_counter;
511
512		if (interval_id != null && loop_counter > loop) {
513			clearInterval(interval_id);
514			return;
515		}
516	}
517
518	if (!first_listing) {
519		return;
520	}
521
522	if (first_listing.dataset.initialHeight != null || list_area[0] == null || list_height == 0) {
523		return;
524	}
525
526	first_listing.dataset.initialHeight = list_height;
527
528	const nav = e.querySelector('.navigation');
529
530	nav?.querySelectorAll('a').forEach(link_element => {
531		link_element.addEventListener('click', event => {
532			event.preventDefault();
533			event.stopPropagation();
534
535			if (link_element.parentElement.classList.contains('current')) {
536				return;
537			}
538			google_business_reviews_rating_carousel(link_element);
539		});
540	});
541
542	if (!auto && interval_id == null && loop && interval != null && interval >= 0.3 && interval <= 999) {
543		interval_id = setInterval(google_business_reviews_rating_carousel, interval * 1000, e, null, true);
544		e.dataset.intervalId = interval_id;
545	}
546
547	const draggable = e.dataset.draggable;
548
549	if (draggable == 'false' || draggable != null && parseInt(draggable) <= 0) {
550		return;
551	}
552
553	if (!first_listing.dataset.touchInit) {
554		first_listing.dataset.touchInit = true;
555
556		first_listing.addEventListener('touchstart', event => {
557			const container = first_listing.closest('.google-business-reviews-rating'),
558			      click_start = event.touches[0].pageX,
559			      nav_element = container.querySelector('.navigation'),
560				  current_view = (container.classList.contains('carousel') && parseInt(container.dataset.view
560) >= 1 && parseInt(container.dataset.view) <= 50) ? parseInt(container.dataset.view) : null,
561			      current_slide = (current_view != null && parseInt(container.dataset.slide) >= 2) ? parseInt(container.dataset.slide) : 1,
562				  get_bullet_index = bullet_e => [...(nav_element?.querySelectorAll('.bullet') ?? [])].indexOf(bullet_e),
563			      current_bullet = () => nav_element?.querySelector('.current');
564
565			const on_touch_move = move_event => {
566				const move_x = move_event.touches[0].pageX,
567				      pixel_sensitivity = 7;
568
569				if (!is_rtl && Math.ceil(move_x - click_start) > pixel_sensitivity || is_rtl && Math.ceil(click_start - move_x) > pixel_sensitivity) {
570					if (!nav_element) {
571						if (current_slide > 1) {
572							google_business_reviews_rating_carousel(container, current_slide - 2);
573						}
574						return;
575					}
576
577					if (get_bullet_index(current_bullet()) > 0) {
578						google_business_reviews_rating_carousel(current_bullet().querySelector('a'), get_bullet_index(current_bullet()) - 1);
579					}
580					return;
581				}
582
583				if (!is_rtl && Math.ceil(click_start - move_x) > pixel_sensitivity || is_rtl && Math.ceil(move_x - click_start) > pixel_sensitivity) {
584					if (!nav_element) {
585						if (current_slide < Math.ceil((first_listing?.children.length ?? 0) / current_view)) {
586							google_business_reviews_rating_carousel(container, current_slide);
587						}
588						return;
589					}
590
591					const bullets = nav_element.querySelectorAll('.bullet');
592
593					if (get_bullet_index(current_bullet()) < bullets.length - 1) {
594						google_business_reviews_rating_carousel(current_bullet().querySelector('a'), get_bullet_index(current_bullet()) + 1);
595					}
596				}
597			};
598
599			first_listing.addEventListener('touchmove', on_touch_move, { once: true });
600			first_listing.addEventListener('touchend', () => first_listing.removeEventListener('touchmove', on_touch_move), { once: true });
601		});
602	}
603}
604
605function google_business_reviews_rating_actions(event) {
606	const carousels = document.querySelectorAll('.google-business-reviews-rating.carousel'),
607	      is_rtl = document.body.classList.contains('rtl');
608
609	let active = false;
610
611	if (!carousels.length || event.key != 'ArrowLeft' && event.key != 'ArrowRight') {
612		return;
613	}
614
615	for (let pass = 0; pass < 2; pass++) {
616		for (const carousel of carousels) {
617			if (active) {
618				break;
619			}
620
621			const cursor_data = carousel.dataset.cursor;
622
623			if (cursor_data == 'false' || cursor_data != null && parseInt(cursor_data) <= 0) {
624				continue;
625			}
626
627			const listing_element = carousel.querySelector('.listing');
628
629			if ((pass == 0 && !carousel.matches(':hover')) || !listing_element) {
630				continue;
631			}
632
633			const bounds = listing_element.getBoundingClientRect();
634
635			if (bounds.bottom < 0 || bounds.top > (window.innerHeight || document.documentElement.clientHeight)) {
636				continue;
637			}
638
639			active = true;
640
641			const view = (carousel.classList.contains('carousel') && parseInt(carousel.dataset.view) >= 1 && parseInt(carousel.dataset.view) <= 50) ? parseInt(carousel.dataset.view) : null,
642			      slide = (view != null && parseInt(carousel.dataset.slide) >= 2) ? parseInt(carousel.dataset.slide) : 1,
643			      nav = carousel.querySelector('.navigation'),
644			      get_bullet_index = bullet_e => [...(nav?.querySelectorAll('.bullet') ?? [])].indexOf(bullet_e),
645			      current_bullet = () => nav?.querySelector('.current');
646
647			if (!is_rtl && event.key == 'ArrowLeft' || is_rtl && event.key == 'ArrowRight') {
648				if (!nav) {
649					if (slide > 1) {
650						google_business_reviews_rating_carousel(carousel, slide - 2);
651					}
652					break;
653				}
654
655				if (get_bullet_index(current_bullet()) > 0) {
656					google_business_reviews_rating_carousel(current_bullet().querySelector('a'), get_bullet_index(current_bullet()) - 1);
657				}
658				break;
659			}
660
661			if (!is_rtl && event.key == 'ArrowRight' || is_rtl && event.key == 'ArrowLeft') {
662				if (!nav) {
663					if (slide < Math.ceil((listing_element?.children.length ?? 0) / view)) {
664						google_business_reviews_rating_carousel(carousel, slide);
665					}
666					break;
667				}
668
669				const bullets = nav.querySelectorAll('.bullet');
670
671				if (get_bullet_index(current_bullet()) < bullets.length - 1) {
672					google_business_reviews_rating_carousel(current_bullet().querySelector('a'), get_bullet_index(current_bullet()) + 1);
673				}
674				break;
675			}
676		}
677
678		if (active) {
679			break;
680		}
681	}
682}
683
684document.addEventListener('DOMContentLoaded', () => {
685	google_business_reviews_rating();
686	window.addEventListener('keydown', google_business_reviews_rating_actions);
687});

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.