UNPKG

@mikezimm/npmfunctions

Version:
137 lines 5.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createFPSWindowProps = exports.defToolBarTitle = exports.defHideQuicklaunchTitle = exports.defHideHeaderTitle = exports.defWpInstanceID = exports.initializeMinimalStyle = exports.initializeFPSSection = exports.initializeFPSPage = exports.webpartInstance = void 0; /** * The purpose of this file is to establish a node in the dom to store all current page variables that can easily be seen and updated by any FPS Webpart */ function webpartInstance(str) { var start = new Date(); var thisInstance = "".concat(str, " | ").concat(start.toUTCString(), " | ").concat(start.getTime(), " | ").concat(Math.floor(Math.random() * 7997)); console.log("winFPS Initiating wpInstanceID: ".concat(thisInstance)); return thisInstance; } exports.webpartInstance = webpartInstance; /** * Creates default pageStyles object for window.FPSOptions */ function initializeFPSPage(wpInstanceID, doThis, fpsPageStyle, fpsPageArray) { var pageStyles = { title: 'FPS Page Styles', do: doThis, wpInstanceID: wpInstanceID, attempted: false, success: 0, errors: 0, Style: fpsPageStyle, Array: fpsPageArray, }; return pageStyles; } exports.initializeFPSPage = initializeFPSPage; function initializeFPSSection(wpInstanceID, maxWidth, marginTB) { if (maxWidth === void 0) { maxWidth = null; } if (marginTB === void 0) { marginTB = null; } var sectionStyles = { summary: { success: 0, errors: 0 }, maxWidth: { title: 'Section maxWidth', cssProp: 'maxWidth', wpInstanceID: wpInstanceID, history: [wpInstanceID], original: 'tbd', attempted: false, do: maxWidth === null ? null : true, value: maxWidth === null ? null : "".concat(maxWidth, "px"), success: 0, errors: 0 }, marginTB: { title: 'Section marginTopBottom', cssProp: 'margin', wpInstanceID: wpInstanceID, history: [wpInstanceID], original: 'tbd', attempted: false, do: marginTB === null ? null : true, value: marginTB === null ? '24px 0' : "".concat(marginTB, "px 0"), success: 0, errors: 0 }, }; return sectionStyles; } exports.initializeFPSSection = initializeFPSSection; /** * initializeToolbar usage: * initializeToolbar( 'Hide Toolbar', wpInstanceID, 'display', this.properties.togglevalue ) * @param title * @param wpInstanceID * @param cssProp * @param value */ function initializeMinimalStyle(title, wpInstanceID, cssProp, value) { if (value === void 0) { value = null; } var sectionStyles = { title: title, cssProp: cssProp, wpInstanceID: wpInstanceID, history: [wpInstanceID], original: 'tbd', attempted: false, do: value === null ? null : true, value: value === null ? null : value, success: 0, errors: 0 }; return sectionStyles; } exports.initializeMinimalStyle = initializeMinimalStyle; exports.defWpInstanceID = 'window'; exports.defHideHeaderTitle = 'Hide Page Header'; exports.defHideQuicklaunchTitle = 'Hide Quick Launch'; exports.defToolBarTitle = 'Hide Toolbar'; function createFPSWindowProps() { var thisWindow = window; var didThis = 'Did not do anything this time'; if (!thisWindow.FPSOptions) { didThis = 'Adding FPSOptions to page'; var fpsWindowProps = { page: initializeFPSPage(exports.defWpInstanceID, null, null, []), sections: initializeFPSSection(exports.defWpInstanceID), header: { title: 'Hide Page Header', wpInstanceID: exports.defWpInstanceID, history: [exports.defWpInstanceID], original: null, attempted: false, value: null, success: 0, errors: 0, }, quicklaunch: { title: 'Hide Quick Launch', wpInstanceID: exports.defWpInstanceID, history: [exports.defWpInstanceID], original: null, attempted: false, value: null, success: 0, errors: 0, }, expando: { title: 'Expandoramic Viewport', wpInstanceID: exports.defWpInstanceID, history: [exports.defWpInstanceID], original: null, attempted: false, value: null, success: 0, errors: 0, }, toolBar: initializeMinimalStyle(exports.defToolBarTitle, exports.defWpInstanceID, 'display', null), }; thisWindow.FPSOptions = fpsWindowProps; } else { } console.log('winFPS createWinProps', didThis, thisWindow.FPSOptions); return thisWindow.FPSOptions; } exports.createFPSWindowProps = createFPSWindowProps; //# sourceMappingURL=FPSDocument.js.map