PageSourceSearch

https://www.stjohnsmead.co.uk/_site/js/min/functions.min.js?cache=260715

js stjohnsmead.co.uk collected 2026-09-29 11:29:16 UTC 14,214 bytes, 1 lines download raw bytes

1"use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function inView(){var e=document.querySelectorAll("[data-inview]");if("IntersectionObserver"in window){var n=new IntersectionObserver(function(e){e.forEach(function(e){if(e.isIntersecting){var t=e.target;viewed(t),n.unobserve(t)}})},{threshold:0});e.forEach(function(e){n.observe(e)})}else e.forEach(function(e){viewed(e)})}function addInViewClass(e){e&&e.classList.add("inview")}function executeCallback(e,t){var n=allowedCallbacks[t];n&&"function"==typeof n&&n(e)}function viewed(e){var t=e.getAttribute("data-inview");addInViewClass((t?document.querySelector(t):null)||e),e.hasAttribute("data-callback")&&executeCallback(e,e.getAttribute("data-callback"))}function lazyLoad(){document.querySelectorAll('img[loading="lazy"]').forEach(function(e){e.complete?handleImageValidation(e):(e.addEventListener("load",function(){handleImageValidation(e)}),e.addEventListener("error",function(){handleImageError(e)}))})}function handleImageValidation(e){validateImage(e.src).then(function(){return e.classList.add("lazy--loaded")}).catch(function(){return handleImageError(e)})}function validateImage(a){return new Promise(function(e,t){var n=new Image;n.onload=function(){0<n.naturalWidth?e():t()},n.onerror=function(){return t()},n.src=a})}function handleImageError(e){const t=e.getAttribute("data-fallback");t?"false"===t||e.src.includes(t)||(e.src=t,e.classList.add("lazy--loaded")):e.src.includes(strFallbackPath)||(e.src=strFallbackPath,e.alt="",e.classList.add("lazy--loaded"))}function loadSwiperImages(e){e.el.querySelectorAll(".swiper-slide-visible").forEach(function(e){findSlide(e)})}function getCurrentAutoplayState(e){return e.autoplay.running}function bindSwiperPause(e,t){t?(0==getCurrentAutoplayState(e)&&t.classList.add("active"),t.addEventListener("click",function(){getCurrentAutoplayState(e)?(e.autoplay.stop(),t.classList.add("active")):(e.autoplay.start(),t.classList.remove("active"))})):console.log("Pause button not found")}function findSlide(e){e.querySelectorAll("[data-img]").forEach(function(e){e.classList.contains("lazy--loaded")||writeImg(e)})}function writeImg(e,t){e.classList.add("lazy--prep");var n=getImageContainer(e),a=t||e.getAttribute("data-img"),o=new Image;o.src=a,o.className="fit",o.alt=e.getAttribute("data-alt")||"",o.onload=function(){return imageLoadHandler(o,n,e,a)},"false"!==e.getAttribute("data-fallback")&&(console.log("img",o),o.onerror=function(){return imageLoadHandler(o,n,e,strFallbackPath)})}function getImageContainer(e){var t=e.querySelector(".lazy__load__img");return t||((t=document.createElement("div")).className="lazy__load__img",e.appendChild(t)),t}function imageLoadHandler(e,t,n,a){n.hasAttribute("data-bg")?t.style.backgroundImage="url("+a+")":t.appendChild(e),setTimeout(function(){return n.classList.add("lazy--loaded")},300)}function itemGrouping(e,t,n,a){for(var o=document.querySelectorAll(e),i=0;i<o.length;i+=t){for(var r=document.createElement(n),l=i;l<i+t&&l<o.length;l++)r.appendChild(o[l].cloneNode(!0));o[i].parentNode&&o[i].parentNode.insertBefore(r,o[i]);for(var c=i;c<i+t&&c<o.length;c++)o[c].remove()}a&&a()}function handleAnchorClick(e){console.log("handled"),e.preventDefault();var t=e.currentTarget.dataset.anchor,n=parseFloat(e.currentTarget.dataset.offset)||0,a=document.querySelector(t);if(a){a.focus(),console.log(a+" set to focus");var o=a.getBoundingClientRect().top+window.scrollY;window.scroll({top:o-n,behavior:blnReducedMotion?"auto":"smooth"}),console.log("targetScrollAmount",o),console.log("calc",o-n),console.log("targetSelectorOffset",n)}else console.warn("Target element not found for selector: "+t)}function parallax(){var e=document.querySelectorAll("[data-parallax]"),n=new IntersectionObserver(function(e){e.forEach(function(t){parallaxItems.has(t.target)&&parallaxItems.get(t.target).forEach(function(e){e.isIntersecting=t.isIntersecting})})},{rootMargin:"50px 0px 50px 0px"});e.forEach(function(e){var t=document.querySelector(e.getAttribute("data-watch"));parallaxItems.has(t)||(parallaxItems.set(t,[]),n.observe(t)),parallaxItems.get(t).push({element:e,isIntersecting:!1})})}
1function parallaxScroll(r){parallaxItems.forEach(function(e,t){e.forEach(function(e){if(e.isIntersecting){var t=e.element.getAttribute("data-parallax").split(",").map(function(e){return e.trim()}),n=e.element.getAttribute("data-multiplier")||.1,a=Math.max(1,e.element.getBoundingClientRect().top+r),o=e.element.getBoundingClientRect().height,i=calculateParallax(t,r,a,o,n);applyParallax(e.element,i)}})})}function calculateParallax(e,t,n,a,o){var i=void 0,r={};return e.forEach(function(e){switch(e){case"centre":r.transform=(t-(n-intWinHeight/2))*o;break;case"centreFixed":i=(t-(n-intWinHeight/2))*o,r.transform=Math.max(i,0);break;case"centreInvert":r.transform=(n-intWinHeight/2-t)*o;break;case"centreInvertFixed":i=(t-(n-intWinHeight/2))*o,r.transform=Math.min(i,0);break;case"top":r.transform=t*o;break;case"topInvert":r.transform=-t*o;break;case"bottom":r.transform=(t+intWinHeight-intDocHeight)*o;break;case"bottomInvert":r.transform=-(t+intWinHeight-intDocHeight)*o;break;case"opacityTop":i=1-(t-n)/a,r.opacity=Math.max(0,Math.min(1,i));break;case"heightTop":i=100-100/intWinHeight*t,r.height=Math.max(0,Math.min(100,i))}}),r}function applyParallax(e,t){void 0!==t.transform&&(e.style.transform="translate3D(0,"+t.transform+"px, 0)"),void 0!==t.opacity&&(e.style.opacity=t.opacity),void 0!==t.height&&(e.style.height=t.height+"%")}function stickyMenu(e,t,n,a){var o=document.getElementsByClassName(t)[0],i=o.offsetHeight;(o.offsetTop+i)*n<e?mason.classList.add(a):mason.classList.remove(a)}function setMenuColumns(){var e=document.querySelector(".menu__list"),t=e.getAttribute("data-columns");if(t&&""!==t.trim()){var o=t.split(",").map(function(e){return parseInt(e.trim())}).sort(function(e,t){return e-t});e.querySelectorAll(".menu__list__item__sub").forEach(function(e){var n=e.childElementCount,a="";1===o.length?a=n>o[0]?"menu__list__item--columns":"":o.forEach(function(e,t){0===t&&n<=e?a="":e<n&&(t===o.length-1||n<=o[t+1])&&(a=t===o.length-1?"menu__list__item--columns--wide":"menu__list__item--columns")}),a&&e.parentNode.classList.add(a)})}}function onScroll(){intScrollPosition=window.scrollY,blnTicking||(window.requestAnimationFrame(function(){handleScroll(intScrollPosition),blnTicking=!1}),blnTicking=!0)}function handleScroll(e){10<=Math.abs(prevScrollPosition-e)&&(prevScrollPosition<e?mason.classList.remove("mason--scrollingup"):mason.classList.add("mason--scrollingup")),stickyMenu(prevScrollPosition=e,"hero",.5,"mason--prep"),stickyMenu(e,"hero",1,"mason--sticky"),"IntersectionObserver"in window&&parallaxScroll(e),"function"==typeof customScroll&&customScroll(e)}function checkMobileBreakpoint(){isMobile=window.innerWidth<=intMenuBreakpoint}function loadBackgroundImage(e){var t=e.dataset.img;t&&(e.style.backgroundImage="url("+t+")",setTimeout(function(){return e.classList.add("lazy--loaded")},300))}function animateNum(e){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:3e3,t=e.querySelectorAll("[data-num]"),a=-1/0,o=[];t.forEach(function(e){if(""!==e.dataset.num){var t=e.dataset.num,n=Number(t.replace(/,/g,""));isNaN(n)||(a<n?(a=n,o=[e]):n===a&&o.push(e))}}),o.forEach(function(e){e.closest("li").classList.add("winning")}),t.forEach(function(o){if(""!==o.dataset.num){if(blnReducedMotion)return o.textContent=o.dataset.num;var e=o.dataset.num,i=e.includes(","),r=Number(e.replace(/,/g,""));if(isNaN(0)||isNaN(r))return console.warn("Invalid number detected:",o),void(o.textContent=o.dataset.num||o.textContent);var l=Number.isInteger(r),c=null;requestAnimationFrame(function e(t){c||(c=t);var n=Math.min((t-c)/s,1),a=n*(r-0)+0;o.textContent=i?l?Math.floor(a).toLocaleString("en"):a.toFixed(2):l?Math.floor(a):a.toFixed(2),n<1&&requestAnimationFrame(e)})}})}function runCustomAccordion(e,t,n,a){a=blnReducedMotion?0:a;var o=$(e);if(o.length<1)return!1;
1o.unbind("click"),o.on("click",t,function(){var e=$(this),t=e.parent();t.siblings().removeClass("active").find(n).slideUp(a),t.hasClass("active")?(t.removeClass("active"),e.next(n).stop().slideUp(a)):(t.addClass("active"),e.next(n).stop().slideDown(a))})}function arraySort(e,n){e.sort(function(e,t){if(n){if(e.priority&&!t.priority)return-1;if(!e.priority&&t.priority)return 1}return new Date(t.date)-new Date(e.date)})}function buildFilters(e,t,n){if(null!==e){var a={news:"News",facebook:"Facebook",instagram:"Instagram",youtube:"YouTube"},o=t.querySelectorAll("[data-type]"),i=new Set;o.forEach(function(e){i.add(e.getAttribute("data-type"))}),i=[].concat(_toConsumableArray(i));var r=function(e,t,n){return'<button class="reset__button inline '+(n?"active":"")+'" title="Filter items to show '+t+' posts" aria-label="Filter social posts to only show '+t+' posts" data-social="'+e+'">'+t+"</button>"},l=r("all","All",!0);i.forEach(function(e){a[e]&&(l+=r(e,a[e],!1))}),e.innerHTML+=l,n&&n()}}function openMasonModal(t,e,n){var a=e,o=n,i=document.querySelector(a),r=document.querySelector(o);if(null!==i){var l=function e(){t.getAttribute("aria-expanded")&&t.setAttribute("aria-expanded","false"),i.removeEventListener("keydown",d),r.removeEventListener("click",e),mason.classList.remove("mason--menu")},c=i.querySelectorAll('button, [href], a, input, select, textarea, [tabindex]:not([tabindex="-1"])'),s=c[0],u=c[c.length-1];setTimeout(function(){s&&s.focus()},100);var d=function(e){var t="Tab"===e.key||9===e.keyCode;"Escape"!==e.key?t&&(e.shiftKey?document.activeElement===s&&(u.focus(),e.preventDefault()):document.activeElement===u&&(s.focus(),e.preventDefault())):l()};i.addEventListener("keydown",d),r&&r.addEventListener("click",l)}}function toggleMenuAttributes(){var e=document.querySelector(".menu");isMobile?(e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true")):(e.removeAttribute("role"),e.removeAttribute("aria-modal"))}function toggleAriaExpanded(e){var t=e.currentTarget,n=t.getAttribute("aria-controls");if(document.getElementById(n)){var a="true"===t.getAttribute("aria-expanded");t.setAttribute("aria-expanded",!a)}}function manageContentTables(){for(var e=document.getElementsByClassName("content__region"),t=0;t<e.length;t++){e[t].querySelectorAll("table").forEach(function(e){return setTableTabbing(e)})}}function setTableTabbing(e){e.querySelectorAll("td").forEach(function(e){e.hasAttribute("tabindex")||e.setAttribute("tabindex","0")});var t=e.parentElement.classList;if(console.log("tableParentClass",t),!t.contains("table__container")&&!t.contains("formElement-table")){var n=document.createElement("div");n.className="table__container",e.parentNode.insertBefore(n,e),n.appendChild(e)}}function manageAccordions(e){document.querySelectorAll(e).forEach(function(t){t.setAttribute("tabindex",0),t.addEventListener("keydown",function(e){"Space"!==e.code&&" "!==e.key||(e.preventDefault(),t.click())})})}function focusShift(e){var t=e.target.closest("[data-focusshift]");if(t){var n=t.getAttribute("data-focusshift");if(n){var a=void 0;try{a=document.querySelector(n)}catch(e){return void console.warn("Invalid selector in data-focusshift: "+n)}if(a){var o=t.getAttribute("data-toggle");if(o){var i=void 0;try{i=document.querySelector(o)}catch(e){return void console.warn("Invalid selector in data-toggle: "+o)}i&&a.focus()}else a.focus()}}}}var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},mason=document.getElementsByClassName("mason")[0],$window=$(window),blnAdmin=mason.classList.contains("mason--admin"),blnHome=mason.classList.contains("mason--home"),blnInner=mason.classList.contains("mason--inner"),blnForm=!!$(".content__form, .content__block__form").length,blnReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,intMenuBreakpoint=1050,intScrollPosition=window.scrollY,prevScrollPosition=0,blnTicking=!1,intWinHeight=0,intDocHeight=0,parallaxItems=new Map,isMobile=!1;document.addEventListener("DOMContentLoaded",function(){lazyLoad(),inView(),scripts(),intScrollPosition=window.scrollY,intWinHeight=window.innerHeight,intDocHeight=document.documentElement.scrollHeight,"IntersectionObserver"in window&&0==blnReducedMotion&&parallax()}),window.onload=function(){handleScroll(intScrollPosition),mason.classList.add("mason--loaded")};var createSwiper=function(e,t,n){if(e&&e.children){if(!e.classList.contains("swiper")){var a=document.createElement("ul");a.classList.add("swiper-wrapper","reset__ul","container"),Array.from(e.children).forEac
1h(function(e){e.classList.add("swiper-slide"),a.appendChild(e)}),e.appendChild(a),e.classList.add("swiper")}var o=n.on&&n.on.init,i=_extends({},n,{on:_extends({},n.on,{init:function(){t&&loadSwiperImages(this),o&&o.call(this),n.extendedInit&&n.extendedInit.call(this)}})}),r=new Swiper(e,i);return t&&r.on("slideChange",function(){loadSwiperImages(r)}),r}};$('[data-popupsource="true"]').each(function(){$(this).e4eDialog({title:"Select Source",width:400,height:450,buttons:[{id:"select",label:"Select",fn:"selectItem()",className:"primary"},"cancel"]})});var arrAnchors=document.querySelectorAll("[data-anchor]");arrAnchors.forEach(function(e){e.addEventListener("click",handleAnchorClick)}),window.addEventListener("scroll",onScroll),checkMobileBreakpoint();var allowedCallbacks={loadBackgroundImage:loadBackgroundImage,animateNum:animateNum},modalOpenButtons=document.querySelectorAll('[mason-modal="open"]');modalOpenButtons.forEach(function(e){e.addEventListener("click",function(){openMasonModal(this,this.getAttribute("mason-modaltarget"),this.getAttribute("mason-modalclose"))})}),document.querySelectorAll("[aria-controls]").forEach(function(e){e.addEventListener("click",toggleAriaExpanded)}),window.onresize=function(){intWinHeight=window.innerHeight,intDocHeight=document.body.scrollHeight,handleScroll(intScrollPosition),checkMobileBreakpoint(),toggleMenuAttributes()};var focusShiftElements=document.querySelectorAll("[data-focusshift]");focusShiftElements.forEach(function(e){e.addEventListener("click",focusShift)});

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.