1(function ($) { 2 'use strict'; 3 $('img[longdesc]').each(function () { 4 var longdesc = $(this).attr('longdesc'); 5 var text = '<span>Long Description</span>'; 6 var classes = $(this).attr('class'); 7 var class_array = ( Array.isArray(classes) ) ? classes.split(' ') : []; 8 var image_id = ''; 9 $.each( class_array, function ( index, value ) { 10 if ( value.match( /wp-image-/gi ) ) { 11 image_id = value; 12 } 13 }); 14 $(this).attr('class', ''); 15 $(this).wrap('<div class="wpa-ld" />') 16 $(this).parent('.wpa-ld').addClass(classes); 17 $(this).parent('.wpa-ld').append('<div class="longdesc" aria-live="assertive"></div>'); 18 $(this).parent('.wpa-ld').append('<button>' + text + '</button>'); 19 $(this).parent('.wpa-ld').children('.longdesc').hide(); 20 $(this).parent('.wpa-ld').children('.longdesc').load( longdesc + ' #desc_' + image_id ); 21 $(this).parent('.wpa-ld').children('button').toggle(function () { 22 $(this).parent('.wpa-ld').children('.longdesc').show(150); 23 }, function () { 24 $(this).parent('.wpa-ld').children('.longdesc').hide(); 25 }); 26 }); 27}(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.