| 1 |
(function(){ |
| 2 |
; |
| 3 |
(function($, window2, document2, undefined$1) { |
| 4 |
$(window2).on("elementor:init", function() { |
| 5 |
$(".elementor-editor-active").addClass("master-addons"); |
| 6 |
if (typeof elementorPro == "undefined") { |
| 7 |
elementor.hooks.addFilter("editor/style/styleText", function(css, context) { |
| 8 |
if (!context) { |
| 9 |
return; |
| 10 |
} |
| 11 |
var model = context.model, customCSS = model.get("settings").get("custom_css"); |
| 12 |
var selector = ".elementor-element.elementor-element-" + model.get("id"); |
| 13 |
if ("document" === model.get("elType")) { |
| 14 |
selector = elementor.config.document.settings.cssWrapperSelector; |
| 15 |
} |
| 16 |
if (customCSS) { |
| 17 |
css += customCSS.replace(/selector/g, selector); |
| 18 |
} |
| 19 |
return css; |
| 20 |
}); |
| 21 |
} |
| 22 |
var JltmaControlBaseDataView = elementor.modules.controls.BaseData; |
| 23 |
var JltmaControlVisualSelectItemView = JltmaControlBaseDataView.extend({ |
| 24 |
onReady: function() { |
| 25 |
this.ui.select.jltmaVisualSelect(); |
| 26 |
}, |
| 27 |
onBeforeDestroy: function() { |
| 28 |
this.ui.select.jltmaVisualSelect("destroy"); |
| 29 |
} |
| 30 |
}); |
| 31 |
elementor.addControlView("jltma-visual-select", JltmaControlVisualSelectItemView); |
| 32 |
function jltmaOnGlobalOpenEditorForTranistions(panel, model, view) { |
| 33 |
view.listenTo(model.get("settings"), "change", function(changedModel) { |
| 34 |
if ("" !== model.getSetting("ma_el_animation_name") && !view.$el.hasClass("jltma-animated")) { |
| 35 |
view.render(); |
| 36 |
view.$el.addClass("jltma-animated"); |
| 37 |
view.$el.addClass("jltma-animated-once"); |
| 38 |
} |
| 39 |
for (settingName in changedModel.changed) { |
| 40 |
if (changedModel.changed.hasOwnProperty(settingName)) { |
| 41 |
if (settingName !== "ma_el_animation_name" && -1 !== settingName.indexOf("ma_el_animation_")) { |
| 42 |
view.$el.removeClass(model.getSetting("ma_el_animation_name")); |
| 43 |
setTimeout(function() { |
| 44 |
view.$el.addClass(model.getSetting("ma_el_animation_name")); |
| 45 |
}, model.getSetting("ma_el_animation_delay") || 300); |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
}, view); |
| 50 |
} |
| 51 |
elementor.hooks.addAction("panel/open_editor/section", jltmaOnGlobalOpenEditorForTranistions); |
| 52 |
elementor.hooks.addAction("panel/open_editor/column", jltmaOnGlobalOpenEditorForTranistions); |
| 53 |
elementor.hooks.addAction("panel/open_editor/widget", jltmaOnGlobalOpenEditorForTranistions); |
| 54 |
var JLTMA_Choose_Text = elementor.modules.controls.Choose.extend({ |
| 55 |
applySavedValue: function applySavedValue() { |
| 56 |
var currentValue = this.getControlValue(); |
| 57 |
if (currentValue || _.isString(currentValue)) { |
| 58 |
this.ui.inputs.filter('[value="'.concat(currentValue, '"]')).prop("checked", true); |
| 59 |
} else { |
| 60 |
this.ui.inputs.filter(":checked").prop("checked", false); |
| 61 |
} |
| 62 |
} |
| 63 |
}); |
| 64 |
elementor.hooks.addAction("panel/open_editor/widget", JLTMA_Choose_Text); |
| 65 |
elementor.addControlView("jltma-choose-text", JLTMA_Choose_Text); |
| 66 |
var JLTMA_ControlQuery = elementor.modules.controls.Select2.extend({ |
| 67 |
cache: null, |
| 68 |
isTitlesReceived: false, |
| 69 |
getSelect2Placeholder: function getSelect2Placeholder() { |
| 70 |
return { |
| 71 |
id: "", |
| 72 |
text: "All" |
| 73 |
}; |
| 74 |
}, |
| 75 |
getSelect2DefaultOptions: function getSelect2DefaultOptions() { |
| 76 |
var self = this; |
| 77 |
return jQuery.extend(elementor.modules.controls.Select2.prototype.getSelect2DefaultOptions.apply(this, arguments), { |
| 78 |
ajax: { |
| 79 |
transport: function transport(params, success, failure) { |
| 80 |
var data = { |
| 81 |
q: params.data.q, |
| 82 |
query_type: self.model.get("query_type"), |
| 83 |
object_type: self.model.get("object_type") |
| 84 |
}; |
| 85 |
return elementorCommon.ajax.addRequest("jltma_query_control_filter_autocomplete", { |
| 86 |
data, |
| 87 |
success, |
| 88 |
error: failure |
| 89 |
}); |
| 90 |
}, |
| 91 |
data: function data(params) { |
| 92 |
return { |
| 93 |
q: params.term, |
| 94 |
page: params.page |
| 95 |
}; |
| 96 |
}, |
| 97 |
cache: true |
| 98 |
}, |
| 99 |
escapeMarkup: function escapeMarkup(markup) { |
| 100 |
return markup; |
| 101 |
}, |
| 102 |
minimumInputLength: 1 |
| 103 |
}); |
| 104 |
}, |
| 105 |
getValueTitles: function getValueTitles() { |
| 106 |
var self = this, ids = this.getControlValue(), queryType = this.model.get("query_type"); |
| 107 |
objectType = this.model.get("object_type"); |
| 108 |
if (!ids || !queryType) return; |
| 109 |
if (!_.isArray(ids)) { |
| 110 |
ids = [ids]; |
| 111 |
} |
| 112 |
elementorCommon.ajax.loadObjects({ |
| 113 |
action: "jltma_query_control_value_titles", |
| 114 |
ids, |
| 115 |
data: { |
| 116 |
query_type: queryType, |
| 117 |
object_type: objectType, |
| 118 |
unique_id: "" + self.cid + queryType |
| 119 |
}, |
| 120 |
success: function success(data) { |
| 121 |
self.isTitlesReceived = true; |
| 122 |
self.model.set("options", data); |
| 123 |
self.render(); |
| 124 |
}, |
| 125 |
before: function before() { |
| 126 |
self.addSpinner(); |
| 127 |
} |
| 128 |
}); |
| 129 |
}, |
| 130 |
addSpinner: function addSpinner() { |
| 131 |
this.ui.select.prop("disabled", true); |
| 132 |
this.$el.find(".elementor-control-title").after('<span class="elementor-control-spinner ee-control-spinner"> <i class="fa fa-spinner fa-spin"></i> </span>'); |
| 133 |
}, |
| 134 |
onReady: function onReady() { |
| 135 |
setTimeout(elementor.modules.controls.Select2.prototype.onReady.bind(this)); |
| 136 |
if (!this.isTitlesReceived) { |
| 137 |
this.getValueTitles(); |
| 138 |
} |
| 139 |
} |
| 140 |
}); |
| 141 |
elementor.addControlView("jltma_query", JLTMA_ControlQuery); |
| 142 |
function jltmaHandleProRestrictedSwitchers() { |
| 143 |
var processedControls = /* @__PURE__ */ new Set(); |
| 144 |
function disableProSwitchers() { |
| 145 |
jQuery(".elementor-control-type-switcher").each(function() { |
| 146 |
var $control = jQuery(this); |
| 147 |
var controlId = $control.attr("data-control-name") || $control.index(); |
| 148 |
if (processedControls.has(controlId)) { |
| 149 |
return; |
| 150 |
} |
| 151 |
var $description = $control.find(".elementor-control-field-description"); |
| 152 |
if ($description.find(".jltma-pro-disabled").length > 0) { |
| 153 |
var $switcherInput = $control.find('input[type="checkbox"]'); |
| 154 |
var $switcherLabel = $control.find(".elementor-switch"); |
| 155 |
$control.addClass("jltma-switcher-disabled"); |
| 156 |
$switcherLabel.addClass("jltma-switcher-disabled"); |
| 157 |
$switcherInput.prop("disabled", true); |
| 158 |
$switcherLabel.off("click.jltma-pro").on("click.jltma-pro", function(e) { |
| 159 |
e.preventDefault(); |
| 160 |
e.stopPropagation(); |
| 161 |
jQuery(".jltma-upgrade-popup").fadeIn(200); |
| 162 |
return false; |
| 163 |
}); |
| 164 |
$control.find("label").off("click.jltma-pro").on("click.jltma-pro", function(e) { |
| 165 |
if ($switcherLabel.hasClass("jltma-switcher-disabled")) { |
| 166 |
e.preventDefault(); |
| 167 |
e.stopPropagation(); |
| 168 |
jQuery(".jltma-upgrade-popup").fadeIn(200); |
| 169 |
return false; |
| 170 |
} |
| 171 |
}); |
| 172 |
processedControls.add(controlId); |
| 173 |
} |
| 174 |
}); |
| 175 |
} |
| 176 |
function setupObserver() { |
| 177 |
var targetNode = document2.querySelector("#elementor-panel-content-wrapper"); |
| 178 |
if (!targetNode) { |
| 179 |
setTimeout(setupObserver, 500); |
| 180 |
return; |
| 181 |
} |
| 182 |
var observer = new MutationObserver(function(mutations) { |
| 183 |
var shouldProcess = false; |
| 184 |
mutations.forEach(function(mutation) { |
| 185 |
if (mutation.addedNodes.length > 0) { |
| 186 |
shouldProcess = true; |
| 187 |
} |
| 188 |
}); |
| 189 |
if (shouldProcess) { |
| 190 |
disableProSwitchers(); |
| 191 |
} |
| 192 |
}); |
| 193 |
var config = { |
| 194 |
childList: true, |
| 195 |
// Watch for child additions/removals |
| 196 |
subtree: true, |
| 197 |
// Watch entire subtree |
| 198 |
attributes: false |
| 199 |
// Don't watch attribute changes |
| 200 |
}; |
| 201 |
observer.observe(targetNode, config); |
| 202 |
disableProSwitchers(); |
| 203 |
} |
| 204 |
function startIntervalCheck() { |
| 205 |
setInterval(function() { |
| 206 |
disableProSwitchers(); |
| 207 |
}, 1e3); |
| 208 |
} |
| 209 |
jQuery(window2).on("elementor:init", function() { |
| 210 |
setTimeout(function() { |
| 211 |
setupObserver(); |
| 212 |
startIntervalCheck(); |
| 213 |
}, 1e3); |
| 214 |
}); |
| 215 |
setTimeout(function() { |
| 216 |
setupObserver(); |
| 217 |
startIntervalCheck(); |
| 218 |
}, 2e3); |
| 219 |
} |
| 220 |
jltmaHandleProRestrictedSwitchers(); |
| 221 |
function jltmaProWidgetPromotionHandler() { |
| 222 |
if (typeof parent.document === "undefined") { |
| 223 |
return false; |
| 224 |
} |
| 225 |
parent.document.addEventListener("mousedown", function(e) { |
| 226 |
var widgets = parent.document.querySelectorAll(".elementor-element--promotion"); |
| 227 |
if (widgets.length > 0) { |
| 228 |
for (var i = 0; i < widgets.length; i++) { |
| 229 |
if (widgets[i].contains(e.target)) { |
| 230 |
var dialog = parent.document.querySelector("#elementor-element--promotion__dialog"); |
| 231 |
var icon = widgets[i].querySelector(".icon > i"); |
| 232 |
if (!dialog || !icon) { |
| 233 |
break; |
| 234 |
} |
| 235 |
var iconClass = icon.classList.toString(); |
| 236 |
if (iconClass.indexOf("jltma") >= 0) { |
| 237 |
var defaultButton = dialog.querySelector(".dialog-buttons-action"); |
| 238 |
if (defaultButton) { |
| 239 |
defaultButton.style.display = "none"; |
| 240 |
} |
| 241 |
e.stopImmediatePropagation(); |
| 242 |
if (dialog.querySelector(".jltma-dialog-buttons-action") === null) { |
| 243 |
var button = document2.createElement("a"); |
| 244 |
var buttonText = document2.createTextNode("Upgrade Master Addons"); |
| 245 |
button.setAttribute("href", "https://master-addons.com/pricing/"); |
| 246 |
button.setAttribute("target", "_blank"); |
| 247 |
button.classList.add( |
| 248 |
"dialog-button", |
| 249 |
"dialog-action", |
| 250 |
"dialog-buttons-action", |
| 251 |
"elementor-button", |
| 252 |
"go-pro", |
| 253 |
"elementor-button-success", |
| 254 |
"jltma-dialog-buttons-action" |
| 255 |
); |
| 256 |
button.style.display = "block"; |
| 257 |
button.style.textAlign = "center"; |
| 258 |
button.appendChild(buttonText); |
| 259 |
if (defaultButton) { |
| 260 |
defaultButton.insertAdjacentHTML("afterend", button.outerHTML); |
| 261 |
} |
| 262 |
} else { |
| 263 |
const btnWrapper = document2.querySelector(".dialog-buttons-buttons-wrapper > button"); |
| 264 |
btnWrapper.style.display = "none"; |
| 265 |
dialog.querySelector(".jltma-dialog-buttons-action").style.display = "block"; |
| 266 |
} |
| 267 |
} else { |
| 268 |
var defaultBtn = dialog.querySelector(".dialog-buttons-action:not(.jltma-dialog-buttons-action)"); |
| 269 |
if (defaultBtn) { |
| 270 |
defaultBtn.style.display = ""; |
| 271 |
} |
| 272 |
var jltmaBtn = dialog.querySelector(".jltma-dialog-buttons-action"); |
| 273 |
if (jltmaBtn !== null) { |
| 274 |
jltmaBtn.style.display = "none"; |
| 275 |
} |
| 276 |
} |
| 277 |
break; |
| 278 |
} |
| 279 |
} |
| 280 |
} |
| 281 |
}); |
| 282 |
} |
| 283 |
jltmaProWidgetPromotionHandler(); |
| 284 |
}); |
| 285 |
})(jQuery, window, document); |
| 286 |
})(); |
| 287 |
|