12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 'use strict';
- define(['jquery'], function ($) {
- return {
- dialogBlockerClasses: ['dialogBlocker', 'ba-common-dialog__blockerCell'],
-
- isShowingDialogBlocker: function isShowingDialogBlocker() {
- return this.dialogBlockerClasses.some(function (className) {
- return document.getElementsByClassName(className).length > 0;
- });
- },
-
- createBlocker: function createBlocker() {
- var $blocker = document.createElement('div');
- $blocker.classList.add('dialogBlocker');
- $blocker.setAttribute('tabindex', '-1');
- return $blocker;
- },
-
- getJqBlocker: function getJqBlocker() {
- return this._wrapEleInJq(this.createBlocker());
- },
-
- show: function show(parent, $blocker) {
- if (!$blocker) {
- $blocker = this.createBlocker();
- } else if ($blocker.length > 0) {
- $blocker = $blocker[0];
- }
- parent = parent.length ? parent[0] : parent;
- parent.appendChild($blocker);
- return this._wrapEleInJq($blocker);
- },
- _wrapEleInJq: function _wrapEleInJq(domEle) {
- return $(domEle);
- }
- };
- });
|