header.controller.js
864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(function() {
'use strict';
angular
.module('dialoga')
.controller('HeaderController', HeaderController);
/** @ngInject */
function HeaderController($timeout, $log) {
$log.debug('HeaderController');
this.$timeout = $timeout;
this.$log = $log;
this.contrast = false;
}
HeaderController.prototype.toggleContrast = function () {
this.contrast = !this.contrast;
console.debug('contrast', this.contrast);
};
HeaderController.prototype.focusMainContent = function ($event) {
// prevent skip link from redirecting
if ($event) { $event.preventDefault(); }
var mainContentArea = document.querySelector("[role='main']");
if ( mainContentArea ) {
this.$timeout(function(){
mainContentArea.focus();
},90);
}else{
this.$log.warn('role="main" not found.');
}
};
})();