https://youthfamilynttac.org/wp-content/plugins/uc-block-utils/uc-decorative-images/uc-decorative.js
1jQuery(document).ready(function($) { 2 function imageWarning(e) { 3 var block = $("<div>"); 4 block.addClass("alert alert-danger accessibility-fail-msg"); 5 block.width(e.width + "px"); 6 7 var icon = $("<span>"); 8 icon.addClass("glyphicon glyphicon-ban-circle"); 9 10 var msg = $("<span>"); 11 msg.append( 12 ' This image needs a <a href="https://kb.uconn.edu/space/IKB/10779852898/Accessibility#Use-Good-Alt-Text">valid Alt tag.</a> ', 13 ); 14 15 block.append(icon).append(msg); 16 $(e).after(block); 17 } 18 19 function isValidAlt(alt) { 20 if (typeof alt === "undefined" || alt === false || alt === null) { 21 return false; 22 } 23 if (alt === "") { 24 return false; 25 } 26 var altLower = alt.toLowerCase(); 27 if ( 28 altLower.indexOf(".jpg") >= 0 || 29 altLower.indexOf(".png") >= 0 || 30 altLower.indexOf(".gif") >= 0 31 ) { 32 return false; 33 } 34 return true; 35 } 36 37 function removeAccessibilityWarning(img) { 38 var $img = $(img); 39 $img.removeClass("accessibility-fail"); 40 $img.next(".accessibility-fail-msg").remove(); 41 } 42 43 // translatepress uses empty-alt flag images, so we have an exception 44 function isTranslatePressFlag(img) { 45 return $(img).is(".trp-language-switcher img.trp-flag-image"); 46 } 47 48 $("#page img").each(function() { 49 if (isTranslatePressFlag(this)) return; 50 if ($(this).hasClass("avatar") || $(this).hasClass("decorative")) return; 51 if ($(this).closest(".decorative").length > 0) return; 52 if ($(this).closest(".ms-youtube").length > 0) return; 53 var alt = $(this).attr("alt"); 54 if ( 55 $(this).closest(".so-parallax").length > 0 || 56 $(this).closest(".flex-control-thumbs").length > 0 57 ) { 58 if (typeof alt === "undefined" || alt === false) $(this).attr("alt", ""); 59 return; 60 } 61 if (alt === "") { 62 $(this).addClass("accessibility-fail"); 63 imageWarning(this); 64 } 65 if (undefined != alt) { 66 alt = alt.toLowerCase(); 67 if ( 68 alt.indexOf(".jpg") >= 0 || 69 alt.indexOf(".png") >= 0 || 70 alt.indexOf(".gif") >= 0 71 ) { 72 $(this).addClass("accessibility-fail"); 73 imageWarning(this); 74 } 75 } else { 76 $(this).addClass("accessibility-fail"); 77 imageWarning(this); 78 } 79 }); 80 81 if (window.MutationObserver) { 82 var observer = new MutationObserver(function(mutations) { 83 mutations.forEach(function(mutation) { 84 if (mutation.type === "attributes" && mutation.attributeName === "alt") { 85 var $img = $(mutation.target); 86 if ($img.hasClass("accessibility-fail")) { 87 var newAlt = $img.attr("alt"); 88 if (isValidAlt(newAlt)) { 89 removeAccessibilityWarning(mutation.target); 90 } 91 } 92 } 93 }); 94 }); 95 96 $("#page img.accessibility-fail").each(function() { 97 observer.observe(this, { 98 attributes: true, 99 attributeFilter: ["alt"] 100 }); 101 }); 102 } 103 104 $("#page table").each(function() { 105 $(this).addClass("table"); 106 }); 107});
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.