1(function ($, Drupal) { 2 'use strict'; 3 4 let openElement = false; 5 6 Drupal.behaviors.agovLoadSubParts = { 7 attach: function (context, settings) { 8 const elements = once('agovLoadSubParts', '.agov-open-subparts-link', context); 9 $(elements).each(function () { 10 $(this).click(function (evt) { 11 // var subpart = window.location.href.substring(window.location.href.lastIndexOf('/') + 1); //daffars/pgi 12 var subpart = $(this).data('doctype'); 13 evt.preventDefault(); 14 let image = evt.currentTarget.childNodes[0].id; 15 Drupal.behaviors.agovLoadSubParts.removeContent(openElement); 16 Drupal.behaviors.agovLoadSubParts.removeContent(image); 17 if ($(".agov-browse-tr").length == 0 && evt.currentTarget.childNodes[0].attributes['data-close'].nodeValue == 'false') { 18 $.ajax({ 19 url: Drupal.url('browse/get-subparts'), 20 type: "POST", 21 cache: false, 22 data: { 23 'type': evt.currentTarget.attributes['data-type'].nodeValue, 24 'part': evt.currentTarget.attributes['data-part'].nodeValue, 25 'subpart': subpart 26 }, 27 success: function (data) { 28 //console.log(JSON.stringify(data)); 29 data.content.map(function (result) { 30 const tr = document.createElement('tr'); 31 tr.setAttribute('class', 'agov-browse-tr'); 32 const td2 = document.createElement('td'); 33 td2.setAttribute('class', 'agov-browse-td'); 34 td2.innerHTML = result.part;
35 tr.appendChild(td2); 36 37 const td3 = document.createElement('td'); 38 td3.setAttribute('class', 'agov-browse-td'); 39 td3.innerHTML = result.html; 40 tr.appendChild(td3); 41 42 const td4 = document.createElement('td'); 43 td4.setAttribute('class', 'agov-browse-td'); 44 td4.innerHTML = result.xml; 45 tr.appendChild(td4); 46 47 const td5 = document.createElement('td'); 48 td5.setAttribute('class', 'agov-browse-td'); 49 td5.innerHTML = result.print; 50 tr.appendChild(td5); 51 52 //console.log(evt.currentTarget.parentElement.parentElement); 53 $(tr).hide(); 54 $(tr).insertAfter(evt.currentTarget.parentElement.parentElement); 55 $(tr).fadeIn("fast"); 56 }); 57 58 $('#' + image).attr("src", "/themes/custom/acquisition_gov/assets/img/minus-alt.svg"); 59 $('#' + image).attr("data-close", 'true'); 60 $('#' + openElement).attr("data-close", 'false'); 61 openElement = image; 62 }, 63 error: function (request, error) { 64 console.log("Request: " + JSON.stringify(request)); 65 } 66 }); 67 } else { 68 Drupal.behaviors.agovLoadSubParts.removeContent(openElement); 69 Drupal.behaviors.agovLoadSubParts.removeContent(image); 70 $('#' + openElement).attr("data-close", 'false'); 71 $('#' + image).attr("data-close", 'false'); 72 openElement = false; 73 } 74 }); 75 }); 76 }, 77 78 removeContent: function(id) { 79 $(".agov-browse-td").remove(); 80 $(".agov-browse-tr").remove(); 81 $(('#'+id)).attr("src", "/themes/custom/acquisition_gov/assets/img/plus-alt.svg"); 82 } 83 }; 84})(jQuery, Drupal);
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.