PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.2
Elementor Website Builder – more than just a page builder v3.6.2
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | assets/lib/dialog/dialog.js +15 -67 4.3.1 → 3.6.2 View file →
@@ -1,6 +1,6 @@
1 1 /*!
2 - * Dialogs Manager v4.9.4
2 + * Dialogs Manager v4.9.0
3 3 * https://github.com/kobizz/dialogs-manager
4 4 *
5 5 * Copyright Kobi Zaltzberg
6 6 * Released under the MIT license
@@ -62,10 +62,8 @@
62 62
63 63 var self = this,
64 64 elements = {},
65 65 settings = {};
66 -
67 - self.openDialogs = [];
68 66
69 67 var initElements = function() {
70 68
71 69 elements.body = $('body');
@@ -104,26 +102,10 @@
104 102
105 103 return Object.create(settings);
106 104 };
107 105
108 - this.maybeLoadAssets = async function () {
109 - const isFrontend = !! window.elementorFrontend?.utils?.assetsLoader;
106 + this.init = function(settings) {
110 107
111 - if ( ! isFrontend ) {
112 - return;
113 - }
114 -
115 - try {
116 - await elementorFrontend.utils.assetsLoader.load( 'style', 'dialog' );
117 - } catch ( error ) {
118 - console.error( 'Failed to load assets:', error );
119 - }
120 - };
121 -
122 - this.init = function (settings) {
123 -
124 - this.maybeLoadAssets();
125 -
126 108 initSettings(settings);
127 109
128 110 initElements();
129 111
@@ -180,9 +162,9 @@
180 162
181 163 var effect = settings.effects[intent],
182 164 $widget = elements.widget;
183 165
184 - if ('function' === typeof effect) {
166 + if ($.isFunction(effect)) {
185 167 effect.apply($widget, params);
186 168 } else {
187 169
188 170 if ($widget[effect]) {
@@ -311,9 +293,9 @@
311 293 // Backwards compatibility
312 294 settings.closeButtonOptions.iconClass = settings.closeButtonClass;
313 295 }
314 296
315 - const $button = $('<a>', settings.closeButtonOptions.attributes),
297 + const $button = $('<div>', settings.closeButtonOptions.attributes),
316 298 $buttonIcon = $(settings.closeButtonOptions.iconElement).addClass(settings.closeButtonOptions.iconClass);
317 299
318 300 $button.append($buttonIcon);
319 301
@@ -333,15 +315,9 @@
333 315 });
334 316
335 317 classes.push(self.getSettings('className'));
336 318
337 - elements.widget
338 - .addClass(classes.join(' '))
339 - .attr({
340 - 'aria-modal': true,
341 - 'role': 'document',
342 - 'tabindex': 0,
343 - });
319 + elements.widget.addClass(classes.join(' '));
344 320 };
345 321
346 322 var initSettings = function(parent, userSettings) {
347 323
@@ -353,12 +329,12 @@
353 329 effects: parentSettings.effects,
354 330 classes: {
355 331 globalPrefix: parentSettings.classPrefix,
356 332 prefix: parentSettings.classPrefix + '-' + widgetName,
357 - preventScroll: parentSettings.classPrefix + '-prevent-scroll',
333 + preventScroll: parentSettings.classPrefix + '-prevent-scroll'
358 334 },
359 335 selectors: {
360 - preventClose: '.' + parentSettings.classPrefix + '-prevent-close',
336 + preventClose: '.' + parentSettings.classPrefix + '-prevent-close'
361 337 },
362 338 container: 'body',
363 339 preventScroll: false,
364 340 iframe: null,
@@ -364,14 +340,9 @@
364 340 iframe: null,
365 341 closeButton: false,
366 342 closeButtonOptions: {
367 343 iconClass: parentSettings.classPrefix + '-close-button-icon',
368 - attributes: {
369 - role: 'button',
370 - 'tabindex': 0,
371 - 'aria-label': 'Close',
372 - href: '#',
373 - },
344 + attributes: {},
374 345 iconElement: '<i>',
375 346 },
376 347 position: {
377 348 element: 'widget',
@@ -377,9 +348,9 @@
377 348 element: 'widget',
378 349 my: 'center',
379 350 at: 'center',
380 351 enable: true,
381 - autoRefresh: false,
352 + autoRefresh: false
382 353 },
383 354 hide: {
384 355 auto: false,
385 356 autoDelay: 5000,
@@ -387,10 +358,10 @@
387 358 onOutsideClick: true,
388 359 onOutsideContextMenu: false,
389 360 onBackgroundClick: true,
390 361 onEscKeyPress: true,
391 - ignore: '',
392 - },
362 + ignore: ''
363 + }
393 364 };
394 365
395 366 $.extend(true, settings, self.getDefaultSettings(), userSettings);
396 367
@@ -482,15 +453,9 @@
482 453 return $newElement;
483 454 };
484 455
485 456 this.destroy = function() {
486 - const widgetId = self.getElements('widget')?.attr('id'),
487 - index = self.parent.openDialogs.lastIndexOf(widgetId);
488 457
489 - if (index !== -1) {
490 - self.parent.openDialogs.splice(index, 1);
491 - }
492 -
493 458 unbindEvents();
494 459
495 460 elements.widget.remove();
496 461
@@ -520,18 +485,8 @@
520 485 if (! self.isVisible()) {
521 486 return;
522 487 }
523 488
524 - const widgetId = self.getElements('widget')?.attr('id'),
525 - openDialogs = self.parent.openDialogs,
526 - topDialogId = openDialogs[openDialogs.length - 1];
527 -
528 - if (topDialogId !== widgetId) {
529 - return;
530 - }
531 -
532 - openDialogs.pop();
533 -
534 489 clearTimeout(hideTimeOut);
535 490
536 491 callEffect('hide', arguments);
537 492
@@ -551,10 +506,8 @@
551 506 if (!(parent instanceof DialogsManager.Instance)) {
552 507 throw 'The ' + self.widgetName + ' must to be initialized from an instance of DialogsManager.Instance';
553 508 }
554 509
555 - self.parent = parent;
556 -
557 510 ensureClosureMethods();
558 511
559 512 self.trigger('init', properties);
560 513
@@ -696,12 +649,8 @@
696 649 }
697 650
698 651 self.trigger('show');
699 652
700 - const widgetId = self.getElements('widget')?.attr('id');
701 -
702 - self.parent.openDialogs.push(widgetId);
703 -
704 653 return self;
705 654 };
706 655
707 656 this.trigger = function(eventName, params) {
@@ -750,10 +699,9 @@
750 699
751 700 var self = this;
752 701
753 702 if (self.getSettings('closeButton')) {
754 - self.getElements('closeButton').on('click', function(event) {
755 - event.preventDefault();
703 + self.getElements('closeButton').on('click', function() {
756 704 self.hide();
757 705 });
758 706 }
759 707 };
@@ -824,9 +772,9 @@
824 772 nextButtonIndex = 0;
825 773 }
826 774 }
827 775
828 - this.focusedButton = this.buttons[nextButtonIndex].trigger('focus');
776 + this.focusedButton = this.buttons[nextButtonIndex].focus();
829 777 }
830 778 },
831 779 addButton: function(options) {
832 780
@@ -847,9 +795,9 @@
847 795 if (settings.hide.onButtonClick) {
848 796 self.hide();
849 797 }
850 798
851 - if ('function' === typeof options.callback) {
799 + if ($.isFunction(options.callback)) {
852 800 options.callback.call(this, self);
853 801 }
854 802 };
855 803
@@ -920,9 +868,9 @@
920 868 this.focusedButton = this.buttons[0];
921 869 }
922 870
923 871 if (this.focusedButton) {
924 - this.focusedButton.trigger('focus');
872 + this.focusedButton.focus();
925 873 }
926 874 },
927 875 unbindHotKeys: function() {
928 876