1/** 2 * ìí ìì¸ ë³¸ë¬¸(.product_detail_content) ì íë¸ iframe: width/height(ìì±Â·ì¸ë¼ì¸)ë¡ ê°ë¡Â·ì¸ë¡ 미íë³ ë ê±°ìë§ ë³´ì . 3 * BO ì ì HTML(.video-container--shorts | --standard)ë í´ëì¤ ê³ ì â ì¹ìë§ ì ê±°. 4 * ë ê±°ì: .video-container ê° ìì¼ë©´ ë¶ëª¨ì .video-container--portrait, ìì¼ë©´ iframeì .youtube-embed--portrait. 5 */ 6(function () { 7 var PORTRAIT_WRAP_CLASS = 'video-container--portrait'; 8 var PORTRAIT_IFRAME_CLASS = 'youtube-embed--portrait'; 9 var BO_SHORTS_CLASS = 'video-container--shorts'; 10 var BO_STANDARD_CLASS = 'video-container--standard'; 11 var IFRAME_SELECTOR = '#pdDetailArea .product_detail_content iframe'; 12 13 function isYoutubeEmbed(src) { 14 if (!src || typeof src !== 'string') { 15 return false; 16 } 17 return /youtube\.com\/embed\//i.test(src) || /youtube-nocookie\.com\/embed\//i.test(src); 18 } 19 20 function getNumericDims(iframe) { 21 var w = parseInt(iframe.getAttribute('width'), 10); 22 var h = parseInt(iframe.getAttribute('height'), 10); 23 if (isNaN(w) || w <= 0) { 24 w = parseInt(iframe.style.width, 10); 25 } 26 if (isNaN(h) || h <= 0) { 27 h = parseInt(iframe.style.height, 10); 28 } 29 return { w: w, h: h }; 30 } 31 32 function stripIframeDimensions(iframe) { 33 iframe.removeAttribute('width'); 34 iframe.removeAttribute('height'); 35 iframe.style.removeProperty('width'); 36 iframe.style.removeProperty('height'); 37 if (!iframe.style || !iframe.style.cssText || iframe.style.cssText.trim() === '') { 38 iframe.removeAttribute('style'); 39 } 40 } 41 42 function wrapHasBoModifier(wrap) { 43 if (!wrap) { 44 return false; 45 } 46 return wrap.classList.contains(BO_SHORTS_CLASS) || wrap.classList.contains(BO_STANDARD_CLASS); 47 } 48 49 function processYoutubeIframe(iframe) { 50 if (!isYoutubeEmbed(iframe.getAttribute('src'))) { 51 return; 52 } 53 var wrap = iframe.closest('.video-container'); 54 if (wrapHasBoModifier(wrap)) { 55 stripIframeDimensions(iframe); 56 iframe.classList.remove(PORTRAIT_IFRAME_CLASS); 57 return; 58 } 59 var d = getNumericDims(iframe); 60 var isPortrait = d.w && d.h && !isNaN(d.w) && !isNaN(d.h) && d.w <= d.h; 61 stripIframeDimensions(iframe); 62 63 iframe.classList.remove(PORTRAIT_IFRAME_CLASS); 64 if (wrap) { 65 if (isPortrait) { 66 wrap.classList.add(PORTRAIT_WRAP_CLASS); 67 } else { 68 wrap.classList.remove(PORTRAIT_WRAP_CLASS); 69 } 70 } else if (isPortrait) { 71 iframe.classList.add(PORTRAIT_IFRAME_CLASS); 72 } 73 } 74 75 function initProductDetailVideoEmbeds() { 76 var iframes = document.querySelectorAll(IFRAME_SELECTOR); 77 for (var i = 0; i < iframes.length; i++) { 78 processYoutubeIframe(iframes[i]); 79 } 80 } 81 82 window.initProductDetailVideoEmbeds = initProductDetailVideoEmbeds; 83})();
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.