UNPKG

2.54 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var IFRAME_ID = 'bb-help-iframe';
4var IFRAME_TITLE = 'BB Help';
5var IFRAME_SRC = 'https://host.nxt.blackbaud.com/bb-help/';
6// Some browsers return the hexdecimal values are rgb and vice versa when the style is set with javascript.
7var BB_HEADER_COLOR = '#71bf43'; // 'rgb(113, 191, 67)';
8var BB_HEADER_TEXT_COLOR = '#fff'; // 'rgb(255, 255, 255)';
9var BB_HELP_INVOKER_ID = 'bb-help-invoker';
10var BB_HELP_HIDE_ON_MOBILE_CLASS = 'bb-help-hide-on-mobile';
11var 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}());
55exports.BBHelpHelpWidgetRenderer = BBHelpHelpWidgetRenderer;
56//# sourceMappingURL=help-widget-renderer.js.map
\No newline at end of file