PageSourceSearch

https://www.poltronesofa.co.uk/on/demandware.static/Sites-SFRA_SCS…/-/en_GB/v1791058580298/js/storeLocator.js

js poltronesofa.co.uk collected 2026-10-04 09:39:29 UTC 16,232 bytes, 1 lines download raw bytes

1!function(){var t={9941:function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}t.exports=function(t){"function"==typeof t?t():"object"===e(t)&&Object.keys(t).forEach(function(e){"function"==typeof t[e]&&t[e]()})}},1929:function(t){"use strict";t.exports={init:function(){var t=$("body");t.on("click","button.btn-storelocator-search",function(){var t=$("input#store-postal-code");if(0!==t.length){var e=t.val();dataLayer.push({event:"storeLocatorSearch",locationAction:"Search Term",locationQuery:e})}}),t.on("click","div.results .store-name",function(){var t=$(this).find("h4").text();dataLayer.push({event:"storeLocatorClick",locationAction:"Store Click",storeDetails:t})}),t.on("click","div.results a.store-hours-heading",function(){var t=$(this).find("div.store-name-hidden").text();dataLayer.push({event:"storeLocatorClick",locationAction:"Store Click",storeDetails:t})}),t.on("click","div.results a.store-detail-link",function(){var t=$(this).closest(".store-details").find(".store-name h4").text();dataLayer.push({event:"storeLocatorMoreInfo",locationAction:"More Info",storeDetails:t})}),t.on("click","div.results a.store-direction-link",function(){var t=$(this).closest(".store-details").find(".store-name h4").text();dataLayer.push({event:"storeLocatorDirections",locationAction:"Store Directions",storeDetails:t})})}}},170:function(t){function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,a=Array(e);o<e;o++)a[o]=t[o];return a}var o="small-device",a="mobile",r="tablet",s="desktop",n="(max-width: ".concat(479,"px)"),i="(max-width: ".concat(767,"px)"),l="(min-width: ".concat(768,"px) and (max-width: ").concat(921,"px)"),c="(min-width: ".concat(922,"px)"),u=[[o,n],[a,i],[r,l],[s,c]],d=function(){var t=u.filter(function(t){var o,a,r=(o=t,a=2,function(t){if(Array.isArray(t))return t}(o)||function(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var a,r,s,n,i=[],l=!0,c=!1;try{if(s=(o=o.call(t)).next,0===e){if(Object(o)!==o)return;l=!1}else for(;!(l=(a=s.call(o)).done)&&(i.push(a.value),i.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=o.return&&(n=o.return(),Object(n)!==n))return}finally{if(c)throw r}}return i}}(o,a)||function(t,o){if(t){if("string"==typeof t)return e(t,o);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?e(t,o):void 0}}(o,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1];return window.matchMedia(r).matches})[0];return t&&t[0]};t.exports={isSmallDeviceView:function(){return d()===o},isMobileView:function(){return d()===a},isTabletView:function(){return d()===r},isDesktopView:function(){return d()===s}}},1575:function(t){"use strict";t.exports={scrollBrowserConsiderHeader:function(t,e){t instanceof $&&(t=t.offset().top),this.scrollBrowser(t-$(".js-sticky_header").height(),e)},scrollBrowser:function(t){$("html, body").animate({scrollTop:t},500)},getWithExpiry:function(t){var e=localStorage.getItem(t);if(!e)return null;var o=JSON.parse(e);return(new Date).getTime()>o.expiry?(localStorage.removeItem(t),null):o.value},setWithExpiry:function(t,e,o){var a={value:e,expiry:(new Date).getTime()+o};localStorage.setItem(t,JSON.stringify(a))}}},1958:function(t){"use strict";function e(t){return e={address:t},o=new google.maps.Geocoder,a=new google.maps.LatLng(60,3),r=new google.maps.LatLng(49,-13),s=$.Deferred(),n=$.extend({},{language:"en-GB",bounds:new google.maps.LatLngBounds(r,a),componentRestrictions:{}},e),o.geocode(n,function(t,e){var o=google.maps.GeocoderStatus,a=e===o.OK||e===o.ZERO_RESULTS;s[a?"resolve":"reject"](t)}),s;var e,o,a,r,s,n}t.exports={getAddressLocation:function(t){var o=$.Deferred();return t?e(t+" UK").then(function(o){return o&&o.length?o:e(t)}).done(function(t){t?o.resolve({location:{lat:t[0].geometry.location.lat(),long:t[0].geometry.location.lng()}}):o.reject(t)}).fail(function(t){o.reject(null)}):o.reject(null),o},getCurrentLocation:function(){var t=$.Deferred();return navigator.geolocation.getCurrentPosition(function(e){t.resolve({latitude:e.coords.latitude,longitude:e.coords.longitude})},function(e){t.reject(e)},{enableHighAccuracy:!0,maximumAge:0,timeout:3e4}),t}}},7031:function(t,e,o){"use strict";
1var a=o(1575),r=o(1958),s=o(170),n={},i="m-active";function l(){n.$detectLocationButton.css("display","block"),n.$searchResults.addClass("location-button-active")}function c(t){t&&n.$detectLocationButton.hide()}function u(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(l,c),n.$searchForm.unbind("submit").on("submit",function(t){t.preventDefault(),p($(this))}),n.$storeSearchInput.bind("keyup change",function(t){t.preventDefault(),""==$(this).val()?n.$findStoreBtn.prop("disabled",!0).css("cursor","default"):n.$findStoreBtn.prop("disabled",!1).css("cursor","pointer")}),n.$findStoreBtn.unbind("click").on("click",function(t){t.preventDefault(),""!==n.$storeSearchInput.val()&&p($(this))}),n.$listView.on("click",function(t){t.preventDefault(),$(this).toggleClass(i,!$(this).hasClass(i)),n.$mapView.toggleClass(i,!n.$mapView.hasClass(i)),n.$mapContainer.addClass("d-none"),n.$searchResults.removeClass("d-none")}),n.$mapView.on("click",function(t){t.preventDefault(),$(this).toggleClass(i,!$(this).hasClass(i)),n.$listView.toggleClass(i,!n.$listView.hasClass(i)),n.$searchResults.addClass("d-none"),n.$mapContainer.removeClass("d-none"),n.map.fitBounds(n.globalBounds)}),$(".js-store-name").on("click",function(t,e){var o=$(this),r=o.closest(".js-sl-result-store"),i=(r.attr("data-latitude"),r.attr("data-longitude"),$($(".js-sl-result-store")[0]).offset().top),l=o.closest(".js-sl-result-store").offset().top;s.isMobileView()||s.isTabletView()?(i=$(".js-search-store-header-mobile").height(),a.scrollBrowser(l-i+100)):s.isDesktopView()&&(a.scrollBrowser($(".store-locator-main .search-form").offset().top),n.$searchResults.animate({scrollTop:l-i+5},500));var c=r.find(".map-marker").data("index");if(c){var u=n.markersArray[c-1];if((n.activeMarker&&n.activeMarker.getPosition())==(u&&u.getPosition()))return;google.maps.event.trigger(n.markersArray[c-1],"click")}}),$(".js-store-detail-wrapper").on("shown.bs.collapse",function(t,e){var o=$(this),r=o.closest(".js-sl-result-store"),i=(r.attr("data-latitude"),r.attr("data-longitude"),$($(".js-sl-result-store")[0]).offset().top),l=o.closest(".js-sl-result-store").offset().top;s.isMobileView()||s.isTabletView()?(i=$(".js-search-store-header-mobile").height(),a.scrollBrowser(l-i+100)):s.isDesktopView()&&(a.scrollBrowser($(".store-locator-main .search-form").offset().top),n.$searchResults.animate({scrollTop:l-i+5},500));var c=r.find(".map-marker").data("index");if(c){var u=n.markersArray[c-1];if((n.activeMarker&&n.activeMarker.getPosition())==(u&&u.getPosition()))return;google.maps.event.trigger(n.markersArray[c-1],"click")}}),$("#storeLinks").on("hidden.bs.collapse",function(){n.toggleBtnText.text("View all stores")}).on("shown.bs.collapse",function(){n.toggleBtnText.text("Hide")});var t=$(".js-seasonal-hour-link"),e=t.find(".show-text"),o=t.find(".hide-text"),r=$(".js-seasonal-hour-table");t.on("click",function(t){t.preventDefault();var a=r.hasClass("d-none");r.toggleClass("d-none",!a),e.toggleClass("d-none",a),o.toggleClass("d-none",!a)}),$("body").on("click",".js-book-appointed",function(t){t.preventDefault(),$("#apwidget > iframe").remove();var e=$(this).data("store-id"),o=$(this).data("host-url"),a=$(this).data("modal-title"),r=$($(this).data("target")),s=$(this).data("apwidget-id")||"apwidget";$(document).trigger("appointeddWidget:init",{organisations:[e],hostUrl:o,pageType:"storeLocator",widgetID:s}),r.length>0&&r.find(".modal-title").length>0&&""!==a&&r.find(".modal-title").text(a)})}function d(t){if(t){var e=t.stores.length>0;e?($(".store-locator-no-results").hide(),n.$storeSearchInput.val(t.stores[0].name)):$(".store-locator-no-results").show(),n.$resultsDiv.empty().data("has-results",e).data("radius",t.radius).data("search-key",t.searchKey).data("store-count",t.storeCount),n.$scsMapCanvas.attr("data-locations",t.locations).attr("data-markers",t.markers).attr("data-query-lat",t.lat).attr("data-query-long",t.long),t.storesResultsHtml&&n.$resultsDiv.append(t.storesResultsHtml)}else $(".store-locator-no-results").show(),n.$resultsDiv.empty().data("has-results",!1).data("radius",n.$resultsDiv.data("radius")).data("search-key",$("#store-postal-code").val()).data("store-count",n.initialStoreCount).append('<div id="accordion" class="container"></div>'),n.$scsMapCanvas.attr("data-locations","[]").attr("data-markers","[]").attr("data-query-lat","").attr("data-query-long","");n.$findStoreBtn.prop("disabled",!1).css("cursor","pointer"),n.$scsMapCanvas.data("has-google-api")?g():$(".
1store-locator-no-apiKey").show(),u()}function p(t){var e=t.closest(".store-locator-main"),o=e.length?e.spinner():$.spinner();o.start();var a=t.closest(".store-locator-search"),s=a.find('[name="postalCode"]').val(),i=n.$resultsDiv.data("radius"),l=a.attr("action");a.is("form")&&a.serialize(),r.getAddressLocation(s).done(function(t){var e={radius:i,lat:t.location.lat,long:t.location.long,storeCount:n.initialStoreCount,searchKey:s};return l=f(l,e),"true"===n.isLandingPage&&window.location.assign(l),$.ajax({url:l,type:a.attr("method"),dataType:"json",success:function(t){o.stop(),d(t),$(".select-store").prop("disabled",!0)}}),!1}).fail(function(t){if("true"===n.isLandingPage){var e={radius:i,storeCount:n.initialStoreCount,searchKey:s};l=f(l,e),window.location.assign(l)}return o.stop(),d(null),$(".select-store").prop("disabled",!0),!1})}function g(){if(!n.map){var t={scrollwheel:!1,gestureHandling:"cooperative",zoom:6,center:new google.maps.LatLng(50.736129,-1.988229),mapTypeControl:!0,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_RIGHT}};n.map=new google.maps.Map(n.$scsMapCanvas[0],t)}!function(){!function(){n.currentLocationMarker&&n.currentLocationMarker.setMap(null);for(var t=0;t<n.markersArray.length;t++)n.markersArray[t].setMap(null);n.markersArray.length=0,n.activeMarker=null}();var t,e=n.$scsMapCanvas.attr("data-locations"),o=(e=JSON.parse(e)).slice(0,n.$resultsDiv.data("store-count")),a=JSON.parse(n.$scsMapCanvas.attr("data-markers")).slice(0,n.$resultsDiv.data("store-count"));t=a,Object.keys(t).forEach(function(e){var o=t[e];$("#"+o.storeID).find(".js-store-distance").text(o.distance.toFixed(2))});var r,s,i,l=new google.maps.LatLngBounds;r=n.$scsMapCanvas.attr("data-query-lat"),s=n.$scsMapCanvas.attr("data-query-long"),i=new google.maps.LatLng({lat:+r,lng:+s}),n.currentLocationMarker=new google.maps.Marker({position:i,map:n.map,clickable:!1,icon:n.currentLocationIcon}),Object.keys(o).forEach(function(t){var e=o[t],r=parseInt(t,10)+1,s=new google.maps.LatLng(e.latitude,e.longitude),i={path:"m17.5,0C7.84,0,0,7.09,0,15.83s15.87,26.04,16.56,26.77c.22.26.57.41.94.4.36,0,.71-.15.94-.4.69-.74,16.56-18.32,16.56-26.77C34.99,7.09,27.16,0,17.5,0Z",fillColor:"#283444",fillOpacity:1,scale:1,strokeColor:"#283444",strokeWeight:1,anchor:new google.maps.Point(0,0),labelOrigin:new google.maps.Point(18,17)},c={position:s,map:n.map,title:e.name,clickable:!0};1===o.length?c.icon={url:n.storeMarkerIcon,scaledSize:new google.maps.Size(35,43),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(0,0)}:(c.label={text:r.toString(),color:"white",fontSize:"16px"},c.icon=i);var u=new google.maps.Marker(c);google.maps.event.clearListeners(u,"click"),google.maps.event.addListener(u,"click",function(){var t,e;n.map.setCenter(u.getPosition()),n.map.setZoom(16),n.globalBounds=n.map.getBounds(),n.activeMarker=u,t=a[r-1].storeID,(e=$("#"+t).find(".js-store-detail-wrapper")).hasClass("show")||e.collapse("show")}),n.markersArray.push(u),l.extend(s)}),n.globalBounds=l,e&&0!==e.length&&n.map.fitBounds(l)}()}function f(t,e){return t+(-1!==t.indexOf("?")?"&":"?")+Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function m(){$(".store-locator-search input.form-control").val().length>0?$(".store-locator-search-widget").addClass("show-close"):$(".store-locator-search-widget").removeClass("show-close")}t.exports={initializeCache:function(){n.map=null,n.markersArray=[],n.currentLocationMarker=null,n.activeMarker=null,n.globalBounds=null,n.$resultsDiv=$(".results"),n.$storetab=n.$resultsDiv.find(".store-name"),n.$mapContainer=$(".js-sl-map-canvas"),n.$loadMoreStores=$(".js-sl-load-more"),n.$storeSearchWrapper=$(".store-locator-search"),n.$storeSearchInput=$("#store-postal-code"),n.isLandingPage=$(".js-store-landing-page").val(),n.$scsMapCanvas=$(".scs-map-canvas"),n.$noAPIkey=$(".store-locator-no-apiKey"),n.$detectLocationButton=$(".js-detect-location"),n.$searchResults=$(".js-sl-search-results"),n.$noResultsDiv=$(".store-locator-no-results"),n.storeMarkerIcon=n.$scsMapCanvas.attr("data-store-marker"),n.currentLocationIcon=n.$scsMapCanvas.attr("data-current-location-marker"),n.$storeSearchForm=$(".store-locator-search .form-group"),n.initialStoreCount=n.$storeSearchForm.attr("data-store-inital-count"),n.additionalCount=n.$storeSearchForm.attr("data-store-additional-count"),n.$listView=$(".js-list-view"),n.$mapView=$(".js-map-view"),n.toggleBtnText=$(".js-toggle-btn-text"),n.$findStoreBtn=$(".btn-storelocator-search"),n.$searchForm=$("#storeSearchForm")},init:function(){u(),null!==document.querySelector(".scs-store-appointment-container .swiper")&&new Swiper(".scs-store-appointment-container .swiper",{slidesPerView:3,spaceBetween:24,loop:!1,allowTouchMove:!1,pagination:{el:".scs-store-appointment-slider-dots",clickable:!0},breakpoints:{1024:{slidesPerView:2.6},900:{slidesPerView:2.2,allowTouchMove:!0},819:{slidesPerView:2.05,allowTouchMove:!0},768:{slidesPerView:1.9,allowTouchMove:!0},700:{slidesPerView:1.5,allowTouchMove:!0},490:{slidesPerView:1.2,allowTouchMove:!0},374:{slidesPerView:1.075,allowTouchMove:!0},339:{slidesPerView:1.05,allowTouchMove:!0}}}),m(),n.$scsMapCanvas.data("has-google-api")?g():n.$noAPIkey.show(),n.$resultsDiv.data("has-results")||n.$noResultsDiv.show(),$("#store-postal-code").focus(),$(".js-custom-book-ma
1p-store-appointment").on("click",function(){$(".js-book-appointed").eq(0).trigger("click")}),$(".js-custom-book-store-appointment").on("click",function(){$(".js-btn-book-appointed").trigger("click")}),$(".store-locator-search input.form-control").on("keyup",function(){m()}),$(".store-search-close-button").on("click",function(){setTimeout(function(){$(".store-locator-search input.form-control").val("")},10),$(".store-locator-search-widget").removeClass("show-close")})},loadMoreStores:function(){n.$loadMoreStores.on("click",function(t){t.preventDefault(),$.spinner().start();var e=n.$resultsDiv.data("store-count"),o=n.$resultsDiv.data("search-key"),a=n.$resultsDiv.data("radius"),r=n.$storeSearchWrapper.attr("action");r=f(r,{radius:a,lat:o.lat,long:o.long,storeCount:+e+ +n.additionalCount}),$.ajax({url:r,type:"get",dataType:"json",success:function(t){$.spinner().stop(),d(t),$(".select-store").prop("disabled",!0)}})})},detectLocation:function(){n.$detectLocationButton.on("click",function(){$.spinner().start(),navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){var e=n.$detectLocationButton.data("action");e=f(e,{radius:$(".results").data("radius"),lat:t.coords.latitude,long:t.coords.longitude,storeCount:n.initialStoreCount}),"true"===n.isLandingPage&&window.location.assign(e),$.ajax({url:e,type:"get",dataType:"json",success:function(t){$.spinner().stop(),l(),d(t),$(".select-store").prop("disabled",!0)}})}):$.spinner().stop()})}}}},e={};function o(a){var r=e[a];if(void 0!==r)return r.exports;var s=e[a]={exports:{}};return t[a](s,s.exports,o),s.exports}!function(){"use strict";var t=o(9941);$(document).ready(function(){t(o(7031)),t(o(1929))})}()}();

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.