PageSourceSearch

https://www.925theticket.com/wp-content/plugins/wp-accessibility/js/wp-accessibility.js?ver=1.7.14_2

js 925theticket.com collected 2026-10-04 08:40:04 UTC 12,024 bytes, 306 lines download raw bytes

1(function( $ ) { 'use strict';
2	var html   = document.querySelector( 'html' );
3	if ( wpa.lang ) {
4		var lang   = html.getAttribute( 'lang' );
5		if ( ! lang ) {
6			$('html').attr( 'lang', wpa.lang );
7			if ( wpa.errors ) {
8				console.log( 'HTML language set by WP Accessibility' );
9			}
10		}
11	}
12
13	if ( wpa.dir ) {
14		var dir  = html.getAttribute( 'dir' );
15		if ( ! dir ) {
16			$('html').attr( 'dir', wpa.dir );
17			if ( wpa.errors ) {
18				console.log( 'HTML language direction set by WP Accessibility' );
19			}
20		}
21	}
22
23	var viewport = document.querySelector( 'meta[name="viewport"]' );
24	if ( viewport ) {
25		var conditionsBefore = viewport.getAttribute( 'content' );
26		var conditionsAfter  = viewport.getAttribute( 'content' );
27		if ( conditionsBefore.search(/user-scalable=no/g) ) {
28			conditionsAfter = conditionsBefore.replace( 'user-scalable=no', 'user-scalable=yes' );
29			viewport.setAttribute( 'content', conditionsAfter );
30			if ( wpa.errors && conditionsAfter != conditionsBefore ) {
31				console.log( 'Viewport made scalable by WP Accessibility' );
32			}
33		}
34		if ( conditionsBefore.search(/maximum-scale=1/g) ) {
35			conditionsAfter = conditionsBefore.replace( 'maximum-scale=1', 'maximum-scale=5' );
36			conditionsAfter = conditionsAfter.replace( 'maximum-scale=0', 'maximum-scale=5' );
37			viewport.setAttribute( 'content', conditionsAfter );
38			if ( wpa.errors && conditionsAfter != conditionsBefore  ) {
39				console.log( 'Viewport maximum scale set by WP Accessibility' );
40			}
41		}
42	}
43
44	if ( wpa.skiplinks.enabled ) {
45		$('body').prepend( wpa.skiplinks.output );
46		if ( wpa.errors ) {
47			console.log( 'Skip links added by WP Accessibility' );
48		}
49	}
50
51	if ( wpa.current ) {
52		$(function() {
53			$( '.current-menu-item a, .current_page_item a' ).attr( 'aria-current', 'page' );
54		});
55		if ( wpa.errors ) {
56			console.log( 'ARIA current added by WP Accessibility' );
57		}
58	}
59
60	if ( wpa.labels ) {
61		var wpa_names = [ 's', 'author', 'email', 'url', 'comment' ];
62		$.each( wpa_names, function( index, value ) {
63			if ( value == 'comment' ) {
64				var field = $( 'textarea[name=' + value + ']' );
65			} else {
66				var field = $( 'input[name=' + value + ']' ).not( '#adminbar-search' );
67			}
68			if ( 0 !== field.length ) {
69				var field_id = field.attr( 'id' );
70				var implicit = $( field ).parent( 'label' );
71				var aria = $( field ).attr( 'aria-label' );
72				var ariaId = $( field ).attr( 'aria-labelledby' );
73				var ariaTarget = {};
74				if ( ariaId ) {
75					ariaTarget = $( '#' + ariaId );
76				}
77				var hasAria   = ( '' == aria || 'undefined' == typeof( aria ) ) ? false : true;
78				var hasAriaId = ( '' == ariaId || 'undefined' == typeof( ariaId ) ) ? false : true;
79				// Add label if aria label empty, aria labelledby empty, or aria reference ID does not exist.
80				if ( ( ! hasAria && ! hasAriaId ) || ( ! hasAria && ( hasAriaId && 0 === ariaTarget.length ) ) ) {
81					if ( field_id ) {
82						var label = $( 'label[for=' + field_id + ']' );
83						if ( !label.length && !implicit.length ) {
84							field.before( "<label for='" + field_id + "' class='wpa-screen-reader-text'>" + wpa.wpalabels[value] + "</label>" );
85							if ( wpa.errors ) {
86								console.log( 'Explicit label on ' + wpa.wpalabels[value] + 'added by WP Accessibility' );
87							}
88						}
89					} else {
90						if ( !implicit.length ) {
91							field.attr( 'id', 'wpa_label_' + value ).before( "<label for='wpa_label_" + value + "' class='wpa-screen-reader-text'>" + wpa.wpalabels[value] + "</label>" );
92							if ( wpa.errors ) {
93								console.log( 'Implicit label on ' + wpa.wpalabels[value] + 'added by WP Accessibility' );
94							}
95						}
96					}
97				}
98			}
99		});
100	}
101
102
103	if ( wpa.titles ) {
104		var images   = 0;
105		var controls = 0;
106		var fields   = 0;
107		const els    = document.querySelectorAll( 'img, a, input, textarea, select, button' );
108		els.forEach((el) => {
109			var title = el.getAttribute( 'title' );
110			if ( title && '' !== title ) {
111				switch ( el.tagName ) {
112					case 'IMG':
113						// If image has alt, remove title. If not, set title as alt.
114						var alt = el.getAttribute( 'alt' );
115						if ( ! alt || '' === alt ) {
116							el.setAttribute( 'alt', title );
117							el.removeAttribute( 'title' );
118						} else {
119							el.removeAttribute( 'title' );
120						}
121						images++;
122						break;
123					case 'A':
124					case 'BUTTON':
125						// If link or button has contained text or an img with alt, remove title. Otherwise, set title as aria-label unless element already has aria-label.
126						var linkText = wpaElementText(el);
127						if ( ! linkText || '' === linkText ) {
128							var ariaLabel = el.getAttribute( 'aria-label' );
129							if ( ! ariaLabel || '' === ariaLabel ) {
130								el.setAttribute( 'aria-label', title );
131								el.removeAttribute( 'title' );
132							}
133						} else {
134							el.removeAttribute( 'title' );
135						}
136						controls++;
137						break;
138					case 'INPUT':
139					case 'SELECT':
140					case 'TEXTAREA':
141						// If input field has an aria-label, aria-labelledby, associated label, or wrapping label, remove title. Else, add title as aria-label.
142						var ariaLabel        = el.getAttribute( 'aria-label' );
143						var ariaLabelled     = el.getAttribute( 'aria-labelledby' );
144						var ariaLabeller     = ( ariaLabelled ) ? document.getElementById( ariaLabelled ) : false;
145						var labelId          = el.getAttribute( 'id' );
146						var label            = ( labelId ) ? document.querySelector( 'label[for="' + labelId + '"]' ) : false;
147						var parentLabel      = el.closest( 'label' );
148						var hasAriaLabel     = ( ariaLabel && '' !== ariaLabel ) ? true : false;
149						var hasRealLabel     = ( label && '' !== wpaElementText( label ) ) ? true : false;
150						var hasImplicitLabel = ( parentLabel && '' !== wpaElementText( parentLabel ) ) ? true : false;
151						var hasAriaLabelled  = ( ariaLabeller && '' !== wpaElementText( arialabeller ) ) ? true : false;
152						if ( hasAriaLabel || hasRealLabel || hasImplicitLabel || hasAriaLabelled ) {
153							// This has a label.
154							el.removeAttribute( 'title' );
155						} else {
156							el.setAttribute( 'aria-label', title );
157							el.removeAttribute( 'title' );
158						}
159						fields++;
160						break;
161				}
162			}
163		});
164		if ( wpa.errors ) {
165			if ( images > 0 ) {
166				console.log( images + ' title attributes removed from images by WP Accessibility' );
167			}
168			if ( controls > 0 ) {
169				console.log( controls + ' title attributes removed from links and buttons by WP Accessibility' );
170			}
171			if ( fields > 0 ) {
172				console.log( fields + ' title attributes removed from input fields by WP Accessibility' );
173			}
174		}
175	}
176
177	if ( wpa.target ) {
178		var targeted      = $('a:not(.wpa-allow-target)');
179		var targetRemoved = 0;
180		console.log('here in wp-accessibility js file........');
181		targeted.each( function() {
182			var target = $( this ).attr( 'target' );
183			if ( target ) {
184				//------------------------
185				//WPB-5382
186				var remove_target = true; //by default as usual remove target
187				//console.log($( this ).attr( 'href' ));
188				var link_class = $( this ).attr( 'class' );
189				if (link_class && link_class != 'undefined') {
190					console.log('link_class : '+link_class);
191					//if menu classes then donot remove targets.
192					if (link_class == 'sub-level-link' || link_class == 'top-level-link' || link_class == 'elementor-sub-item') {
193						remove_target = false;
194					}
195					else {
196						console.log('removed target.....'+link_class);
197					}
198				}
199				//------------------------
200				if (remove_target) { //WPB-
201				$( this ).removeAttr( 'target' );
202				targetRemoved++;
203				}
204			}
205		});
206		if ( targetRemoved > 0 && wpa.errors ) {
207			console.log( targetRemoved + ' target attributes removed from links by WP Accessibility' );
208		}
209	}
210
211	if ( wpa.tabindex ) {
212		// Remove tabindex from elements that should be natively focusable.
213		var focusable  = $('input,a,select,textarea,button').not('a:not([href])');
214		var tabRemoved = 0;
215		focusable.each( function() {
216			var tabindex = $( this ).attr( 'tabindex' );
217			if ( tabindex ) {
218				$( this ).removeAttr('tabindex');
219				tabRemoved++;
220			}
221		});
222
223		if ( tabRemoved > 0 && wpa.errors ) {
224			console.log( tabRemoved + ' tabindex attributes removed from links, buttons and inputs by WP Accessibility' );
225		}
226
227		// Add tabindex to elements that appear active but are not natively focusable.
228		var fakeButtons = $('div[role="button"]').not('div[tabindex]' );
229		var buttonLinks = $('a[role="button"]').not('a[tabindex],a[href]');
230		fakeButtons.attr( 'tabindex', '0' ).addClass('wpa-focusable');
231		if ( fakeButtons.length > 0 && wpa.errors ) {
232			console.log( fakeButtons.length + ' tabindex attributes added to divs with the button role by WP Accessibility' );
233		}
234		buttonLinks.attr( 'tabindex', '0' ).addClass('wpa-focusable');
235		if ( buttonLinks.length > 0 && wpa.errors ) {
236			console.log( buttonLinks.length + ' tabindex attributes added to anchor elements with the button role and no href value by WP Accessibility' );
237		}
238	}
239
240	if ( wpa.underline.enabled ) {
241		// Underline any link not inside a `nav` region. Using JS for this avoids problems with cascade precedence.
242		var originalOutline = $( wpa.underline.target ).css( 'outline-width' );
243		var originalOffset  = $( wpa.underline.target ).css( 'outline-offset' );
244		var textColor       = $( wpa.underline.target ).css( 'color' );
245		var originalColor   = $( wpa.underline.target ).css( 'outline-color' );
246		$( wpa.underline.target ).not( 'nav ' + wpa.underline.target ).css( 'text-decoration', 'underline' );
247
248		$( wpa.underline.target ).on( 'mouseenter', function() {
249			$( this ).css( 'text-decoration', 'none' );
250		});
251		$(  wpa.underline.target ).on( 'mouseleave', function() {
252			// Reset visible appearance on exit.
253			$( this ).css( 'text-decoration', 'underline' );
254		});
255
256		$( wpa.underline.target ).on( 'focusin', function() {
257			var newOutline = '2px';
258			if ( originalOutline == '2px' ) {
259				newOutline = '4px';
260			}
261			// Ensure there's a visible change of appearance on hover or focus.
262			$(this).css( 'outline-width', newOutline );
263			$(this).css( 'outline-color', textColor );
264			$(this).css( 'outline-offset', '2px' );
265		});
266		$(  wpa.underline.target ).on( 'focusout', function() {
267			// Reset visible appearance on exit.
268			$(this).css( 'outline-width', originalOutline );
269			$(this).css( 'outline-color', originalColor );
270			$(this).css( 'outline-offset', originalOffset );
271		});
272	}
273}(jQuery));
274
275/**
276 * Check whether an element contains text, including inspecting contained content for image alt attributes or aria-label attributes.
277 *
278 *
279 * @arg el DOM element to check.
280 *
281 * Based on work by Roger Johansson https://www.456bereastreet.com/archive/201105/get_element_text_including_alt_text_for_images_with_javascript/
282 */
283function wpaElementText(el) {
284	var text = '';
285	// Text node (3) or CDATA node (4) - return its text
286	if ( (el.nodeType === 3) || (el.nodeType === 4) ) {
287		text = el.nodeValue;
288	// If node is an element (1) and an img, input[type=image], or area element, return its alt text
289	} else if ( (el.nodeType === 1) && (
290			(el.tagName.toLowerCase() == 'img') ||
291			(el.tagName.toLowerCase() == 'area') ||
292			((el.tagName.toLowerCase() == 'input') && el.getAttribute('type') && (el.getAttribute('type').toLowerCase() == 'image'))
293			) ) {
294		text = el.getAttribute('alt') || '';
295	// Traverse children unless this is a script or style element
296	} else if ( (el.nodeType === 1) && !el.tagName.match(/^(script|style)$/i) ) {
297		var children = el.childNodes;
298		for (var i = 0, l = children.length; i < l; i++) {
299			// If an element has an aria-label, that will override any other contained text.
300			var ariaLabel = el.getAttribute( 'aria-label' );
301			text += ( ariaLabel ) ? ariaLabel : wpaElementText( children[i] ) + ' ';
302		}
303	}
304
305	return text;
306};

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.