1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var IFRAME_ID = 'bb-help-iframe';
|
4 | var IFRAME_TITLE = 'BB Help';
|
5 | var IFRAME_SRC = 'https://host.nxt.blackbaud.com/bb-help/';
|
6 |
|
7 | var BB_HEADER_COLOR = '#71bf43';
|
8 | var BB_HEADER_TEXT_COLOR = '#fff';
|
9 | var BB_HELP_INVOKER_ID = 'bb-help-invoker';
|
10 | var BB_HELP_HIDE_ON_MOBILE_CLASS = 'bb-help-hide-on-mobile';
|
11 | var BBHelpHelpWidgetRenderer = (function () {
|
12 | function BBHelpHelpWidgetRenderer(styleUtility) {
|
13 | this.styleUtility = styleUtility;
|
14 | this.styleUtility.addAllStyles();
|
15 | }
|
16 | BBHelpHelpWidgetRenderer.prototype.createContainer = function () {
|
17 | var domElement;
|
18 | domElement = document.createElement('div');
|
19 | domElement.id = 'bb-help-container';
|
20 | domElement.classList.add('bb-help-container');
|
21 | domElement.classList.add('bb-help-closed');
|
22 | return domElement;
|
23 | };
|
24 | BBHelpHelpWidgetRenderer.prototype.createInvoker = function () {
|
25 | var invoker;
|
26 | invoker = document.createElement('button');
|
27 | invoker.setAttribute('aria-title', 'Toggle Help Widget');
|
28 | invoker.setAttribute('aria-controls', 'bb-help-container');
|
29 | invoker.setAttribute('aria-pressed', 'false');
|
30 | invoker.id = BB_HELP_INVOKER_ID;
|
31 | return invoker;
|
32 | };
|
33 | BBHelpHelpWidgetRenderer.prototype.createIframe = function () {
|
34 | var iframe;
|
35 | iframe = document.createElement('iframe');
|
36 | iframe.id = IFRAME_ID;
|
37 | iframe.title = IFRAME_TITLE;
|
38 | iframe.src = IFRAME_SRC;
|
39 | return iframe;
|
40 | };
|
41 | BBHelpHelpWidgetRenderer.prototype.addInvokerStyles = function (invoker, config) {
|
42 | invoker.style.backgroundColor = config.headerColor || BB_HEADER_COLOR;
|
43 | invoker.style.color = config.headerTextColor || BB_HEADER_TEXT_COLOR;
|
44 | invoker.innerHTML = '<span>?</span>';
|
45 | if (config.hideWidgetOnMobile !== false) {
|
46 | invoker.classList.add(BB_HELP_HIDE_ON_MOBILE_CLASS);
|
47 | }
|
48 | };
|
49 | BBHelpHelpWidgetRenderer.prototype.appendElement = function (el, parentEl) {
|
50 | if (parentEl === void 0) { parentEl = document.body; }
|
51 | parentEl.appendChild(el);
|
52 | };
|
53 | return BBHelpHelpWidgetRenderer;
|
54 | }());
|
55 | exports.BBHelpHelpWidgetRenderer = BBHelpHelpWidgetRenderer;
|
56 |
|
\ | No newline at end of file |