document.addEventListener('DOMContentLoaded',function(){var searchBox=document.querySelector('.site-search-box');searchBox.addEventListener('keypress',function(event){if(event.keyCode===13){event.preventDefault()}})});document.addEventListener('DOMContentLoaded',function(){if(document.body.classList.contains('single-product')){var opticOptions=document.querySelector('.mounted-optic-options');if(!opticOptions){return}
var warningText="Note that this optic may not be 100% compatible";var warningParagraph=document.createElement('p');warningParagraph.textContent=warningText;opticOptions.addEventListener('change',function(event){if(event.target.name==='wapf[field_656ce855c2b36]'){var selectedOptic=opticOptions.querySelector('input:checked').value;var firstOpticValue=opticOptions.querySelector('input').value;var existingWarning=document.querySelector('.fully-compatible-optics + p');if(selectedOptic!==firstOpticValue){if(!existingWarning){var fullyCompatibleOpticsParagraph=document.querySelector('.fully-compatible-optics');fullyCompatibleOpticsParagraph.parentNode.insertBefore(warningParagraph,fullyCompatibleOpticsParagraph.nextSibling)}}else{if(existingWarning){existingWarning.remove()}}}})}});jQuery(document).ready(function($){function updateLiElement(selector,imagePath,altText){var liToReplace=$(selector);if(liToReplace.length){var checkboxes=liToReplace.find('input[type="checkbox"]');if(checkboxes.length>1){checkboxes.slice(1).remove()}
var checkbox=checkboxes.first().detach();var newContent=$('<div></div>').append(checkbox).append('<img src="'+imagePath+'" alt="'+altText+'">');liToReplace.empty().append(newContent)}}
var elementsInfo=[{selector:'.cat-rebel-stars li.wpfTermWrapper[data-term-id="3672"][data-term-slug="saber-2"]',imagePath:($(window).width()<=768?'/wp-content/uploads/2024/01/saber2-stars-mobile.webp':'/wp-content/uploads/2024/01/saber2-stars.webp'),altText:'Saber 2 Star LED Modules'},{selector:'.cat-rebel-stars li.wpfTermWrapper[data-term-id="3671"][data-term-slug="coolbase"]',imagePath:'/wp-content/uploads/2024/01/coolbase-stars.webp',altText:'Coolbase Star LED Modules'},{selector:'.cat-rebel-stars li.wpfTermWrapper[data-term-id="3670"][data-term-slug="sinkpad-ii"]',imagePath:'/wp-content/uploads/2024/01/sinkpad-stars.webp',altText:'SinkPAD II Star LED Modules'},{selector:'.cat-rebel-stars li.wpfTermWrapper[data-term-id="3668"][data-term-slug="saber"]',imagePath:'/wp-content/uploads/2024/01/saber-stars.webp',altText:'Saber Star LED Modules'},];elementsInfo.forEach(function(info){updateLiElement(info.selector,info.imagePath,info.altText)})});jQuery(document).ready(function($){function updateLiElement(selector,contentImage,altText,contentTitle){var liToReplace=$(selector);if(liToReplace.length){var checkboxes=liToReplace.find('input[type="checkbox"]');if(checkboxes.length>1){checkboxes.slice(1).remove()}
var checkbox=checkboxes.first().detach();var newContent=$('<div></div>').append(checkbox).append('<div class="led-modules-cat-image"><img src="'+contentImage+'" alt="'+altText+'" width="160" height="115"></div><div class="led-modules-cat-text">'+contentTitle+'</div>');liToReplace.empty().append(newContent)}}
var elementsInfo=[{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3783"][data-term-slug="10mm-squares"]',contentImage:'/wp-content/uploads/2024/01/10mm-squares.png.webp',altText:'10mm Squares',contentTitle:'10mm Squares'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3784"][data-term-slug="20mm-stars"]',contentImage:'/wp-content/uploads/2024/01/20mm-stars.png.webp',altText:'20mm Stars',contentTitle:'20mm Stars'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3785"][data-term-slug="20mm-tri-stars"]',contentImage:'/wp-content/uploads/2024/01/20mm-tri-stars.png.webp',altText:'20mm Tri-Stars',contentTitle:'20mm Tri-Stars'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3789"][data-term-slug="25mm-rounds"]',contentImage:'/wp-content/uploads/2024/01/25mm-rounds.png.webp',altText:'25mm Rounds',contentTitle:'25mm Rounds'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3787"][data-term-slug="40mm-7-led-rounds"]',contentImage:'/wp-content/uploads/2024/01/40mm-rounds.png.webp',altText:'40mm Rounds',contentTitle:'40mm 7-Up Rounds'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3786"][data-term-slug="5mm-squares"]',contentImage:'/wp-content/uploads/2024/01/5mm-squares.png.webp',altText:'5mm Squares',contentTitle:'5mm Squares'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3788"][data-term-slug="rectangular"]',contentImage:'/wp-content/uploads/2024/01/rectangular.png.webp',altText:'Rectangular',contentTitle:'Rectangular'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3790"][data-term-slug="25mm-quad-rounds"]',contentImage:'/wp-content/uploads/2024/01/25mm-quads.png.webp',altText:'25mm Quad Rounds',contentTitle:'25mm Quad Rounds'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3791"][data-term-slug="25mm-squares"]',contentImage:'/wp-content/uploads/2024/01/25mm-squares.png.webp',altText:'25mm Squares',contentTitle:'25mm Squares'},{selector:'.cat-led-modules li.wpfTermWrapper[data-term-id="3792"][data-term-slug="20mm-quad-squares"]',contentImage:'/wp-content/uploads/2024/01/20mm-squares.png.webp',altText:'20mm Quad Squares',contentTitle:'20mm Quad Squares'},];elementsInfo.forEach(function(info){updateLiElement(info.selector,info.contentImage,info.altText,info.contentTitle)})});document.addEventListener('DOMContentLoaded',function(){var modal=document.getElementById("myModal");var btn=document.getElementById("openModal");var span=document.getElementsByClassName("close")[0];if(btn&&span){btn.addEventListener('click',function(event){event.preventDefault();modal.style.display="block"});span.onclick=function(){modal.style.display="none"}
window.onclick=function(event){if(event.target==modal){modal.style.display="none"}}}});document.querySelectorAll('.wfpDescription a#openModal').forEach(function(a){var div=a.parentElement;div.style.marginTop="-15px"});document.addEventListener('DOMContentLoaded',function(){var tooltipTriggers=document.querySelectorAll('.leadtime-tooltip-link');var tooltipContents=document.querySelectorAll('.leadtime-tooltip-content');tooltipTriggers.forEach(function(tooltipTrigger,index){tooltipTrigger.addEventListener('click',function(event){event.stopPropagation();var tooltipContent=tooltipContents[index];var isDisplayed=window.getComputedStyle(tooltipContent).display!=='none';tooltipContent.style.display=isDisplayed?'none':'block'})});document.addEventListener('click',function(event){tooltipContents.forEach(function(tooltipContent){if(!tooltipContent.parentNode.contains(event.target)){tooltipContent.style.display='none'}})})});document.addEventListener('DOMContentLoaded',function(){var div=document.querySelector('.gb-container.gb-container-9c68a87c.quadica-stock-notify');if(div&&div.innerHTML.trim()===''){div.style.display='none';if(div.previousElementSibling){div.previousElementSibling.style.paddingBottom='5px'}}});jQuery(document).ready(function($){$(document).on('init.wcpt',function(event,table){table.$table.find('tbody tr').each(function(){var $row=$(this);var productLink=$row.find('td.col-product_details a').attr('href');if(productLink){$row.css('cursor','pointer');$row.off('click').on('click',function(){window.location.href=productLink})}else{console.log('Product link not found for this row')}})})});function formatCheckoutOptions(){const cartItemDataElements=document.querySelectorAll('.cfw-cart-item-data');cartItemDataElements.forEach(element=>{let content=element.innerHTML;content=content.replace(/Null Price: Null Price \(\+[^\s)]+0\) \//g,'');content=content.replace(/(\/ )?Apply Discounts: Apply Discounts \([+-][^\s)]+[0-9.]+\)( \/ )?/g,'');content=content.replace(/\s*\([+-][^\s)]+[0-9.]+\)\s*/g,' ');content=content.replace(/\s*\/\s*$/,'');const parts=content.split(/\s*\/\s*(?=(LED Position|Mounting Base|Connector Option))/).map(part=>part.trim()).filter(Boolean).filter(part=>!['LED Position','Mounting Base','Connector Option'].includes(part));const formattedContent=parts.map(part=>{part=part.replace(/\s*\[[^\]]+\]\s*/g,' ');return `<div class="cart-option-details">${part.trim()}</div>`}).join('');element.innerHTML=formattedContent})}(function($){$(document).ready(function(){formatCheckoutOptions();$(document.body).on('updated_cart_totals updated_cart_contents wc_fragments_loaded wc_fragments_refreshed ',function(){formatCheckoutOptions();setTimeout(()=>{formatCheckoutOptions()},500)});$(document.body).on('checkoutwc_updated checkoutwc_open_cart yaycurrency_updated',function(){formatCheckoutOptions()});$(document.body).on('yaycurrency_after_set_currency',function(){formatCheckoutOptions()})})})(jQuery);(function(){const ALLOWED_TOOLTIPS=2;const HALFWAY_THRESHOLD=0.5;function limitKnowledgeBaseTooltips(){if(!window.location.pathname.includes('/knowledgebase/'))return;const tooltipContainers=document.querySelectorAll('.glossary-tooltip-container');const uniqueTooltips={};const pageHeight=document.body.offsetHeight;const halfwayPoint=pageHeight*HALFWAY_THRESHOLD;tooltipContainers.forEach((container,index)=>{const tooltipContent=container.getAttribute('data-tooltip');processTooltip(container,tooltipContent,index,halfwayPoint,uniqueTooltips)})}
function processTooltip(container,tooltipContent,index,halfwayPoint,uniqueTooltips){if(!(tooltipContent in uniqueTooltips)){uniqueTooltips[tooltipContent]={indices:[index],count:1}}else if(uniqueTooltips[tooltipContent].count<ALLOWED_TOOLTIPS&&container.getBoundingClientRect().top+window.pageYOffset>halfwayPoint){uniqueTooltips[tooltipContent].indices.push(index);uniqueTooltips[tooltipContent].count++}else{disableTooltip(container)}}
function disableTooltip(container){try{container.classList.remove('active');container.querySelector('.glossary-tooltip-overlay')?.remove();const anchor=container.querySelector('a');if(anchor){anchor.removeAttribute('href');anchor.style.cssText='text-decoration: none; color: inherit; cursor: text;'}
container.style='';container.classList.add('disabled-tooltip')}catch(error){console.error('Error disabling tooltip:',error)}}
const style=document.createElement('style');style.textContent=`
        .disabled-tooltip,
        .disabled-tooltip * {
            text-decoration: none !important;
            border-bottom: none !important;
        }
    `;document.head.appendChild(style);if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',limitKnowledgeBaseTooltips)}else{limitKnowledgeBaseTooltips()}})();function calculateHeatsinkResistance(){const forwardVoltage=parseFloat(document.getElementById('forwardVoltage').value);const driveCurrent=parseFloat(document.getElementById('driveCurrent').value)/1000;const maxJunctionTemp=parseFloat(document.getElementById('maxJunctionTemp').value);const junctionToPadResistance=parseFloat(document.getElementById('junctionToPadResistance').value);const mountingBaseResistance=parseFloat(document.getElementById('mountingBaseResistance').value);const attachmentResistance=parseFloat(document.getElementById('attachmentResistance').value);const ambientTemp=parseFloat(document.getElementById('ambientTemp').value);const ledPower=forwardVoltage*driveCurrent;const totalResistanceExcludingHeatsink=junctionToPadResistance+mountingBaseResistance+attachmentResistance;const maxTempRise=maxJunctionTemp-ambientTemp;const maxHeatsinkResistance=(maxTempRise/ledPower)-totalResistanceExcludingHeatsink;document.getElementById('result').textContent=maxHeatsinkResistance.toFixed(2)}
document.querySelectorAll('input').forEach(input=>{input.addEventListener('input',calculateHeatsinkResistance)});calculateHeatsinkResistance()