1 2function MandatoryCleanUp(e) { 3 /* 4 $(e).find('div').each(function () { 5 $(this).contents().filter(function () { 6 return this.nodeType === 3; // Text node type 7 }).wrap('<p></p>'); 8 }); 9 */ // Causes problems with callout > h3 10 $(e).find('.qe-editable').removeClass('qe-editable'); 11 ChangeAllTags(e, 'B', 'STRONG'); 12 ChangeAllTags(e, 'I', 'EM'); 13 ChangeAllTags(e, 'H1', 'H2'); 14 RemoveAllAttrs(e, 'data-mce-style'); 15 RemoveAllAttrs(e, 'data-mce-src'); 16 RemoveAllAttrs(e, 'width'); 17 RemoveAllAttrs(e, 'height'); 18 19 // Fill in the blank 20 $(e).find('input[data-etb-pq-value], input.pq-fill').each(function () { 21 let v = $(this).attr('data-etb-pq-value') || ''; 22 let n = $('<input></input>').attr('data-role', 'fib').attr('data-value', v); 23 $(this).replaceWith(n); 24 }); 25 26 // Move images out of paragraphs 27 $(e).find('img').each((i, e2) => { 28 let p = $(e2).parent()[0]; 29 if ($(p).is('p')) { 30 $(e2).insertBefore(p); 31 Toast('Image Moved', 'An imaged was moved out of a paragraph, per HTML requirements.', 'bg-warning'); 32 } 33 }); 34 35 $('[data-etb-glossary-term-id]').each(function () { 36 $(this).attr('data-glossary-term-id', $(this).attr('data-etb-glossary-term-id')); 37 $(this).removeAttr('data-etb-glossary-term-id'); 38 }); 39 40 // Accordions 41 $('.card.answerKey').each(async (i, e) => { 42 let b = $(`<button class="accordion-button fs-4" type="button">Accordion Button Text</button>`); 43 let d = $(`<div class="accordion-body"><p><br /></p></div>`); 44 let btnHTML = $(e).children('a').eq(0).html(); 45 console.log(btnHTML); 46 let hiddenHTML = $(e).children('div').eq(0).html(); 47 console.log(hiddenHTML); 48 d.html(hiddenHTML); 49 b.html(btnHTML); 50 $(e).replaceWith(b); 51 b.after(d); 52 Toast('Accordion Updated', 'An accordion was updated to the new format.', 'bg-info'); 53 }); 54 55 // JSFiddle 56 $('iframe').each((i, e) => { 57 if ($(e).attr('src') !== undefined && $(e).attr('src') !== null && $(e).attr('src').startsWith('//jsfiddle.net/')) { 58 let b = $('<a></a>').addClass('btn btn-jsfiddle').text('Try it out...').attr('href', 'https:' + $(e).attr('src')).attr('target', '_blank'); 59 $(e).replaceWith(b); 60 } 61 }); 62 63 // Glossary 64 $(e).find('[data-etb-glossary-term-id]').each(function () { 65 $(this).attr('data-glossary-term-id', $(this).attr('data-etb-glossary-term-id')); 66 }); 67 $(e).find('.glossary-link,[data-anchor-name],[data-etb-glossary-term-id]').removeAttr('class').removeAttr('data-anchor-name').removeAttr('data-etb-glossary-term-id').removeAttr('title').removeAttr('data-bs-original-title').removeAttr('data-bs-toggle'); 68 return e; 69} 70function ChangeAllTags(e, t1, t2) { 71 $(e).find(t1).each(function () { 72 $(this).replaceWith($('<' + t2 + '/>' + $(this).html() + '</' + t2 + '>')); 73 }); 74} 75function RemoveAllAttrs(e, a) { 76 $(e).find('[' + a + ']').removeAttr(a); 77 return e; 78}
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.