Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/popup-bu.../public/js
File: Modals.js
function SGPBModals() {
[0] Fix | Delete
}
[1] Fix | Delete
[2] Fix | Delete
SGPBModals.prototype.changeModalContent = function (modal, newContent, targetId)
[3] Fix | Delete
{
[4] Fix | Delete
this.moveContentBeforeModalDestroy(targetId, modal);
[5] Fix | Delete
const header = newContent.find(`#${targetId}Header`),
[6] Fix | Delete
body = newContent.find(`#${targetId}Body`),
[7] Fix | Delete
footer = newContent.find(`#${targetId}Footer`);
[8] Fix | Delete
modal.find('.sgpb-modal-header').text(header.text());
[9] Fix | Delete
modal.find('.sgpb-modal-body').html(body.children());
[10] Fix | Delete
modal.find('#sgpb-modal-footer-action-btn').html(footer.children());
[11] Fix | Delete
modal.data('target', newContent.attr('id'));
[12] Fix | Delete
modal.find('select').sgpbselect2();
[13] Fix | Delete
};
[14] Fix | Delete
[15] Fix | Delete
/* TODO fix and remove this function */
[16] Fix | Delete
SGPBModals.prototype.modalInit = function ()
[17] Fix | Delete
{
[18] Fix | Delete
const that = this;
[19] Fix | Delete
[20] Fix | Delete
jQuery('.sgpb-modal-btn').on('click', function () {
[21] Fix | Delete
const targetId = jQuery(this).data('target'),
[22] Fix | Delete
target = jQuery('#' + targetId),
[23] Fix | Delete
header = target.find(`#${targetId}Header`),
[24] Fix | Delete
body = target.find(`#${targetId}Body`),
[25] Fix | Delete
footer = target.find(`#${targetId}Footer`);
[26] Fix | Delete
const content = that.modalContent(targetId, header.text(), body.children(), footer.children());
[27] Fix | Delete
jQuery(content).appendTo(document.body);
[28] Fix | Delete
that.actionsCloseModal();
[29] Fix | Delete
})
[30] Fix | Delete
};
[31] Fix | Delete
SGPBModals.prototype.actionsCloseModal = function (closeOnBackDropClick = false, handleCloseEvent = undefined, handleEventArguments = null)
[32] Fix | Delete
{
[33] Fix | Delete
const that = this;
[34] Fix | Delete
jQuery('.sgpb-close-icon, .sgpb-modal-cancel').on('click', function () {
[35] Fix | Delete
if (typeof handleCloseEvent != 'undefined') {
[36] Fix | Delete
handleCloseEvent(handleEventArguments)
[37] Fix | Delete
}
[38] Fix | Delete
that.moveContentBeforeModalDestroy(jQuery('.sgpb-modal').data('target'), jQuery('.sgpb-modal'));
[39] Fix | Delete
that.destroyModal('cancel');
[40] Fix | Delete
});
[41] Fix | Delete
/* handle backdrop click and close */
[42] Fix | Delete
if (closeOnBackDropClick){
[43] Fix | Delete
jQuery('.sgpb.sgpb-modal').on('click', function (e) {
[44] Fix | Delete
if(e.target !== this) return;
[45] Fix | Delete
if (typeof handleCloseEvent != 'undefined') {
[46] Fix | Delete
handleCloseEvent(handleEventArguments)
[47] Fix | Delete
}
[48] Fix | Delete
that.moveContentBeforeModalDestroy(jQuery('.sgpb-modal').data('target'), jQuery('.sgpb-modal'));
[49] Fix | Delete
that.destroyModal('cancel');
[50] Fix | Delete
});
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
jQuery(document).keyup(function (e) {
[54] Fix | Delete
if (e.keyCode === 27) {
[55] Fix | Delete
if (jQuery('.sgpb-modal')) {
[56] Fix | Delete
if (typeof handleCloseEvent != 'undefined') {
[57] Fix | Delete
handleCloseEvent(handleEventArguments)
[58] Fix | Delete
}
[59] Fix | Delete
that.moveContentBeforeModalDestroy(jQuery('.sgpb-modal').data('target'), jQuery('.sgpb-modal'));
[60] Fix | Delete
that.destroyModal('cancel');
[61] Fix | Delete
}
[62] Fix | Delete
}
[63] Fix | Delete
});
[64] Fix | Delete
[65] Fix | Delete
};
[66] Fix | Delete
[67] Fix | Delete
SGPBModals.prototype.openModal = function (content)
[68] Fix | Delete
{
[69] Fix | Delete
jQuery(content).appendTo(document.body);
[70] Fix | Delete
};
[71] Fix | Delete
/* TODO add reason logic callback for full control modal destroy moment */
[72] Fix | Delete
SGPBModals.prototype.destroyModal = function (reason)
[73] Fix | Delete
{
[74] Fix | Delete
jQuery('.sgpb-modal').remove();
[75] Fix | Delete
jQuery(document.body).removeClass('sgpb-overflow-hidden');
[76] Fix | Delete
};
[77] Fix | Delete
SGPBModals.prototype.moveContentBeforeModalDestroy = function (id, modal)
[78] Fix | Delete
{
[79] Fix | Delete
let target = jQuery('#' + id),
[80] Fix | Delete
body = target.find(`#${id}Body`),
[81] Fix | Delete
footer = target.find(`#${id}Footer`);
[82] Fix | Delete
if (!target.length)
[83] Fix | Delete
return;
[84] Fix | Delete
if (!body.length) {
[85] Fix | Delete
target.append(modal.find('.sgpb-modal-body').children());
[86] Fix | Delete
} else {
[87] Fix | Delete
body.append(modal.find('.sgpb-modal-body').children());
[88] Fix | Delete
}
[89] Fix | Delete
if (footer.length)
[90] Fix | Delete
footer.append(modal.find('#sgpb-modal-footer-action-btn').children());
[91] Fix | Delete
};
[92] Fix | Delete
SGPBModals.prototype.modalContent = function (targetId, header = '', body = '', footerConfirmBtn = '', hideFooter = false, styles = '', hideCloseBtn = false)
[93] Fix | Delete
{
[94] Fix | Delete
jQuery(document.body).addClass('sgpb-overflow-hidden');
[95] Fix | Delete
return jQuery('<div/>', {
[96] Fix | Delete
"class": 'sgpb sgpb-modal',
[97] Fix | Delete
"style": styles,
[98] Fix | Delete
"data-target": targetId,
[99] Fix | Delete
html: jQuery('<div/>', {
[100] Fix | Delete
"class": 'sgpb-modal-main',
[101] Fix | Delete
html: [
[102] Fix | Delete
jQuery('<span/>', {
[103] Fix | Delete
"class": `sgpb-close-icon ${hideCloseBtn ? 'sgpb-display-none' : ''}`,
[104] Fix | Delete
}),
[105] Fix | Delete
jQuery('<h2/>', {
[106] Fix | Delete
"class": 'sgpb-modal-header',
[107] Fix | Delete
html: header
[108] Fix | Delete
}),
[109] Fix | Delete
jQuery('<div/>', {
[110] Fix | Delete
"class": 'sgpb-modal-body sgpb-width-100',
[111] Fix | Delete
html: body
[112] Fix | Delete
}),
[113] Fix | Delete
jQuery('<div/>', {
[114] Fix | Delete
"class": `sgpb-modal-footer ${hideFooter ? 'sgpb-display-none' : ''}`,
[115] Fix | Delete
html: [
[116] Fix | Delete
jQuery('<button/>', {
[117] Fix | Delete
"class": "sgpb-btn sgpb-btn-dark-outline sgpb-modal-cancel sgpb-margin-right-10",
[118] Fix | Delete
text: 'cancel'
[119] Fix | Delete
}),
[120] Fix | Delete
jQuery('<div/>', {
[121] Fix | Delete
id: 'sgpb-modal-footer-action-btn',
[122] Fix | Delete
"class": "sgpb-display-inline-block",
[123] Fix | Delete
html: footerConfirmBtn
[124] Fix | Delete
}),
[125] Fix | Delete
]
[126] Fix | Delete
})
[127] Fix | Delete
]
[128] Fix | Delete
})
[129] Fix | Delete
});
[130] Fix | Delete
};
[131] Fix | Delete
[132] Fix | Delete
/*this action is to pass already opened modal new content for each part of source code*/
[133] Fix | Delete
SGPBModals.prototype.changeModalContentAdvanced = function (modal, header = '', body = '', confirmBtn = '', oldTargetId, newTargetId)
[134] Fix | Delete
{
[135] Fix | Delete
if (!modal)
[136] Fix | Delete
return;
[137] Fix | Delete
this.moveContentBeforeModalDestroy(oldTargetId, modal);
[138] Fix | Delete
if (header) {
[139] Fix | Delete
modal.find('.sgpb-modal-header').text(header);
[140] Fix | Delete
}
[141] Fix | Delete
if (body) {
[142] Fix | Delete
modal.find('.sgpb-modal-body').html(body);
[143] Fix | Delete
}
[144] Fix | Delete
if (confirmBtn) {
[145] Fix | Delete
modal.find('#sgpb-modal-footer-action-btn').html(confirmBtn);
[146] Fix | Delete
}
[147] Fix | Delete
if (newTargetId) {
[148] Fix | Delete
modal.data('target', newTargetId);
[149] Fix | Delete
}
[150] Fix | Delete
};
[151] Fix | Delete
jQuery(document).ready(function () {
[152] Fix | Delete
sgpbModalsObj = new SGPBModals();
[153] Fix | Delete
});
[154] Fix | Delete
[155] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function