PageSourceSearch

https://inews.co.uk/wp-content/plugins/shorts/build/blocks/shorts-carousel/view.js?m=1790688460g

js inews.co.uk collected 2026-10-01 07:41:17 UTC 15,498 bytes, 1 lines download raw bytes

vendor: 4,188 bytes, line 1
1(()=>{var t={124:(t,e,r)=>{var n=r(325);t.exports=function(){return n.Date.now()}},128:(t,e,r)=>{var n=r(800),o=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},221:(t,e,r)=>{var n=r(805),o=r(124),s=r(374),a=Math.max,i=Math.min;t.exports=function(t,e,r){var c,d,l,u,h,p,f=0,g=!1,v=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function b(e){var r=c,n=d;return c=d=void 0,f=e,u=t.apply(n,r)}function y(t){var r=t-p;return void 0===p||r>=e||r<0||v&&t-f>=l}function _(){var t=o();if(y(t))return w(t);h=setTimeout(_,function(t){var r=e-(t-p);return v?i(r,l-(t-f)):r}(t))}function w(t){return h=void 0,m&&c?b(t):(c=d=void 0,u)}function x(){var t=o(),r=y(t);if(c=arguments,d=this,p=t,r){if(void 0===h)return function(t){return f=t,h=setTimeout(_,e),g?b(t):u}(p);if(v)return clearTimeout(h),h=setTimeout(_,e),b(p)}return void 0===h&&(h=setTimeout(_,e)),u}return e=s(e)||0,n(r)&&(g=!!r.leading,l=(v="maxWait"in r)?a(s(r.maxWait)||0,e):l,m="trailing"in r?!!r.trailing:m),x.cancel=function(){void 0!==h&&clearTimeout(h),f=0,c=p=d=h=void 0},x.flush=function(){return void 0===h?u:w(o())},x}},325:(t,e,r)=>{var n=r(840),o="object"==typeof self&&self&&self.Object===Object&&self,s=n||o||Function("return this")();t.exports=s},346:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},350:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},374:(t,e,r)=>{var n=r(128),o=r(805),s=r(394),a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(s(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=i.test(t);return r||c.test(t)?d(t.slice(2),r?2:8):a.test(t)?NaN:+t}},394:(t,e,r)=>{var n=r(552),o=r(346);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},552:(t,e,r)=>{var n=r(873),o=r(659),s=r(350),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):s(t)}},659:(t,e,r)=>{var n=r(873),o=Object.prototype,s=o.hasOwnProperty,a=o.toString,i=n?n.toStringTag:void 0;t.exports=function(t){var e=s.call(t,i),r=t[i];try{t[i]=void 0;var n=!0}catch(t){}var o=a.call(t);return n&&(e?t[i]=r:delete t[i]),o}},800:t=>{var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},805:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},840:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},873:(t,e,r)=>{var n=r(325).Symbol;t.exports=n}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,r),s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=r(221),e=r.n(t);function n(){return window.matchMedia("(min-width: 64rem)").matches}function o(t){if(!t||!n())return;const e=document.querySelector(`[data-carousel-body="${t}"]`),r=document.querySelector(`.shorts-carousel__nav-item--prev[data-instance="${t}"]`),o=document.querySelector(`.shorts-carousel__nav-item--next[data-instance="${t}"]`);if(!e||!r||!o)return;const s=Math.round(e.scrollLeft),a=Math.round(e.scrollWidth-e.clientWidth);r.disabled=s<=0,r.setAttribute("aria-disabled",String(s<=0)),o.disabled=s>=a,o.setAttribute("aria-disabled",String(s>=a))}function s(){const t=n();document.querySelectorAll('.dmg__post-section[data-type="ShortsCarousel"] .dmg__post-section__body').forEach(e=>{const r=e.closest(".dmg__post-section");if(!r)return;const n=r.querySelector(".shorts-carousel__navigation");if(!n)return;const o=t&&e.scrollWidth>r.clientWidth;n.classList.toggle("is-overflowing",o)})}function a(){const t=n();document.querySelectorAll('.dmg__post-section[data-type="ShortsCarou
1sel"] .dmg__post-section__body').forEach(e=>{e.style.width="";const r=e.closest(".dmg__post-section"),n=t&&r?r.clientWidth:window.innerWidth;e.scrollWidth>n&&(e.style.width=t?"100%":"100vw")})}function i(t){const e=t.currentTarget?.getAttribute("data-instance");if(!e)return;const r=document.querySelector(`[data-carousel-body="${e}"]`);if(!r)return;const n=t.currentTarget.classList.contains("shorts-carousel__nav-item--next")?164:-164;r.scrollBy({behavior:"smooth",left:n});const o=new CustomEvent("shorts-carousel-nav");document.dispatchEvent(o)}const c=["Escape","Esc"];function d(){return document.body.classList.contains("single-short-template")&&!document.body.classList.contains("single-short-template--embedded")&&!document.body.classList.contains("single-short-template--preview")}const l=new Map;function u(t){if(!t)return null;if(l.has(t))return l.get(t);const e=document.querySelector(`.shorts-carousel__lightbox-wrapper[data-shorts-lightbox-instance="${t}"]`),r=document.querySelector(`.shorts-carousel__lightbox-carousel[data-shorts-carousel="${t}"]`);if(!e||!r)return null;const n=Array.from(r.querySelectorAll(".shorts-lightbox__card"));if(!n.length)return null;const o=parseInt(e.getAttribute("data-total-shorts"),10)||0,s={activeIndex:0,animationTimeout:null,cards:n,carousel:r,triggerElement:null,wrapper:e,totalShorts:o,shortsSeen:new Set,isLanding:!0,lastEventObject:{},previousIndex:-1};return l.set(t,s),function(t){if(!t?.wrapper)return;const e=t.wrapper.querySelector(".shorts-carousel__lightbox-close"),r=t.wrapper.querySelector(".shorts-carousel__lightbox-wrapper .overlay"),n=t.wrapper.querySelector(".shorts-carousel__lightbox-nav--prev"),o=t.wrapper.querySelector(".shorts-carousel__lightbox-nav--next"),s=e=>{e?.stopPropagation(),p(t)};e&&e.addEventListener("click",s),r&&r.addEventListener("click",s),n&&n.addEventListener("click",e=>{e?.stopPropagation(),f(t,-1)}),o&&o.addEventListener("click",e=>{e?.stopPropagation(),f(t,1)}),t.wrapper.addEventListener("click",e=>{const r=e.target.closest(".shorts-lightbox__pagination-dot");if(r){e.stopPropagation();const n=parseInt(r.getAttribute("data-card-index"),10),o=t.cards[t.activeIndex],s=o?.getAttribute("data-short-id"),a=t.cards.findIndex(t=>{const e=t.getAttribute("data-short-id"),r=parseInt(t.getAttribute("data-card-index"),10);return e===s&&r===n});if(a>=0&&a!==t.activeIndex){t.animationTimeout&&(clearTimeout(t.animationTimeout),t.animationTimeout=null);const e=a>t.activeIndex?1:-1,r=Math.abs(a-t.activeIndex);let n=0;const o=()=>{n>=r?t.animationTimeout=null:(n++,t.activeIndex+=e,g(t),t.animationTimeout=n<r?setTimeout(o,100):null)};o()}return}if(e.target.closest(".shorts-lightbox__share-button"))return e.stopPropagation(),void async function({activeCard:t,lastEventObject:e}){if(!t)return;const r=t.getAttribute("data-short-id"),n=t.getAttribute("data-short-title");if(!r||!n)return;const o=new URL(window.location.href);o.searchParams.set("utm_source","theipaper"),o.searchParams.set("utm_medium","shorts_card"),o.searchParams.set("utm_campaign",`shorts_${n}`),o.searchParams.set("short_id",r),o.searchParams.set("share_story","true");const s={title:n,text:n,url:o.toString()};if(navigator.share)try{await navigator.share(s);const t=new CustomEvent("shorts-share",{detail:{lastEventObject:e}});document.dispatchEvent(t)}catch(t){"AbortError"!==t.name&&console.error("Share failed:",t)}}({activeCard:t.cards[t.activeIndex],lastEventObject:t.lastEventObject});e.target.closest(".shorts-carousel__lightbox-close--mobile")&&(e.stopPropagation(),p(t))}),function(t,e,r){if(!e||!t)return;let n=!1;const o=()=>{n=!0,setTimeout(()=>{n=!1},1e3)};if("ontouchstart"in window||navigator?.maxTouchPoints>0){let s=0,a=0,i=!1;const c=t=>{if(n)return;const e=t.touches[0];s=e.clientX,a=e.clientY,i=!1},d=t=>{if(n)return;const e=t.touches[0],r=e.clientX-s,o=e.clientY-a;Math.abs(r)>Math.abs(o)&&(i=!0,t.preventDefault())},l=e=>{if(n||!i)return;i=!1;const a=e.changedTouches[0].clientX-s;Math.abs(a)<50||(r(t,a>0?-1:1),o())};e.addEventListener("touchstart",c,{passive:!0}),e.addEventListener("touchmove",d,{passive:!1}),e.addEventListener("touchend",l,{passive:!0})}let s=0,a=null;e.addEventListener("wheel",e=>{Math.abs(e.deltaX)<=Math.abs(e.deltaY)||(e.preventDefault(),n||(s+=e.deltaX,clearTimeout(a),Math.abs(s)<50?a=setTimeout(()=>{s=0},150):(r(t,s<0?-1:1),s=0,o())))},{passive:!1})}(t,t.wrapper,f)}(s),s}function h(t,e,r){const n=u(t);if(!n)return;const o=n.cards.findIndex(t=>t.getAttribute("data-short-id")===e);n.activeIndex=o>=0?o:0,n.triggerElement=r,n.cards.forEach((t,e)=>{t.style.display=Math.abs(e-n.activeIndex)<=1?"":"none"}),n.wrapper.classList.add("show"),n.wrapper.setAttribute("aria-hidden","false"),n.wrapper.dataset.triggerElementId=r.id||"",n.wrapper.dataset.instanceId=t,document.body.classList.add("shorts-lightbox-open"),g(n);const s=n.wrapper.querySelector(".shorts-carousel__lightbox-close");!s?.focus||window.innerWidth<=767||s.focus()}function p(t){if(!t?.wrapper)return;if(d())return;const e=new CustomEvent("shorts-exit",{detail:{lastEventObject:t.lastEventObject}});document.dispatchEvent(e),t.animationTimeout&&(clearTimeout(t.animationTimeout),t.animationTimeout=null),t.wrapper.classList.remove("show"),t.wrapper.setAttribute("aria-hidden","true"),document.body.classList.remove("shorts-lightbox-open"),t.isLanding=!0,t.lastEventObject={},t.previousIndex=-1,t.triggerElement?.focus&&t.triggerElement.focus(),t.triggerElement=null}function f(t,e){if(!t?.cards)return;const r=t.cards.length-1,n=Math.min(r,Math.max(0,t.activeIndex+e));n!==t.activeIndex&&(t.activeIndex=n,g(t))}function g(t){const{activeIndex:e,cards:r,wrapper:n}=t;if(!r?.length||e<0||!n)return;const o=r[e],s=o?.getAttribute("data-short-id"),a=parseInt(o?.getAttribute("data-card-index"),10),i=parseInt(o?.getAttribute("data-total-cards"),
110),c=o?.getAttribute("data-short-title"),d=o?.getAttribute("data-short-publish");s&&t.shortsSeen.add(s);let l=1;const u=Array.from(t.shortsSeen).indexOf(s);u>=0&&(l=u+1);const h=function(t,e,r,n){if(t)return"true"===new URLSearchParams(window.location.search).get("share_story")?"shared_landing":"landing";const o=e[r],s=o?.getAttribute("data-short-id");return s&&s!==n?"switch":"manualAdvance"}(t.isLanding,r,t.previousIndex,s),p=a===i-1?"last_card":(["first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth"][(f=a+1)-1]||f)+"_card";var f;t.lastEventObject={event_action:h,event_category:"extended_view",event_label:p,event_object_position:a+1,event_object_text:c,event_object_type:"short_card",interaction_depth:`${t.shortsSeen.size}/${t.totalShorts}`,unit_position:l},d&&(t.lastEventObject.short_publish=d);const g=r[t.previousIndex],v=g?.getAttribute("data-short-id")||null,m=new CustomEvent("shorts-card-view",{detail:{isLanding:t.isLanding,previousShortId:v,cardIndex:a,totalCards:i,shortTitle:c||"",shortId:s,unitPosition:l,shortsSeen:t.shortsSeen.size,totalShorts:t.totalShorts,publishDate:d}});document.dispatchEvent(m),t.isLanding&&(t.isLanding=!1),r.forEach((t,r)=>{t.classList.remove("is-active","is-prev","is-next","is-hidden","is-hidden-left","is-hidden-right"),t.removeAttribute("aria-current"),r===e?(t.style.display="",t.classList.add("is-active"),t.setAttribute("aria-current","true"),t.querySelectorAll(".shorts-lightbox__pagination-dot").forEach(t=>{parseInt(t.getAttribute("data-card-index"),10)===a?t.classList.add("is-active"):t.classList.remove("is-active")})):r===e-1?(t.style.display="",t.classList.add("is-prev")):r===e+1?(t.style.display="",t.classList.add("is-next")):(t.style.display="none",t.classList.add(r<e?"is-hidden-left":"is-hidden-right"))}),t.previousIndex=e;const b=n.querySelector(".shorts-carousel__lightbox-nav--prev"),y=n.querySelector(".shorts-carousel__lightbox-nav--next");b&&(b.disabled=e<=0,b.setAttribute("aria-disabled",String(e<=0))),y&&(y.disabled=e>=r.length-1,y.setAttribute("aria-disabled",String(e>=r.length-1)));const _=n.querySelector("[data-lightbox-announcement]");if(_){const t=n.getAttribute("data-total-cards")||r.length;_.textContent=`Viewing card ${e+1} of ${t}`}}function v(t){if(t?.key)if(c.includes(t.key))l.forEach(t=>{t.wrapper?.classList.contains("show")&&p(t)});else if("ArrowLeft"===t.key||"ArrowRight"===t.key){const e=Array.from(l.values()).find(t=>t.wrapper?.classList.contains("show"));if(!e)return;f(e,"ArrowLeft"===t.key?-1:1)}}function m(t){const e=t.target?.closest(".dmg__post-short");if(!e)return;const r=e.getAttribute("data-instance"),n=e.getAttribute("data-short-id");r&&n&&u(r)&&(t.preventDefault(),t.stopPropagation(),h(r,n,e))}function b(t){if(t.target.classList.contains("shorts-carousel__lightbox-content")||t.target.classList.contains("shorts-carousel__lightbox")){const t=Array.from(l.values()).find(t=>t.wrapper?.classList.contains("show"));t&&p(t)}}function y(){return window.dmgShorts=window.dmgShorts||{},window?.dmgShorts?.listenerPrefix||"dmg-web-stories"}function _(t,e={}){try{parent.postMessage({type:t,...e},"*")}catch(t){console.error("Failed to send message to parent:",t)}}function w(){if(window.dmgShortsViewInitialized)return;window.dmgShortsViewInitialized=!0,document.querySelectorAll(".shorts-carousel__nav-item").forEach(t=>{t.addEventListener("click",i)}),document.querySelectorAll("[data-carousel-body]").forEach(t=>{const e=t.getAttribute("data-carousel-body");e&&(setTimeout(()=>{o(e),s()},500),t.addEventListener("scroll",()=>{o(e)}))}),a(),s(),document.addEventListener("click",m),document.addEventListener("click",b),document.addEventListener("keydown",v),function(){let t=null;if(d()){const e=Array.from(document.body.classList).find(t=>t.startsWith("postid-"));t=e?.replace("postid-","")}else{const e=new URLSearchParams(window.location.search),r=e.get("utm_medium"),n=e.get("short_id");"shorts_card"===r&&n&&(t=n)}if(!t)return;const e=document.querySelectorAll(".shorts-carousel__lightbox-wrapper[data-shorts-lightbox-instance]");let r=null;for(const n of e){const e=n.getAttribute("data-shorts-lightbox-instance"),o=document.querySelector(`.shorts-carousel__lightbox-carousel[data-shorts-carousel="${e}"]`);if(o&&o.querySelector(`.shorts-lightbox__card[data-short-id="${t}"]`)){r=e;break}}r&&h(r,t,document.body)}(),function(){if(!document.body.classList.contains("single-short-template--embedded"))return;!function(){const t=y();window.gtag=function(...e){const[r,n,o]=e;try{parent.postMessage({type:`${t}-gtag`,command:r,eventName:n,params:o},"*")}catch(t){console.error("Failed to forward gtag to parent:",t)}}}();const t=y();!function(t){const e=document.querySelector('.dmg__post-section[data-type="ShortsCarou
1sel"]');if(!e)return;const r=()=>{const r=Math.ceil(e.getBoundingClientRect().height);_(`${t}-embed-resize`,{height:r})};r(),new ResizeObserver(r).observe(e)}(t),document.querySelectorAll(".dmg__post-short, .web-stories-list__story").forEach(e=>{e.addEventListener("click",()=>{_(`${t}-embed-open`)})}),document.addEventListener("shorts-exit",()=>{_(`${t}-embed-close`)})}();const t=e()(()=>{document.querySelectorAll('.dmg__post-section[data-type="ShortsCarousel"] .dmg__post-section__body').forEach(t=>{t.style.width="";const e=t.getAttribute("data-carousel-body");e&&o(e)}),s(),a()},150);window.addEventListener("resize",t)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",w):w()})()})();

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.