1/* 2 * OLD FUNCTION 3 */ 4 5// function switchexplorergallery() { 6 7// if( jQuery('#exswitcher input[type="checkbox"]').is(':checked') ) { 8// jQuery('.pimg-whitecolor').css('display', 'none'); 9// jQuery('.pimg-blackcolor').css('display', 'block'); 10 11 12// if(jQuery('.jet-switcher').hasClass('jet-switcher--disable')) { 13// jQuery('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18760'); 14// } else { 15// jQuery('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18761'); 16// } 17 18// } else { 19 20// jQuery('.pimg-whitecolor').css('display', 'block'); 21// jQuery('.pimg-blackcolor').css('display', 'none'); 22 23 24// if(jQuery('.jet-switcher').hasClass('jet-switcher--disable')) { 25// jQuery('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18762'); 26// } else { 27// jQuery('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18763'); 28// } 29// } 30// } 31 32// jq2 = jQuery.noConflict(); 33// jq2(function( $ ) { 34 35// if( $('.sbs-add-package-to-cart a').length ) { 36// $('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18760'); 37// } 38 39// $('.jet-switcher').click( function(e) { 40// if($(this).hasClass('jet-switcher--disable')) { 41 42// if( $('#exswitcher input[type="checkbox"]').is(':checked') ) { 43// $('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18760'); 44// } else { 45// $('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18762'); 46// } 47 48// } else { 49 50// if( $('#exswitcher input[type="checkbox"]').is(':checked') ) { 51// $('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18761'); 52// } else { 53// $('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18763'); 54// } 55// } 56// }); 57 58// $('#color-switcher-1').click(function(){ 59// var x = document.getElementById("explorer-black-img"); 60// if (x.style.display === "none") { 61// x.style.display = "block"; 62// } else { 63// x.style.display = "none"; 64// } 65 66// var x = document.getElementById("explorer-white-img"); 67// if (x.style.display === "block") { 68// x.style.display = "none"; 69// } else { 70// x.style.display = "block"; 71// } 72// }); 73 74// $('#color-switcher-2').click(function(){ 75// var x = document.getElementById("venture-black-img"); 76// if (x.style.display === "none") { 77// x.style.display = "block"; 78// } else { 79// x.style.display = "none"; 80// } 81 82// var x = document.getElementById("venture-white-img"); 83// if (x.style.display === "block") { 84// x.style.display = "none"; 85// } else { 86// x.style.display = "block"; 87// } 88// }); 89 90// $('#color-switcher-3').click(function(){ 91// var x = document.getElementById("infinte-black-img"); 92// if (x.style.display === "none") { 93// x.style.display = "block"; 94// } else { 95// x.style.display = "none"; 96// } 97 98// var x = document.getElementById("infinte-white-img"); 99// if (x.style.display === "block") { 100// x.style.display = "none"; 101// } else { 102// x.style.display = "block"; 103// } 104// }); 105// }); 106 107/* 108 * NEW FUNCTION 109 */ 110 111jQuery(function ($) { 112 // Utility function to toggle images 113 const toggleImageVisibility = (blackImgId, whiteImgId) => { 114 $(`#${blackImgId}`).toggleClass('hidden'); 115 $(`#${whiteImgId}`).toggleClass('hidden'); 116 }; 117 118 // Set default href based on the initial state 119 const updateHref = () => { 120 const isChecked = $('#exswitcher input[type="checkbox"]').is(':checked'); 121 const isSwitcherDisabled = $('.jet-switcher').hasClass('jet-switcher--disable'); 122 123 let href; 124 if (isChecked) { 125 href = isSwitcherDisabled 126 ? '/ordering/?step=1&add-to-cart=18760' 127 : '/ordering/?step=1&add-to-cart=18761'; 128 } else { 129 href = isSwitcherDisabled 130 ? '/ordering/?step=1&add-to-cart=18762' 131 : '/ordering/?step=1&add-to-cart=18763'; 132 } 133 $('.sbs-add-package-to-cart a').attr('href', href); 134 }; 135 136 // Initial setup 137 if ($('.sbs-add-package-to-cart a').length) { 138 $('.sbs-add-package-to-cart a').attr('href', '/ordering/?step=1&add-to-cart=18760'); 139 } 140 141 // Event handler for switcher clicks 142 $('.jet-switcher').on('click', () => { 143 updateHref(); 144 }); 145 146 // Toggle visibility for Explorer images 147 $('#color-switcher-1').on('click', () => { 148 toggleImageVisibility('explorer-black-img', 'explorer-white-img'); 149 }); 150 151 // Toggle visibility for Venture images 152 $('#color-switcher-2').on('click', () => { 153 toggleImageVisibility('venture-black-img', 'venture-white-img'); 154 }); 155 156 // Toggle visibility for Infinite images 157 $('#color-switcher-3').on('click', () => { 158 toggleImageVisibility('infinte-black-img', 'infinte-white-img'); 159 }); 160 161 // Update href on checkbox change 162 $('#exswitcher input[type="checkbox"]').on('change', () => { 163 updateHref(); 164 // Toggle images based on checkbox state 165 $('.pimg-whitecolor').toggleClass('hidden', $('#exswitcher input[type="checkbox"]').is(':checked')); 166 $('.pimg-blackcolor').toggleClass('hidden', !$('#exswitcher input[type="checkbox"]').is(':checked')); 167 }); 168});
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.