/**
* OptimizePress3 element type:
* property children type
*/
;(function($, window, document) {
"use strict";
/**
* CSS selector
*
* @type {String}
*/
var _selector = '[data-property-type="children"]';
/**
* Render option widget
*
* @param {Object} e
* @param {Object} o
* @return {Void}
*/
var _render = function(e, o) {
$(o.parent).find(_selector).each(function() {
var $list = $("
")
.attr("class", "op3-element-options-property-children-list")
.on("click", ".op3-element-options-property-children-list-item", _clickItem)
.on("click", ".op3-element-options-property-children-list-item-visible", _clickVisible)
.on("click", ".op3-element-options-property-children-list-item-clone", _clickClone)
.on("click", ".op3-element-options-property-children-list-item-remove", _clickRemove)
.insertAfter(this);
// make list items sortable
new Sortable($list.get(0), {
onUpdate: _sort,
});
// bind, hide and refresh
$(this)
.on("change", _change)
.css("display", "none");
_change.call(this);
});
}
/**
* Clean:
* destroy option widget
*
* @param {Object} e
* @param {Object} o
* @return {Void}
*/
var _clean = function(e, o) {
// pass
}
var _getChildren = function(element) {
return OP3.$(element)
.children()
.filter(function(index, child) {
return !(false
|| !/form|userprofile$/.test(element.type())
|| [ "dummy", "hidden", "gdpr1", "gdpr2" ].indexOf(OP3.$(child).spec()) !== -1
|| [ "input", "checkbox", "radiobutton", "textarea", "select", "fieldset" ].indexOf(OP3.$(child).type()) === -1
);
});
}
/**
* Widget input change event handler
*
* @param {Object} e
* @return {Void}
*/
var _change = function(e) {
var $list = $(this).nextAll(".op3-element-options-property-children-list:first")
.empty();
var element = OP3.Designer.activeElement();
if (!element)
return;
_getChildren(element).each(function() {
var child = OP3.$(this);
var $item = $("")
.attr("class", "op3-element-options-property-children-list-item")
.attr("data-op3-element-child-uuid", child.uuid())
.attr("data-op3-element-child-type", child.type())
.attr("data-op3-element-child-spec", child.spec())
.attr("data-op3-element-child-style", child.style())
.appendTo($list);
var visibleDisplay = child.getOption("visible", "all")
var visibleLock = child.getOption("visibleLock", "all");
$("")
.addClass("op3-element-options-property-children-list-item-desc")
.html("" + child.desc() + "
")
.appendTo($item);
$("")
.addClass("op3-element-options-property-children-list-item-visible")
.addClass("op3-element-options-property-children-list-item-visible-display-" + visibleDisplay)
.addClass("op3-element-options-property-children-list-item-visible-lock-" + visibleLock)
.attr("href", "#")
.html(''
+ ''
+ ''
+ ''
)
.appendTo($item);
$("")
.addClass("op3-element-options-property-children-list-item-clone")
.attr("href", "#")
.html('')
.appendTo($item);
$("")
.addClass("op3-element-options-property-children-list-item-remove")
.attr("href", "#")
.html('')
.appendTo($item);
});
$list.attr("data-count", length);
}
/**
* Widget sortable update event handler
*
* @param {Object} e
* @return {Void}
*/
var _sort = function(e) {
var element = OP3.$(OP3.Designer.activeElement());
var children = _getChildren(element);
var target = children.eq(e.oldIndex);
var index = e.newIndex;
var method = index > e.oldIndex ? "insertAfter" : "insertBefore";
target[method](children.eq(index));
}
/**
* Widget item click event handler
*
* @param {Object} e
* @return {Void}
*/
var _clickItem = function(e) {
var element = _getClickChild(e);
if (!element)
return;
element.focus();
}
/**
* Widget icon visible click event handler
*
* @param {Object} e
* @return {Void}
*/
var _clickVisible = function(e) {
var element = _getClickChild(e);
if (!element)
return;
element = OP3.$(element);
var value = element.getOption("display", "all");
var reverse = value === "none" ? OP3.Designer.getElementDefaultCssDisplay(element.type()) : "none";
element.setOption("display", reverse, "all");
// Refresh element fields
OP3.transmit("elementoptionsrefreshrequest", { property: [ "children" ] });
}
/**
* Widget icon clone click event handler
*
* @param {Object} e
* @return {Void}
*/
var _clickClone = function(e) {
var element = _getClickChild(e);
if (!element)
return;
element.clone().insertAfter(element);
}
/**
* Widget icon remove click event handler
*
* @param {Object} e
* @return {Void}
*/
var _clickRemove = function(e) {
var element = _getClickChild(e);
if (!element)
return;
element.detach();
}
/**
* Get op3 element from click event
*
* @param {Object} e
* @return {Void}
*/
var _getClickChild = function(e) {
e.preventDefault();
e.stopPropagation();
var $item = $(e.target).closest(".op3-element-options-property-children-list-item");
var uuid = $item.attr("data-op3-element-child-uuid");
var element = OP3.$(OP3.Designer.activeElement()).children("#" + uuid);
return element.length ? element : null;
}
// init
OP3.bind("elementoptionsrefresh", _render);
OP3.bind("elementoptionsclear elementoptionsformdetach", _clean);
})(jQuery, window, document);
1.0مؤسسه سجايا العرب التجاريهhttps://sjarb.net3dnan3delhttps://sjarb.net/author/3dnan3del/الرئيسيةrich600338<blockquote class="wp-embedded-content" data-secret="ipJN3fSxek"><a href="https://sjarb.net/">الرئيسية</a></blockquote><iframe sandbox="allow-scripts" security="restricted" src="https://sjarb.net/embed/#?secret=ipJN3fSxek" width="600" height="338" title="“الرئيسية” — مؤسسه سجايا العرب التجاريه" data-secret="ipJN3fSxek" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe><script type="text/javascript">
/* <![CDATA[ */
/*! This file is auto-generated */
!function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document);
/* ]]> */
</script>