UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

65 lines (64 loc) 2.73 kB
/** * CodeAnalizerComment: Updated 2 imports on 2024-09-22 14:49:52 * Update:: import { IFPSWindowProps } to '@mikezimm/fps-core-v7/lib/banner/features/FPSDOM/IFPSWindowProps;' * Update:: import { createFPSWindowProps } to '@mikezimm/fps-core-v7/lib/banner/features/FPSDOM/FPSDocument;' */ import { createFPSWindowProps, } from '@mikezimm/fps-core-v7/lib/banner/features/FPSDOM/FPSDocument'; import { check4This, Check4 } from '@mikezimm/fps-core-v7/lib/logic/Links/CheckSearch'; /** * THIS WAS DEPRECATED IN FAVOR OF hideSPODataAutoId * This minimizes the header on site pages where you do not want the Page Title at the top. originally copied from Pivot Tiles * @param minimize * @param alertError * @param consoleResult * @returns */ export function minimizeHeaderDEPRECATED(minimize, alertError = true, consoleResult = false) { let fpsWindowProps = createFPSWindowProps(); //If this was already attempted, then exit if (fpsWindowProps.pageHeader.attempted === true) { return; } else if (minimize !== true) { return; } else { fpsWindowProps.pageHeader.attempted = true; } let height = minimize === true ? '0px' : null; /** * Was getting this ts error creating divs: * Type 'NodeListOf<Element>' is missing the following properties from type 'any[]': pop, push, concat, join, and 26 more.ts(2740) * * Found this reference: https://stackoverflow.com/a/222847 * which references this: https://262.ecma-international.org/8.0/#sec-array.from * * Which now removes the error */ const divs = Array.from(document.querySelectorAll('[data-automation-id="pageHeader"]')); if (check4This(Check4.fpsInitRender_Eq_true) === true) console.log("divs.length: ", divs.length); //inspiration from: https://reactgo.com/select-element-data-attribute-js/ divs.forEach((el) => { try { if (el.style) { el.style.height = height; } else { el.style = { height: height }; } if (consoleResult === true) { console.log('minimizeHeader: set minimize to ', minimize); } fpsWindowProps.pageHeader.success++; } catch (e) { if (alertError === true) { alert('minimizeHeader: Could not find element with data-automation-id="pageHeader"'); } console.log('minimizeHeader: Could not find element with data-automation-id="pageHeader"'); fpsWindowProps.pageHeader.errors++; } }); } //# sourceMappingURL=minimzeHeader.js.map