1function setCookie(cname, cvalue, exdays) { 2var d = new Date(); 3d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 4var expires = "expires="+d.toUTCString(); 5document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 6} 7function getCookie(cname) { 8var name = cname + "="; 9var ca = document.cookie.split(';'); 10for(var i = 0; i < ca.length; i++) { 11var c = ca[i]; 12while (c.charAt(0) == ' ') { 13c = c.substring(1); 14} 15if (c.indexOf(name) == 0) { 16return c.substring(name.length, c.length); 17} 18} 19return ""; 20} 21function load_modal_pop_up() { 22var modal_cookie = getCookie("modal_popup_closed"); 23if (modal_cookie == "") { 24$('#modal-pop-up').modal('show'); 25$('#modal-pop-up').on('shown.bs.modal', function () { 26var contentHeight = $(this).find('.is3-comp-advanced-content').height(); 27$(this).find('.modal-body').css({ 28'height': contentHeight + 120 + 'px' 29}); 30}); 31} 32} 33$(function(){ 34load_modal_pop_up(); 35$('#modal-pop-up').on('hide.bs.modal', function (e) { 36setCookie('modal_popup_closed', 'true', 14); 37}) 38//= Basket amount 39var basket_amount_path = 'order_amount_ex_vat'; 40$('.basket-amount-value').load("https://www.specflue.com/special/ajax/" + basket_amount_path); 41//= Product thumbnail 42$('.is3-product-thumbnail-placeholder').each(function(){ 43link = $(this).find('a'); 44targeturl = encodeURIComponent(link.attr('href')); 45$.ajax({ 46url: "https://www.specflue.com/product/"+ $(this).attr("data-esku") +"/view:thumbnail/", 47type: "POST", 48data: "target=" + targeturl, 49context: $(this), 50success: function(returnedData) { 51$(this).replaceWith(returnedData); 52} 53}); 54}); 55$('body').on('click', '.is3-tradeproduct-order-qty-add', function(){ 56AddToOrder($(this)); 57}); 58$('body').on('keypress', '.is3-tradeproduct-order-qty', function(e){ 59if(e.which == 13){ 60AddToOrder($(this)); 61} 62}); 63//= Add product to order 64function AddToOrder(c){ 65var thumb = $(c).closest('.is3-global-add-to-order'); 66var sku_to_add = thumb.find("input[name='esku']").val(); 67var min_mult = thumb.find("input[name='minmult']").val(); 68var freetype4 = thumb.find("input[name='freetype4']").val(); 69var productgroup = thumb.find("input[name='product-group']").val(); 70var productgroupqtylabel = thumb.find("input[name='productgroupqtylabel']").val(); 71var qty_txt_box = thumb.find("input[name='qty']"); 72var info_cont = thumb.find('.is3-tradeproduct-order-qty-add'); 73var spinner = thumb.find('.loading'); 74var qty_on_order_cont = thumb.find('.is3-tradeproduct-qtyonorder'); 75var hide_qty_label = thumb.find("input[name='hide_qty_label']").val(); 76var qty_to_add = qty_txt_box.val(); 77info_cont.hide(); 78spinner.show(); 79$.ajax({ 80dataType: 'json', 81type: "POST", 82url: "https://www.specflue.com/trade/php_cust/specflue/ajax/add_order_line_engine2.php", 83data: "action=AddItemAJAX&SKU="+sku_to_add+"&qty=" + qty_to_add+"&freetype4="+freetype4, 84success: function( result ){ 85spinner.hide(); 86info_cont.show(); 87if(hide_qty_label == 'true') 88{ 89qty_on_order_cont.html( result.qty_on_order); 90} 91else { 92if (typeof productgroup === 'undefined') 93{ 94if (freetype4 == "N") { 95qty_on_order_cont.html("Qty Ordered: " + result.qty_on_order); 96} else { 97qty_on_order_cont.html(result.qty_on_order); 98} 99} 100else 101{ 102if (productgroupqtylabel == "Y") { 103qty_on_order_cont.html("Total Metres Ordered: " + result.qty_on_order); 104} else { 105qty_on_order_cont.html("Qty Ordered: " + result.qty_on_order); 106} 107} 108} 109qty_on_order_cont.hide(); 110qty_on_order_cont.removeClass('hidden'); 111qty_on_order_cont.fadeIn('fast'); 112$('.basket-amount-value').load("https://www.specflue.com/special/ajax/" + basket_amount_path); 113} 114}); 115qty_txt_box.val(min_mult); 116} 117//= Lightboxes for product details 118$('[rel=lightbox]').fancybox({ 119'cyclic' : true, 120'opacity' : true, 121'overlayColor' : '#333', 122'overlayOpacity' : '0.8', 123'padding' : 10, 124'autoScale' : false, 125'transitionIn' : 'fade', 126'transitionOut' : 'fade', 127'speedIn' : 400, 128'speedOut' : 400, 129'title' : this.title 130}); 131$(".fancybox").fancybox({ 132'overlayColor' : '#333', 133'overlayOpacity' : '0.8', 134'transitionIn' : 'none', 135'transitionOut' : 'none', 136'width' : 680, 137'height' : 495, 138padding: 0, // remove white border 139preload: true 140}); 141$(".fancyboxvideo") 142.attr('rel', 'gallery') 143.fancybox({ 144openEffect : 'none', 145closeEffect : 'none', 146nextEffect : 'none',
147prevEffect : 'none', 148padding : 0, 149margin : [20, 60, 20, 60] // Increase left/right margin 150}); 151//= Login Panel 152$('.login-panel-btn').click(function(event){ 153event.preventDefault(); 154if($('#is3-sec-top-login-placeholder').length){ 155$.ajax({ 156url: "https://www.specflue.com/special/ajax/trade_login/", 157success: function(returnedData) { 158$('#is3-sec-top-login-placeholder').replaceWith(returnedData); 159$('#is3-sec-top-login').slideToggle('fast','linear'); 160} 161}); 162} 163else 164{ 165$('#is3-sec-top-login').slideToggle(); 166} 167if($('#login-tab-text').html() == 'Login / Register') 168{ 169$('#login-tab-text').html('Close <i class="fa fa-close"></i>'); 170} 171else 172{ 173$('#login-tab-text').html('Login / Register'); 174} 175$(".login-tab .fa-chevron-up").toggle(); 176$(".login-tab .fa-chevron-down").toggle(); 177}); 178$('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) { 179// Avoid following the href location when clicking 180event.preventDefault(); 181// Avoid having the menu to close when clicking 182event.stopPropagation(); 183// Re-add .open to parent sub-menu item 184$(this).parent().addClass('open'); 185$(this).parent().find("ul").parent().find("li.dropdown").addClass('open'); 186}); 187// $('.is3-productgroup-thumbnail-img').each(function(){ 188// $i = $(this).find('img'); 189// alert($i.attr('src')); 190// $(this).css('background-image', 'url("'+$i.attr('src')+'")'); 191// $i.hide(); 192// }); 193//Show/hide dropdown sub-menus in header navigation bar 194$("#is3-sec-top-2 .navbar-default .dropdown").on('mouseenter', function() { 195if (!$('.navbar-toggle').is(':visible')) { //If the mobile navigation is not present 196$(this).addClass("open"); 197} 198}); 199$("#is3-sec-top-2 .navbar-default .dropdown").on('mouseleave', function() { 200if (!$('.navbar-toggle').is(':visible')) { //If the mobile navigation is not present 201$(this).removeClass("open"); 202} 203}); 204//Prevent a dropdown click from triggering the "close" event. This stops the dropdown flashing in and out on click. 205$("#is3-sec-top-2 .navbar-default .dropdown-menu a").click(function(e) { 206e.stopPropagation(); 207}); 208//adapted from https://codepen.io/rtpHarry/pen/YPBydd/?editors=1000 209(function() { 210// setup your carousels as you normally would using JS 211// or via data attributes according to the documentation 212// https://getbootstrap.com/javascript/#carousel 213$('#additional-images-carousel').carousel({ 214interval: 0 215}); 216}()); 217/* Multiple carousel items, scrolling one at a time */ 218$(function () { 219// setup your carousels as you normally would using JS 220// or via data attributes according to the documentation 221// https://getbootstrap.com/javascript/#carousel 222$('.carousel-showmanymoveone').carousel({ 223interval: 3000 224}); 225}); 226(function(){ 227var numberToDisplay = 6; 228if (window.innerWidth >= 992) { 229numberToDisplay = 6; 230} else if (window.innerWidth >= 768) { 231numberToDisplay = 4; 232} else if (window.innerWidth < 768 ) { 233numberToDisplay = 3; 234} 235$('.carousel-showmanymoveone .item').each(function(){ 236var itemToClone = $(this); 237for (var i=1;i<numberToDisplay;i++) { 238itemToClone = itemToClone.next(); 239// wrap around if at end of item collection 240if (!itemToClone.length) { 241itemToClone = $(this).siblings(':first'); 242} 243// grab item, clone, add marker class, add to collection 244itemToClone.children(':first-child').clone() 245.addClass("cloneditem-"+(i)) 246.appendTo($(this)); 247} 248}); 249}()); 250(function() { 251$('#additional-images-carousel .item').each(function() { 252var itemToClone = $(this); 253for (var i = 1; i < 3; i++) { 254itemToClone = itemToClone.next(); 255// wrap around if at end of item collection 256if (!itemToClone.length) { 257itemToClone = $(this).siblings(':first'); 258} 259// grab item, clone, add marker class, add to collection 260itemToClone.children(':first-child').clone() 261.addClass("cloneditem-" + (i)) 262.appendTo($(this)); 263} 264}); 265}()); 266// currently on so change to off and reload page to refresh results 267$('.hide-out-stock-on').click(function(){ 268$.ajax({ 269url: "https://www.specflue.com/php/is3/ajax/show_hide_out_stock_products.php", 270data: "action=change_in_out_stock_flag&show_out_stock_products=false", 271success: function( result ){ 272$('.hide-out-stock-on').hide(); 273$('.hide-out-stock-off').show(); 274} 275}); 276window.location.reload() 277}); 278// currently off so change to on and reload page to refresh results 279$('.hide-out-stock-off').click(function(){ 280$.ajax({ 281url: "https://www.specflue.com/php/is3/ajax/show_hide_out_stock_products.php", 282data: "action=change_in_out_stock_flag&show_out_stock_products=true", 283success: function( result ){ 284$('.hide-out-stock-off').hide(); 285$('.hide-out-stock-on').show(); 286} 287}); 288window.location.reload() 289}); 290$('.is3-trade-stock-notification-add').click(function(event){ 291var sn_container = $(this).closest('.is3-trade-stock-notification-container');
292var stock_notification_setup = sn_container.find(".is3-trade-stock-notification-setup"); 293var stock_notification_info = sn_container.find(".is3-trade-stock-notification-info"); 294var esku = sn_container.find("input[name='esku']").val(); 295var notification_email_address = sn_container.find(".is3-trade-stock-notification-setup-email-address").val(); 296var info_email = sn_container.find(".is3-trade-stock-notification-info-email-address"); 297$.ajax({ 298dataType: 'json', 299url: "https://www.specflue.com/trade/php_cust/default/ajax/stock_notification.php", 300data: "action=add&email_address="+notification_email_address+"&esku="+esku, 301success: function( result ){ 302if(result.status == "invalid_email_address") 303{ 304alert("Please enter a valid email address"); 305} 306else 307{ 308info_email.html(notification_email_address); 309stock_notification_setup.hide(); 310stock_notification_info.show(); 311} 312} 313}); 314}); 315$('.is3-trade-stock-notification-remove').click(function(){ 316var sn_container = $(this).closest('.is3-trade-stock-notification-container'); 317var stock_notification_setup = sn_container.find(".is3-trade-stock-notification-setup"); 318var stock_notification_info = sn_container.find(".is3-trade-stock-notification-info"); 319var esku = sn_container.find("input[name='esku']").val(); 320var notification_email_address = sn_container.find(".is3-trade-stock-notification-setup-email-address"); 321var info_email = sn_container.find(".is3-trade-stock-notification-info-email-address"); 322$.ajax({ 323dataType: 'json', 324url: "https://www.specflue.com/trade/php_cust/default/ajax/stock_notification.php", 325data: "action=remove&esku="+esku, 326success: function( result ){ 327notification_email_address.val(""); 328info_email.html(""); 329stock_notification_info.hide(); 330stock_notification_setup.show(); 331} 332}); 333}); 334function get_stock_notification_status(esku ,callback) { 335$.ajax({ 336dataType: 'json', 337url: "https://www.specflue.com/trade/php_cust/default/ajax/stock_notification.php", 338data: "action=check&esku="+ esku, 339cache: false, 340success: function(result){ 341callback(result); 342} 343}); 344} 345$('.is3-trade-stock-notification-container').each(function() { 346var stock_notification_setup = $(this).find(".is3-trade-stock-notification-setup"); 347var stock_notification_info = $(this).find(".is3-trade-stock-notification-info"); 348var esku = $(this).find("input[name='esku']").val(); 349var notification_email_address = $(this).find(".is3-trade-stock-notification-setup-email-address").val(); 350var info_email = $(this).find(".is3-trade-stock-notification-info-email-address"); 351// console.log(stock_notification_info.html()); 352// console.log(stock_notification_setup.html()); 353get_stock_notification_status(esku,function(result) { 354// console.log(result); 355// console.log(stock_notification_info.html()); 356// console.log(stock_notification_setup.html()); 357if(result.status == 'stock_notification_on') 358{ 359info_email.html(result.notification_email_address); 360stock_notification_info.show(); 361stock_notification_setup.hide(); 362} 363else 364{ 365stock_notification_setup.show(); 366stock_notification_info.hide(); 367} 368}); 369}); 370CarouselInit( ".carousel", 3 ); 371function CarouselInit( carousel_cont, number_of_items ){ 372// console.log('hello world'); 373$(carousel_cont).carousel({ 374interval: 12000 375}); 376$(carousel_cont).on('slide.bs.carousel', function(event) { 377//event.preventDefault(); 378//console.log('sliding'); 379/* Act on the event */ 380}); 381} 382$('form[name=skoo_image_download]').on('submit', function (e) { 383e.preventDefault(); 384let ajaxData = $(this).serialize(); 385skooCloudImageDownload(ajaxData); 386}); 387$('button[name=skoo_image_download]').on('click', function (e) { 388e.preventDefault(); 389let ajaxData = {'trade_order': 1} 390skooCloudImageDownload(ajaxData); 391}); 392function skooCloudImageDownload(data) 393{ 394let skooModal = $('#skooImageDownloadModal'); 395$.ajax({ 396type: 'get', 397url: 'https://www.specflue.com/php/skoocloud/skoo_image_download.php', 398dataType: 'json', 399data: data, 400success: function (result) { 401// Create modal here 402if (result.items_processed > 0) 403{
404skooModal.find('.modal-body').text(result.items_processed + ' images have been queued and will be emailed to you shortly.'); 405} 406else 407{ 408skooModal.find('.modal-body').text('There are no available assets for these products.'); 409} 410skooModal.modal('show'); 411}, 412error: function () { 413// Create modal here 414skooModal.find('.modal-body').text('An Error occurred: Unable to queue selected images'); 415skooModal.modal('show'); 416} 417}); 418} 419$("#is3-sec-top-1,#is3-sec-top-2").find("[name='search_term']").keyup(function (event) { 420if(event.which == 13){ 421//stop any more searching on enter pressed 422$(this).closest('form').trigger('submit'); 423} 424if($(this).parent().find("[name='search_term']").val().length > 2) 425{ 426$(this).parent().find(".product-search-results").load( "https://www.specflue.com/php/is3/ajax/live_search.php?" + $.param({ search_term:$(this).parent().find("[name='search_term']").val() }), function(response, status, xhr ) { 427if(response){ 428$(this).parent().find(".product-search-results").css("display", "block"); 429} 430}); 431} 432else{ 433$(this).parent().find(".product-search-results").html(''); 434$(this).parent().find(".product-search-results").css("display", "none"); 435} 436}); 437$(document).click(function(e) 438{ 439var search_input_container = $(".is3-search-input"); 440// if the target of the click isn't the search container nor a descendant of the container 441if (!search_input_container.is(e.target) && search_input_container.has(e.target).length === 0) 442{ 443search_input_container.find(".product-search-results").hide(); 444} 445}); 446$(".is3-search-input").click(function(e) { 447if ($(this).find("[name='search_term']").val().length > 2) { 448$(this).find(".product-search-results").show(); 449} 450}); 451// modal box for related products 452$('#product-related-modal').on('show.bs.modal', function(e) { 453// show spinner icon 454let modalBody = $(this).find('.modal-body'); 455modalBody.html( 456'<div class="text-center"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span></div>'); 457const esku = $(e.relatedTarget).data('esku'); 458const title = $(e.relatedTarget).data('title'); 459const product_relation_type_id = $(e.relatedTarget). 460data('product-relation-type-id'); 461const show_substitute_products = $(e.relatedTarget). 462data('show-substitute-products'); 463// set title 464$(this).find('.modal-title').text(title); 465$(this).find('.modal-title').addClass('text-info'); 466$.ajax({ 467url: 'https://www.specflue.com/php/is3/ajax/product_related_modal.php', 468type: 'GET', 469data: { 470esku: esku, 471product_relation_type_id: product_relation_type_id, 472show_substitute_products: show_substitute_products, 473}, 474complete: function(html) { 475modalBody.html(html.responseText); 476}, 477}); 478}); 479$('a.product-related-link').on('click', function(event) { 480const target = $(this.getAttribute('href')); 481if (target.length) { 482event.preventDefault(); 483$('html, body').stop().animate({ 484scrollTop: target.offset().top - 50, 485}, 1000); 486} 487}); 488});
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.