@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
51 lines • 2.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.minimizeToolbar = void 0;
var FPSDocument_1 = require("./FPSDocument");
var setAllSectionStyles_1 = require("./setAllSectionStyles");
var console_1 = require("./console");
/**
* This minimizes the header on site pages where you do not want the Page Title at the top. originally copied from Pivot Tiles
*
* @param document
* @param minimize
* @param alertError
* @param consoleResult
*/
function minimizeToolbar(document, sectionStyle, alertError, consoleResult) {
if (alertError === void 0) { alertError = true; }
if (consoleResult === void 0) { consoleResult = false; }
var fpsWindowProps = (0, FPSDocument_1.createFPSWindowProps)();
var winStyle = fpsWindowProps.toolBar;
//If this was already attempted, then exit
if (fpsWindowProps.toolBar.attempted === true) {
return;
}
else if (sectionStyle.do === false || winStyle.success > 0) {
return;
}
else {
fpsWindowProps.toolBar.attempted = true;
}
// if ( proceed === false ) { return ; }
var el = document.getElementById('spCommandBar');
try {
//This updates updates display to none or null
if (sectionStyle.do === true) {
fpsWindowProps.toolBar = (0, setAllSectionStyles_1.applySectionStyle)(el, sectionStyle, winStyle, alertError, consoleResult);
}
sectionStyle.success++;
}
catch (e) {
if (alertError === true) {
alert('minimizeToolbar: Could not find element with id="spCommandBar"');
}
console.log('minimizeToolbar: Could not find element with id="spCommandBar"');
sectionStyle.errors++;
fpsWindowProps.toolBar.errors++;
}
(0, console_1.sendFPSWindowConsole)(true, 'COMPLETE', fpsWindowProps);
return { sectionStyle: sectionStyle };
}
exports.minimizeToolbar = minimizeToolbar;
//# sourceMappingURL=minimzeToolbar.js.map