PageSourceSearch

https://idealblasting.com/content/magiczoomplus/magiczoomplus.stencil.js

js idealblasting.com collected 2026-10-05 05:25:34 UTC 34,243 bytes, 693 lines download raw bytes

1function mtLinkFile(url) {
2    var extention = url.replace(/^.+\.([^.]+)$/, '$1'),
3        targetTag = document.getElementsByTagName('head')[0];
4    if (extention == 'js') {
5        var scriptTag = document.createElement('script');
6        scriptTag.type = 'text/javascript';
7        scriptTag.src = url;
8        scriptTag.async = false;
9        if (arguments.length > 1) {
10            scriptTag.onload = arguments[1];
11        }
12        targetTag.appendChild(scriptTag);
13    }
14    if (extention == 'css') {
15        var linkTag = document.createElement('link');
16        linkTag.type = 'text/css';
17        linkTag.href = url;
18        linkTag.rel = 'stylesheet';
19        linkTag.media = 'screen';
20        targetTag.appendChild(linkTag);
21    }
22}
23
24if (typeof UseMagicScroll == 'undefined') {
25    UseMagicScroll = 'No';
26}
27
28
29if (typeof jQuery == 'undefined') {
30    mtLinkFile('https://code.jquery.com/jquery-2.2.4.min.js');
31}
32
33
34function mzp_docReady(fn) {
35    if (document.readyState === "complete" || document.readyState === "interactive") {
36        setTimeout(fn, 1);
37    } else {
38        document.addEventListener("DOMContentLoaded", fn);
39    }
40}    
41
42if (typeof BCData != 'undefined' && typeof BCData.product_attributes != 'undefined' && typeof window['mzpinstalled_stage1'] == 'undefined') {
43
44    mtLinkFile('/content/magiczoomplus/magiczoomplus.settings.js');
45    mtLinkFile('/content/magiczoomplus/magiczoomplus.js');
46    mtLinkFile('/content/magiczoomplus/magicscroll.js');
47    mzp_docReady(function() {
48
49        mzpScriptsReady(function() {
50            mtLinkFile('/content/magiczoomplus/magiczoomplus.css');
51            if (UseMagicScroll == 'Yes') {
52                mtLinkFile('/content/magiczoomplus/magicscroll.css');
53            }
54            var $s = '.MagicScroll .mcs-item img { height: 100% !important; max-height: 100% !important; object-fit: contain; } .mcs-item a {vertical-align:top;margin:0 3px !important;} .MagicZoomGallery{position:relative;z-index:1;text-align:center;width:100%}.MagicZoomSelectors{margin:5px;text-align:center}.MagicZoomSelectors a{margin:5px;display:inline-block}.MagicZoomSelectors a img{max-height:60px}.mz-thumb:hover:not(.mz-thumb-selected) img{-webkit-filter:none;filter:none}.mz-thumb-selected img{-webkit-filter:none;filter:none}.no-cssfilters-magic .mz-thumb{background:0 0}.no-cssfilters-magic .mz-thumb:hover:not(.mz-thumb-selected) img{opacity:1;filter:none}.no-cssfilters-magic .mz-thumb-selected img{opacity:1;filter:none}.MagicZoomSelectors a:hover img,.active-magic-selector img{-webkit-filter:brightness(60%)!important;filter:brightness(60%)!important}@media only screen and (min-width:768px){.MagicZoomSelectors .mz-thumb img .MagicZoomSelectors .mz-thumb-selected img,.MagicZoomSelectors a[data-zoom-id] img,.MagicZoomSelectors img{border:1px solid rgba(0,0,0,.1);opacity:.75;padding:2px;aspect-ratio:1;object-fit:contain;height:60px;width:60px;-webkit-filter:none!important;filter:none!important}.MagicZoomSelectors a.x-mz-thumb-selected[data-zoom-id] img, .MagicZoomSelectors .active-magic-selector img,.MagicZoomSelectors a.active-magic-selector[data-zoom-id] img,.MagicZoomSelectors a:hover img{opacity:1!important;border-color:#000!important}a[data-slide-id^=video]{position:relative}a[data-slide-id^=video]:before{content:"";position:absolute;color:#fff;text-shadow:0 1px 10px #000;top:50%!important;left:50%!important;display:inline-block;transform:translateY(-50%) translateX(-50%)!important;-webkit-transform:translateY(-50%) translateX(-50%)!important;z-index:100;width:36px!important;height:36px!important;border-radius:50%;background-repeat:no-repeat;background-color:rgba(0,0,0,.6)!important;background-size:50%;background-position:center center;border:2px solid rgba(255,255,255,.8);z-index:1}a[data-slide-id^=video]:after{position:absolute;content:"";width:12px;height:16px;border-top:8px solid transparent;border-left:12px solid rgba(255,255,255,.8);border-bottom:8px solid transparent;position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);-webkit-transform:translateY(-50%) translateX(-50%);margin-left:1px;box-sizing:border-box!important;z-index:2}
54a[data-slide-id^=video]:hover:before{background-color:rgba(0,0,0,.7)!important;border-color:#fff}a[data-slide-id^=video]:hover:after{border-left-color:#fff}}div[data-slide-id^=video]{position:relative;overflow:hidden;max-width:100%;padding-bottom:56.25%;height:0;height:auto}div[data-slide-id^=video] iframe, div[data-slide-id^=video] video {position:absolute;top:0;left:0;width:100%!important;height:100%!important}@media only screen and (max-width:767px){.MagicZoomSelectors > div:not(.MagicScroll) a img{display:none} .MagicZoomSelectors{> div:not(.MagicScroll) font-size:0px} .MagicZoomSelectors > div:not(.MagicScroll) a{width:12px!important;height:12px!important;border-radius:100%!important;background:none repeat scroll 0 0 #aaa!important;margin:3px!important;cursor:pointer!important;display:inline-block!important;position:relative!important;text-indent:-9999px!important;vertical-align:middle!important;font-size:0px!important;line-height:0!important} .MagicZoomSelectors > div:not(.MagicScroll) a.active-magic-selector:before, .MagicZoomSelectors > div:not(.MagicScroll) a:hover:before{width:10px!important;height:10px!important;border:1px solid transparent!important;border-radius:100%!important;margin:1px!important;content:""!important;position:relative!important;display:block!important;text-indent:-9999px!important;background:#fff!important}}.MZP-Cornerstone .easyzoom-flyout{display:none!important}.MZP-Cornerstone .productView-image{pointer-events:all!important} div[data-slide-id="spin-model"] { width:100%; position:relative; padding-bottom:100%; height:0; line-height:0; } div[data-slide-id="spin-model"] model-viewer { width:100%; position:absolute; height:100%; top:0; left:0; }.mz-zoom-window.mz-magnifier { background: #fff; } div[data-slide-id] { position:relative; z-index:111; }';
55            $s += '.MagicScroll[data-mode="carousel"], .MagicScroll[data-mode="cover-flow"]  {background:#fff !important;}';
56            jQuery('html > head').append('<style type="text/css">'+$s+'</style>');
57            initMagicZoomPlus();
58        })
59
60    });
61
62    window['mzpinstalled_stage1'] = true;
63
64}
65
66var $mzp_firstImageIsVideo = false;
67
68function mzpScriptsReady(fnc) {
69    if (typeof MagicZoom == 'undefined' || typeof mzOptions == 'undefined' || typeof jQuery == 'undefined' || UseMagicScroll == 'Yes' && typeof MagicScroll == 'undefined') {
70        setTimeout(function() {
71            mzpScriptsReady(fnc);
72        }, 50);
73        return;
74    }
75    arguments[0]();
76}
77
78var $SirvCache = [];
79
80function SirvShowSpin(spinURL, SirvProductSKU_) {
81    jQuery('div[data-slide-id="spin"]').html('<div class="Sirv" id="sirv-spin" data-src="' + spinURL + '"></div>');
82    jQuery('a[data-slide-id="spin"]').show();
83    if (SirvProductSKU_ != '') {
84        //jQuery('a[data-slide-id="spin"]').trigger('click');
85    }    
86    if (SirvSpinPosition == 'first') {
87        jQuery('a[data-slide-id="spin"]').trigger('click');
88    }
89
90}
91
92function SirvHideSpin(spinURL) {
93    jQuery('div[data-slide-id="spin"], a[data-slide-id="spin"]').remove();
94    jQuery('div[data-slide-id="zoom"]').show();
95}
96
97function initMagicScroll() {
98    if (typeof MagicScroll != 'undefined') {
99       $mjs(document).jAddEvent('domready', function() {
100            MagicScroll.start();
101        });        
102    }
103}
104
105function initSirv(SirvProductSKU_ = '') {
106    var SirvProductID = jQuery('input[name="product_id"]').val(),
107        SirvProductSKU = BCData.product_attributes.sku;
108    if (SirvProductSKU_!='') {
109        SirvProductSKU = SirvProductSKU_;
110    }
111
112
113    if (SirvID == '') {
114        initMagicScroll();
115        return;
116    }
117
118    var spinURL = document.location.protocol.replace('file:', 'http:') + '//' + SirvID + '.sirv.com/' + SirvSpinsPath.replace(/{product\-id}/g, SirvProductID).replace(/{product\-sku}/g, SirvProductSKU).replace(/{product\-name}/g, $('.product-heading__title, h1.productView-title').text());    
119
120    if (jQuery('div[data-slide-id="spin"]').length == 0) {
121
122        jQuery('div[data-slide-id="zoom"]').after('<div style="display:none;" data-slide-id="spin"></div>');
123        jQuery('.MagicZoomSelectors > div').addClass('sirv-enabled').show();
124
125        var $sirvIconHTML = '<a style="display:none;
125" data-slide-id="spin" class="SirvIcon mz-thumb" href="#"><img id="SirvIcon" src="' + SirvIconURL + '"/></a>';
126
127        if (SirvSpinPosition == 'last') {
128            jQuery('.MagicZoomSelectors > div').append($sirvIconHTML);
129        } else if (SirvSpinPosition == 'first') {
130            jQuery('.MagicZoomSelectors > div').prepend($sirvIconHTML);
131        } else if (SirvSpinPosition == 'second') {
132            jQuery('.MagicZoomSelectors > div a').first().after($sirvIconHTML);
133        }
134        
135        jQuery('.MagicZoomSelectors a[data-zoom-id]').first().addClass('active-magic-selector');
136        initMagicZoomPlusSelectors('a[data-slide-id="spin"]');
137
138        initMagicScroll();
139    }
140
141
142    if (typeof $SirvCache[spinURL] != 'undefined' ) {
143        if ($SirvCache[spinURL]) {
144
145        }
146    }
147
148    jQuery.ajax({
149        url: spinURL,
150        type: 'HEAD',
151        cache: true,
152        timeout: 8000,
153        error: function(data) {
154            SirvHideSpin();
155            $SirvCache[spinURL] = false;
156            initMagicScroll();
157        },
158        success: function(data) {
159
160            if (typeof SirvSpinsProfile != 'undefined') {
161                SirvSpinsProfile = SirvSpinsProfile.trim().replace(/\.profile/gmi,'');
162                if (SirvSpinsProfile!='') {
163                    spinURL += '?profile=' + SirvSpinsProfile;
164                }
165            }
166
167            $SirvCache[spinURL] = true;
168
169            SirvShowSpin(spinURL, SirvProductSKU_);
170
171            initMagicScroll();
172
173            if ($('script[src*="sirv.js"]').length == 0) {
174                var sirv = document.createElement('script');
175                sirv.type = 'text/javascript';
176                sirv.async = true;
177                sirv.src = document.location.protocol.replace('file:', 'http:') + '//scripts.sirv.com/sirvjs/v3/sirv.js';
178                document.getElementsByTagName('script')[0].parentNode.appendChild(sirv);
179            }
180
181        }
182    });
183
184    var SirvModelPath = SirvSpinsPath.replace('.spin', '.glb');
185
186    var modelURL = document.location.protocol.replace('file:', 'http:') + '//' + SirvID + '.sirv.com/' + SirvModelPath.replace(/{product\-id}/g, SirvProductID).replace(/{product\-sku}/g, SirvProductSKU).replace(/{product\-name}/g, $('h1.productView-title').text());    
187
188    jQuery.ajax({
189        url: modelURL,
190        type: 'HEAD',
191        cache: true,
192        timeout: 8000,
193        error: function(data) {},
194        success: function(data) {
195
196            jQuery('[data-slide-id="spin-model"]').remove();
197
198            jQuery('div[data-slide-id="zoom"]').after('<div style="display:none;" data-slide-id="spin-model"><model-viewer shadow-intensity="1" src="'+modelURL+'" camera-controls></model-viewer></div>');
199
200            jQuery('.MagicZoomSelectors').addClass('sirv-enabled').show().append('<a data-slide-id="spin-model" class="SirvIcon mz-thumb" href="#"><img id="SirvIcon" src="' + SirvIconURL + '"/></a>');
201
202            jQuery('.MagicZoomSelectors a[data-zoom-id]').first().addClass('active-magic-selector');
203
204            initMagicZoomPlusSelectors('a[data-slide-id="spin-model"]') 
205
206            var modeljs = document.createElement('script');
207            modeljs.type = 'module';
208            modeljs.src = 'https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js';
209            document.getElementsByTagName('script')[0].parentNode.appendChild(modeljs);
210            
211        }
212    });
213}
214
215
216function initMagicZoomPlusSelectors($s) {
217    jQuery($s).on('keydown', function(e) {
218        if(e.keyCode == 13 && $(this).hasClass('mz-thumb')) {
219           MagicZoom.switchTo('zoom', $(this).get(0))
220        }
221    })
222    jQuery($s).on(mzOptions.selectorTrigger == 'hover' ? 'mouseover click touchend' : 'click touchend', function(e) {
223    //jQuery($s).on('click touchend', function(e) {
224        if ( jQuery('div[data-slide-id]:visible iframe').length ==1 ) {
225          jQuery('div[data-slide-id]:visible iframe')[0].src = jQuery('div[data-slide-id]:visible iframe')[0].src;
226        }
227        jQuery('div[data-slide-id]').hide();
228        jQuery('div[data-slide-id="' + jQuery(this).attr('data-sli
228de-id') + '"]').show();
229        jQuery('a.active-magic-selector').removeClass('active-magic-selector');
230        jQuery(this).addClass('active-magic-selector');
231
232        if ( jQuery('div[data-slide-id]:visible iframe').length == 1 && typeof jQuery('div[data-slide-id]:visible iframe').attr('src') == 'undefined' ) {
233          jQuery('div[data-slide-id]:visible iframe').attr('src', jQuery('div[data-slide-id]:visible iframe').attr('data-src') ).show()
234        }
235
236        e.preventDefault();
237    });
238}
239
240function isVideoSelector($s) {
241    var regex_youtube_short = /https?:\/\/youtu\.be\/([^\/]{1,})\/?/gm,
242        regex_youtube_full = /https?:\/\/www\.youtube\.com\/watch\?v=(.{1,})/gm,
243        regex_youtube_embed = /https?:\/\/www\.youtube\.com\/embed\/(.{1,})/gm,
244        regex_youtube_shorts = /https?:\/\/www\.youtube\.com\/shorts\/(.{1,})/gm,
245        regex_vimeo = /https?:\/\/vimeo\.com\/(.{1,})/gm,
246        regex_mp4 = /\.mp4$/gm,
247        video_id, video_type;
248    var m = regex_youtube_short.exec($s);
249    if (m) {
250        video_id = m[1];
251        video_type = 'youtube';
252    } else {
253        var m = regex_youtube_full.exec($s);
254        if (m) {
255            video_id = m[1];
256            video_type = 'youtube';
257        } else {
258            var m = regex_youtube_embed.exec($s);
259            if (m) {
260                video_id = m[1];
261                video_type = 'youtube';
262            } else {
263                var m = regex_vimeo.exec($s);
264                if (m) {
265                    video_id = m[1];
266                    video_type = 'vimeo';
267                } else {
268                    var m = regex_youtube_shorts.exec($s);
269                    if (m) {
270                        video_id = m[1];
271                        video_type = 'youtube';
272                    } else {
273                    var m = regex_mp4.exec($s);
274                        if (m) {
275                            video_type = 'mp4';
276                        }
277                    }
278                }
279            }  
280        }
281    }
282
283    if (video_type=='youtube') {
284        return '<iframe style="display:none" data-src="https://www.youtube.com/embed/'+video_id+'" frameborder="0" allowfullscreen></iframe>';
285    } else if (video_type=='vimeo') {
286        return '<iframe style="display:none" data-src="https://player.vimeo.com/video/'+video_id+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
287    } else if (video_type=='mp4') {
288        return '<video controls><source src="' + $s + '" type="video/mp4"></video>';
289    }
290
291    return false;
292}
293
294/*
295var mzp_xhr_open = window.XMLHttpRequest.prototype.open,
296    mzp_xhr_send = window.XMLHttpRequest.prototype.send,
297    mzp_xhr_onReadyStateChangeReplacement;
298
299function mzp_xhr_openReplacement(method, url, async, user, password) {
300    var syncMode = async !== false ? 'async' : 'sync';
301    return mzp_xhr_open.apply(this, arguments);
302}
303function mzp_xhr_sendReplacement(data) {
304    if(this.onreadystatechange) {
305        this._onreadystatechange = this.onreadystatechange;
306    }
307    this.onreadystatechange = mzp_xhr_onReadyStateChangeReplacement;
308    return mzp_xhr_send.apply(this, arguments);
309}
310function mzp_xhr_onReadyStateChangeReplacement() {
311
312    if(this._onreadystatechange) {
313        this._onreadystatechange.apply(this, arguments);
314    }
315    if (this.readyState == 4 && this.responseText.match(/modal\-body quickView/gm)) {
316        setTimeout(initMagicZoomPlus,500);
317    }
318}
319
320
321window.XMLHttpRequest.prototype.open = mzp_xhr_openReplacement;
322window.XMLHttpRequest.prototype.send = mzp_xhr_sendReplacement;
323
324*/
325
326var themes = {
327
328   'juniperflowers': {
329        'imagesList': 'div[data-image-gallery]  img',
330        'galleryContainer': 'div[data-image-gallery] > figure',
331        'elementsToHide': 'ul.product-gallery__thumbnails'
332    },
333
334   'plumblinejewelry': {
335        'imagesList': '.product-images-wrapper  img',
336        'galleryContainer': '.product-images-container',
337        'elementsToHide': '.product-images-pagination-container'
338    },
339
340   'Superkart': {
341        'imagesList': '.productView-nav-inner .slick-slide:not(.slick-cloned) img, .productView-nav-inner  img',
342        'galleryContainer': '.productView-nav-inner',
343        'elementsToHide': '.productView-nav, .productView-for'
344    },
345
346    'Cornerstone_0': {
347        'imagesList': 'section.productView-images img',
348        'galleryContainer': '.ob-image-main-carousel ',
349        'elementsToHide': '.ob-image-below-carousel'
350    },
351    'Cornerstone_': {
352        'imagesList': '.productView__topLeft .productView-images img',
353        'galleryContainer': '.productView__topLeft .productView-images',
354        'elementsToHide': ''
355    },
356    'Cornerstone__': {
357        'imagesList': '.productView-image-wrap .slick-slide:not(.slick-cloned) img, .productView-image-wrap  img',
358        'galleryContainer': '.productView-image-wrap',
359        'elementsToHide': ''
360    },
361
362    'Light002': {
363        'imagesList': 'section.productView-images .productView-images--inner img',
364        'galleryContainer': 'section.productView-images .productView-images--inner',
365        'elementsToHide': ''
366    },
367
368    'Light001': {
369        'imagesList': '.themevale_productView-images .productView-image img',
370        'galleryContainer': '.themevale_productView-images',
371        'elementsToHide': '.themevale_productView-images'
372    },
373    'Light003': {
374        'imagesList': 'figure.productView-image img, .productView-thumbnails:not(.slick-initialized) img, .productView-thumbnails li:not(.slick-cloned) img',
375        'galleryContainer': '.main-image-container',
376        'elementsToHide': '.slider-nav'
377    },
378
379    'Light004': {
380        'imagesList': '.productView-nav:not(.slick-initialized) img, .productView-nav li:not(.slick-cloned) img, .productView-nav img',
381        'galleryContainer': '.productView-image-wrapper',
382        'elementsToHide': '.productView-thumbnail-wrapper'
383    },
384    
385    'Light00': {
386        'imagesList': 'figure.productView-image img, .productView-thumbnails:not(.slick-initialized) img, .productView-thumbnails li:not(.slick-cloned) img, .videoGallery lite-youtube',
387        'galleryContainer': 'figure.productView-image',
388        'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails, .videoGallery lite-youtube, .mobile_view-slider'
389    },
390    'Light0': {
391        'imagesList': '.productView-thumbnails li:not(.slick-cloned) img',
392        'galleryContainer': 'figure.productView-image',
393        'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails'
394    },
395    'Light': {
396        'imagesList': '.productView .productView-thumbnails .slick-slide:not(.slick-cloned) img',
397        'galleryContainer': 'figure.productView-image',
398        'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails'
399    },
400    'Light2': {
401        'imagesList': '.productView .productView-thumbnails img',
402        'galleryContainer': 'ul.productView.productView-image',
403        'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails'
404    },
405    // 'Fish': {
406    //     'imagesList': 'section.productView-images img',
407    //     'galleryContainer': 'section.productView-images ',
408    //     'elementsToHide': ''
409    // },
410    'Arcade': {
411        'imagesList': '.template-product .product-images img',
412        'galleryContainer': '.template-product .product-images',
413        'elementsToHide': ''
414    },
415    'Clean': {
416        'imagesList': '.product-wrap .product-thumbnails img',
417        'galleryContainer': '.product-wrap .product-main-image',
418        'elementsToHide': '.product-wrap .product-thumbnails'
419    },
420    'Exhibit': {
421        'imagesList': '.main-product-graphic .product-slides-container img',
422        'galleryContainer': '.main-product-graphic .product-slides-container',
423        'elementsToHide': ''
424    },
425
426    'Cornerstone_': {
427        'imagesList': '.productView__topLeft .productView-images img',
428        'galleryContainer': '.productView__topLeft .productView-images',
429        'elementsToHide': ''
430    },
431    'Cornerstone0': {
432        'imagesList': '.main-image-container img',
433        'galleryContainer': '.main-image-container',
434        'elementsToHide': '#product-images-container .slider-nav, ul.productView-thumbs'
435    },
436    'Cornerstone': {
437        'imagesList': '.productView-images img',
438        'galleryContainer': 'figure.productView-image',
439        'elementsToHide': 'ul.productView-thumbnails, .product-images-container .slider-nav, .productView-thumbs'
440    },
441    'Cornerstone2': {
442        'imagesList': '.productView-images .productView-thumbnails img',
443        'galleryContainer': '.productView-images .productView-image-update',
444        'elementsToHide': '.productView-images .productView-thumbnails'
445    },
446    'Covent': {
447        'imagesList': '.productView-images .productView-thumbs img',
448        'galleryContainer': 'figure.productView-image',
449        'elementsToHide': '.productView-thumbs'
450    },
451    'Covent2': {
452        'imagesList': '.productView-images .productView-img-container img',
453        'galleryContainer': 'figure.productView-image',
454        'elementsToHide': '.productView-thumbs'
455    },
456    'Merchant': {
457        'imagesList': 'body.product .product-slides-container img',
458        'galleryContainer': 'body.product .product-images-container',
459        'elementsToHide': 'body.product .product-images-container .product-images-p
459agination'
460    },
461    'Fortune': {
462        'imagesList': 'body.template-product .product-slideshow-wrapper img',
463        'galleryContainer': 'body.template-product .product-slideshow-wrapper',
464        'elementsToHide': 'body.template-product .single-product-thumbnails'
465    },
466    'Supermarket': {
467        'imagesList': '.productView-detailsWrapper .productView-images .productView-imageCarousel-main img',
468        'galleryContainer': '.productView-detailsWrapper .productView-images .productView-imageCarousel-main',
469        'elementsToHide': '.productView-detailsWrapper .productView-images .productView-imageCarousel-nav'
470    },
471    'Supermarket2': {
472        'imagesList': '.productView-images .productView-imageCarousel-main img',
473        'galleryContainer': '.productView-images .productView-imageCarousel-main',
474        'elementsToHide': '.productView-images .productView-imageCarousel-nav'
475    },
476    'Foundry': {
477        'imagesList': '.template-product .product-slideshow .product-slideshow-images img',
478        'galleryContainer': '.template-product .product-slideshow .product-slideshow-images',
479        'elementsToHide': '.template-product .product-slideshow .product-thumbnails, .template-product .product-slideshow .spinner'
480    },
481    'Eloquence': {
482        'imagesList': '.hero-carousel--product img',
483        'galleryContainer': '.hero-carousel--product',
484        'elementsToHide': '.hero-carousel-navContainer'
485    },
486    'Warm': {
487        'imagesList': 'body.product .product-container .product-images .product-thumbnails img',
488        'galleryContainer': 'body.product .product-container .product-images .product-main-image',
489        'elementsToHide': 'body.product .product-container .product-images .product-thumbnails'
490    },
491    'Solera': {
492        'imagesList': '.page-type-product .productView-images .productView-wrap .productView-image img',
493        'galleryContainer': '.page-type-product .productView-images .productView-wrap',
494        'elementsToHide': '.page-type-product .productView-images .productView-thumbnails'
495    },
496    'Brixton0': {
497        'imagesList': '.product-images .product-image-slide img',
498        'galleryContainer': '.product-view > .product-gallery ',
499        'elementsToHide': '.product-images-pagination'
500    },
501    'Brixton': {
502        'imagesList': '.product-images .product-image-slide img',
503        'galleryContainer': '.product-image-slides-wrap',
504        'elementsToHide': '.product-images-pagination'
505    },
506    'Warm2': // single image page
507    {
508        'imagesList': 'body.product .product-container .product-images .product-main-image img',
509        'galleryContainer': 'body.product .product-container .product-images .product-main-image',
510        'elementsToHide': 'body.product .product-container .product-images .product-thumbnails'
511    },
512     'QeRetail': {
513        'imagesList': '.productView-thumbnails .slick-slide:not(.slick-cloned) img, .productView-images  img',
514        'galleryContainer': '.productView-images-container',
515        'elementsToHide': ''
516    }
517}
518
519
520
521//var themes = {};
522
523// var $s = '<style type="text/css">';
524// for (var th in themes) {
525//     $s += themes[th].galleryContainer+' {visibility:hidden !important; x-aspect-ratio:1;} '+themes[th].elementsToHide+' {visibility:hidden !important; }';
526//     $s += '.modal-content '+themes[th].galleryContainer+' {visibility:visible !important; x-aspect-ratio:auto;} .modal-content '+themes[th].elementsToHide+' {visibility:visible !important; }';
527// }
528// $s += '</style>';
529// document.write($s);
530
531
532
533function initMagicZoomPlus() {
534
535    
536
537    mzOptions.onUpdate = function() {
538        jQuery('a.active-magic-selector').removeClass('active-magic-selector');
539        jQuery('a.mz-thumb-selected').addClass('active-magic-selector');
540    }
541
542    mzOptions.onZoomReady = function(id) {
543        if (!$mzp_firstImageIsVideo) {
544            jQuery('a.mz-thumb-selected').addClass('active-magic-selector');
545        }
546    }
547
548    for (var th in themes) {
549        var theme = themes[th];
550        if (jQuery(theme.imagesList).length && jQuery(theme.galleryContainer).length) {
551
552            var $gallery = jQuery('<div class="MagicZoomGallery ' + th + '"><div class="MagicZoomSelectors"><div' + ( UseMagicScroll == 'Yes' ? ' class="MagicScroll" data-options="autostart:false;"' : '' ) + '></div></div></div>');
553
554            var $images = [];
555
556            jQuery(theme.imagesList + ', a[data-video-id][data-video-type]').each(function(index, el) {
557                var $imageURL = jQuery(this).attr('src');
558                var $alt,$title
559
560                if (typeof jQuery(this).attr('data-video-id') !='undefined') {
561                    $alt = 'https://www.youtube.com/watch?v=' + jQuery(this).attr('data-video-id');
562                    $imageURL = 'https://img.youtube.com/vi/'+jQuery(this).attr('data-video-id')+'/0.jpg';
563                 } else {
564
565
566                    if (typeof jQuery(this).attr('data-src') !== typeof undefined && jQuery(this).attr('data-src') !== false) {
567                        $imageURL = jQuery(this).attr('data-src').replace(/(.*)\?.*$/gm, '$1');
568                    }
569                    if (typeof jQuery(this).attr('data-lazy') !== typeof undefined && jQuery(this).attr('data-lazy') !== false) {
570                        $imageURL = jQuery(this).attr('data-lazy').replace(/(.*)\?.*$/gm, '$1');
571                    }
572
573                    if (typeof $imageURL == 'undefined') {
574                        $imageURL = '';
575                    }
576
577                    //$imageURL = $imageURL/*.replace(/(.*)\?.*?$/gm,'$1')*/.replace(/stencil\/[0-9]{1,}x[0-9]{1,}\/products/gm, 'stencil/original/products');//.replace(/\?[^\/]*$/gm,'');//+'?c=2&imbypass=on&imbypass=on';
578                    $imageURL = $imageURL/*.replace(/(.*)\?.*?$/gm,'$1')*/.replace(/stencil\/[0-9]{1,}x[0-9]{1,}\/products/gm, 'stencil/original/products').replace(/stencil\/[0-9]{1,}w\/products/gm, 'stencil/original/products');//.replace(/\?[^\/]*$/gm,'');//+'?c=2&imbypass=on&imbypass=on';
579                    $imageURL = $imageURL.replace(/(\/\/i\.ytimg\.com\/vi\/.*?\/)(hq)?(default\.jpg)/gmi, '$1$3')
580                    $imageURL = $imageURL.replace(/\?c=[0-9]{1,}/gmi, '')
581                    $imageURL = $imageURL.replace(/\???imbypass=on/gmi, '')
582                    
583
584                    $done = true;
585                    while($done) {
586                        $imageURL_ = decodeURIComponent($imageURL).replace(/%252/ims,'%2');
587                        $done = $imageURL_ != $imageURL;
588                        $imageURL = $imageURL_;
589                    }
590
591                   if (typeof $images[$imageURL] != 'undefined' || $imageURL.indexOf('btn-play.png') > 0 ) {
592                        return;
593                    }
594                    $images[$imageURL] = $imageURL;
595
596                    $alt = jQuery(this).attr('alt');
597                    $title = jQuery(this).attr('alt');
598
599                }
600                if (typeof jQuery(this).attr('videoid') !='undefined' && jQuery(this).prop("tagName") == 'LITE-YOUTUBE') {
601                    $alt = 'https://www.youtube.com/watch?v=' + jQuery(this).attr('videoid');
602                    $imageURL = 'https://img.youtube.com/vi/'+jQuery(this).attr('videoid')+'/0.jpg';
603                }
604
605                if (jQuery(this).closest('a').attr('data-type') == 'video' && typeof jQuery(this).closest('a').attr('data-video-id') != 'undefined') {
606                    $alt = 'https://www.youtube.com/watch?v=' + jQuery(this).closest('a').attr('data-video-id');
607                }
608                if (jQuery(this).closest('a').attr('data-type') == 'video' && typeof jQuery(this).closest('a').attr('data-modal-content') != 'undefined') {
609                    $alt = 'https://www.youtube.com/watch?v=' + jQuery(this).closest('a').attr('data-modal-content').replace(/.*https?:\/\/www\.youtube\.com\/embed\/(.*?)(\?|$).*/gm,'$1')
610                }
611                if ($imageURL.match(/\/\/i\.ytimg\.com\/vi\/(.*?)\/(hq)?default\.jpg/gmi)) {
612                    $videoCode = $imageURL.replace(/\/\/i\.ytimg\.com\/vi\/(.*?)\/(hq)?default\.jpg/gmi, '$1')
613                        $alt = 'https://www.youtube.com/watch?v=' + $videoCode;
614                }
615                if ($imageURL.match(/\/\/i\.ytimg\.com\/vi\/([^\/]{1,})\/.*$/gm)) {
616                    $alt = 'https://www.youtube.com/watch?v=' + $imageURL.replace(/\/\/i\.ytimg\.com\/vi\/([^\/]{1,})\/.*$/gm, '$1')
617                }
618
619                var $videoCode = isVideoSelector($alt);
620
621                if (index == 0) {
622                    $gallery.prepend(
623                        '<div data-slide-id="zoom" x-style="aspect-ratio:1;">' +
624                        '<a title="' + $title + '" class="MagicZoom" data-options="autostart:false;" id="zoom" href="' + $imageURL + '">' +
625                        '<img data-style="aspect-ratio:1;object-fit:contain;" title="' + $title + '" alt="' + $alt + '" src="' + $imageURL.replace(/\/original\//gm, '/1280w/') + '" xsrcset="' + $imageURL.replace(/\/original\//gm, '/1000x1318/') + ' 2x"/>' +
626                        '</a></div>'
627                    );
628                }
629
630                if ($videoCode) {
631                    $gallery.find('.MagicZoomSelectors > div').append('<a data-slide-id="video-' + index + '" href="#"><img src="' + $imageURL.replace(/\/original\//gm, '/100x100/') + '"/></a>');
632                    $gallery.find('div[data-slide-id="zoom"]').after('<div style="display:none" data-slide-id="video-' + index + '">' + $videoCode + '</div>');
633
634                    if (index == 0) {
635                        $mzp_firstImageIsVideo = true;
636                        $gallery.find('div[data-slide-id="zoom"]').hide();
637                        $gallery.find('div[data-slide-id="video-' + index + '"]').show();
638                        $gallery.find('a[data-slide-id="video-' + index + '"]').addClass('active-magic-selector');
639                    }
640
641                } else {
642                    $gallery.find('.MagicZoomSelectors > div').append('<a data-slide-id="zoom" title="' + $title + '" data-zoom-id="zoom" href="' + $imageURL + '" data-image="' + $imageURL.replace(/\/original\//gm, '/1280w/') + '" xdata-image-2x="' + $imageURL.replace(/\/original\//gm, '/1000x1318/') + '"><img data-style="aspect-ratio:1;object-fit:contain;" title="' + $title + '" alt="' + $alt + '" src="' + $imageURL.replace(/\/original\//gm, '/200x60/') + '"/></a>');
643                }
644
645            })
646
647            jQuery(theme.galleryContainer).after($gallery);
648            jQuery(theme.galleryContainer).hide();
649
650            if (jQuery('.MagicZoomSelectors a').length == 1) {
651                jQuery('.MagicZoomSelectors').hide();
652            }
653
654            initMagicZoomPlusSelectors('a[data-slide-id]');
655
656            jQuery(theme.elementsToHide).hide().wrap('<div style="display:none"></div>');
657            jQuery(document.body).addClass('MZP-' + th);
658
659            jQuery('input[name*="attribute"], select[name*="attribute"]').on('change', function() {
660                var data = { }, $formData = $('form[data-cart-item-add]').serializeArray();
661                for (var i in $formData) {
662                    data[$formData[i].name] = $formData[i].value;
663                }
664
665
666                jQuery.ajax({
667                    dataType: "json",
668                    url: '/remote/v1/product-attributes/' + jQuery('input[name="product_id"]').val(),
669                    headers: { 'stencil-config': '{}', 'stencil-options': '{"render_with":"products/bulk-discount-rates"}', "x-xsrf-token": window.BCData && window.BCData.csrf_token ? window.BCData.csrf_token : "" },
670                    data: data,
671                    type: 'POST',
672                    success: function(response) {
673                        if (response.data.image != null) {
674                            jQuery('div[data-slide-id="spin"]').hide();
675                            jQuery('div[data-slide-id="zoom"]').show();
676                            MagicZoom.update('zoom', response.data.image.data.replace('{:size}', 'original'), response.data.image.data.replace('{:size}', '1280w'))
677                        }
678                        initSirv(response.data.sku);
679                    }
680                });
681                
682            });
683
684            $mjs(document).jAddEvent('domready', function() {
685                MagicZoom.start();
686            });
687
688            initSirv();
689
690            break;
691        }
692    }
693}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.