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/modules
File: gallery.mjs
if(layout!=='lightboxed'){
[500] Fix | Delete
this.bindEvents(module,data);
[501] Fix | Delete
}
[502] Fix | Delete
api.Utils.runJs(this.el,'module');
[503] Fix | Delete
}
[504] Fix | Delete
});
[505] Fix | Delete
}
[506] Fix | Delete
return module;
[507] Fix | Delete
}
[508] Fix | Delete
getShortcodeValue(){
[509] Fix | Delete
let value=this.get('mod_settings').shortcode_gallery;
[510] Fix | Delete
if(api.activeModel?.id===this.id){
[511] Fix | Delete
const textarea=ThemifyConstructor.getEl('shortcode_gallery');
[512] Fix | Delete
if(textarea){
[513] Fix | Delete
value=textarea.value;
[514] Fix | Delete
}
[515] Fix | Delete
}
[516] Fix | Delete
return value;
[517] Fix | Delete
}
[518] Fix | Delete
setShortcodeValue(shortcode,trigger=true){
[519] Fix | Delete
if(api.activeModel?.id===this.id){
[520] Fix | Delete
ThemifyConstructor.settings.shortcode_gallery=shortcode;
[521] Fix | Delete
const textarea=ThemifyConstructor.getEl('shortcode_gallery');
[522] Fix | Delete
if(textarea){
[523] Fix | Delete
textarea.value=shortcode;
[524] Fix | Delete
if(trigger){
[525] Fix | Delete
Themify.triggerEvent(textarea,'change');
[526] Fix | Delete
return true;
[527] Fix | Delete
}
[528] Fix | Delete
}
[529] Fix | Delete
}
[530] Fix | Delete
else{
[531] Fix | Delete
api.undoManager.start('inline');
[532] Fix | Delete
this.get('mod_settings').shortcode_gallery=shortcode;
[533] Fix | Delete
api.undoManager.end('inline');
[534] Fix | Delete
}
[535] Fix | Delete
}
[536] Fix | Delete
bindEvents(el,data){
[537] Fix | Delete
el.tfOn(_CLICK_,async e=>{
[538] Fix | Delete
const target=e.target?.closest('.tb_add_gal_btn,.tb_del_gal');
[539] Fix | Delete
if(target){
[540] Fix | Delete
e.stopPropagation();
[541] Fix | Delete
if(target.classList.contains('tb_del_gal')){
[542] Fix | Delete
e.preventDefault();
[543] Fix | Delete
const itemId=target.dataset.id,
[544] Fix | Delete
galleryField=ThemifyConstructor.gallery,
[545] Fix | Delete
oldVal=this.getShortcodeValue(),
[546] Fix | Delete
shortcode = galleryField.parseIds(oldVal),
[547] Fix | Delete
index = shortcode?.indexOf(itemId) ?? -1;
[548] Fix | Delete
if(index!==-1){
[549] Fix | Delete
shortcode.splice(index,1);
[550] Fix | Delete
const layout=data.layout_gallery|| 'grid',
[551] Fix | Delete
trigger=layout==='slider' || (layout==='showcase' && index===0),
[552] Fix | Delete
val=shortcode.length > 0 ? galleryField.replaceShortcode(oldVal, shortcode.join(',')) : '';
[553] Fix | Delete
if(api.activeModel?.id===this.id){
[554] Fix | Delete
api.LightBox.el.querySelector('.tf_close[data-id="'+itemId+'"]')?.closest('.tb_gal_item')?.remove();
[555] Fix | Delete
}
[556] Fix | Delete
if(!this.setShortcodeValue(val,trigger)){
[557] Fix | Delete
if(!trigger){
[558] Fix | Delete
const galItem=target.closest('.gallery-item') || target.closest('.gallery-icon');
[559] Fix | Delete
galItem.remove();
[560] Fix | Delete
if(layout==='grid' && data.layout_masonry){
[561] Fix | Delete
api.Utils.runJs(this.el,'module');
[562] Fix | Delete
}
[563] Fix | Delete
}
[564] Fix | Delete
else {
[565] Fix | Delete
this.previewLive(this.get('mod_settings'));
[566] Fix | Delete
}
[567] Fix | Delete
}
[568] Fix | Delete
}
[569] Fix | Delete
}
[570] Fix | Delete
else{
[571] Fix | Delete
const btn=createElement(),
[572] Fix | Delete
input=createElement('input');
[573] Fix | Delete
input.tfOn('change',async e=>{
[574] Fix | Delete
const inp=e.currentTarget;
[575] Fix | Delete
if(!this.setShortcodeValue(inp.value)){
[576] Fix | Delete
const layout=data.layout_gallery|| 'grid';
[577] Fix | Delete
await this[layout].call(this,e.detail.images,data,true);
[578] Fix | Delete
api.Utils.runJs(this.el,'module');
[579] Fix | Delete
}
[580] Fix | Delete
inp.remove();
[581] Fix | Delete
btn.remove();
[582] Fix | Delete
},{passive:true,once:true})
[583] Fix | Delete
.value=this.getShortcodeValue() || '';
[584] Fix | Delete
ThemifyConstructor.gallery.init(btn,input);
[585] Fix | Delete
}
[586] Fix | Delete
}
[587] Fix | Delete
});
[588] Fix | Delete
}
[589] Fix | Delete
grid(images,data,addImages){
[590] Fix | Delete
const fr=createDocumentFragment(),
[591] Fix | Delete
frImages=createDocumentFragment(),
[592] Fix | Delete
grid=createElement(),
[593] Fix | Delete
gridSt=grid.style,
[594] Fix | Delete
showTitle=data.gallery_image_title==='yes',
[595] Fix | Delete
showCaption=data.gallery_exclude_caption!=='yes',
[596] Fix | Delete
pagination=data.gallery_pagination && data.gallery_per_page>0,
[597] Fix | Delete
{gallery_columns:desktopCols=3,t_columns:tabletCols,m_columns:mobileCols}=data,
[598] Fix | Delete
classes=['module-gallery-grid'],
[599] Fix | Delete
items=pagination?images.slice(0,data.gallery_per_page):images;
[600] Fix | Delete
[601] Fix | Delete
[602] Fix | Delete
for(let i=0;i<items.length;++i){
[603] Fix | Delete
let item=items[i],
[604] Fix | Delete
dl=createElement('dl','gallery-item'),
[605] Fix | Delete
dt=createElement('dt','gallery-icon tf_rel'),
[606] Fix | Delete
img=this.constructor.setEditableImage(createElement('img'),'','thumb_w_gallery','thumb_h_gallery',data),
[607] Fix | Delete
src=item.large?.[0] || item.full?.[0] || item.thumbnail,
[608] Fix | Delete
title=item.title || '',
[609] Fix | Delete
caption=item.caption || '';
[610] Fix | Delete
img.src=ThemifyImageResize.getCache(src,data.thumb_w_gallery,data.thumb_h_gallery,.8) || src;
[611] Fix | Delete
img.dataset.orig = src;
[612] Fix | Delete
if( data.link_opt!=='none'){
[613] Fix | Delete
let link=createElement('a',{href:'#',title:caption,'data-title':title,rel:item.id || ''});
[614] Fix | Delete
if(data.lightbox){
[615] Fix | Delete
link.className='themify_lightbox';
[616] Fix | Delete
}
[617] Fix | Delete
link.appendChild(img);
[618] Fix | Delete
dt.appendChild(link);
[619] Fix | Delete
}
[620] Fix | Delete
else{
[621] Fix | Delete
dl.className+=' tf_rel';
[622] Fix | Delete
dt.appendChild(img);
[623] Fix | Delete
}
[624] Fix | Delete
dt.appendChild(createElement('span',{class:'tb_del_btn tb_del_gal tf_close tb_disable_sorting',role:'button','data-id':item.id || '',title:'Delete Image'}));
[625] Fix | Delete
if((title!=='' && showTitle===true) || (caption!=='' && showCaption===true)){
[626] Fix | Delete
let dd=createElement('dd','wp-caption-text gallery-caption');
[627] Fix | Delete
if(title!=='' && showTitle===true){
[628] Fix | Delete
dd.appendChild(createElement('strong','themify_image_title tf_block',title));
[629] Fix | Delete
}
[630] Fix | Delete
if(caption!=='' && showCaption===true){
[631] Fix | Delete
dd.appendChild(createElement('span','themify_image_caption',caption));
[632] Fix | Delete
}
[633] Fix | Delete
dt.appendChild(dd);
[634] Fix | Delete
}
[635] Fix | Delete
dl.appendChild(dt);
[636] Fix | Delete
frImages.appendChild(dl);
[637] Fix | Delete
}
[638] Fix | Delete
if(addImages===true){
[639] Fix | Delete
this.el.tfClass('module-gallery-grid')[0].replaceChildren(frImages);
[640] Fix | Delete
return;
[641] Fix | Delete
}
[642] Fix | Delete
gridSt.setProperty('--gald',desktopCols);
[643] Fix | Delete
gridSt.setProperty('--galt',tabletCols || desktopCols);
[644] Fix | Delete
gridSt.setProperty('--galm',mobileCols || tabletCols || desktopCols);
[645] Fix | Delete
if(data.layout_masonry){
[646] Fix | Delete
classes.push('gallery-masonry');
[647] Fix | Delete
}
[648] Fix | Delete
grid.className=classes.join(' ');
[649] Fix | Delete
grid.appendChild(frImages);
[650] Fix | Delete
fr.append(grid,createElement('span',{class:'tb_add_gal_btn tb_add_btn tf_plus_icon',role:'button',title:'Add Images'}));
[651] Fix | Delete
if(pagination){
[652] Fix | Delete
[653] Fix | Delete
}
[654] Fix | Delete
return fr;
[655] Fix | Delete
}
[656] Fix | Delete
showcase(images,data,addImages){
[657] Fix | Delete
const constructor=this.constructor,
[658] Fix | Delete
fr=createDocumentFragment(),
[659] Fix | Delete
frImages=createDocumentFragment(),
[660] Fix | Delete
showCaseWrap=createElement('','gallery-showcase-image'),
[661] Fix | Delete
imageWrap=createElement('','image-wrapper gallery-icon tf_rel'),
[662] Fix | Delete
thumbsWrap=createElement('','gallery-images tf_hidden'),
[663] Fix | Delete
mainItem=images[0] || {},
[664] Fix | Delete
src=mainItem.large?.[0] || mainItem.full?.[0] || mainItem.thumbnail,
[665] Fix | Delete
mainImg=constructor.setEditableImage(createElement('img'),'','s_image_w_gallery','s_image_h_gallery',data);
[666] Fix | Delete
[667] Fix | Delete
if(src){
[668] Fix | Delete
;
[669] Fix | Delete
mainImg.src=ThemifyImageResize.getCache(src,data.s_image_w_gallery,data.s_image_h_gallery,.8) || src;
[670] Fix | Delete
mainImg.dataset.orig = src;
[671] Fix | Delete
imageWrap.appendChild(mainImg);
[672] Fix | Delete
if((mainItem.title && data.gallery_image_title==='yes') || (mainItem.caption && data.gallery_exclude_caption!=='yes')){
[673] Fix | Delete
const showCaseTitle=createElement('','gallery-showcase-title tf_hidden tf_abs tf_textl');
[674] Fix | Delete
if(mainItem.title && data.gallery_image_title==='yes' ){
[675] Fix | Delete
showCaseTitle.appendChild(createElement('strong','gallery-showcase-title-text',mainItem.title));
[676] Fix | Delete
}
[677] Fix | Delete
if(mainItem.caption && data.gallery_exclude_caption!=='yes'){
[678] Fix | Delete
showCaseTitle.appendChild(createElement('span','gallery-showcase-caption',mainItem.caption));
[679] Fix | Delete
}
[680] Fix | Delete
imageWrap.appendChild(showCaseTitle);
[681] Fix | Delete
}
[682] Fix | Delete
showCaseWrap.appendChild(imageWrap);
[683] Fix | Delete
for(let i=0;i<images.length;++i){
[684] Fix | Delete
let item=images[i],
[685] Fix | Delete
galItem=createElement('','gallery-icon tf_rel'),
[686] Fix | Delete
linkImage=createElement('a',{href:'#',title:item.title || ''}),
[687] Fix | Delete
dataset=linkImage.dataset,
[688] Fix | Delete
thumb=constructor.setEditableImage(createElement('img'),'','thumb_w_gallery','thumb_h_gallery',data),
[689] Fix | Delete
src=item.large?.[0] || item.full?.[0] || item.thumbnail;
[690] Fix | Delete
[691] Fix | Delete
thumb.src=ThemifyImageResize.getCache(src,data.thumb_w_gallery,data.thumb_h_gallery,.8) || src;
[692] Fix | Delete
thumb.dataset.orig = src;
[693] Fix | Delete
dataset.caption=item.caption || '';
[694] Fix | Delete
dataset.orig=dataset.image=src;
[695] Fix | Delete
ThemifyImageResize.toBlob(linkImage, data.s_image_w_gallery, data.s_image_h_gallery).then(url=>{
[696] Fix | Delete
if(url){
[697] Fix | Delete
dataset.image = url;
[698] Fix | Delete
}
[699] Fix | Delete
})
[700] Fix | Delete
.catch(()=>{
[701] Fix | Delete
[702] Fix | Delete
});
[703] Fix | Delete
linkImage.appendChild(thumb);
[704] Fix | Delete
galItem.append(linkImage,createElement('span',{role:'button',class:'tb_del_btn tb_del_gal tf_close tb_disable_sorting',title:'Delete Image','data-id':item.id}));
[705] Fix | Delete
frImages.appendChild(galItem);
[706] Fix | Delete
}
[707] Fix | Delete
}
[708] Fix | Delete
if(addImages===true){
[709] Fix | Delete
const el=this.el;
[710] Fix | Delete
el.tfClass('gallery-images')[0].replaceChildren(frImages);
[711] Fix | Delete
el.tfClass('gallery-showcase-image')[0].replaceWith(showCaseWrap);
[712] Fix | Delete
return;
[713] Fix | Delete
}
[714] Fix | Delete
thumbsWrap.append(frImages,createElement('span',{role:'button',class:'tb_add_gal_btn tf_plus_icon tf_opacity tf_rel',title:'Add Images'}));
[715] Fix | Delete
fr.append(showCaseWrap,thumbsWrap);
[716] Fix | Delete
return fr;
[717] Fix | Delete
}
[718] Fix | Delete
slider(images,data,addImages){
[719] Fix | Delete
const fr=createDocumentFragment(),
[720] Fix | Delete
slides=['slider'],
[721] Fix | Delete
cssUrl=ThemifyBuilderModuleJs.cssUrl+'sliders/',
[722] Fix | Delete
id='tb_'+this.id+'_thumbs',
[723] Fix | Delete
args={...{
[724] Fix | Delete
show_arrow_slider:'yes',
[725] Fix | Delete
show_nav_slider:'yes',
[726] Fix | Delete
effect_slider:'scroll',
[727] Fix | Delete
pause_on_hover_slider:'resume',
[728] Fix | Delete
play_pause_control:'no',
[729] Fix | Delete
auto_scroll_opt_slider: 'off',
[730] Fix | Delete
scroll_opt_slider:1,
[731] Fix | Delete
speed_opt_slider:1,
[732] Fix | Delete
wrap_slider:1,
[733] Fix | Delete
height_slider: 'variable'
[734] Fix | Delete
},
[735] Fix | Delete
...data
[736] Fix | Delete
},
[737] Fix | Delete
showTitle=args.gallery_image_title==='yes',
[738] Fix | Delete
showCaption=args.gallery_exclude_caption!=='yes',
[739] Fix | Delete
showThumbs=args.slider_thumbs!=='yes';
[740] Fix | Delete
if(showThumbs===true){
[741] Fix | Delete
slides.push('thumbs');
[742] Fix | Delete
}
[743] Fix | Delete
[744] Fix | Delete
for(let i=0;i<slides.length;++i){
[745] Fix | Delete
let isSlider=slides[i]==='slider',
[746] Fix | Delete
hasNav= (slides[i]===( (isSlider === true && showThumbs===false) || data.show_arrow_buttons_vertical ? 'slider' : 'thumbs' )) ? (args.show_arrow_slider === 'yes' ? 1 : 0):0,
[747] Fix | Delete
swiperContainer=createElement('','tf_swiper-container tf_carousel themify_builder_slider tf_rel tf_overflow'),
[748] Fix | Delete
swiperWrapper=createElement('','tf_swiper-wrapper tf_lazy tf_rel tf_w tf_h tf_textc'),
[749] Fix | Delete
dataset=swiperContainer.dataset,
[750] Fix | Delete
imgWKey= 's_image_w_gallery',
[751] Fix | Delete
imgHKey= 's_image_h_gallery';
[752] Fix | Delete
if(isSlider===false){
[753] Fix | Delete
imgWKey='thumb_w_gallery';
[754] Fix | Delete
imgHKey='thumb_h_gallery';
[755] Fix | Delete
swiperContainer.className+=' '+id;
[756] Fix | Delete
dataset.thumbsId=id;
[757] Fix | Delete
}
[758] Fix | Delete
else{
[759] Fix | Delete
if (args.auto_scroll_opt_slider !== 'off'){
[760] Fix | Delete
dataset.auto=args.auto_scroll_opt_slider;
[761] Fix | Delete
dataset.pause_hover=args.pause_on_hover_slider === 'resume' ? 1 : 0;
[762] Fix | Delete
if (args.play_pause_control === 'yes'){
[763] Fix | Delete
dataset.controller=1;
[764] Fix | Delete
}
[765] Fix | Delete
}
[766] Fix | Delete
dataset.thumbs=id;
[767] Fix | Delete
dataset.effect=args.effect_slider;
[768] Fix | Delete
dataset.css_url=cssUrl+'carousel,'+cssUrl+'gallery';
[769] Fix | Delete
}
[770] Fix | Delete
dataset.pager=(isSlider === false || showThumbs===false) && args.show_nav_slider === 'yes'?1:0;
[771] Fix | Delete
dataset.speed=args.speed_opt_slider;
[772] Fix | Delete
dataset.wrapvar=args.wrap_slider === 'yes' ? 1 : 0;
[773] Fix | Delete
dataset.slider_nav=hasNav;
[774] Fix | Delete
dataset.height=args.horizontal === 'yes' ? 'variable' : args.height_slider;
[775] Fix | Delete
if(args.touch_swipe){
[776] Fix | Delete
dataset.touch_swipe=args.touch_swipe;
[777] Fix | Delete
}
[778] Fix | Delete
if(isSlider === false || showThumbs===false){
[779] Fix | Delete
dataset.visible=args.visible_opt_slider || '';
[780] Fix | Delete
dataset.tabVisible=args.tab_visible_opt_slider || '';
[781] Fix | Delete
dataset.mobVisible=args.mob_visible_opt_slider || '';
[782] Fix | Delete
dataset.scroll=args.scroll_opt_slider;
[783] Fix | Delete
}
[784] Fix | Delete
for(let j=0;j<images.length;++j){
[785] Fix | Delete
let item=images[j],
[786] Fix | Delete
slideItem=createElement('','tf_swiper-slide'),
[787] Fix | Delete
slideInner=createElement('','slide-inner-wrap'),
[788] Fix | Delete
slideImage=createElement('','tf_lazy slide-image gallery-icon'),
[789] Fix | Delete
img=this.constructor.setEditableImage(createElement('img'),'',imgWKey,imgHKey,args),
[790] Fix | Delete
src=item.full?.[0] || item.large?.[0] || item.thumbnail,
[791] Fix | Delete
{title='',caption=''}=item;
[792] Fix | Delete
if(args.left_margin_slider!==undefined){
[793] Fix | Delete
slideInner.style.marginLeft=args.left_margin_slider+'px';
[794] Fix | Delete
}
[795] Fix | Delete
if(args.right_margin_slider!==undefined){
[796] Fix | Delete
slideInner.style.marginRight=args.right_margin_slider+'px';
[797] Fix | Delete
}
[798] Fix | Delete
[799] Fix | Delete
img.src=ThemifyImageResize.getCache(src,args[imgWKey],args[imgHKey],.8) || src;
[800] Fix | Delete
img.dataset.orig = src;
[801] Fix | Delete
if(isSlider===true && data.link_opt!=='none'){
[802] Fix | Delete
let link=createElement('a');
[803] Fix | Delete
link.href='#';
[804] Fix | Delete
if(data.lightbox){
[805] Fix | Delete
link.className+=' themify_lightbox';
[806] Fix | Delete
}
[807] Fix | Delete
link.appendChild(img);
[808] Fix | Delete
slideImage.appendChild(link);
[809] Fix | Delete
}else{
[810] Fix | Delete
slideImage.appendChild(img);
[811] Fix | Delete
}
[812] Fix | Delete
if((showThumbs===false || isSlider===false) && images.length>1){
[813] Fix | Delete
slideImage.appendChild(createElement('',{role:'button',class:'tb_del_btn tb_del_gal tf_close tb_disable_sorting','data-id':item.id,title:'Delete Slide'}));
[814] Fix | Delete
}
[815] Fix | Delete
slideInner.appendChild(slideImage);
[816] Fix | Delete
if(isSlider===true && ((title!=='' && showTitle===true) || (caption!=='' && showCaption===true))){
[817] Fix | Delete
let content=createElement('','content tf_opacity tf_texl tf_abs');
[818] Fix | Delete
if(title!=='' && showTitle===true){
[819] Fix | Delete
content.appendChild(createElement('h3','slide-title',title));
[820] Fix | Delete
}
[821] Fix | Delete
if(caption!=='' && showCaption===true){
[822] Fix | Delete
content.appendChild(createElement('p','',caption));
[823] Fix | Delete
}
[824] Fix | Delete
slideInner.appendChild(content);
[825] Fix | Delete
}
[826] Fix | Delete
slideItem.appendChild(slideInner);
[827] Fix | Delete
swiperWrapper.appendChild(slideItem);
[828] Fix | Delete
}
[829] Fix | Delete
swiperContainer.appendChild(swiperWrapper);
[830] Fix | Delete
if(isSlider===true){
[831] Fix | Delete
swiperContainer.appendChild(createElement('span',{role:'button',class:'tb_add_gal_btn tb_add_btn tf_plus_icon',title:'Add Slides'}));
[832] Fix | Delete
}
[833] Fix | Delete
if(hasNav===1){
[834] Fix | Delete
let sliderVertical=createElement('','themify_builder_slider_vertical tf_rel');
[835] Fix | Delete
sliderVertical.appendChild(swiperContainer);
[836] Fix | Delete
fr.appendChild(sliderVertical);
[837] Fix | Delete
}
[838] Fix | Delete
else{
[839] Fix | Delete
fr.appendChild(swiperContainer);
[840] Fix | Delete
}
[841] Fix | Delete
}
[842] Fix | Delete
if(addImages===true){
[843] Fix | Delete
for(let swipers=this.el.tfClass('tf_swiper-container'),i=swipers.length-1;i>-1;--i){
[844] Fix | Delete
let parent=swipers[i].parentNode;
[845] Fix | Delete
if(parent.classList.contains('themify_builder_slider_vertical')){
[846] Fix | Delete
parent.remove();
[847] Fix | Delete
}else{
[848] Fix | Delete
swipers[i].remove();
[849] Fix | Delete
}
[850] Fix | Delete
}
[851] Fix | Delete
this.el.tfClass('tb_data_mod_name')[0].after(fr);
[852] Fix | Delete
}
[853] Fix | Delete
else{
[854] Fix | Delete
return fr;
[855] Fix | Delete
}
[856] Fix | Delete
}
[857] Fix | Delete
async lightboxed(images,data){
[858] Fix | Delete
const fr=createDocumentFragment(),
[859] Fix | Delete
showTitle=data.gallery_image_title==='yes',
[860] Fix | Delete
showCaption=data.gallery_exclude_caption!=='yes',
[861] Fix | Delete
thumbnailGallery=data.thumbnail_gallery || null,
[862] Fix | Delete
items=[];//in live preview this always show 1 element, but maybe in the "preview" we will change this?
[863] Fix | Delete
if(thumbnailGallery){
[864] Fix | Delete
const field={full:[thumbnailGallery]};
[865] Fix | Delete
if(showTitle===true || showCaption===true){
[866] Fix | Delete
let cache=this.constructor.cache,
[867] Fix | Delete
res=cache.get(thumbnailGallery);
[868] Fix | Delete
if(!res){
[869] Fix | Delete
try{
[870] Fix | Delete
res=await api.LocalFetch({action:'tb_gallery_lightbox_data',url:thumbnailGallery});
[871] Fix | Delete
if(!res?.success){
[872] Fix | Delete
throw '';
[873] Fix | Delete
}
[874] Fix | Delete
res=res.data;
[875] Fix | Delete
cache.set(thumbnailGallery,res);
[876] Fix | Delete
}
[877] Fix | Delete
catch(e){
[878] Fix | Delete
[879] Fix | Delete
}
[880] Fix | Delete
}
[881] Fix | Delete
field.title=res?.title ?? images[0].title;
[882] Fix | Delete
field.caption=res?.caption ?? images[0].caption;
[883] Fix | Delete
}
[884] Fix | Delete
[885] Fix | Delete
items.push(field);
[886] Fix | Delete
}
[887] Fix | Delete
else{
[888] Fix | Delete
items.push(images[0]);
[889] Fix | Delete
}
[890] Fix | Delete
for(let i=0;i<items.length;++i){
[891] Fix | Delete
let dl=createElement('dl','gallery-item'),
[892] Fix | Delete
img=this.constructor.setEditableImage(createElement('img'),(thumbnailGallery?'thumbnail_gallery':''),'thumb_w_gallery','thumb_h_gallery',data),
[893] Fix | Delete
item=items[i],
[894] Fix | Delete
src=item.full?.[0] || item.large?.[0] || item.thumbnail,
[895] Fix | Delete
{title='',caption=''}=item;
[896] Fix | Delete
[897] Fix | Delete
if(i===0){
[898] Fix | Delete
dl.className+=' tf_hidden';
[899] Fix | Delete
}else{
[900] Fix | Delete
dl.style.display='none';
[901] Fix | Delete
}
[902] Fix | Delete
img.src=ThemifyImageResize.getCache(src,data.thumb_w_gallery,data.thumb_h_gallery,.8) || src;
[903] Fix | Delete
img.dataset.orig = src;
[904] Fix | Delete
if(item.link){
[905] Fix | Delete
let dt=createElement('dt','gallery-icon'),
[906] Fix | Delete
link=createElement('a',{class:'themify_lightbox',href:item.link,title:title,'data-title':data.lightbox_title || '',rel:this.id});
[907] Fix | Delete
link.appendChild(img);
[908] Fix | Delete
dt.appendChild(link);
[909] Fix | Delete
dl.appendChild(dt);
[910] Fix | Delete
}
[911] Fix | Delete
else{
[912] Fix | Delete
dl.appendChild(img);
[913] Fix | Delete
}
[914] Fix | Delete
if((title!=='' && showTitle===true) || (caption!=='' && showCaption===true)){
[915] Fix | Delete
let dd=createElement('dd','wp-caption-text gallery-caption');
[916] Fix | Delete
if(title!=='' && showTitle===true){
[917] Fix | Delete
dd.appendChild(createElement('strong','themify_image_title tf_block',title));
[918] Fix | Delete
}
[919] Fix | Delete
if(caption!=='' && showCaption===true){
[920] Fix | Delete
dd.appendChild(createElement('span','themify_image_caption',caption));
[921] Fix | Delete
}
[922] Fix | Delete
dl.appendChild(dd);
[923] Fix | Delete
}
[924] Fix | Delete
fr.appendChild(dl);
[925] Fix | Delete
}
[926] Fix | Delete
return fr;
[927] Fix | Delete
}
[928] Fix | Delete
[929] Fix | Delete
};
[930] Fix | Delete
if(api.isFrontend){
[931] Fix | Delete
Themify.on('tb_options_expand', container=> {
[932] Fix | Delete
if ( api.isVisual && container&& api.activeModel?.get('mod_name')==='gallery') {
[933] Fix | Delete
for(let sliderRanges=container.querySelectorAll('#gr_ga_c,#gr_ga_r'),i=sliderRanges.length-1;i>-1;--i){
[934] Fix | Delete
let isVertical=sliderRanges[i].id==='gr_ga_r';
[935] Fix | Delete
sliderRanges[i].closest('.tb_slider_container').querySelector('input[type="range"]')?.tfOn('input',()=>{
[936] Fix | Delete
const gallery=api.activeModel.el.tfClass('gallery-masonry')[0];
[937] Fix | Delete
if(gallery){
[938] Fix | Delete
if(isVertical){
[939] Fix | Delete
window.Isotope?.data(gallery)?.layout();
[940] Fix | Delete
}
[941] Fix | Delete
else{
[942] Fix | Delete
Themify.trigger('builder_load_module_partial',[gallery.parentNode,true]);
[943] Fix | Delete
}
[944] Fix | Delete
}
[945] Fix | Delete
},{passive:true});
[946] Fix | Delete
}
[947] Fix | Delete
}
[948] Fix | Delete
});
[949] Fix | Delete
}
[950] Fix | Delete
})(tb_app);
[951] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function