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

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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../js/editor/componen...
File: constructor.mjs
tfminicolors.parentNode.removeChild(tfminicolors);
[4000] Fix | Delete
that._controlChange(input, opacity, data);
[4001] Fix | Delete
}, {once: true, passive: true});
[4002] Fix | Delete
input.tfOn('focusin', () => {
[4003] Fix | Delete
swatch.click();
[4004] Fix | Delete
}, {once: true, passive: true});
[4005] Fix | Delete
opacity.tfOn('focusin', function () {
[4006] Fix | Delete
if (!input.dataset.tfminicolorsInitialized) {
[4007] Fix | Delete
input.dataset.opacity = this.value;
[4008] Fix | Delete
swatch.click();
[4009] Fix | Delete
} else {
[4010] Fix | Delete
$(input).tfminicolors('show');
[4011] Fix | Delete
}
[4012] Fix | Delete
}, {passive: true});
[4013] Fix | Delete
[4014] Fix | Delete
if (!v && data.default) {
[4015] Fix | Delete
v = data.default;
[4016] Fix | Delete
}
[4017] Fix | Delete
[4018] Fix | Delete
if (v !== undefined) {
[4019] Fix | Delete
this.setColor(input, span, opacity, v);
[4020] Fix | Delete
}
[4021] Fix | Delete
f.appendChild(wrapper);
[4022] Fix | Delete
if (data.after !== undefined) {
[4023] Fix | Delete
f.appendChild(self.after(data));
[4024] Fix | Delete
}
[4025] Fix | Delete
if (data.description !== undefined) {
[4026] Fix | Delete
f.appendChild(self.description(data.description));
[4027] Fix | Delete
}
[4028] Fix | Delete
if (data.tooltip !== undefined) {
[4029] Fix | Delete
f.appendChild(self.hint(data.tooltip));
[4030] Fix | Delete
}
[4031] Fix | Delete
if (data.label === undefined) {
[4032] Fix | Delete
data.label = 'c';
[4033] Fix | Delete
}
[4034] Fix | Delete
else if (data.label === false) {
[4035] Fix | Delete
delete data.label;
[4036] Fix | Delete
}
[4037] Fix | Delete
return f;
[4038] Fix | Delete
}
[4039] Fix | Delete
},
[4040] Fix | Delete
tooltip: {
[4041] Fix | Delete
render(data, self) {
[4042] Fix | Delete
const prefix = data.prefix || '_tooltip',
[4043] Fix | Delete
group = data.group ?? true;
[4044] Fix | Delete
let options = [
[4045] Fix | Delete
{
[4046] Fix | Delete
type: 'textarea',
[4047] Fix | Delete
label: 'tt',
[4048] Fix | Delete
id: prefix,
[4049] Fix | Delete
class: 'fullwidth',
[4050] Fix | Delete
control: false, /* disable live preview refresh */
[4051] Fix | Delete
binding : {
[4052] Fix | Delete
empty : { hide : [ prefix + '_bg', prefix + '_c', prefix + '_w' ] },
[4053] Fix | Delete
not_empty : { show : [ prefix + '_bg', prefix + '_c', prefix + '_w' ] }
[4054] Fix | Delete
}
[4055] Fix | Delete
},
[4056] Fix | Delete
{
[4057] Fix | Delete
type : 'multi',
[4058] Fix | Delete
label : '',
[4059] Fix | Delete
options: [
[4060] Fix | Delete
{
[4061] Fix | Delete
type: 'color',
[4062] Fix | Delete
label: 'bg_c',
[4063] Fix | Delete
id: prefix + '_bg',
[4064] Fix | Delete
control: false
[4065] Fix | Delete
},
[4066] Fix | Delete
{
[4067] Fix | Delete
type: 'color',
[4068] Fix | Delete
label: 'f_c',
[4069] Fix | Delete
id: prefix + '_c',
[4070] Fix | Delete
control: false
[4071] Fix | Delete
},
[4072] Fix | Delete
{
[4073] Fix | Delete
type: 'range',
[4074] Fix | Delete
label: 'ma_wd',
[4075] Fix | Delete
id: prefix + '_w',
[4076] Fix | Delete
control: false,
[4077] Fix | Delete
units: {
[4078] Fix | Delete
px: {
[4079] Fix | Delete
min: -2000,
[4080] Fix | Delete
max: 2000
[4081] Fix | Delete
},
[4082] Fix | Delete
em: {
[4083] Fix | Delete
min: -20,
[4084] Fix | Delete
max: 20
[4085] Fix | Delete
}
[4086] Fix | Delete
},
[4087] Fix | Delete
wrap_class : 'tb_disable_dc'
[4088] Fix | Delete
}
[4089] Fix | Delete
]
[4090] Fix | Delete
}
[4091] Fix | Delete
];
[4092] Fix | Delete
if ( group ) {
[4093] Fix | Delete
options = [ {
[4094] Fix | Delete
type: 'group',
[4095] Fix | Delete
label: 't',
[4096] Fix | Delete
display: 'accordion',
[4097] Fix | Delete
options: options
[4098] Fix | Delete
} ];
[4099] Fix | Delete
}
[4100] Fix | Delete
let f = self.create( options );
[4101] Fix | Delete
if (api.isVisual) {
[4102] Fix | Delete
f = this._bindEvents(f, data);
[4103] Fix | Delete
}
[4104] Fix | Delete
return f;
[4105] Fix | Delete
},
[4106] Fix | Delete
/* setup live preview events */
[4107] Fix | Delete
_bindEvents(el, data) {
[4108] Fix | Delete
const self = this,
[4109] Fix | Delete
prefix = data.prefix ? data.prefix : '_tooltip',
[4110] Fix | Delete
_tooltip = el.querySelector('#' + prefix),
[4111] Fix | Delete
color_fields = [el.querySelector('#' + prefix + '_bg'), el.querySelector('#' + prefix + '_c')],
[4112] Fix | Delete
events = ['focus', 'keyup', 'blur', 'change'],
[4113] Fix | Delete
tooltip_w = el.querySelector('#' + prefix + '_w');
[4114] Fix | Delete
[4115] Fix | Delete
tooltip_w.tfOn(events, e => {
[4116] Fix | Delete
self._addOrRemoveTooltip(e.type !== 'blur', data);
[4117] Fix | Delete
}, {passive: true});
[4118] Fix | Delete
[4119] Fix | Delete
events.pop();
[4120] Fix | Delete
[4121] Fix | Delete
_tooltip.tfOn(events, e => {
[4122] Fix | Delete
self._addOrRemoveTooltip(e.type !== 'blur', data);
[4123] Fix | Delete
}, {passive: true});
[4124] Fix | Delete
[4125] Fix | Delete
for (let i = color_fields.length - 1; i > -1; --i) {
[4126] Fix | Delete
color_fields[i].tfOn('themify_builder_color_picker_show', function () {
[4127] Fix | Delete
self._addOrRemoveTooltip(true, data);
[4128] Fix | Delete
this.tfOn('themify_builder_color_picker_hide', () => {
[4129] Fix | Delete
self._addOrRemoveTooltip(false, data);
[4130] Fix | Delete
}, {once: true, passive: true});
[4131] Fix | Delete
}, {passive: true})
[4132] Fix | Delete
.tfOn('themify_builder_color_picker_change', () => {
[4133] Fix | Delete
self._addOrRemoveTooltip(true, data);
[4134] Fix | Delete
}, {passive: true});
[4135] Fix | Delete
}
[4136] Fix | Delete
return el;
[4137] Fix | Delete
},
[4138] Fix | Delete
/* creates tooltip preview element */
[4139] Fix | Delete
_addOrRemoveTooltip(show, data) {
[4140] Fix | Delete
let el = api.liveStylingInstance.el,
[4141] Fix | Delete
tooltip;
[4142] Fix | Delete
if ( data.scope ) {
[4143] Fix | Delete
/* change element to display the tooltip inside */
[4144] Fix | Delete
el = el.querySelector( data.scope );
[4145] Fix | Delete
}
[4146] Fix | Delete
tooltip = el.querySelector( ':scope > .tf_tooltip' );
[4147] Fix | Delete
if (!show && tooltip) {
[4148] Fix | Delete
tooltip.remove();
[4149] Fix | Delete
return;
[4150] Fix | Delete
}
[4151] Fix | Delete
[4152] Fix | Delete
Themify.loadCss('tooltip');
[4153] Fix | Delete
[4154] Fix | Delete
const self = ThemifyConstructor,
[4155] Fix | Delete
prefix = data.prefix || '_tooltip',
[4156] Fix | Delete
val = self.getEl(prefix).value; /* Tooltip Text field */
[4157] Fix | Delete
[4158] Fix | Delete
if (val !== '') {
[4159] Fix | Delete
if (!tooltip) {
[4160] Fix | Delete
tooltip = createElement('','tf_tooltip');
[4161] Fix | Delete
el.appendChild(tooltip);
[4162] Fix | Delete
}
[4163] Fix | Delete
let width = self.getEl( prefix + '_w' ).value;
[4164] Fix | Delete
tooltip.classList.add('tf_abs_c');
[4165] Fix | Delete
tooltip.innerHTML = val;
[4166] Fix | Delete
tooltip.style.background = api.Helper.getColor( self.getEl( prefix + '_bg' ) );
[4167] Fix | Delete
tooltip.style.color = api.Helper.getColor( self.getEl( prefix + '_c' ) );
[4168] Fix | Delete
if (width !== '') {
[4169] Fix | Delete
width += self.getEl( prefix + '_w_unit' ).value;
[4170] Fix | Delete
}
[4171] Fix | Delete
tooltip.style.width = width;
[4172] Fix | Delete
tooltip.classList.remove('tf_hide');
[4173] Fix | Delete
}
[4174] Fix | Delete
else {
[4175] Fix | Delete
tooltip?.remove();
[4176] Fix | Delete
}
[4177] Fix | Delete
}
[4178] Fix | Delete
},
[4179] Fix | Delete
text: {
[4180] Fix | Delete
update(id, v, self) {
[4181] Fix | Delete
const item = self.getEl(id);
[4182] Fix | Delete
if (item !== null) {
[4183] Fix | Delete
item.value = v?? '';
[4184] Fix | Delete
}
[4185] Fix | Delete
},
[4186] Fix | Delete
render(data, self) {
[4187] Fix | Delete
const f = createDocumentFragment(),
[4188] Fix | Delete
input = createElement('input'),
[4189] Fix | Delete
v = self.getStyleVal(data.id) ?? data.default;
[4190] Fix | Delete
input.type = data.input_type || 'text'; // custom input types
[4191] Fix | Delete
if (self.is_repeat === true) {
[4192] Fix | Delete
input.className = self.is_sort === true ? 'tb_lb_sort_child' : 'tb_lb_option_child';
[4193] Fix | Delete
input.dataset.inputId = data.id;
[4194] Fix | Delete
} else {
[4195] Fix | Delete
input.className = 'tb_lb_option';
[4196] Fix | Delete
input.id = data.id;
[4197] Fix | Delete
}
[4198] Fix | Delete
if (data.placeholder !== undefined) {
[4199] Fix | Delete
input.placeholder = data.placeholder;
[4200] Fix | Delete
}
[4201] Fix | Delete
if (data.custom_args !== undefined) {
[4202] Fix | Delete
for (let i in data.custom_args) {
[4203] Fix | Delete
input.setAttribute(i, data.custom_args[i]);
[4204] Fix | Delete
}
[4205] Fix | Delete
}
[4206] Fix | Delete
if (v !== undefined) {
[4207] Fix | Delete
input.value = v;
[4208] Fix | Delete
}
[4209] Fix | Delete
if (data.class !== undefined) {
[4210] Fix | Delete
input.className += ' ' + data.class;
[4211] Fix | Delete
}
[4212] Fix | Delete
f.appendChild(self._initControl(input, data));
[4213] Fix | Delete
if (data.unit !== undefined) {
[4214] Fix | Delete
f.appendChild(self.select.render(data.unit, self));
[4215] Fix | Delete
}
[4216] Fix | Delete
if (data.after !== undefined) {
[4217] Fix | Delete
f.appendChild(self.after(data));
[4218] Fix | Delete
}
[4219] Fix | Delete
if (data.description !== undefined) {
[4220] Fix | Delete
f.appendChild(self.description(data.description));
[4221] Fix | Delete
}
[4222] Fix | Delete
if (data.tooltip !== undefined) {
[4223] Fix | Delete
f.appendChild(self.hint(data.tooltip));
[4224] Fix | Delete
}
[4225] Fix | Delete
return f;
[4226] Fix | Delete
}
[4227] Fix | Delete
},
[4228] Fix | Delete
number: {
[4229] Fix | Delete
render(data, self) {
[4230] Fix | Delete
data.input_type = 'number';
[4231] Fix | Delete
if (data.custom_args === undefined) {
[4232] Fix | Delete
data.custom_args = {min: data.min || 0};
[4233] Fix | Delete
if (data.max !== undefined) {
[4234] Fix | Delete
data.custom_args.max = data.max;
[4235] Fix | Delete
}
[4236] Fix | Delete
if (data.step !== undefined) {
[4237] Fix | Delete
data.custom_args.step = data.step;
[4238] Fix | Delete
}
[4239] Fix | Delete
}
[4240] Fix | Delete
return self.text.render(data, self);
[4241] Fix | Delete
}
[4242] Fix | Delete
},
[4243] Fix | Delete
angle: {
[4244] Fix | Delete
update(id, v, self) {
[4245] Fix | Delete
self.range.update(id, v, self);
[4246] Fix | Delete
},
[4247] Fix | Delete
render(data, self) {
[4248] Fix | Delete
data.input_type = 'number';
[4249] Fix | Delete
data.custom_args = {min: 0, max: 360};
[4250] Fix | Delete
const wrap = createElement('',{class:'tb_angle_container tf_rel',tabindex:-1}),
[4251] Fix | Delete
css_class = 'tb_lb_option tb_angle_input';
[4252] Fix | Delete
data.class = data.class !== undefined ? data.class + ' ' + css_class : css_class;
[4253] Fix | Delete
wrap.appendChild(self.range.render(data, self));
[4254] Fix | Delete
const angle = wrap.querySelector('#' + data.id),
[4255] Fix | Delete
event = data.event|| (self.clicked === 'styling' ? 'keyup' : 'change');
[4256] Fix | Delete
angle.tfOn('pointerdown', function (e) {
[4257] Fix | Delete
e.stopImmediatePropagation();
[4258] Fix | Delete
let _circle = this.parentNode.tfClass('tb_angle_circle')[0];
[4259] Fix | Delete
if (!_circle) {
[4260] Fix | Delete
let v = this.value;
[4261] Fix | Delete
const tmp1 = createElement('','tb_angle_dot'),
[4262] Fix | Delete
tmp2 = createElement('','tb_angle_circle_wrapper');
[4263] Fix | Delete
_circle = createElement('','tb_angle_circle');
[4264] Fix | Delete
if (v !== '') {
[4265] Fix | Delete
tmp1.style.transform = 'rotate(' + v + 'deg)';
[4266] Fix | Delete
}
[4267] Fix | Delete
_circle.appendChild(tmp1);
[4268] Fix | Delete
tmp2.appendChild(_circle);
[4269] Fix | Delete
this.parentNode.appendChild(tmp2);
[4270] Fix | Delete
}
[4271] Fix | Delete
_circle.tfOn(e.type, function (e) {
[4272] Fix | Delete
if (e.button === 0) {
[4273] Fix | Delete
let box = this.getBoundingClientRect(),
[4274] Fix | Delete
center_x = (this.offsetWidth / 2) + box.left,
[4275] Fix | Delete
center_y = (this.offsetHeight / 2) + box.top,
[4276] Fix | Delete
timer,
[4277] Fix | Delete
_dot = this.parentNode.tfClass('tb_angle_dot')[0];
[4278] Fix | Delete
const PI = 180 / Math.PI,
[4279] Fix | Delete
_start = e => {
[4280] Fix | Delete
e.stopImmediatePropagation();
[4281] Fix | Delete
topBodyCl.add('tb_start_animate');
[4282] Fix | Delete
},
[4283] Fix | Delete
_move = e => {
[4284] Fix | Delete
e.stopImmediatePropagation();
[4285] Fix | Delete
timer = requestAnimationFrame(() => {
[4286] Fix | Delete
let delta_y = center_y - e.clientY,
[4287] Fix | Delete
delta_x = center_x - e.clientX,
[4288] Fix | Delete
ang = Math.atan2(delta_y, delta_x) * PI; // Calculate Angle between circle center and mouse pos
[4289] Fix | Delete
ang -= 90;
[4290] Fix | Delete
if (ang < 0) {
[4291] Fix | Delete
ang += 360; // Always show angle positive
[4292] Fix | Delete
}
[4293] Fix | Delete
ang = Math.round(ang);
[4294] Fix | Delete
_dot.style.transform = 'rotate(' + ang + 'deg)';
[4295] Fix | Delete
angle.value = ang;
[4296] Fix | Delete
Themify.triggerEvent(angle, event);
[4297] Fix | Delete
});
[4298] Fix | Delete
},
[4299] Fix | Delete
_up = function () {
[4300] Fix | Delete
cancelAnimationFrame(timer);
[4301] Fix | Delete
this.tfOff('pointermove', _start, {passive: true, once: true})
[4302] Fix | Delete
.tfOff('pointermove', _move, {passive: true})
[4303] Fix | Delete
.tfOff('lostpointercapture pointerup', _up, {passive: true, once: true});
[4304] Fix | Delete
topBodyCl.remove('tb_start_animate');
[4305] Fix | Delete
requestAnimationFrame(() => {
[4306] Fix | Delete
_dot = center_x = timer = center_y = null;
[4307] Fix | Delete
});
[4308] Fix | Delete
};
[4309] Fix | Delete
[4310] Fix | Delete
this.tfOn('lostpointercapture pointerup', _up, {passive: true, once: true})
[4311] Fix | Delete
.tfOn('pointermove', _start, {passive: true, once: true})
[4312] Fix | Delete
.tfOn('pointermove', _move, {passive: true})
[4313] Fix | Delete
.setPointerCapture(e.pointerId);
[4314] Fix | Delete
_move(e);
[4315] Fix | Delete
}
[4316] Fix | Delete
[4317] Fix | Delete
}, {passive: true});
[4318] Fix | Delete
[4319] Fix | Delete
}, {passive: true, once: true});
[4320] Fix | Delete
return wrap;
[4321] Fix | Delete
}
[4322] Fix | Delete
},
[4323] Fix | Delete
autocomplete: {
[4324] Fix | Delete
_cache: new Map,
[4325] Fix | Delete
render(data, self) {
[4326] Fix | Delete
const d = self.text.render(data, self);
[4327] Fix | Delete
if (data.dataset === undefined) {
[4328] Fix | Delete
return d;
[4329] Fix | Delete
}
[4330] Fix | Delete
let controller = null;
[4331] Fix | Delete
const _this = this,
[4332] Fix | Delete
input = d.querySelector('input',{autocomplete:'off'}),
[4333] Fix | Delete
container = createElement('','tb_autocomplete_container');
[4334] Fix | Delete
d.appendChild(container);
[4335] Fix | Delete
input.tfOn('input', async function () {
[4336] Fix | Delete
// remove all elements in container
[4337] Fix | Delete
const wrapper = this.nextElementSibling,
[4338] Fix | Delete
value = this.value,
[4339] Fix | Delete
type = data.dataset,
[4340] Fix | Delete
k = type + value;
[4341] Fix | Delete
wrapper.replaceChildren();
[4342] Fix | Delete
if (value !== '') {
[4343] Fix | Delete
controller?.abort();
[4344] Fix | Delete
let resp = _this._cache.get(k);
[4345] Fix | Delete
if (!resp) {
[4346] Fix | Delete
const parent = this.parentNode;
[4347] Fix | Delete
try {
[4348] Fix | Delete
controller = new AbortController();
[4349] Fix | Delete
parent.classList.add('tb_autocomplete_loading', 'tf_loader');
[4350] Fix | Delete
resp = await api.LocalFetch({action: 'tb_get_ajax_data', mode: 'autocomplete', dataset: type, value: value}, false, {signal: controller.signal});
[4351] Fix | Delete
resp = resp.success ? resp.data : '';
[4352] Fix | Delete
_this._cache.set(k, resp);
[4353] Fix | Delete
} catch (e) {
[4354] Fix | Delete
[4355] Fix | Delete
}
[4356] Fix | Delete
parent.classList.remove('tb_autocomplete_loading', 'tf_loader');
[4357] Fix | Delete
}
[4358] Fix | Delete
if (resp) {
[4359] Fix | Delete
const d = createDocumentFragment();
[4360] Fix | Delete
for (let i in resp) {
[4361] Fix | Delete
d.appendChild(createElement('',{class:'tb_autocomplete_item','data-value':i},resp[i]));
[4362] Fix | Delete
}
[4363] Fix | Delete
wrapper.classList.add('tf_scrollbar');
[4364] Fix | Delete
wrapper.appendChild(d);
[4365] Fix | Delete
}
[4366] Fix | Delete
controller = null;
[4367] Fix | Delete
}
[4368] Fix | Delete
}, {passive: true});
[4369] Fix | Delete
container.tfOn('pointerdown', function (e) {
[4370] Fix | Delete
if (e.button === 0 && e.target.classList.contains('tb_autocomplete_item')) {
[4371] Fix | Delete
e.preventDefault();
[4372] Fix | Delete
e.stopPropagation();
[4373] Fix | Delete
const field = this.previousElementSibling;
[4374] Fix | Delete
field.value = e.target.dataset.value;
[4375] Fix | Delete
field.blur();
[4376] Fix | Delete
Themify.triggerEvent(field, 'change');
[4377] Fix | Delete
}
[4378] Fix | Delete
});
[4379] Fix | Delete
return d;
[4380] Fix | Delete
}
[4381] Fix | Delete
},
[4382] Fix | Delete
mediaFile: {
[4383] Fix | Delete
_frames: {},
[4384] Fix | Delete
browse(uploader, input, self, type) {
[4385] Fix | Delete
uploader.tfOn(_CLICK_, e => {
[4386] Fix | Delete
e.preventDefault();
[4387] Fix | Delete
e.stopPropagation();
[4388] Fix | Delete
let file_frame;
[4389] Fix | Delete
if (this._frames[type] !== undefined) {
[4390] Fix | Delete
file_frame = this._frames[type];
[4391] Fix | Delete
} else {
[4392] Fix | Delete
file_frame = wp.media.frames.file_frame = wp.media({
[4393] Fix | Delete
title: input.dataset.title || i18n['upload_' + type] || i18n.upload_image,
[4394] Fix | Delete
library: {
[4395] Fix | Delete
type: type === 'json' ? 'text/plain,application/json' : type
[4396] Fix | Delete
},
[4397] Fix | Delete
button: {
[4398] Fix | Delete
text: i18n.insert_image
[4399] Fix | Delete
},
[4400] Fix | Delete
multiple: false
[4401] Fix | Delete
});
[4402] Fix | Delete
this._frames[type] = file_frame;
[4403] Fix | Delete
}
[4404] Fix | Delete
file_frame.off('select').on('select', () => {
[4405] Fix | Delete
api.ActionBar.disable = true;
[4406] Fix | Delete
const attachment = file_frame.state().get('selection').first().toJSON();
[4407] Fix | Delete
input.value = attachment.url;
[4408] Fix | Delete
Themify.triggerEvent(input, 'change');
[4409] Fix | Delete
$(input).trigger('change');
[4410] Fix | Delete
const attach_id = input.getRootNode().querySelector('#' + input.id + '_id');
[4411] Fix | Delete
if (attach_id) {
[4412] Fix | Delete
attach_id.value = attachment.id;
[4413] Fix | Delete
}
[4414] Fix | Delete
});
[4415] Fix | Delete
file_frame.on('close', () => {
[4416] Fix | Delete
api.ActionBar.disable = true;
[4417] Fix | Delete
setTimeout(() => {
[4418] Fix | Delete
api.ActionBar.disable = null;
[4419] Fix | Delete
}, 5);
[4420] Fix | Delete
});
[4421] Fix | Delete
// Finally, open the modal
[4422] Fix | Delete
file_frame.open();
[4423] Fix | Delete
file_frame.content.mode('browse');
[4424] Fix | Delete
});
[4425] Fix | Delete
if (type === 'image') {
[4426] Fix | Delete
input.tfOn('change', e => {
[4427] Fix | Delete
this.setImage(uploader, e.currentTarget.value.trim());
[4428] Fix | Delete
}, {passive: true});
[4429] Fix | Delete
}
[4430] Fix | Delete
},
[4431] Fix | Delete
setImage(prev, url) {
[4432] Fix | Delete
prev.replaceChildren();
[4433] Fix | Delete
if (url) {
[4434] Fix | Delete
const w = 40,
[4435] Fix | Delete
h = 40,
[4436] Fix | Delete
img = new Image(w, h),
[4437] Fix | Delete
placeholder = new Image(w, h);
[4438] Fix | Delete
placeholder.decoding = 'async';
[4439] Fix | Delete
placeholder.src = 'https://placehold.co/' + w + 'x' + h + '.png';
[4440] Fix | Delete
img.src = url;
[4441] Fix | Delete
img.decoding = 'async';
[4442] Fix | Delete
img.decode()
[4443] Fix | Delete
.catch(() => {
[4444] Fix | Delete
})
[4445] Fix | Delete
.finally(() => {
[4446] Fix | Delete
placeholder.replaceWith(img);
[4447] Fix | Delete
});
[4448] Fix | Delete
prev.appendChild(placeholder);
[4449] Fix | Delete
}
[4450] Fix | Delete
},
[4451] Fix | Delete
update(id, v='', self) {
[4452] Fix | Delete
const item = self.getEl(id);
[4453] Fix | Delete
if (item !== null) {
[4454] Fix | Delete
item.value = v;
[4455] Fix | Delete
this.setImage(item.parentNode.tfClass('thumb_preview')[0], v);
[4456] Fix | Delete
}
[4457] Fix | Delete
},
[4458] Fix | Delete
render(type, data, self) {
[4459] Fix | Delete
const wr = createElement('','tb_uploader_wrapper tf_rel'),
[4460] Fix | Delete
input = createElement('input',{class:'tb_uploader_input',type:'text',required:'required',pattern: /.*\S.*/.source,autocomplete:'off'}),
[4461] Fix | Delete
upload_btn = createElement('a',{class:'tb_media_uploader tb_upload_btn thumb_preview tf_plus_icon tf_rel',href:'#',title:i18n.browse_image,'data-library-type':type === 'json' ? 'text/plain,application/json' : type}),
[4462] Fix | Delete
btn_delete =createElement('span','tb_clear_input tf_close'),
[4463] Fix | Delete
v = self.getStyleVal(data.id);
[4464] Fix | Delete
let id;
[4465] Fix | Delete
if (data.title) {
[4466] Fix | Delete
input.dataset.title = data.title;
[4467] Fix | Delete
}
[4468] Fix | Delete
if (self.is_repeat === true) {
[4469] Fix | Delete
input.className += self.is_sort === true ? ' tb_lb_sort_child' : ' tb_lb_option_child';
[4470] Fix | Delete
id = 'tb_' + Math.random().toString(36).substr(2, 7);
[4471] Fix | Delete
input.dataset.inputId = data.id;
[4472] Fix | Delete
} else {
[4473] Fix | Delete
input.className += ' tb_lb_option';
[4474] Fix | Delete
id = data.id;
[4475] Fix | Delete
}
[4476] Fix | Delete
input.id = id;
[4477] Fix | Delete
[4478] Fix | Delete
if (v !== undefined) {
[4479] Fix | Delete
input.value = v;
[4480] Fix | Delete
}
[4481] Fix | Delete
[4482] Fix | Delete
btn_delete.tfOn(_CLICK_, e => {
[4483] Fix | Delete
e.stopPropagation();
[4484] Fix | Delete
input.value = '';
[4485] Fix | Delete
Themify.triggerEvent(input, 'change');
[4486] Fix | Delete
}, {passive: true});
[4487] Fix | Delete
wr.append(self._initControl(input, data), btn_delete, upload_btn);
[4488] Fix | Delete
if (type === 'image') {
[4489] Fix | Delete
this.setImage(upload_btn, v);
[4490] Fix | Delete
}
[4491] Fix | Delete
this.browse(upload_btn, input, self, type);
[4492] Fix | Delete
if (data.after !== undefined) {
[4493] Fix | Delete
wr.appendChild(self.after(data));
[4494] Fix | Delete
}
[4495] Fix | Delete
if (data.description !== undefined) {
[4496] Fix | Delete
wr.appendChild(self.description(data.description));
[4497] Fix | Delete
}
[4498] Fix | Delete
if (data.tooltip !== undefined) {
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function