PageSourceSearch

https://www.kingliving.com/pub/static/version1790693932/frontend/Playhouse/Kingliving/en_US/js/theme.min.js

js kingliving.com collected 2026-10-04 00:20:35 UTC 20,410 bytes, 44 lines download raw bytes

1requirejs(['jquery','underscore','jQueryTabs','owl.carousel','aos','slick'],function($,_,jQueryTabs,jQueryOwlCarousel,AOS){'use strict';var largeWidth=1800;var mediumWidth=1300;var smallWidth=768;var kingLiving={};function getCurrentScroll(){return window.pageYOffset||document.documentElement.scrollTop;}
2function equalHeight(group,onMobile){var ww=$(window).width();var tallest=0;if(typeof onMobile!='underfined'&&onMobile!=false){if(ww>=smallWidth){group.css('min-height','auto').each(function(){var thisHeight=$(this).outerHeight();if(thisHeight>tallest){tallest=thisHeight;}});group.css('min-height',tallest);}else{group.css('min-height','auto');}}else{group.css('min-height','auto').each(function(){var thisHeight=$(this).outerHeight();if(thisHeight>tallest){tallest=thisHeight;}});group.css('min-height',tallest);}}
3(function($,undefined){var customUI=kingLiving.customUI=function(opts){customUI.prototype._singletonInstance=this;opts=opts||{};var defaultOpts={'element':'.elementClassOrdId'};this.opts=$.extend(defaultOpts,opts);};customUI.prototype.init=function(){this.listBoxStyle();this.videoSection();this.removeCmsHiddenTag();this.cmsStickyNavigation();this.cmsTabs();this.cmsSlider();this.actionDimension();this.packagePopup();this.themeHelper();this.shareButton();this.imageSuperWide();this.slideSubMenuHome();this.urlAnchor();$(document).on("ubContentSlider:afterInit",function(){AOS.refresh();});};customUI.getInstance=function(){if(customUI.prototype._singletonInstance==undefined){customUI.prototype._singletonInstance=new kingLiving.customUI();}
4return customUI.prototype._singletonInstance;};customUI.prototype.themeHelper=function(){if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))||(navigator.userAgent.match(/iPad/i))){$('body').addClass('ios');}
5AOS.init({once:true});var ww=$(window).width();if(ww<smallWidth){if(jQuery('body').hasClass('cms-home')){jQuery('.outdoor-furniture').attr('data-aos-offset','0');jQuery('.cushion-ottomans').attr('data-aos-offset','20');}}
6$('.cms-home').find('.owl-wrapper-outer').removeAttr('style');$(window).on('resize',function(){$('.cms-home').find('.owl-wrapper-outer').removeAttr('style');});if($('.promotion').length==0){$('body').addClass('hide-promotion');}else{$('body').removeClass('hide-promotion');}
7if($('.section-slider').length==0){if($('.banner-section-video').length==0){$('body').addClass('no-slider');}}else{$('section-slider').removeClass('no-slider');}
8$('.product-label').each(function(){if($(this).length!=0){var label='label-'+$.trim($(this).text().toLowerCase());$(this).addClass(label);if($.trim($(this).text().toLowerCase())=="red special offer"){$(this).text("Special Offer");}}});};customUI.prototype.activeNav=function(){$('.nav-toggle').click(function(){$(this).toggleClass('active');$('html').toggleClass('menu-open');if($('.search_field:visible').length!=0){}});};customUI.prototype.removeCmsHiddenTag=function(){if($('.cms-template-wrap').length){$('.cms-template-wrap .hidden-in-frontend').remove();}};customUI.prototype.cmsStickyNavigation=function(){const stickyContainer='.cms-sticky-navigation .cms-sticky-content';const stickyWrap='.cms-sticky-navigation .cms-sticky-content ul';const anchorItem='.cms-anchor-item';if($(anchorItem).length===0&&$('body').hasClass('cms-page-view')){return;}
9if($('.cms-template-wrap.cms-sticky-navigation').length){$(stickyWrap).addClass('cms-sticky-links');if($(anchorItem).length){$(stickyWrap).find('li').remove();$(anchorItem).each(function(){let title=$(this).text();let name=$(this).find('a').attr('name');let className=$(this).find('a').attr('className');if(!className){className='';}
10if(className==='category'){$(stickyContainer).prepend('<h1 class="title">'+title+'</h1>');}else if(className==='shop'||name==='shop'){if(className!=='shop'){$(stickyWrap).append('<li><a href="#'+name+'" class="'+className+'shop action primary"><span><span>'+title+'</span></span></a></li>');}else{$(stickyWrap).append('<li><a href="#'+name+'" class="'+className+' action primary"><span><span>'+title+'</span></span></a></li>');}}else{$(stickyWrap).append('<li class="'+className+' section"><a href="#'+name+'"><span><span>'+title.toLowerCase()+'</span></span></a></li>');}});}
11if($('.cms-sticky-content h1.title').length===0&&!$('body').hasClass('cms-page-view')){const currentUrl=window.location.href;const urlParts=currentUrl.split('/');const lastSegment=urlParts.pop();const cleanedSegment=lastSegment.split('#')[0];const formattedTitle=cleanedSegment.replace(/-/g,' ').split(' ').map(word=>word.charAt(0).toUpperCase()+word.slice(1)).join(' ');$(stickyContainer).prepend('<h1 class="title">'+formattedTitle+'</h1>')}
12if($('.cms-sticky-links li a.shop').length===0){$(stickyWrap).append('<li><a href="#shop" class="shop action primary"><span><span>Buy Now</span></span></a></li>');$('#searchspring-product-list').prepend('<div class="cms-anchor-item"><a id="shop" name="shop" classname="shop"></a><span>Shop Packages</span></div>');}
13var liSticky=$(".cms-sticky-links .section");liSticky.on('mouseenter',function(){$(this).parent('.cms-sticky-links').addClass('hover');});liSticky.on('mouseleave',function(){$(this).parent('.cms-sticky-links').removeClass('hover');});}};customUI.prototype.cmsTabs=function(){if($('.cms-template-wrap.cms-tabs').length){$('.cms-template-wrap.cms-tabs').each(function(){if($(this).find('.hidden-in-frontend').length){$(this).find('.hidden-in-frontend').remove();}
14var autoSwitch=$(this).attr('data-auto-switch');var setDelay=3000;var tabsConfig={};if(autoSwitch==='true'){if($(this).attr('data-delay')!=''){setDelay=$(this).attr('data-delay');}
15tabsConfig={animation:true,animationspeed:500,autorotate:true,delay:parseInt(setDelay)}}else{tabsConfig={animation:true,animationspeed:500}}
16$(this).find('.tabs').jquerytabs(tabsConfig);});}};customUI.prototype.cmsSlider=function(){if($('.cms-template-wrap.cms-slider').length){$('.cms-template-wrap.cms-slider .owl-video').text('');$('.cms-template-wrap.cms-slider').each(function(){if($(this).find('.hidden-in-frontend').length){$(this).find('.hidden-in-frontend').remove();}
17var options={};
17var sliderType=$(this).attr('data-slider-type');var optPage=$(this).attr('data-page');var optNav=$(this).attr('data-nav');var optPlay=$(this).attr('data-auto-play');var optTime=$(this).attr('data-timeout');if(optPage==='true'){optPage=true;}else{optPage=false;}
18if(optNav==='true'){optNav=true;}else{optNav=false;}
19if(optPlay==='true'){if(optTime===''||parseInt(optTime)==0){optPlay=4000;}else{optPlay=parseInt(optTime);}}else{optPlay=false;}
20if(sliderType!=='carousel'){options={navigation:optNav,pagination:optPage,singleItem:true,transitionStyle:"fade",autoPlay:optPlay,stopOnHover:true,autoHeight:true}}else{var optDesktop=$(this).attr('data-desktop-items');var optTablet=$(this).attr('data-tablet-items');var optMobile=$(this).attr('data-mobile-items');if(optDesktop===''||parseInt(optDesktop)==0){optDesktop=4;}else{optDesktop=parseInt(optDesktop);}
21if(optTablet===''||parseInt(optTablet)==0){optTablet=3;}else{optTablet=parseInt(optTablet);}
22if(optMobile===''||parseInt(optMobile)==0){optMobile=1;}else{optMobile=parseInt(optMobile);}
23options={navigation:optNav,pagination:optPage,singleItem:false,transitionStyle:"fade",autoPlay:optPlay,stopOnHover:true,autoHeight:true,items:optDesktop,itemsDesktop:false,itemsDesktopSmall:false,itemsTablet:[1023,optTablet],itemsTabletSmall:false,itemsMobile:[767,optMobile]};}
24$(this).find('.owl-carousel').owlCarousel(options);});}};customUI.prototype.listBoxStyle=function(){var ww=$(window).width();var slider_section=$('.section-slider');var list_box_category=$('.list-box-category');var award_container=$('.award-winning-container');if(slider_section.length==0||list_box_category.length==0){return;}
25if(ww>=smallWidth){var distance=0;if(ww>=largeWidth){distance=70;}else if(ww>=mediumWidth){distance=60;}else if(ww>=smallWidth){distance=44;}
26slider_section.css({'opacity':1,'display':'block'});if(award_container.length!==0){var first_award_box=list_box_category.find('.box').first();var last_award_box=list_box_category.find('.box').last();var height=last_award_box.offset().top-first_award_box.offset().top+last_award_box.outerHeight();award_container.css('height',height);}}else{slider_section.removeAttr('style');if(award_container.length!==0){award_container.removeAttr('style');}}
27$(window).scroll(function(){if(ww>=smallWidth){var scroll=getCurrentScroll();var sliderHeight=slider_section.outerHeight();var y_coordinate=scroll / 5;y_coordinate+=distance;var opacity=1-(scroll /(sliderHeight-distance));slider_section.css({'opacity':opacity,});}else{slider_section.removeAttr('style');}});};customUI.prototype.videoSection=function(){var ww=$(window).width();$("a.vimeo-play-button").on('click touchstart',function(){var iframe_slider=$('.slide-content').find('iframe')[0];if($(iframe_slider).length){var iframe_video_element=document.getElementById($('.slide-content').find('iframe').attr("id"));if(iframe_video_element){var iframe_video_player=$f(iframe_video_element);iframe_video_player.api("play");}else{var old_src=$(iframe_slider).attr('src');var new_src=old_src.replace('background=1','background=0');new_src=new_src.replace('autoplay=0','autoplay=1');$(iframe_slider).attr('src',new_src);}
28setTimeout(function(){$('body').addClass('active_video');$('.slide-content').append('<a id="close_slide_video">Close<span class="icon icon-close"></span></a>');$("#close_slide_video").on('click',function(){$(iframe_slider).attr('src',old_src);$('body').removeClass('active_video');$(this).remove();});},500);}});setTimeout(function(){$('div.video-item').each(function(index){var wrap=$(this);var vimeoVideoUrl=$(this).find('iframe').attr('src');var height_img=450;var width_img=1140;height_img=$(this).find('iframe').height();width_img=$(this).find('iframe').width();wrap.find('.img-wrap').find('.img').css({"height":height_img+"px"});if(ww<smallWidth){wrap.find('.img-wrap').find('.img').find('.js-video').css({"padding-bottom":height_img+"px"});}
29var match=/vimeo.*\/(\d+)/i.exec(vimeoVideoUrl);if(match){var vimeoVideoID=match[1];$.getJSON('http://www.vimeo.com/api/v2/video/'+vimeoVideoID+'.json?callback=?',{format:"json"},function(data){var featuredImg=data[0].thumbnail_large;featuredImg=featuredImg.substring(0,featuredImg.indexOf("_"));featuredImg=featuredImg+'_'+width_img+'x'+height_img+'.jpg';
29var place_image='<div class="placeholder_video" style="background:url('+featuredImg+') 0 0 no-repeat transparent"></div>';wrap.find('.img-wrap').append(place_image);});}});},1000);$('.player-video').on('click touchstart',function(){var $this=$(this);var contain_element=$(this).closest('.item-video');if(!contain_element.length){contain_element=$(this).closest('.video-item');}
30if(contain_element.length){var img_wrap=contain_element.find('.img-wrap');var iframe_video=contain_element.find('iframe')[0];var iframe_video_element=document.getElementById(contain_element.find('iframe').attr("id"));var old_src=$(iframe_video).attr('src');var new_src=old_src.replace('background=1','background=0');new_src=new_src.replace('autoplay=0','autoplay=1');if(iframe_video_element){var iframe_video_player=$f(iframe_video_element);iframe_video_player.api("play");}else{$(iframe_video).attr('src',new_src);}
31setTimeout(function(){contain_element.addClass('video_item_active');contain_element.find('#close_item_video').remove();contain_element.append('<a id="close_item_video" class="video_close">Close<span class="icon icon-close"></span></a>');$("#close_item_video").on('click',function(){$(iframe_video).attr('src',old_src);contain_element.removeClass('video_item_active');$(this).remove();});},500);}});};customUI.prototype.actionDimension=function(){var dimensionSlider=$('.dimension-section').find('.block');$('.catalog-category-view').find('.box-dimension').hide();if(dimensionSlider.length){dimensionSlider.owlCarousel({navigation:true,singleItem:true,transitionStyle:"fade",autoPlay:false,stopOnHover:true,autoHeight:false,paginationNumbers:true});}
32$('.open-dimension').on('click',function(e){e.preventDefault();var href=$(this).attr('data-target');var infoItem=$(this).attr('data-info');if($(href).css('display')=='none'){$('.box-dimension').hide();$(href).slideDown(500);var height=$('.fixed-headsticky').height();$('html, body').animate({scrollTop:$(infoItem).offset().top},1000);}else{$(href).slideUp(500);}});$('.close-dimension').on('click',function(e){e.preventDefault();var href=$(this).attr('data-target');$(href).slideUp();});};customUI.prototype.packagePopup=function(){var popup=$('.package-popup');$('.show-popup').on('click',function(){setupPopup($(this));openPop($(this),popup);});popup.find('.close').on('click',function(){closePopup($(this));});var setupPopup=function($this){var imageSection=$this.closest('.dimension-configuration').find('.dimension-hidden').html();var packageName=$this.closest('.box-dimension').prev('.product-item').find('.product-item-link').html();if(packageName==undefined){packageName=$('.product-info-name').html();}
33packageName+=' Configuration';popup.find('.title').html(packageName);popup.find('.info-popup').html(imageSection);};var openPop=function($this,popup){popup.show();};var closePopup=function($this){$this.closest('.package-popup').hide();};};customUI.prototype.shareButton=function(){var shareSection=$('.product-info-share-section');if(shareSection.length!=0){var shareButton=shareSection.find('.share');var shareItems=shareSection.find('.salesids-socialshare');shareButton.on('click',function(){shareItems.slideToggle();});}};customUI.prototype.imageSuperWide=function(){if(jQuery('.cms-template-wrap').hasClass('cms-superwide')){jQuery('.cms-superwide .img').each(function(){var srcImg=jQuery(this).children('img').attr('src');jQuery(this).css('background-image','url('+srcImg+')');});}};customUI.prototype.slideSubMenuHome=function(){var ww=$(window).width();if(ww<767){jQuery("#king-difference-tab .tabs-content").on('swiperight',function(){var activeEle=jQuery('#king-difference-tab .tab-header .tabs-menu li.active');var scrollTo=activeEle.position().left;jQuery('#king-difference-tab .tab-header .tabs-menu').animate({'scrollLeft':scrollTo},500);console.log('scrollRight');});jQuery("#king-difference-tab .tabs-content").on('swipeleft',function(){var activeEle=jQuery('#king-difference-tab .tab-header .tabs-menu li.active');var scrollTo=activeEle.position().left;jQuery('#king-difference-tab .tab-header .tabs-menu').animate({'scrollLeft':scrollTo},500);console.log('scrollLeft');});}};customUI.prototype.urlAnchor=function(){$(window).on('load',function(){if(window.location.hash){var urlhash=window.location.hash.substring(1);if(urlhash&&$('#'+urlhash).length){var getStickyHeight=jQuery('.fixed-headsticky').height();setTimeout(function(){$('html,body').stop().animate({scrollTop:$('#'+urlhash).offset().top-(getStickyHeight-10)},1000);},1500);}}});};})(jQuery);$(document).ready(function(){var king_custom_ui=new kingLiving.customUI();king_custom_ui.init();checkPlpWidth();});$(window).resize(function(){kingLiving.customUI.getInstance().listBoxStyle();checkPlpWidth();setHeightMiniCart();});function setHeightMiniCart(){let li1=document.querySelector('#mini-cart li.product-item:nth-child(1)');let li2=document.querySelector('#mini-cart li.product-item:nth-child(2)');let totalHeight=0;let height1=0;let height2=0;let marginTop=15;let marginBottom=16;if(li2){height2=li2.offsetHeight;}
34if(li1){height1=marginTop+li1.offsetHeight;totalHeight=height1+height2+marginBottom;}else{totalHeight=100;}
35$('#minicart-content-wrapper .minicart-items-wrapper').css('max-height',totalHeight+'px');let deviceHeight=window.innerHeight;let miniCart=document.getElementById("minicart-content-wrapper");if(miniCart){if(miniCart.offsetHeight>=deviceHeight){$('.block-minicart').addClass('landscape');}else{$('.block-minicart').removeClass('landscape');}}}
36function checkPlpWidth(){const mainStickyNav=$('#maincontent .cms-sticky-navigation.cms-template-wrap .cms-sticky-content ul.cms-sticky-links');const mainStickyTitle=$('#maincontent .cms-sticky-navigation.cms-template-wrap .cms-sticky-content h1.title');const stickyPlpNavs=$('.cms-sticky-navigation.cms-template-wrap .cms-sticky-content ul.cms-sticky-links');if((mainStickyNav.width()+mainStickyTitle.width())>
361177){if(!mainStickyNav.hasClass('overflow')){stickyPlpNavs.addClass('overflow');}}else{stickyPlpNavs.removeClass('overflow');}}
37jQuery(document).ready(function(){var ww=jQuery(window).width();if(ww<768){jQuery('.aos-mobileoff').each(function(){jQuery(this).removeAttr('data-aos-offset');});}
38jQuery('#cat-collection .box:nth-child(1)').removeAttr('data-aos-offset');jQuery('#cat-collection .box:nth-child(1)').removeAttr('data-aos-delay');jQuery('#cat-collection .box:nth-child(1)').removeAttr('data-aos');jQuery('#cat-collection .box:nth-child(1)').removeAttr('data-aos-duration');jQuery('#cat-collection .box:nth-child(1)').removeAttr('data-aos-easing');jQuery('#cat-collection .box:nth-child(2)').removeAttr('data-aos-offset');jQuery('#cat-collection .box:nth-child(2)').removeAttr('data-aos-delay');jQuery('#cat-collection .box:nth-child(2)').removeAttr('data-aos');jQuery('#cat-collection .box:nth-child(2)').removeAttr('data-aos-duration');jQuery('#cat-collection .box:nth-child(2)').removeAttr('data-aos-easing');});$(document).ready(function(){$("#anchor-link-policy a, a.policy-anchor").click(function(e){e.preventDefault();var offset=$('.main-headnav').outerHeight();var anchorId=$(this).attr('href');var target=$(anchorId).offset().top-offset;if(!$('body').hasClass('_has-modal')){$('html, body').animate({scrollTop:target},500,function(){});}});$(".cms-accordion-wraper .accordion-list  li .title").click(function(){$(this).toggleClass("active");$(this).next(".content").toggle();});});$(document).click(function(event){if(!$(event.target).closest('header .searchform').length){$('.searchform #search_input').blur();}});$(window).on('resize scroll',function(){var top_of_element="";var bottom_of_element="";var bottom_of_screen=$(window).scrollTop()+$(window).innerHeight();var top_of_screen=$(window).scrollTop();$(".slick-initialized").each(function(){top_of_element=$(this).offset().top;bottom_of_element=$(this).offset().top+$(this).outerHeight();if((bottom_of_screen>top_of_element)&&(top_of_screen<bottom_of_element)){$(this).find("img").each(function(){if($(this).attr("data-amsrc")){$(this).attr("src",$(this).attr("data-amsrc"));$(this).removeAttr("data-amsrc");}});}});});$(document).ready(function(){var x,i,j,l,ll,selElmnt,a,b,c;x=document.getElementsByClassName("kl-custom-select");l=x.length;for(i=0;i<l;i++){selElmnt=x[i].getElementsByTagName("select")[0];ll=selElmnt.length;a=document.createElement("DIV");a.setAttribute("class","select-selected default");a.innerHTML=selElmnt.options[selElmnt.selectedIndex].innerHTML;x[i].appendChild(a);b=document.createElement("DIV");b.setAttribute("class","select-items select-hide");for(j=1;j<ll;j++){c=document.createElement("DIV");c.innerHTML=selElmnt.options[j].innerHTML;c.addEventListener("click",function(e){var y,i,k,s,h,sl,yl;s=this.parentNode.parentNode.getElementsByTagName("select")[0];sl=s.length;h=this.parentNode.previousSibling;for(i=0;i<sl;i++){if(s.options[i].innerHTML==this.innerHTML){s.selectedIndex=i;h.innerHTML=this.innerHTML;y=this.parentNode.getElementsByClassName("same-as-selected");yl=y.length;for(k=0;k<yl;k++){y[k].removeAttribute("class");}
39this.setAttribute("class","same-as-selected");$(this).parent().parent().find(".select-selected").removeClass("default");break;}}
40h.click();});b.appendChild(c);}
41x[i].appendChild(b);a.addEventListener("click",function(e){e.stopPropagation();closeAllSelect(this);this.nextSibling.classList.toggle("select-hide");this.classList.toggle("select-arrow-active");});}
42function closeAllSelect(elmnt){var x,y,i,xl,yl,arrNo=[];x=document.getElementsByClassName("select-items");y=document.getElementsByClassName("select-selected");xl=x.length;yl=y.length;for(i=0;i<yl;i++){if(elmnt==y[i]){arrNo.push(i)}else{y[i].classList.remove("select-arrow-active");}}
43for(i=0;i<xl;i++){if(arrNo.indexOf(i)){x[i].classList.add("select-hide");}}}
44document.addEventListener("click",closeAllSelect);});$(document).ready(function(){$('.lookbook-banners').slick({infinite:true,slidesToShow:5,responsive:[{breakpoint:1023,settings:{slidesToShow:3}},{breakpoint:767,settings:{slidesToShow:1}}]});});});

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.