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 24 25if (typeof jQuery == 'undefined') { 26 mtLinkFile('https://code.jquery.com/jquery-2.2.4.min.js'); 27} 28 29mtLinkFile('/content/magiczoomplus/magiczoomplus.settings.js'); 30mtLinkFile('/content/magiczoomplus/magiczoomplus.js'); 31 32function mzp_docReady(fn) { 33 if (document.readyState === "complete" || document.readyState === "interactive") { 34 setTimeout(fn, 1); 35 } else { 36 document.addEventListener("DOMContentLoaded", fn); 37 } 38} 39 40mzp_docReady(function() { 41 42 mzpScriptsReady(function() { 43 mtLinkFile('/content/magiczoomplus/magiczoomplus.css'); 44 var $s = '.MagicZoomGallery{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}a[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 a img{display:none}.MagicZoomSelectors{font-size:0px}.MagicZoomSelectors 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 a.active-magic-selector:before,.MagicZoomSelectors 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}
44 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; }'; 45 jQuery('html > head').append('<style type="text/css">'+$s+'</style>'); 46 initMagicZoomPlus(); 47 }) 48 49}); 50 51var $mzp_firstImageIsVideo = false; 52 53function mzpScriptsReady(fnc) { 54 if (typeof MagicZoom == 'undefined' || typeof mzOptions == 'undefined' || typeof jQuery == 'undefined') { 55 setTimeout(function() { 56 mzpScriptsReady(fnc); 57 }, 50); 58 return; 59 } 60 arguments[0](); 61} 62 63var $SirvCache = []; 64 65function SirvShowSpin(spinURL, SirvProductSKU_) { 66 jQuery('div[data-slide-id="spin"]').html('<div class="Sirv" id="sirv-spin" data-src="' + spinURL + '"></div>'); 67 jQuery('a[data-slide-id="spin"]').show(); 68 if (SirvProductSKU_ != '') { 69 //jQuery('a[data-slide-id="spin"]').trigger('click'); 70 } 71} 72 73function SirvHideSpin(spinURL) { 74 jQuery('div[data-slide-id="spin"], a[data-slide-id="spin"]').hide(); 75 jQuery('div[data-slide-id="zoom"]').show(); 76} 77 78function initSirv(SirvProductSKU_ = '') { 79 var SirvProductID = jQuery('input[name="product_id"]').val(), 80 SirvProductSKU = BCData.product_attributes.sku; 81 if (SirvProductSKU_!='') { 82 SirvProductSKU = SirvProductSKU_; 83 } 84 if (SirvID == '') return; 85 86 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, $('h1.productView-title').text()); 87 88 if (jQuery('div[data-slide-id="spin"]').length == 0) { 89 jQuery('div[data-slide-id="zoom"]').after('<div style="display:none;" data-slide-id="spin"></div>'); 90 jQuery('.MagicZoomSelectors').addClass('sirv-enabled').show().append('<a style="display:none;" data-slide-id="spin" class="SirvIcon mz-thumb" href="#"><img id="SirvIcon" src="' + SirvIconURL + '"/></a>'); 91 jQuery('.MagicZoomSelectors a[data-zoom-id]').first().addClass('active-magic-selector'); 92 initMagicZoomPlusSelectors('a[data-slide-id="spin"]') 93 } 94 95 if (typeof $SirvCache[spinURL] != 'undefined' ) { 96 if ($SirvCache[spinURL]) { 97 98 } 99 } 100 101 jQuery.ajax({ 102 url: spinURL, 103 type: 'HEAD', 104 cache: true, 105 timeout: 8000, 106 error: function(data) { 107 SirvHideSpin(); 108 $SirvCache[spinURL] = false; 109 }, 110 success: function(data) { 111 112 $SirvCache[spinURL] = true; 113 114 SirvShowSpin(spinURL, SirvProductSKU_); 115 116 if ($('script[src*="sirv.js"]').length == 0) { 117 var sirv = document.createElement('script'); 118 sirv.type = 'text/javascript'; 119 sirv.async = true; 120 sirv.src = document.location.protocol.replace('file:', 'http:') + '//scripts.sirv.com/sirvjs/v3/sirv.js'; 121 document.getElementsByTagName('script')[0].parentNode.appendChild(sirv); 122 } 123 124 } 125 }); 126 127 var SirvModelPath = SirvSpinsPath.replace('.spin', '.glb'); 128 129 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()); 130 131 jQuery.ajax({ 132 url: modelURL, 133 type: 'HEAD', 134 cache: true, 135 timeout: 8000, 136 error: function(data) {}, 137 success: function(data) { 138 139 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>'); 140 141 jQuery('.MagicZoomSelectors').addClass('sirv-enabled').show().append('<a data-slide-id="spin-model" class="SirvIcon mz-thumb" href="#"><img id="SirvIcon" src="' + SirvIconURL + '"/></a>'); 142 143 jQuery('.MagicZoomSelectors a[data-zoom-id]').first().addClass('active-magic-selector'); 144
145 initMagicZoomPlusSelectors('a[data-slide-id="spin-model"]') 146 147 var modeljs = document.createElement('script'); 148 modeljs.type = 'module'; 149 modeljs.src = 'https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js'; 150 document.getElementsByTagName('script')[0].parentNode.appendChild(modeljs); 151 152 } 153 }); 154} 155 156 157function initMagicZoomPlusSelectors($s) { 158 jQuery($s).on('keydown', function(e) { 159 if(e.keyCode == 13 && $(this).hasClass('mz-thumb')) { 160 MagicZoom.switchTo('zoom', $(this).get(0)) 161 } 162 }) 163 jQuery($s).on('click touchend', function(e) { 164 if ( jQuery('div[data-slide-id]:visible iframe').length ==1 ) { 165 jQuery('div[data-slide-id]:visible iframe')[0].src = jQuery('div[data-slide-id]:visible iframe')[0].src; 166 } 167 jQuery('div[data-slide-id]').hide(); 168 jQuery('div[data-slide-id="' + jQuery(this).attr('data-slide-id') + '"]').show(); 169 jQuery('a.active-magic-selector').removeClass('active-magic-selector'); 170 jQuery(this).addClass('active-magic-selector'); 171 172 if ( jQuery('div[data-slide-id]:visible iframe').length == 1 && typeof jQuery('div[data-slide-id]:visible iframe').attr('src') == 'undefined' ) { 173 jQuery('div[data-slide-id]:visible iframe').attr('src', jQuery('div[data-slide-id]:visible iframe').attr('data-src') ).show() 174 } 175 176 e.preventDefault(); 177 }); 178} 179 180function isVideoSelector($s) { 181 var regex_youtube_short = /https?:\/\/youtu\.be\/([^\/]{1,})\/?/gm, 182 regex_youtube_full = /https?:\/\/www\.youtube\.com\/watch\?v=(.{1,})/gm, 183 regex_youtube_embed = /https?:\/\/www\.youtube\.com\/embed\/(.{1,})/gm, 184 regex_youtube_shorts = /https?:\/\/www\.youtube\.com\/shorts\/(.{1,})/gm, 185 regex_vimeo = /https?:\/\/vimeo\.com\/(.{1,})/gm, 186 regex_mp4 = /\.mp4$/gm, 187 video_id, video_type; 188 var m = regex_youtube_short.exec($s); 189 if (m) { 190 video_id = m[1]; 191 video_type = 'youtube'; 192 } else { 193 var m = regex_youtube_full.exec($s); 194 if (m) { 195 video_id = m[1]; 196 video_type = 'youtube'; 197 } else { 198 var m = regex_youtube_embed.exec($s); 199 if (m) { 200 video_id = m[1]; 201 video_type = 'youtube'; 202 } else { 203 var m = regex_vimeo.exec($s); 204 if (m) { 205 video_id = m[1]; 206 video_type = 'vimeo'; 207 } else { 208 var m = regex_youtube_shorts.exec($s); 209 if (m) { 210 video_id = m[1]; 211 video_type = 'youtube'; 212 } else { 213 var m = regex_mp4.exec($s); 214 if (m) { 215 video_type = 'mp4'; 216 } 217 } 218 } 219 } 220 } 221 } 222 223 if (video_type=='youtube') { 224 return '<iframe style="display:none" data-src="https://www.youtube.com/embed/'+video_id+'" frameborder="0" allowfullscreen></iframe>'; 225 } else if (video_type=='vimeo') { 226 return '<iframe style="display:none" data-src="https://player.vimeo.com/video/'+video_id+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; 227 } else if (video_type=='mp4') { 228 return '<video controls><source src="' + $s + '" type="video/mp4"></video>'; 229 } 230 231 return false; 232} 233 234/* 235var mzp_xhr_open = window.XMLHttpRequest.prototype.open, 236 mzp_xhr_send = window.XMLHttpRequest.prototype.send, 237 mzp_xhr_onReadyStateChangeReplacement; 238 239function mzp_xhr_openReplacement(method, url, async, user, password) { 240 var syncMode = async !== false ? 'async' : 'sync'; 241 return mzp_xhr_open.apply(this, arguments); 242} 243function mzp_xhr_sendReplacement(data) { 244 if(this.onreadystatechange) { 245 this._onreadystatechange = this.onreadystatechange; 246 } 247 this.onreadystatechange = mzp_xhr_onReadyStateChangeReplacement; 248 return mzp_xhr_send.apply(this, arguments); 249} 250function mzp_xhr_onReadyStateChangeReplacement() { 251 252 if(this._onreadystatechange) { 253 this._onreadystatechange.apply(this, arguments); 254 } 255 if (this.readyState == 4 && this.responseText.match(/modal\-body quickView/gm)) { 256 setTimeout(initMagicZoomPlus,500); 257 } 258} 259 260 261window.XMLHttpRequest.prototype.open = mzp_xhr_openReplacement; 262window.XMLHttpRequest.prototype.send = mzp_xhr_sendReplacement; 263 264*/ 265 266var themes = { 267 268 'vzgrips': { 269 'imagesList': '[data-image-gallery] img', 270 'galleryContainer': '[data-image-gallery]', 271 'elementsToHide': '' 272 }, 273 'Cornerstone_': { 274 'imagesList': '.productView__topLeft .productView-images img', 275 'galleryContainer': '.productView__topLeft .productView-images', 276 'elementsToHide': '' 277 }, 278 'Cornerstone__': { 279 'imagesList': '.productView-image-wrap .slick-slide:not(.slick-cloned) img, .productView-image-wrap img', 280 'galleryContainer': '.productView-image-wrap', 281 'elementsToHide': '' 282 }, 283 284 'Light001': { 285 'imagesList': '.themevale_productView-images img', 286 'galleryContainer': '.themevale_productView-images', 287 'elementsToHide': '.themevale_productView-images' 288 }, 289 'Light00': {
290 'imagesList': '.productView-thumbnails:not(.slick-initialized) img, .productView-thumbnails li:not(.slick-cloned) img', 291 'galleryContainer': 'figure.productView-image', 292 'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails' 293 }, 294 'Light0': { 295 'imagesList': '.productView-thumbnails li:not(.slick-cloned) img', 296 'galleryContainer': 'figure.productView-image', 297 'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails' 298 }, 299 'Light': { 300 'imagesList': '.productView .productView-thumbnails .slick-slide:not(.slick-cloned) img', 301 'galleryContainer': 'figure.productView-image', 302 'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails' 303 }, 304 'Light2': { 305 'imagesList': '.productView .productView-thumbnails img', 306 'galleryContainer': 'ul.productView.productView-image', 307 'elementsToHide': 'ul.productView-thumbnails, div.productView-thumbnails' 308 }, 309 // 'Fish': { 310 // 'imagesList': 'section.productView-images img', 311 // 'galleryContainer': 'section.productView-images ', 312 // 'elementsToHide': '' 313 // }, 314 'Arcade': { 315 'imagesList': '.template-product .product-images img', 316 'galleryContainer': '.template-product .product-images', 317 'elementsToHide': '' 318 }, 319 'Clean': { 320 'imagesList': '.product-wrap .product-thumbnails img', 321 'galleryContainer': '.product-wrap .product-main-image', 322 'elementsToHide': '.product-wrap .product-thumbnails' 323 }, 324 'Exhibit': { 325 'imagesList': '.main-product-graphic .product-slides-container img', 326 'galleryContainer': '.main-product-graphic .product-slides-container', 327 'elementsToHide': '' 328 }, 329 330 'Cornerstone_': { 331 'imagesList': '.productView__topLeft .productView-images img', 332 'galleryContainer': '.productView__topLeft .productView-images', 333 'elementsToHide': '' 334 }, 335 'Cornerstone0': { 336 'imagesList': '.main-image-container img', 337 'galleryContainer': '.main-image-container', 338 'elementsToHide': '#product-images-container .slider-nav, ul.productView-thumbs' 339 }, 340 'Cornerstone': { 341 'imagesList': '.productView-images img', 342 'galleryContainer': 'figure.productView-image', 343 'elementsToHide': 'ul.productView-thumbnails, .product-images-container .slider-nav, ul.productView-thumbs' 344 }, 345 'Cornerstone2': { 346 'imagesList': '.productView-images .productView-thumbnails img', 347 'galleryContainer': '.productView-images .productView-image-update', 348 'elementsToHide': '.productView-images .productView-thumbnails' 349 }, 350 'Covent': { 351 'imagesList': '.productView-images .productView-thumbs img', 352 'galleryContainer': 'figure.productView-image', 353 'elementsToHide': '.productView-thumbs' 354 }, 355 'Covent2': { 356 'imagesList': '.productView-images .productView-img-container img', 357 'galleryContainer': 'figure.productView-image', 358 'elementsToHide': '.productView-thumbs' 359 }, 360 'Merchant': { 361 'imagesList': 'body.product .product-slides-container img', 362 'galleryContainer': 'body.product .product-images-container', 363 'elementsToHide': 'body.product .product-images-container .product-images-p
363agination' 364 }, 365 'Fortune': { 366 'imagesList': 'body.template-product .product-slideshow-wrapper img', 367 'galleryContainer': 'body.template-product .product-slideshow-wrapper', 368 'elementsToHide': 'body.template-product .single-product-thumbnails' 369 }, 370 'Supermarket': { 371 'imagesList': '.productView-detailsWrapper .productView-images .productView-imageCarousel-main img', 372 'galleryContainer': '.productView-detailsWrapper .productView-images .productView-imageCarousel-main', 373 'elementsToHide': '.productView-detailsWrapper .productView-images .productView-imageCarousel-nav' 374 }, 375 'Supermarket2': { 376 'imagesList': '.productView-images .productView-imageCarousel-main img', 377 'galleryContainer': '.productView-images .productView-imageCarousel-main', 378 'elementsToHide': '.productView-images .productView-imageCarousel-nav' 379 }, 380 'Foundry': { 381 'imagesList': '.template-product .product-slideshow .product-slideshow-images img', 382 'galleryContainer': '.template-product .product-slideshow .product-slideshow-images', 383 'elementsToHide': '.template-product .product-slideshow .product-thumbnails, .template-product .product-slideshow .spinner' 384 }, 385 'Eloquence': { 386 'imagesList': '.hero-carousel--product img', 387 'galleryContainer': '.hero-carousel--product', 388 'elementsToHide': '.hero-carousel-navContainer' 389 }, 390 'Warm': { 391 'imagesList': 'body.product .product-container .product-images .product-thumbnails img', 392 'galleryContainer': 'body.product .product-container .product-images .product-main-image', 393 'elementsToHide': 'body.product .product-container .product-images .product-thumbnails' 394 }, 395 'Solera': { 396 'imagesList': '.page-type-product .productView-images .productView-wrap .productView-image img', 397 'galleryContainer': '.page-type-product .productView-images .productView-wrap', 398 'elementsToHide': '.page-type-product .productView-images .productView-thumbnails' 399 }, 400 'Brixton': { 401 'imagesList': '.product-images .product-image-slide img', 402 'galleryContainer': '.product-image-slides-wrap',
403 'elementsToHide': '.product-images-pagination' 404 }, 405 'Warm2': // single image page 406 { 407 'imagesList': 'body.product .product-container .product-images .product-main-image img', 408 'galleryContainer': 'body.product .product-container .product-images .product-main-image', 409 'elementsToHide': 'body.product .product-container .product-images .product-thumbnails' 410 } 411} 412 413 414var $s = '<style type="text/css">'; 415for (var th in themes) { 416 $s += themes[th].galleryContainer+' {visibility:hidden !important; x-aspect-ratio:1;} '+themes[th].elementsToHide+' {visibility:hidden !important; }'; 417 $s += '.modal-content '+themes[th].galleryContainer+' {visibility:visible !important; x-aspect-ratio:auto;} .modal-content '+themes[th].elementsToHide+' {visibility:visible !important; }'; 418} 419$s += '</style>'; 420document.write($s); 421 422 423 424function initMagicZoomPlus() { 425 426 427 428 mzOptions.onUpdate = function() { 429 jQuery('a.active-magic-selector').removeClass('active-magic-selector'); 430 jQuery('a.mz-thumb-selected').addClass('active-magic-selector'); 431 } 432 433 mzOptions.onZoomReady = function(id) { 434 if (!$mzp_firstImageIsVideo) { 435 jQuery('a.mz-thumb-selected').addClass('active-magic-selector'); 436 } 437 } 438 439 for (var th in themes) { 440 var theme = themes[th]; 441 if (jQuery(theme.imagesList).length && jQuery(theme.galleryContainer).length) { 442 443 var $gallery = jQuery('<div class="MagicZoomGallery ' + th + '"><div class="MagicZoomSelectors"></div></div>'); 444 445 var $images = []; 446 447 jQuery(theme.imagesList).each(function(index, el) { 448 var $imageURL = jQuery(this).attr('src'); 449 450 if (typeof jQuery(this).attr('data-src') !== typeof undefined && jQuery(this).attr('data-src') !== false) { 451 $imageURL = jQuery(this).attr('data-src').replace(/(.*)\?.*$/gm, '$1'); 452 } 453 if (typeof jQuery(this).attr('data-lazy') !== typeof undefined && jQuery(this).attr('data-lazy') !== false) { 454 $imageURL = jQuery(this).attr('data-lazy').replace(/(.*)\?.*$/gm, '$1'); 455 } 456 457 //$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'; 458 $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'; 459 $imageURL = $imageURL.replace(/(\/\/i\.ytimg\.com\/vi\/.*?\/)(hq)?(default\.jpg)/gmi, '$1$3') 460 $imageURL = $imageURL.replace(/\?c=1/gmi, '') 461 462 if (typeof $images[$imageURL] != 'undefined') { 463 return; 464 } 465 $images[$imageURL] = $imageURL; 466 467 var $alt = jQuery(this).attr('alt'), 468 $title = jQuery(this).attr('alt'); 469 470 if (jQuery(this).closest('a').attr('data-type') == 'video') { 471 $alt = 'https://www.youtube.com/watch?v=' + jQuery(this).closest('a').attr('data-modal-content').replace(/.*https?:\/\/www\.youtube\.com\/embed\/(.*?)(\?|$).*/gm,'$1') 472 } 473 if ($imageURL.match(/\/\/i\.ytimg\.com\/vi\/(.*?)\/(hq)?default\.jpg/gmi)) { 474 $videoCode = $imageURL.replace(/\/\/i\.ytimg\.com\/vi\/(.*?)\/(hq)?default\.jpg/gmi, '$1') 475 $alt = 'https://www.youtube.com/watch?v=' + $videoCode; 476 } 477 if ($imageURL.match(/\/\/i\.ytimg\.com\/vi\/([^\/]{1,})\/.*$/gm)) { 478 $alt = 'https://www.youtube.com/watch?v=' + $imageURL.replace(/\/\/i\.ytimg\.com\/vi\/([^\/]{1,})\/.*$/gm, '$1') 479 } 480 481 var $videoCode = isVideoSelector($alt); 482 483 if (index == 0) { 484 $gallery.prepend(
485 '<div data-slide-id="zoom" x-style="aspect-ratio:1;">' + 486 '<a title="' + $title + '" class="MagicZoom" data-options="autostart:false;" id="zoom" href="' + $imageURL + '">' + 487 '<img data-style="aspect-ratio:1;object-fit:contain;" title="' + $title + '" alt="' + $alt + '" src="' + $imageURL.replace(/\/original\//gm, '/608x608/') + '" xsrcset="' + $imageURL.replace(/\/original\//gm, '/1000x1318/') + ' 2x"/>' + 488 '</a></div>' 489 ); 490 } 491 492 if ($videoCode) { 493 $gallery.find('.MagicZoomSelectors').append('<a data-slide-id="video-' + index + '" href="#"><img src="' + $imageURL.replace(/\/original\//gm, '/100x100/') + '"/></a>'); 494 $gallery.find('div[data-slide-id="zoom"]').after('<div style="display:none" data-slide-id="video-' + index + '">' + $videoCode + '</div>'); 495 496 if (index == 0) { 497 $mzp_firstImageIsVideo = true; 498 $gallery.find('div[data-slide-id="zoom"]').hide(); 499 $gallery.find('div[data-slide-id="video-' + index + '"]').show(); 500 $gallery.find('a[data-slide-id="video-' + index + '"]').addClass('active-magic-selector'); 501 } 502 503 } else { 504 $gallery.find('.MagicZoomSelectors').append('<a data-slide-id="zoom" title="' + $title + '" data-zoom-id="zoom" href="' + $imageURL + '" data-image="' + $imageURL.replace(/\/original\//gm, '/608x608/') + '" 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>'); 505 } 506 507 }) 508 509 jQuery(theme.galleryContainer).after($gallery); 510 jQuery(theme.galleryContainer).hide(); 511 512 if (jQuery('.MagicZoomSelectors a').length == 1) { 513 jQuery('.MagicZoomSelectors').hide(); 514 } 515 516 initMagicZoomPlusSelectors('a[data-slide-id]'); 517 518 jQuery(theme.elementsToHide).hide(); 519 jQuery(document.body).addClass('MZP-' + th); 520 521 jQuery('input[name*="attribute"], select[name*="attribute"]').on('change', function() { 522 var data = { }, $formData = $('form[data-cart-item-add]').serializeArray(); 523 for (var i in $formData) { 524 data[$formData[i].name] = $formData[i].value; 525 } 526 jQuery.ajax({ 527 dataType: "json", 528 url: '/remote/v1/product-attributes/' + jQuery('input[name="product_id"]').val(), 529 headers: { 'stencil-config': '{}', 'stencil-options': '{"render_with":"products/bulk-discount-rates"}', "x-xsrf-token": window.BCData && window.BCData.csrf_token ? window.BCData.csrf_token : "" }, 530 data: data, 531 method: 'post', 532 success: function(response) { 533 if (response.data.image != null) { 534 MagicZoom.update('zoom', response.data.image.data.replace('{:size}', 'original'), response.data.image.data.replace('{:size}', '1000x1318')) 535 } 536 initSirv(response.data.sku); 537 } 538 }); 539 }); 540 541 $mjs(document).jAddEvent('domready', function() { 542 MagicZoom.start(); 543 }); 544 545 initSirv(); 546 547 break; 548 } 549 } 550}
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.