PageSourceSearch

https://rigsombudsmanden.fo/dist/assets/index-C496vYqC.js

js rigsombudsmanden.fo collected 2026-10-02 19:54:21 UTC 4,372 bytes, 1 lines download raw bytes

1import{i as P,n as A,a as F}from"./editor-rte-BFqDgSLQ.js";import{a as v,E as k}from"./api-fetcher-D7q-2H74.js";import"./_commonjsHelpers-Cpj98o6Y.js";const R=(e,n="",c="",t,o=500,d=10)=>P(e,{initialHtml:n,placeholder:c,maxLength:o,maxLines:d,counterEl:t}),O=(e,n,c,t)=>v(k.addComment,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",RequestVerificationToken:c},body:new URLSearchParams({contentId:String(e),text:n,culture:t||""})}),B=(e,n,c,t,o)=>v(k.editComment,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",RequestVerificationToken:t},body:new URLSearchParams({contentId:String(e),commentId:n,text:c,culture:o||""})}),N=(e,n,c)=>v(k.deleteComment,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",RequestVerificationToken:c},body:new URLSearchParams({contentId:String(e),commentId:n})}),M=(e,n,c,t,o,d,u="Are you sure you want to delete this comment?")=>{const f=e.querySelector(".js-delete-comment"),q=e.querySelector(".js-edit-comment"),S=e.querySelector(".js-comment-text"),h=e.querySelector(".js-comment-edit"),i=e.querySelector(".js-edit-comment-editor"),E=e.querySelector(".js-save-edit"),C=e.querySelector(".js-cancel-edit");if(f&&f.addEventListener("click",async()=>{if(!window.confirm(u))return;const r=e.dataset.commentId;if(r)try{if(await N(n,r,t),e.remove(),o){const s=parseInt(o.innerText,10)||1;o.innerText=String(s-1)}}catch(s){console.error("Delete comment failed:",s)}}),q&&S&&h&&i&&E&&C){let r=null;q.addEventListener("click",()=>{if(c.querySelectorAll(".js-comment-item.is-editing").forEach(s=>s.classList.remove("is-editing")),e.classList.add("is-editing"),!r&&i){const s=e.querySelector(".js-edit-comment-counter");r=R(i,S.innerHTML??"","",s)}}),C.addEventListener("click",()=>{e.classList.remove("is-editing"),r&&i&&(r.root.innerHTML=i.dataset.initial??"")}),E.addEventListener("click",async()=>{if(!r)return;const s=r.root.innerHTML,T=A(s);if(!T)return;const y=e.dataset.commentId;if(y)try{const a=await B(n,y,T,t,d);if(!a.comment)return;S.innerHTML=a.comment.text;const l=e.querySelector(".js-comment-meta"),m=l==null?void 0:l.querySelector(".js-comment-modified");m&&a.comment.modified&&(m.classList.remove("is-hidden"),m.textContent=`(${m.dataset.modifiedLabel} ${a.comment.localModifiedFormatted})`,m.title=a.comment.modifiedFormatted??""),i&&(i.dataset.initial=a.comment.text),e.classList.remove("is-editing")}catch(a){console.error("Edit comment failed:",a)}})}},Z=e=>{const n=Number(e.dataset.contentId);if(!n)return;const c=e.dataset.culture||"";(function(){const j=Intl.DateTimeFormat().resolvedOptions().timeZone;j&&(document.cookie=`LocalTimeZone=${j}; path=/; max-age=${60*60*24*365}; SameSite=Lax`)})();const t=e.closest(".js-likes-and-comments");if(!t)return;const o=t.querySelector(".js-content-comments-list"),d=t.querySelector(".js-comment-items"),u=t.querySelector(".js-comment-count"),f=t.querySelector(".js-add-comment-editor"),q=t.querySelector(".js-save-comment"),S=t.querySelector(".js-cancel-comment"),h=t.querySelector("#js-comment-template"),i=t.querySelector(".js-verification-token");if(!o||!d||!f||!q||!S||!h||!i)return;const E=o.dataset.deleteConfirmLabel,C=o.dataset.commentMaxLength,r=o.dataset.commentMaxLines,s=C?parseInt(C,10):500,T=r?parseInt(r,10):10,y=i.value,a=t.querySelector(".js-add-comment-counter"),l=R(f,"",f.dataset.placeholder??"",a,s,T),m=e.querySelector(".js-comments-toggle");m==null||m.addEventListener("click",()=>{const L=o.classList.contains("is-open");o.classList.toggle("is-open",!L),m.classList.toggle("active",!L)}),d.querySelectorAll(".js-comment-item").forEach(L=>M(L,n,d,y,u,c,E)),q.addEventListener("click",async()=>{const j=l.root.innerHTML;if(j&&!F(l))try{const x=(await O(n,j,y,c)).comment;if(!x)return;if(l.setText(""),u){const b=parseInt(u.textContent||"0",10);u.textContent=String(b+1)}const p=h.content.cloneNode(!0).querySelector(".js-comment-item");if(!p)return;p.dataset.commentId=String(x.id);const H=p.querySelector(".js-comment-text");H&&(H.innerHTML=x.text);const g=p.querySelector(".js-comment-meta"),w=g==null?void 0:g.querySelector(".js-comment-created");w&&(w.textContent=x.localCreatedFormatted,w.title=x.createdFormatted),d.appendChild(p),M(p,n,d,y,u,c,E)}catch(I){console.error("Add comment failed:",I)}}),S.addEventListener("click",()=>l.setText(""))};export{Z as ContentComments};

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.