PageSourceSearch

https://www.transitionresourceguide.ca/themes/custom/transitionresourceguide/js/miscellaneous.js?tiw66b

js transitionresourceguide.ca collected 2026-09-24 12:08:42 UTC 2,552 bytes, 42 lines download raw bytes

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.