VIEW SUBCATEGORIES
');$('.see-more-cats').fadeIn(150);} $(this).find('.see-more-cats').on('click',function(){var hiddenLinks=$(this).closest('.col-md-3.cat').find('.hidden-links');hiddenLinks.css('height');hiddenLinks.css({'display':'block','height':'101%'});setTimeout(function(){hiddenLinks.css({'overflow-y':'auto'});},250);hiddenLinks.on('mouseleave',function(){setTimeout(function(){if(!hiddenLinks.is(':hover')){hiddenLinks.css('height');hiddenLinks.css('height','0%');hiddenLinks.css('overflow-y','hidden');setTimeout(function(){hiddenLinks.css('display','none');},150);}},500);})})}});$('.col-md-3.cat').on('mouseleave',function(){$(this).find($('.see-more-cats')).fadeOut(150,function(){$(this).remove();});});} function leftNavSeeMore() {var lightology,edge,foscarini,tech,flos,moooi,minka,modernfan,third,liCount;liCount=$('#menuitem_vend').find('li').not('li.subcat, .view_all').length;if(liCount>1){lightology=$('#menuitem_vend').find('span:contains("Collection")').closest('li').clone();edge=$('#menuitem_vend').find('span:contains("Edge Lighting")').closest('li').clone();minka=$('#menuitem_vend').find('span:contains("Minka Aire")').closest('li').detach();modernfan=$('#menuitem_vend').find('span:contains("Modern Fan")').closest('li').detach();}else{lightology=null;edge=null;} foscarini=$('#menuitem_vend').find('span:contains("Foscarini")').closest('li');tech=$('#menuitem_vend').find('span:contains("Tech Lighting")').closest('li');flos=$('#menuitem_vend').find('span:contains("Flos USA")').closest('li');moooi=$('#menuitem_vend').find('span:contains("Moooi")').closest('li');if(foscarini.length>1){third=foscarini.detach();}else if(tech.length>1){third=tech.detach();}else if(flos.length>1){third=flos.detach();}else if(moooi.length>1){third=moooi.detach();}else{third=null;} if(liCount===0){$('#menuitem_vend').find('li').first().after(lightology,edge,minka,modernfan,third);}else{$('#menuitem_vend').find('li').first().before(lightology,edge,minka,modernfan,third);} $('[id^="menuitem_"]').each(function(){if($(this).find('.see_more').length){var $li=$(this).find('li:gt(5) a').not('.see_more');if(!$(this).hasClass('all')){$li.closest('li').hide();}}});$('.see_more').on('click',function(){var $li=$(this).closest('.subcat').find('li:gt(5) a').not('.see_more');if($(this).data().collapsed===true){$(this).data('collapsed',false);$li.closest('li').show();$(this).text('See less');}else{$(this).data('collapsed',true);$li.closest('li').hide();$(this).text('See more');}});} function dropdown_settimer(dropdown){current_dropdown=dropdown;closetimerdropdown=window.setTimeout(function(){$(dropdown).find(".dropmenu").slideUp();},dropdown_timeout);} function dropdown_canceltimer(){if(closetimerdropdown) {window.clearTimeout(closetimerdropdown);closetimertop=null;}} function catEventHandler() {$('body').on('click','.add-to-compare, .compare-box-wrapper .img-wrapper .remove',function(){handle_product_compare_link_click($(this))}).on('click','button.per-row-btn',function(){let $view_dropdown=$('.per-row-dropdown');if($view_dropdown.hasClass('active')){$view_dropdown.removeClass('active');}else{$view_dropdown.addClass('active');}}).on('click','button.sort-btn',function(){let $sort_dropdown=$('.sort-dropdown');if($sort_dropdown.hasClass('active')){$sort_dropdown.removeClass('active');}else{$sort_dropdown.addClass('active');}}).on('click','button.view-btn',function(){let $view_dropdown=$('.view-dropdown');if($view_dropdown.hasClass('active')){$view_dropdown.removeClass('active');}else{$view_dropdown.addClass('active');}}).on('click','.color_swatch',function(){handle_swatch_click($(this));}).on('click','.compare_table .remove',function(){handle_compare_remove_item_click($(this));}).on('click','.finish_swatch',function(){handle_swatch_click($(this));}).on('click','.flts-head',function(){let $this_icon=$(this).find('i');let $all_icons=$('#list-item-flts').find('i');let is_closed=$this_icon.hasClass('fa-plus');let filter=$(this).data('facetKey');$('.each-flts').slideUp();$all_icons.removeClass('fa-minus').addClass('fa-plus');if(is_closed){$(this).next().slideDown();$this_icon.toggleClass('fa-plus fa-minus');} if(search_filter_changed){search_filter_changed=false;window.location.href=build_search_url(true,false,filter);}}).on('mouseenter','.product_original_image',function(){let $next=$(this).next('.product_hover_image');$(this).hide();$next.show();}).on('mouseleave','.product_hover_image',function(){let $prev=$(this).prev('.product_original_image');$(this).hide();$prev.show();}).on('click','.remove-all',function(){handle_clear_all_click($(this))}).on('click','.add-to-compare.added a',function(e){e.stopPropagation();}).on('click','.card-header',function(){$(this).find('i').toggleClass('fa-chevron-down fa-chevron-up');}).on('click','#filter-flap','#selected-flts-btn',function(){let $flts_tog=$('#filters-side');let $close_head=$('.close-box-flts');let filters_mode='show';$('#filters-side').toggleClass('toggled') if($flts_tog.hasClass('toggled')){$close_head.css('padding','0');$('#filter-flap span.txt-show-hide').text('Show Filters');filters_mode='hide';}else{$close_head.css('padding','15px');$('#filter-flap span.txt-show-hide').text('Hide Filters');} if(window.matchMedia('only screen and (max-width: 820px)').matches){$('#filters-side').addClass('active').css('width','500px');$('#flts-backdrop').addClass('active')} let url='https://www.lightology.com/index.php?module=dispatcher';let filters_display=get_filters_display_values();let data='action=set_filters_show_hide&filters_mode='+filters_mode+'&filters_module='+filters_display.module+'&filters_id_key='+filters_display.id_key+'&filters_id_val='+filters_display.id_val;$.ajax({type:'POST',url:url,data:data,dataType:'json'});}).on('click','#filter-flap-mob',function(){$('#filters-side').toggleClass('toggled') if(window.matchMedia('only screen and (max-width: 820px)').matches){$('#filters-side').addClass('active').css('width','500px');$('#flts-backdrop').addClass('active')}}).on('change','form[name="compared_categories_form"] select',function(){$(this).closest('form').submit();}).on('click','.common-sort-label',function(){$(this).children('input').prop('checked',true);let value=$('input[name="sort-by"]:checked').val();window.location='https://www.lightology.com/index.php?module=set_session&key=sort_by&value='+value;}).on('click','.sets-sort-label',function(){$(this).children('input').prop('checked',true);let value=$('input[name="sets-sort-by"]:checked').val();window.location='https://www.lightology.com/index.php?module=set_session&key=sets_sort_by&value='+value;}).on('click','.per-row-label',function(){$(this).children('input').prop('checked',true);let value=$('input[name="per-row"]:checked').val();window.location='https://www.lightology.com/index.php?module=set_session&key=products_per_row_category&value='+value;}).on('click','.view-label',function(){$(this).children('input').prop('checked',true);let value=$('input[name="view-by"]:checked').val();window.location='https://www.lightology.com/index.php?module=set_session&key=record_limit&value='+value;})} var $myAccordion=$('#accordion-recessed');$myAccordion.on('show.bs.collapse','.collapse',function(){$myAccordion.find('.collapse.in').collapse('hide');});$(function(){$('[data-toggle="tooltip"]').tooltip()}) $(document).click(function(e){if($(e.target).is('.per-row-dropdown, button.per-row-btn, button.per-row-btn span')===false){$('.per-row-dropdown').removeClass('active');} if($(e.target).is('.sort-dropdown, button.sort-btn, button.sort-btn span')===false){$('.sort-dropdown').removeClass('active');} if($(e.target).is('.view-dropdown, button.view-btn, button.view-btn span')===false){$('.view-dropdown').removeClass('active');} let targets='.flts-head, .flts-head span, .flts-head i.fa.fa-minus, .flts-head img, .filter_line input, '+'.filter_line label, .filter_line span';if($(e.target).is(targets)===false){let $all_icons=$('#list-item-flts').find('i');$('.each-flts').slideUp();$all_icons.removeClass('fa-minus').addClass('fa-plus');if(search_filter_changed){search_filter_changed=false;window.location.href=build_search_url(true,false,false);}}});$('#flts-backdrop, #close-filters-side').on('click',function(){$('#flts-backdrop').removeClass('active');$('#filters-side').removeClass('active').css('width','0');const button=document.getElementById('view_results_button');button.click();});;const SEND_WISHLIST_EMAIL=1;const PREVIEW_WISHLIST_EMAIL=2;let saved_button;var spinner=$('% markup (from '+$this.data('mkup-lo')+'% to '+$this.data('mkup-hi')+'%)*
'+'*Prices will not go higher than retail price, so maximum markup may vary.
';$('#wl_email_price_warning').html(html);break;default:$('#wl_email_price_warning').html('');$('#wl_email_markup_input').remove();break;}} function handle_email_wishlist_request(request_type) {let url='https://www.lightology.com/index.php?module=dispatcher';let data='action=process_email_wishlist_request&request_type='+request_type;let $email_dialog_message=$('#email_dialog_message');$email_dialog_message.html('');data+='&'+$('#form-email-wishlist').serialize();$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {if(data){let $modal_content=$('.modal-content');let $static_display_email=$('#static-display-email');switch(data.code){case 0:$static_display_email.height(650);$modal_content.height(690);$modal_content.width(600);$email_dialog_message.html(data.message);break;case 1:$email_dialog_message.html('');if(request_type===PREVIEW_WISHLIST_EMAIL){let item_count=data.item_count;let modal_content_height=1360+item_count*420;let static_display_email_height=1220+item_count*420;$static_display_email.height(static_display_email_height);$modal_content.height(modal_content_height);$modal_content.width(700);$('#wl_preview_email_section').html(data.html);} else if(request_type===SEND_WISHLIST_EMAIL){$('#wl_preview_email_section').html('');$static_display_email.height(680);$modal_content.height(750);$modal_content.width(600);$('#email_dialog_message').html(data.html);setTimeout(function(){$('#emailModal').modal('hide');},2500);} break;}}},error:function(){$('#email_dialog_message').html('Unable to send email - please try again later');}});} function handle_item_quantity_focusout($this){let quantity=$this.val();if(quantity.length>0){quantity=parseInt(quantity,10);if(quantity<1){$this.val('1');}}else{$this.val('1');}} function handle_item_quantity_dec_click($this){let prod_id=$this.data('prodId');let $quantity=$('#quantity_'+prod_id);let quantity=parseInt($quantity.val(),10);if(quantity>1){$quantity.val(quantity-1);}} function handle_item_quantity_inc_click($this){let prod_id=$this.data('prodId');let $quantity=$('#quantity_'+prod_id);let quantity=parseInt($quantity.val(),10);if(quantity<999){$quantity.val(quantity+1);}} function handle_item_quantity_key(event){let key=event.which;if((key<48||key>57)&&key!=8&&key!=9&&key!=35&&key!=36&&key!=46) {event.preventDefault();}} function handle_move_to_button_click($this){if(move_buttons_enabled){let prod_id=$this.data('prodId');selected_item=prod_id;$('#moveModal').modal('show');}} function handle_move_to_submit(){let wishlist_id=$('#move_to_wishlist option:selected').val();let data='';if(wishlist_id<1){$('#move_to_wishlist_error').text('Please select a list');}else{let mode=$('input[name="wishlist_move_mode"]:checked').val();if(selected_item>0){selected_items=[];selected_items.push(selected_item);selected_item=0;} if(selected_items.length>0){let url='https://www.lightology.com/index.php?module=dispatcher';let prod_ids=get_available_selected_item_prod_ids();let quantities=get_available_selected_item_quantities();if(mode==='cut'){let from_wishlist_id=parseInt($('span#wishlist_id').text(),10);data='action=move_to_wishlist&from_wishlist_id='+from_wishlist_id+'&to_wishlist_id='+ wishlist_id+'&prod_id='+prod_ids.join('|')+'&quantity='+quantities.join('|');}else{data='action=copy_to_wishlist&wishlist_id='+wishlist_id+'&prod_id='+prod_ids.join('|')+'&quantity='+quantities.join('|');} $.ajax({type:'POST',url:url,data:data,dataType:'json',success:function() {window.location='https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id;},error:function(){window.location='https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id;}});}}} function handle_print_wishlist_click() {let url='https://www.lightology.com/index.php?module=dispatcher';let wishlist_id=parseInt($('span#wishlist_id').text(),10);let data='action=build_print_wishlist_html&wishlist_id='+wishlist_id;if(wishlist_id>0){$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {if(data){let printer=window.open('','');printer.document.write(data);printer.document.close();printer.print();printer.close();}}});}} function handle_remove_selected_items_click() {if(selected_items.length<1){return;} $('#removeSelectedModal').modal('show');} function handle_remove_selected_items_submit() {let wishlist_id=parseInt($('span#wishlist_id').text(),10);let prod_ids=selected_items.join(':');let data='&wishlist_id='+wishlist_id+'&prod_ids='+encodeURIComponent(prod_ids);window.location='https://www.lightology.com/index.php?module=dispatcher&action=remove_items_from_wishlist'+data;} function handle_rename_wishlist_submit() {let url='https://www.lightology.com/index.php?module=dispatcher';let wishlist_id=parseInt($('span#wishlist_id').text(),10);let wishlist_name=encodeURIComponent($('input[name="rename_wishlist_name"]:first').val());let data='action=rename_wishlist&wishlist_id='+wishlist_id+'&wishlist_name='+wishlist_name;if(wishlist_id>0){$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {if(data){switch(data.code){case 0:$('#rename_wishlist_error').html(data.content);break;case 1:window.location='https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id;break;}}}});}} function handle_save_cart_to_wishlist_click() {let url='https://www.lightology.com/index.php?module=dispatcher';let data='action=save_cart_to_wishlist';$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data){if(data){switch(data.code){case 1:$('.wishlist_count').html(data.count.toString());$('li.wishlist').addClass('active');show_wishlist_dialog(data.content);break;case 2:show_wishlist_dialog(data.content);$('input[name="wishlist_select"]:eq(0)').prop('checked',true);break;}}}});} function handle_save_cart_to_wishlist_submit($this) {let url='https://www.lightology.com/index.php?module=dispatcher';let data='action=save_cart_to_wishlist';data+='&'+$this.serialize();$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data){if(data.code==1){$('.wishlist_count').html(data.count.toString());$('li.wishlist').addClass('active');$('#wishlist_dialog_error_message').html('');$('#wishlist_dialog_success_message').html(data.content);}else{$('#wishlist_dialog_success_message').html('');$('#wishlist_dialog_error_message').html(data.content);}},error:function(){$('#wishlist_dialog_success_message').html('');$('#wishlist_dialog_error_message').html('A system error has occurred - changes may not have been saved');}});} function handle_select_action_cancel_click() {$('.select_wishlist_item').each(function(){$(this).prop('checked',false);handle_select_wishlist_item_click($(this));});selected_items=[];$('.action-bar').removeClass('active');move_buttons_enabled=true;} function handle_select_all_items_click() {if($('#select_all_items').is(':checked')){selected_items=[];$('.select_wishlist_item').each(function(){$(this).prop('checked',true);handle_select_wishlist_item_click($(this));});}else{$('.select_wishlist_item').each(function(){$(this).prop('checked',false);handle_select_wishlist_item_click($(this));});selected_items=[];}} function handle_select_wishlist_item_click($this) {let prod_id=parseInt($this.data().prodId,10);let item_offset=selected_items.indexOf(prod_id);if(item_offset>-1){selected_items.splice(item_offset,1);}else{selected_items.push(prod_id);} console.log(selected_items.join(' '));if(selected_items.length>0){$('.action-bar').addClass('active');move_buttons_enabled=false;}else{$('.action-bar').removeClass('active');move_buttons_enabled=true;} let all=$('.select_wishlist_item').length;let checked=$('.select_wishlist_item:checked').length;if(checked===all){$('#select_all_items').prop('checked',true);}else{$('#select_all_items').prop('checked',false);}} function update_wishlist_item_notes($this) {let url='https://www.lightology.com/index.php?module=dispatcher';let prod_id=parseInt($this.data().prodId,10);let wishlist_id=parseInt($this.data().wishlistId,10);let type=$('#type_'+prod_id).val();let room=$('#room_'+prod_id).val();let note=$('#note_'+prod_id).val();let data='action=update_wishlist_item_notes&wishlist_id='+wishlist_id+'&prod_id='+prod_id+'&type='+encodeURIComponent(type)+'&room='+encodeURIComponent(room)+'¬e='+ encodeURIComponent(note);let button=$this;let div=$this.closest('div');button.replaceWith('Saving…');$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function() {div.find('span').replaceWith('Saved');div.find('span').fadeOut(1000,function(){$(this).replaceWith(button);});let room_note='';if(room.length>0){room_note=room;if(note.length>0){room_note=room_note+' / '+note;}} else if(note.length>0){room_note=note;} room_note=' Notes: '+room_note;$('#wishlist_room_note_'+prod_id).text(room_note);}});} function update_wishlist_item_quantity($this) {let url='https://www.lightology.com/index.php?module=dispatcher';let prod_id=parseInt($this.data().prodId,10);let wishlist_id=parseInt($this.data().wishlistId,10);let quantity=parseInt($('#quantity_'+prod_id).val(),10);let data='action=update_wishlist_item_quantity&wishlist_id='+wishlist_id+'&prod_id='+prod_id+'&quantity='+quantity;let $div=$this.closest('div.update_wishlist_item_quantity_div');let a=$div.find('a');a.replaceWith('Updating…');$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {$div.find('span').replaceWith(data.message);$div.find('span').fadeOut(1000,function(){$(this).replaceWith(a);});if(data.subtotal){$('#price_subtotal_'+prod_id).html(data.subtotal);} if(data.total){$('#wishlist_total').html(data.total);}}});} $(document).ready(function(){$(window).on('scroll',function(){let scrollTop=$(window).scrollTop();if(scrollTop>50){$('.action-bar').stop().css("padding","12px 20px 15px");$('.scroll-fx').stop().css("height","25px");} else{$('.action-bar').stop().css("padding","50px 20px");$('.scroll-fx').stop().css("height","50px");}});if(matchMedia('only screen and (max-width: 820px)').matches){$(".wishlist-collapse").hide();} $('body').on('click','#add_selected_items_to_cart',function(event){event.preventDefault();handle_add_selected_items_to_cart_click();}).on('click','#add_to_wishlist, #add_to_wishlist_new',function(event){event.preventDefault();handle_add_to_wishlist_click();}).on('submit','form[name="add_to_wishlist"]',function(event){event.preventDefault();handle_add_to_wishlist_submit($(this));}).on('click','.atc-btn',function(event){event.preventDefault();handle_add_wishlist_item_to_cart_click($(this));}).on('click','#atc-total',function(event){event.preventDefault();handle_add_all_items_to_cart_click();}).on('click','.collapse-list',function(){$(this).next('.wishlist-collapse').slideToggle('fast');$(this).toggleClass('list-open');$(this).find('i').toggleClass('fa fa-plus fa fa-minus');}).on('keypress','input[name="create_wishlist_name"]',function(event){let key=event.which;if(key==13){event.preventDefault();handle_create_wishlist_submit();}}).on('click','#submit-new-inquiry',function(event){event.preventDefault();handle_create_wishlist_submit();}).on('click','#submit-remove-list',function(event){event.preventDefault();handle_delete_wishlist_submit();}).on('click','.dropbtn',function(){$(this).next(".dropdown-content").slideToggle("fast");$(this).text($(this).text()=='Show Options and Notes'?'Hide Options and Notes x':'Show Options and Notes');}).on('click','#email_wishlist',function(event){event.preventDefault();handle_email_wishlist_click();}).on('focusout','.item_quantity',function(event){event.preventDefault();handle_item_quantity_focusout($(this));}).on('keydown','.item_quantity',function(event){handle_item_quantity_key(event);}).on('click','.item_quantity_dec',function(){handle_item_quantity_dec_click($(this));}).on('click','.item_quantity_inc',function(){handle_item_quantity_inc_click($(this));}).on('click','.modal-header .close',function(){$('#wishlist_quickview_box').empty();$('#wishlist_quickview_box').removeAttr("style")}).on('click','.move-btn',function(event){event.preventDefault();handle_move_to_button_click($(this));}).on('click','#submit-move-list',function(event){event.preventDefault();handle_move_to_submit();}).on('click','#move_selected_items',function(event){event.preventDefault();$('#moveModal').modal('show');}).on('click','#print_wishlist',function(event){event.preventDefault();handle_print_wishlist_click();}).on('click','#remove_selected_items',function(){handle_remove_selected_items_click();}).on('click','#submit-remove-selected',function(event){event.preventDefault();handle_remove_selected_items_submit();}).on('click','#rename_wishlist_submit',function(event){event.preventDefault();handle_rename_wishlist_submit();}).on('click','#save_cart_to_wishlist',function(event){event.preventDefault();handle_save_cart_to_wishlist_click();}).on('submit','form[name="save_cart_to_wishlist"]',function(event){event.preventDefault();handle_save_cart_to_wishlist_submit($(this));}).on('click','#search_wishlist',function(){let wishlist_id=$('#search_wishlist_id').val();window.location.href=('https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id);}).on('keypress','#search_wishlist_id',function(event){let key=event.which;if(key==13){event.preventDefault();let wishlist_id=$('#search_wishlist_id').val();window.location.href=('https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id);}}).on('click','#select_action_cancel',function(event){event.preventDefault();handle_select_action_cancel_click();}).on('click','#select_all_items',function(){handle_select_all_items_click();}).on('click','.select_wishlist_item',function(){handle_select_wishlist_item_click($(this));}).on('click','#submit-email-list',function(event){event.preventDefault();handle_email_wishlist_request(SEND_WISHLIST_EMAIL);}).on('click','#submit-preview-list',function(event){event.preventDefault();handle_email_wishlist_request(PREVIEW_WISHLIST_EMAIL);}).on('click','.update_wishlist_item_notes',function(event){event.preventDefault();update_wishlist_item_notes($(this));}).on('click','.update_wishlist_item_quantity',function(event){event.preventDefault();update_wishlist_item_quantity($(this));}).on('change','select[name="wishlist_email_pricing"]',function(){handle_email_wishlist_pricing_change($(this));}).on('click','.wishlist_prod_sku',function(event){event.preventDefault();let temp=$('');$('body').append(temp);temp.val($(this).text()).select();document.execCommand('copy');temp.remove();});});