(function () {
'use strict';
// Main component which contains all other components
angular
.module('mohistory')
.component('mohistoryApp', {
templateUrl: 'app/components/mohistory-app/mohistory-app.component.html',
controller: mohistoryAppCtrl,
controllerAs: 'mohistoryApp',
bindings: {
menus: '<',
}
});
mohistoryAppCtrl.$inject = ['$stateParams', '$rootScope'];
/**
* Outermost component which loads and stores the navigation and footer
* information.
* @memberof mohistory
* @name mohistoryApp
* @ngdoc component
* @param {object} $stateParams UI-Router old service for accessing state parameters
* @param {object} $rootScope Parent scope for all other scopes in AngularJS applications
*/
function mohistoryAppCtrl($stateParams, $rootScope) {
var vm = this;
/* ----- Variables ----- */
vm.a11yHidden = false; // For hiding content from screen readers
vm.visuallyHidden = false; // For hiding content from everyone
vm.footerHidden = false; // For hiding the footer in infinite scroll
/* ----- Function Bindings ----- */
vm.$onInit = onInit;
vm.setA11yHidden = setA11yHidden;
vm.setVisuallyHidden = setVisuallyHidden;
vm.setFooterHidden = setFooterHidden;
/* ----- Function Definitions ----- */
/**
* Initialization code run every time the component is created, used to setup variables
* based on the UI-Router state.
* @function onInit
* @memberof mohistoryApp
*/
function onInit() {
if($stateParams.fullscreen || $stateParams.fullscreen == 1) {
// hideBorder effects the CSS border placed on Body.
$rootScope.hideBorder = true;
vm.visuallyHidden = true;
} else {
$rootScope.hideBorder = false;
vm.visuallyHidden = false;
}
}
/**
* Set the a11yHidden variable, which effects aria-hidden.
* @function setA11yHidden
* @memberof mohistoryApp
* @param {boolean} bool true sets aria-hidden to true, where
* false sets aria-hidden to false
*/
function setA11yHidden(bool) {
vm.a11yHidden = bool;
}
/**
* Set the variables capable of hiding/showing the majority of
* the content on the page.
* @function setVisuallyHidden
* @memberof mohistoryApp
* @param {boolean} bool true to hide the majority of content, false to show it
*/
function setVisuallyHidden(bool) {
$rootScope.hideBorder = bool;
vm.visuallyHidden = bool;
}
/**
* Set a variable that can hide or show the site footer.
* This is mainly used to aid in Infinite scrolling.
* @function setFooterHidden
* @memberof mohistoryApp
* @param {boolean} bool True to hide the footer, false to show it
*/
function setFooterHidden(bool) {
vm.footerHidden = bool;
}
};
})();