controls-handlers.js
6 months ago
editor-handler.js
6 months ago
live-editor.js
6 months ago
pa-editor-behavior.js
6 months ago
pa-editor-behavior.min.js
6 months ago
pa-maps-finder.js
6 months ago
premium-cross-cp.js
6 months ago
xdlocalstorage.js
6 months ago
pa-editor-behavior.js
114 lines
| 1 | (function ($) { |
| 2 | |
| 3 | 'use strict'; |
| 4 | |
| 5 | var PAWidgetsEditor = { |
| 6 | |
| 7 | init: function () { |
| 8 | |
| 9 | window.elementor.on('preview:loaded', function () { |
| 10 | |
| 11 | elementor.$preview[0].contentWindow.PAWidgetsEditor = PAWidgetsEditor; |
| 12 | |
| 13 | }); |
| 14 | |
| 15 | window.elementor.on('panel:init', function () { |
| 16 | |
| 17 | setTimeout(function () { |
| 18 | |
| 19 | PAWidgetsEditor.handleUnusedWidgetsDialog(); |
| 20 | |
| 21 | }, 10 * 1000); |
| 22 | |
| 23 | }); |
| 24 | |
| 25 | |
| 26 | |
| 27 | }, |
| 28 | |
| 29 | handleUnusedWidgetsDialog: function () { |
| 30 | |
| 31 | jQuery.ajax({ |
| 32 | type: "GET", |
| 33 | url: paEditorSettings.ajaxurl, |
| 34 | dataType: "JSON", |
| 35 | data: { |
| 36 | action: "pa_check_unused_widgets", |
| 37 | security: paEditorBehaviorSettings.nonce, |
| 38 | }, |
| 39 | success: function (res) { |
| 40 | |
| 41 | if (res.success) { |
| 42 | |
| 43 | var dialogsManager = new DialogsManager.Instance(); |
| 44 | |
| 45 | dialogsManager.createWidget( |
| 46 | 'confirm', |
| 47 | { |
| 48 | headerMessage: wp.i18n.__('Disable Premium Addons Unused Elements', 'premium-addons-for-elementor'), |
| 49 | message: wp.i18n.__('You have a couple of Premium Addons elements being unused for some time. Disable them for a faster editor loading speed.', 'premium-addons-for-elementor'), |
| 50 | strings: { |
| 51 | confirm: wp.i18n.__('Disable Unused Widgets', 'premium-addons-for-elementor'), |
| 52 | cancel: wp.i18n.__('Never show again', 'premium-addons-for-elementor'), |
| 53 | }, |
| 54 | onConfirm: function () { |
| 55 | window.open(paEditorBehaviorSettings['disable_unused_link'], '_blank') |
| 56 | }, |
| 57 | onHide: function () { |
| 58 | |
| 59 | jQuery.ajax({ |
| 60 | type: "GET", |
| 61 | url: paEditorSettings.ajaxurl, |
| 62 | dataType: "JSON", |
| 63 | data: { |
| 64 | action: "pa_hide_unused_widgets_dialog", |
| 65 | security: paEditorBehaviorSettings.nonce, |
| 66 | } |
| 67 | }); |
| 68 | |
| 69 | } |
| 70 | } |
| 71 | ).show(); |
| 72 | |
| 73 | } |
| 74 | |
| 75 | |
| 76 | }, |
| 77 | error: function (err) { |
| 78 | |
| 79 | console.log(err); |
| 80 | |
| 81 | } |
| 82 | }); |
| 83 | |
| 84 | |
| 85 | |
| 86 | }, |
| 87 | |
| 88 | activateControlsTab: function (tab, parentTab) { |
| 89 | |
| 90 | setTimeout(function () { |
| 91 | |
| 92 | if (parentTab) |
| 93 | $('.elementor-tab-control-' + parentTab).trigger('click'); |
| 94 | |
| 95 | var $tab = $("div.elementor-control-" + tab); |
| 96 | |
| 97 | if ($tab.length && !$tab.hasClass('e-open')) { |
| 98 | |
| 99 | $tab.trigger('click'); |
| 100 | } |
| 101 | |
| 102 | }, 150); |
| 103 | |
| 104 | } |
| 105 | |
| 106 | } |
| 107 | |
| 108 | $(window).on('elementor:init', PAWidgetsEditor.init); |
| 109 | |
| 110 | window.PAWidgetsEditor = PAWidgetsEditor; |
| 111 | |
| 112 | |
| 113 | })(jQuery); |
| 114 |