PageSourceSearch

https://www.neocate.com/shop/skins/skin_1/scripts/siteaccessibility.js

js neocate.com collected 2026-09-25 21:32:24 UTC 3,456 bytes, 120 lines download raw bytes

1$(document).ready(function () {
2
3	//Button missing a text alternative
4	if (location.href.includes('neocate-syneo-clinical-research')) {
5		$('.owl-dot').attr('aria-label', 'Graph Button');
6		$('.owl-prev').attr('aria-label', 'Prev Button');
7		$('.owl-next').attr('aria-label', 'Next Button');
8		//Presentational element is exposed to assistive technologies
9		$(".owl-prev").removeAttr("role");
10		$(".owl-next").removeAttr("role");
11	}
12
13	//Container element is empty
14	if (location.href.includes('request-samples-consumer')
15		|| location.href.includes('request-samples-hcp')) {
16		var ulElement = $(".chosen-results");
17		if (ulElement.find("li").length === 0) {
18			ulElement.append("<li>None</li>");
19		}
20	}
21
22	//Form field missing a label
23	if (location.href.includes('request-samples-consumer')
24		|| location.href.includes('request-samples-hcp')) {
25		var inputElement = $('.search-field').find('input');
26
27		if (inputElement.attr('id')) {
28			var labelFor = inputElement.attr('id');
29		} else {
30			var lblInputFormula = 'lblInputFormula';
31			inputElement.attr('id', lblInputFormula);
32			var labelFor = lblInputFormula;
33		}
34		var labelElement = $('<label>').attr('for', labelFor).text('Select:');
35		labelElement.css('display', 'none');
36		$('.search-field').prepend(labelElement);
37	}
38
39	//Element IDs are not unique
40	jQuery(window).on('load', renameDuplicateIDs);
41
42	//Image missing a text alternative
43	jQuery(window).on('load', addAltTextToImage);
44
45	//Link missing a text alternative
46
47	jQuery(window).on('load', addAltTextToAnchor);
48	//if (location.href.includes('hypoallergenic-formula-and-products')) { //Comment due to anchor lin area lable not work on pepticate new page.
49	//    jQuery(window).on('load', addAltTextToAnchor);
50	//}
51
52});
53
54function addAltTextToImage() {
55	$('img').each(function () {
56		if (!$(this).attr('alt')) {
57			const src = $(this).attr('src');
58			if (src) {
59				var lastPartHref = src.split('/').filter(Boolean).pop();
60				if (lastPartHref) {
61					if (lastPartHref.includes('?')) {
62						altValue = lastPartHref.split('?')[0];
63					} else {
64						altValue = lastPartHref;
65					}
66
67					$(this).attr('alt', altValue);
68				
69				}
70			}
71		}
72		//if (!$(this).attr('title')) {
73		//	const src = $(this).attr('src');
74		//	if (src) {
75		//		var lastPartHref = src.split('/').filter(Boolean).pop();
76		//		if (lastPartHref) {
77		//			if (lastPartHref.includes('?')) {
78		//				altValue = lastPartHref.split('?')[0];
79		//			} else {
80		//				altValue = lastPartHref;
81		//			}
82
83			
84		//			$(this).attr('title', altValue);
85		//		}
86		//	}
87		//}
88	});
89}
90
91function addAltTextToAnchor() {
92	$('a').each(function () {
93		if (!$(this).attr('aria-label')) {
94			const href = $(this).attr('href');
95			if (href) {
96				var lastPartHref = href.split('/').filter(Boolean).pop();
97				if (lastPartHref) {
98					if (lastPartHref.includes('?')) {
99						altValue = lastPartHref.split('?')[0];
100					} else {
101						altValue = lastPartHref;
102					}
103
104					$(this).attr('aria-label', altValue);
105				}
106			}
107		}
108	});
109}
110
111function renameDuplicateIDs() {
112	// Step 1: Find elements with duplicate IDs
113	const elementsWithDuplicateIDs = $('[id]').filter((index, element) => $('[id="' + element.id + '"]').length > 1);
114
115	// Step 2: Rename duplicate IDs
116	elementsWithDuplicateIDs.each(function (index) {
117		const currentID = this.id;
118		this.id = `${currentID}_${index + 1}`;
119	});
120}

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.