PageSourceSearch

https://cascade-prod.static.wm.edu/_shared/static/js/_js-imports/page_nav_adjust_social_icons.js

js wm.edu collected 2026-10-01 08:36:45 UTC 1,854 bytes, 44 lines download raw bytes

1/* =============================================================
2FUNCTION page_nav_adjust_social_icons()
3
4- Social Media Icons: adds a class to the social icons wrapper in the page nav if there are 5, 6, or 9 icons so that the icon layout can be altered for aesthetics.
5
6================================================================= */
7
8const { runTests, addCheck } = await import('./_run_tests_var.js');
9const { CONTENT_ELEMENT, 
10        PAGENAV, 
11        EXTRANAV, 
12        SOCIALMEDIA_WRAPPER, 
13        MOBILE_PAGENAV_BUTTON, 
14        WM_PAGE_MENU } = await import('./page_nav_variables.js');
15        
16
17
18export function page_nav_adjust_social_icons() {
19
20    if (SOCIALMEDIA_WRAPPER) {
21        for (let i = 0; i < SOCIALMEDIA_WRAPPER.length; i++) {
22            let numIcons = SOCIALMEDIA_WRAPPER[i].querySelectorAll('.sm_icon');
23            if (numIcons.length == 5 || numIcons.length == 6 || numIcons.length == 9) {
24                SOCIALMEDIA_WRAPPER[i].classList += " -js-narrow";
25            }
26        }
27        if (runTests) {
28            for (let i = 0; i < SOCIALMEDIA_WRAPPER.length; i++) {
29                let numIcons = SOCIALMEDIA_WRAPPER[i].querySelectorAll('.sm_icon');
30                if ((numIcons.length == 5 || numIcons.length == 6 || numIcons.length == 9) && SOCIALMEDIA_WRAPPER[i].classList.contains("-js-narrow")) {
31                    addCheck('socialIconsAdd');
32                } else if ((numIcons.length == 5 || numIcons.length == 6 || numIcons.length == 9) && !SOCIALMEDIA_WRAPPER[i].classList.contains("-js-narrow")) {
33                    console.log("Test failed - -js-narrow class not added");
34                    addCheck('socialIconsAdd', false);
35                } else {
36                    addCheck('socialClassNone');
37                }
38            }
39        }
40    }
41}
42
43
44

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.