PageSourceSearch

https://www.muhlenberg.edu/wp-content/plugins/alt-manager/assets/js/alm-frontend.js?ver=1790782338

js muhlenberg.edu collected 2026-10-01 09:08:14 UTC 2,247 bytes, 57 lines download raw bytes

1(function() {
2    'use strict';
3
4    function isInsideLoopContext(img) {
5        if (!img || !img.closest) {
6            return false;
7        }
8
9        return Boolean(
10            img.closest('article') ||
11            img.closest('[data-post-id]') ||
12            img.closest('[id^="post-"]') ||
13            img.closest('[class*=" post-"]') ||
14            img.closest('[class^="post-"]') ||
15            img.closest('.elementor-post') ||
16            img.closest('.e-loop-item') ||
17            img.closest('.post') ||
18            img.closest('.product')
19        );
20    }
21
22    document.addEventListener("DOMContentLoaded", function() {
23        if (typeof almAltManager !== 'undefined') {
24            const altText = almAltManager.altText || '';
25            const titleText = almAltManager.titleText || '';
26
27            // This is a last-resort fallback for unresolved images only.
28            document.querySelectorAll('img').forEach(function(img) {
29                // Skip featured images, WPML flags, and logos
30                const classes = img.className || '';
31                if (classes.includes('wp-post-image') || classes.includes('wpml-ls-flag') || classes.includes('logo') || (img.src && img.src.includes('logo'))) {
32                    return;
33                }
34
35                // Skip loop/archive/card items. Those must use per-item PHP context instead of one global fallback.
36                if (isInsideLoopContext(img)) {
37                    return;
38                }
39
40                // Alt: set only when altText provided AND current alt is missing/empty
41                const currentAlt = img.getAttribute('alt');
42                const altIsEmpty = !currentAlt || currentAlt.trim() === '';
43                if (altText && altIsEmpty) {
44                    img.setAttribute('alt', altText);
45                }
46
47                // Title: set only when titleText provided AND current title is missing/empty
48                const currentTitle = img.getAttribute('title');
49                const titleIsEmpty = !currentTitle || currentTitle.trim() === '';
50                if (titleText && titleIsEmpty) {
51                    img.setAttribute('title', titleText);
52                }
53            });
54        }
55    });
56})();
57

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.