1/* 2 * Custom code goes here. 3 * A template should always ship with an empty custom.js 4 */ 5 6jQuery(document).ready(function($){ 7 8 if( $('body').is('#product') ){ 9 $("#read-more").click(function() { 10 $('html, body').animate({ 11 scrollTop: $("#detailed-info-container").offset().top 12 }, 2000); 13 }); 14 15 $("div#close-button").click(function() { 16 $('div#product-modal').hide(); 17 $('div.modal-backdrop').remove(); 18 $('body').removeClass('modal-open'); 19 }); 20 } 21 22 $('header#header nav#_desktop_top_menu li div.menu-sub__content li').hover(function(){ 23 $(this).find('div[role="group"] > div > ul').addClass('open-sub'); 24 }); 25 26 $('header#header nav#_desktop_top_menu ul[data-depth="0"] > li').mouseleave(function(){ 27 $(this).find('ul').removeClass('open-sub'); 28 }); 29 30 $('div#left-column ul.category-sub-menu li a[href="' + document.location.href + '"]').addClass('bold'); 31 $('div#left-column ul.category-sub-menu li a[href="' + document.location.href + '"]').parents('div.navbar-toggler').removeClass('collapsed'); 32 $('div#left-column ul.category-sub-menu li a[href="' + document.location.href + '"]').parents('div.collapse').addClass('show'); 33 34 if( $(window).width() <= 980 ){ 35 $('div.ets_mm_megamenu li.mm_menus_li a[href="' + document.location.href + '"]').addClass('bold'); 36 $('div.ets_mm_megamenu li.mm_menus_li a[href="' + document.location.href + '"]').parents('ul.ets_mm_categories').addClass('active'); 37 $('div.ets_mm_megamenu li.mm_menus_li a[href="' + document.location.href + '"]').parents('ul.ets_mm_categories').prev('.arrow').removeClass('closed').addClass('opened'); 38 39 $('div.ets_mm_megamenu li.mm_menus_li a[href="' + document.location.href + '"]').parents('.mm_menus_li').addClass('active'); 40 $('div.ets_mm_megamenu li.mm_menus_li a[href="' + document.location.href + '"]').parents('.mm_menus_li').find(' > .arrow').removeClass('closed').addClass('opened'); 41 $('div.ets_mm_megamenu li.mm_menus_li a[href="' + document.location.href + '"]').parents('.mm_menus_li').find(' > ul.mm_columns_ul').addClass('active'); 42 } 43 44 if( $('body').is('#checkout') ){ 45 $('div.delivery-option input[type="radio"]').change(function(){ 46 if( parseInt($(this).val()) == 9999 ){ 47 $('section#checkout-delivery-step form#js-delivery button[name="confirmDeliveryOption"]').hide(); 48 $('section#checkout-delivery-step form#js-delivery div#delivery').hide(); 49 $('section#checkout-payment-step').hide(); 50 $('section#checkout-delivery-step div#quote-form').show(); 51 } else{ 52 $('section#checkout-delivery-step form#js-delivery button[name="confirmDeliveryOption"]').show(); 53 $('section#checkout-delivery-step form#js-delivery div#delivery').show(); 54 $('section#checkout-payment-step').show(); 55 $('section#checkout-delivery-step div#quote-form').hide(); 56 } 57 }); 58 } 59 60 $('select#select-sort-order').click(function(){ 61 var $new_ext = ''; 62 if( location.search != '' ){ 63 if( location.search.includes("q=") ){ 64 var $ext_raw = location.search.split("q="); 65 $new_ext = $ext_raw[1]; 66 } 67 } 68 69 $('select#select-sort-order option').each(function(){ 70 var $option_url = [$(this).attr('value')]; 71 if( $(this).attr('value').includes("&q=") ){ 72 var $option_url = $(this).attr('value').split("&q="); 73 } 74 75 if( $new_ext != '' ){ 76 $(this).attr('value', $option_url[0] + "&q=" + $new_ext); 77 } else{ 78 $(this).attr('value', $option_url[0]); 79 } 80 }); 81 }); 82 83 document.addEventListener('scroll', handleInteraction); 84 document.addEventListener('mousedown', handleInteraction); 85 document.addEventListener('mousemove', handleInteraction); 86 document.addEventListener('keydown', handleInteraction); 87 88 function handleInteraction(evt){ 89 $('img').each(function(){ 90 if( $(this).is("[del-src]") ){ 91 $(this).attr('src', $(this).attr('del-src')); 92 $(this).removeAttr('del-src'); 93 } 94 }); 95 96 document.removeEventListener('scroll', handleInteraction, true); 97 document.removeEventListener('mousedown', handleInteraction, true); 98 document.removeEventListener('mousemove', handleInteraction, true); 99 document.removeEventListener('keydown', handleInteraction, true); 100 } 101 102 $('body').on('change', 'div#onepagecheckoutps input#customer_firstname', function(){ 103 $('div#onepagecheckoutps div#field_delivery_firstname input#delivery_firstname').val($(this).val()); 104 }); 105 106 $('body').on('change', 'div#onepagecheckoutps input#customer_lastname', function(){ 107 $('div#onepagecheckoutps div#field_delivery_lastname input#delivery_lastname').val($(this).val()); 108 }); 109 110 if( $('body').is('#product') ){
111 $('button.product-layer-zoom').click(function(){ 112 113 if( typeof $(this).attr('src') != "undefined" ){ 114 $(this).attr('src', $(this).attr('src').replace('-test_dun', '') ); 115 } 116 117 if( typeof $(this).attr('data-src') != "undefined" ){ 118 $(this).attr('src', $(this).attr('data-src').replace('-test_dun', '') ); 119 } 120 }); 121 } 122 123 $('.manuf_img_menu').hover(function(){ 124 if( $(this).find('img[manuf-src]') ){ 125 $('img').each(function(){ 126 if( $(this).is('[manuf-src]') ){ 127 $(this).attr('src', $(this).attr('manuf-src')); 128 } 129 }); 130 } 131 }); 132 133 $('.manuf_img_menu').click(function(){ 134 if( $(this).find('img[manuf-src]') ){ 135 $('img').each(function(){ 136 if( $(this).is('[manuf-src]') ){ 137 $(this).attr('src', $(this).attr('manuf-src')); 138 } 139 }); 140 } 141 }); 142 143 if( $('body').is('#checkout') && $('div#onepagecheckoutps').length > 0 ){ 144 145 $('body').on('click', 'div#onepagecheckoutps button.quote__form', function(){ 146 console.log(2); 147 148 fillAndOpenModal(); 149 }); 150 151 $('div#onepagecheckoutps button.quote__form').click(function(){ 152 console.log(1); 153 154 fillAndOpenModal(); 155 }); 156 157 function fillAndOpenModal(){ 158 let $quoteForm = $('div#quote_modal div.gformbuilderpro_form form'); 159 160 let $mainCustomerForm = $('div#onepagecheckoutps form#form_customer'); 161 let $mainDeliveryForm = $('div#onepagecheckoutps form#form_address_delivery'); 162 163 let $fullName = ''; 164 if( $mainCustomerForm.find('input[name="customer_firstname"]').val() != '' ){ 165 $fullName = $mainCustomerForm.find('input[name="customer_firstname"]').val() + ' ' + $mainCustomerForm.find('input[name="customer_lastname"]').val(); 166 } 167 168 $quoteForm.find('input.input_77321').val($fullName); 169 $quoteForm.find('input.input_50844').val($mainCustomerForm.find('input#customer_email').val()); 170 171 $quoteForm.find('input.input_72948').val($mainDeliveryForm.find('input[name="delivery_phone"]').val()); 172 $quoteForm.find('input.input_33208').val($mainDeliveryForm.find('input[name="delivery_postcode"]').val()); 173 $quoteForm.find('input.input_73128').val($mainDeliveryForm.find('input[name="delivery_city"]').val()); 174 $quoteForm.find('input.input_73128').val($mainDeliveryForm.find('input[name="delivery_city"]').val()); 175 176 /*let $fullAddress = ''; 177 if( $mainDeliveryForm.find('input[name="delivery_address1"]').val() ){ 178 $fullAddress = $mainDeliveryForm.find('input[name="delivery_address1"]').val() + ' ' + $mainDeliveryForm.find('input[name="delivery_address2"]').val(); 179 } 180 $quoteForm.find('input.input_128').val($fullAddress);*/ 181 182 $quoteForm.find('input.input_128').val($mainDeliveryForm.find('input[name="delivery_address1"]').val()); 183 $quoteForm.find('input.input_85392').val($mainDeliveryForm.find('input[name="delivery_address2"]').val()); 184 185 $quoteForm.find('input.input_3088').val($('div#onepagecheckoutps form#form_address_delivery').find('select[name="delivery_id_country"] option:selected').text().trim()); 186 187 let $fullProductDesc = ''; 188 $('div#onepagecheckoutps_step_overview div.cart-detailed-totals div.cart_item').each(function(){ 189 190 let $productLine = ''; 191 $(this).find('.s_title_block > span').each(function(){ 192 if( $productLine.length > 0 ){ 193 $productLine += ' '; 194 } 195 196 $productLine += $(this).text().trim(); 197 }); 198 199 if( $fullProductDesc.length > 0 ){ 200 $fullProductDesc += '\n'; 201 } 202 203 $fullProductDesc += $productLine; 204 }); 205 206 207 $quoteForm.find('textarea.textarea_91667').val($fullProductDesc); 208 $('div#quote_modal').modal('show'); 209 } 210 } 211});
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.