PageSourceSearch

https://www.tv2ostjylland.dk/vendor/statamic-norkon-livecenter/build/assets/norkon_channel-2adbb209.js

js tv2ostjylland.dk collected 2026-09-24 18:01:04 UTC 8,007 bytes, 1 lines download raw bytes

1import{l as p}from"./lib-9ab42b46.js";document.addEventListener("alpine:init",()=>{Alpine.data("norkon_relative_time",(l,d)=>({date:l,longMonths:d||!1,timeString:"",monthNames:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longMonthNames:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],now:null,aYearAgo:null,aDayAgo:null,fiftyNineMinutesAgo:null,aMinuteAgo:null,init(){this.date instanceof Date&&(this.$el.innerText=this.relativeTime())},setComparisonDates(){this.now=new Date,this.aYearAgo=new Date,this.aDayAgo=new Date,this.fiftyNineMinutesAgo=new Date,this.aMinuteAgo=new Date,this.aYearAgo.setFullYear(this.aYearAgo.getFullYear()-1),this.aDayAgo.setDate(this.aDayAgo.getDate()-1),this.fiftyNineMinutesAgo.setMinutes(this.fiftyNineMinutesAgo.getMinutes()-59),this.aMinuteAgo.setMinutes(this.aMinuteAgo.getMinutes()-1)},relativeTime(){if(this.setComparisonDates(),this.date>this.aMinuteAgo)return"lige nu";if(this.date>this.fiftyNineMinutesAgo)return`${Math.floor((this.now-this.date)/1e3/60)} min. siden`;if(this.date>this.aDayAgo){const a=this.date.getDate()==this.now.getDate()?"dag":"går",o=this.date.getHours().toString().padStart(2,"0"),g=this.date.getMinutes().toString().padStart(2,"0");return`i ${a} kl. ${o}:${g}`}return this.date>this.aYearAgo?`${this.date.getDate()}. ${this.longMonths?this.longMonthNames[this.date.getMonth()]:this.monthNames[this.date.getMonth()]}`:`${this.date.getDate()}. ${this.longMonths?this.longMonthNames[this.date.getMonth()]:this.monthNames[this.date.getMonth()]} ${this.date.getFullYear()}`}}))});const u=l=>{l.data("norkon_alpine_channel_updater",({articleId:d,articleUrl:a,channelId:o,tenantKey:g,order:f,selectedTag:c,minVideoWidth:m})=>({bulletinProvider:null,wsProvider:null,articleId:d,articleUrl:a,channelId:o,tenantKey:g,selectedTag:c?c.trim():"",order:f||["latest"],minVideoWidth:m||320,latest:[],pinned:[],highlighted:[],pinned_latest:[],feed:[],get post(){return this.feed.length>0?this.feed[0]:{title:"",url:"",date:null,media:{type:"none"}}},get postMedia(){return this.post.media},get postHasMedia(){return this.postMedia.type!="none"},init(){p("NcPosts").then(e=>{this.bulletinProvider=new e.BulletinTenantProvider(new NcCore.StandardBackendService("https://livecenter.norkon.net/",window.axios),this.tenantKey),this.getInitialData(),this.startWebsocket()})},getInitialData(){let e=Promise.resolve();this.selectedTag!==""&&(e=fetch(`https://livecentercdn.norkon.net/BulletinFeed/${this.tenantKey}/${this.channelId}/EarlierObj/0/${this.selectedTag}/`).then(i=>i.json()).then(i=>i.result));let t=this.bulletinProvider.getFeedInitial(this.channelId);Promise.all([t,e]).then(i=>{this.constructFeed(i[0],i[1])})},startWebsocket(){this.wsProvider=new NcPosts.BulletinWebSocketProvider("wss://livecenter.norkon.net/",this.tenantKey,window.WebSocket),this.wsProvider.connect(this.channelId,this.socketDataReceived.bind(this),this.socketOpened.bind(this),this.socketClosed.bind(this))},constructFeed(e,t){this.pinned=[],this.highlighted=[],this.latest=[],e&&e.channelContent&&e.channelContent.pinnedPostIds&&e.channelContent.pinnedPostIds.length>0&&(this.pinned=e.channelContent.pinnedPostIds.map(i=>this.objFromPost(e.inferred[i]))),e&&e.channelContent&&e.channelContent.highlightedPostIds&&e.channelContent.highlightedPostIds.length>0&&(this.highlighted=e.channelContent.highlightedPostIds.map(i=>this.objFromPost(i))),t&&t.bulletins&&Array.isArray(t.bulletins)&&t.bulletins.length>0?this.latest=t.bulletins.map(i=>this.objFromPost(i)):e&&e.addedOrChanged&&e.addedOrChanged.length>0&&(this.latest=e.addedOrChanged.map(i=>this.objFromPost(i))),this.feedFromOrder()},objFromPost(e){let t=e&&e.content&&e.content.userContribution&&!e.content.html;return{id:e.id,type:t?"question":"post",title:e.title,date:new Date(e.created*1e3),importance:e.importance||1,tags:e.tags||[],url:this.getDirectPostURL(e.id),plain_text:this.getPlainText(e),media:this.getMedia(e)}},getDirectPostURL(e){return this.articleId?`${location.protocol}//${location.host}/live-blog-post/${this.articleId}/${this.channelId}/${e}`:`${this.articleUrl}?p=${e}`},feedFromOrder(){this.filterTags(),this.filterOutQuestions(),this.latest.sort((e,t)=>
1t.date-e.date),this.highlighted.sort((e,t)=>t.date-e.date),this.pinned.sort((e,t)=>t.date-e.date),Array.isArray(this.order)&&this.order.length>0&&(this.feed=[],this.order.forEach(e=>{e==="pinned"?this.feed=[...this.feed,...this.pinned]:e==="highlighted"?this.feed=[...this.feed,...this.highlighted]:e==="latest"&&(this.feed=[...this.feed,...this.latest])})),this.feed.length===0&&(this.feed=[...this.latest]),this.removeDuplicates(),console.log("New feed",this.feed)},removeDuplicates(){const e=new Set;this.feed=this.feed.filter(t=>e.has(t.id)?!1:(e.add(t.id),!0))},filterTags(){this.selectedTag!==""&&(this.latest=this.latest.filter(e=>e.tags.includes(this.selectedTag)),this.pinned=this.pinned.filter(e=>e.tags.includes(this.selectedTag)),this.highlighted=this.highlighted.filter(e=>e.tags.includes(this.selectedTag)))},filterOutQuestions(){this.latest=this.latest.filter(e=>e.type!=="question"),this.pinned=this.pinned.filter(e=>e.type!=="question"),this.highlighted=this.highlighted.filter(e=>e.type!=="question")},socketOpened(){},socketClosed(){},socketDataReceived(e){e.deletedIds&&e.deletedIds.length>0&&e.deletedIds.forEach(this.deleteId.bind(this)),e.added&&e.added.length>0&&e.added.forEach(this.addPost.bind(this)),e.changed&&e.changed.length>0&&e.changed.forEach(this.changePost.bind(this)),!e.deletedIds&&!e.added&&!e.changed&&this.getInitialData()},deleteId(e){this.latest=this.latest.filter(t=>t.id!==e),this.pinned=this.pinned.filter(t=>t.id!==e),this.highlighted=this.highlighted.filter(t=>t.id!==e),this.feedFromOrder()},addPost(e){const t={id:e.id,title:e.title,date:new Date(e.created*1e3),importance:e.importance||1,tags:e.tags||[],url:`${this.articleUrl}?p=${e.id}`,plain_text:this.getPlainText(e),media:this.getMedia(e)};this.latest.unshift(t),this.feedFromOrder()},changePost(e){const t={id:e.id,title:e.title,date:new Date(e.created*1e3),importance:e.importance||1,tags:e.tags||[],url:`${this.articleUrl}?p=${e.id}`,plain_text:this.getPlainText(e),media:this.getMedia(e)};this.pinned=this.pinned.map(i=>i.id===e.id?t:i),this.highlighted=this.highlighted.map(i=>i.id===e.id?t:i),this.latest=this.latest.map(i=>i.id===e.id?t:i),this.latest.find(i=>i.id===e.id)==null&&this.latest.unshift(t),this.feedFromOrder()},getPlainText(e={}){return!e||Object.keys(e).length===0||!e.content||!e.content.html?"":new DOMParser().parseFromString(e.content.html,"text/html").body.textContent||""},getMedia(e={}){if(!e||Object.keys(e).length===0||!e.content||!e.content.html)return{type:"none"};{const t=new DOMParser().parseFromString(e.content.html,"text/html"),i=t.querySelector("ncpost-content[data-type=tv2reg_video]"),r=t.querySelector("ncpost-content[data-type=tv2reg_image]");return i?(this.loadMP4(i.getAttribute("data-video-jwp-id")).then(s=>{let n=this.latest.find(h=>h.id==e.id);n&&(n.media.src=s),n=this.pinned.find(h=>h.id==e.id),n&&(n.media.src=s),n=this.highlighted.find(h=>h.id==e.id),n&&(n.media.src=s),this.feedFromOrder()}),{type:"video",src:"",thumbnail:i.getAttribute("data-video-thumbnail")||null}):r?{type:"image",src:r.getAttribute("data-image-src")||null,alt:r.getAttribute("data-image-alt")||null}:{type:"none"}}},async loadMP4(e){const t=await fetch(`https://cdn.jwplayer.com/v2/media/${e}?format=json`),i=await t.json();if(t.status===200){let r=i.playlist[0].sources.filter(n=>n.type==="video/mp4").sort((n,h)=>h.width-n.width),s=null;return r.forEach(n=>{s==null&&(s=n),n.width<=s.width&&n.width>this.minVideoWidth&&(s=n)}),s?s.file:""}}})),Array.from(document.querySelectorAll(".norkon_alpine_channel_updater[x-ignore]")).forEach(d=>{d.removeAttribute("x-ignore"),window.requestAnimationFrame(()=>{l.initTree(d)})})};window.Alpine?u(window.Alpine):document.addEventListener("alpine:init",()=>{u(window.Alpine)});

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.