1(function(Drupal, once) { 2 Drupal.behaviors.transitionResourceGuideMiscellaneous = { 3 attach: function(context, settings){ 4 once('transitionResourceGuideMiscellaneous', 'body', context).forEach(function(element){ 5 // Set maximum height of portrait-oriented images beside checklists (in 6 // Checklist section paragraphs) and Sections to not exceded the height 7 // of the other content (the checklist itself, the title, the body). An 8 // image is portrait-oriented if the view mode is âPortraitâ or if the 9 // view mode is âIntrinsic aspect ratioâ and the field value container 10 // has class âimage-shape-portraitâ. 11 const portrait_image_sections = element.querySelectorAll('.paragraph--bundle-checklist.transitionresourceguide-highlight:has(.field--id-field-section-media .media--bundle-image.media--view-mode-portrait, .field--id-field-section-media .media--bundle-image.media--view-mode-intrinsic-aspect-ratio .field-value.image-shape-portrait), .paragraph--bundle-section:has(.field--id-field-section-media .media--bundle-image.media--view-mode-intrinsic-aspect-ratio .field-value.image-shape-portrait)'); 12 if ((portrait_image_sections) && (portrait_image_sections.length > 0)) { 13 portrait_image_sections.forEach(portrait_image_section => { 14 let image_max_height = 0; 15 [ 16 '.field--id-field-media-svg', 17 '.field--id-field-title:not(.list-and-ancillary .field--id-field-title) > .field-values', 18 '.field--id-field-body:not(.list-and-ancillary .field--id-field-body) > .field-values', 19 '.list-and-ancillary', 20 ].forEach(portrait_image_component_class => { 21 let portrait_image_component = portrait_image_section.querySelector(portrait_image_component_class); 22 if (portrait_image_component) { 23 image_max_height += portrait_image_component.offsetHeight; 24 } 25 }); 26 if (image_max_height > 0) { 27 // Set a minimum in case there's very little content beside the 28 // image. 29 if (image_max_height < 400) { 30 image_max_height = 400; 31 } 32 const portrait_image = portrait_image_section.querySelector('.field--id-field-section-media img'); 33 if (portrait_image) { 34 portrait_image.style.maxHeight = image_max_height + 'px'; 35 } 36 } 37 }); 38 } 39 }); 40 } 41 }; 42})(Drupal, once);
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.