PageSourceSearch

https://www1.wdr.de/assets-v5.180.2/js/Comments-BXn9AJqV.js

js wdr.de collected 2026-09-24 07:59:28 UTC 4,585 bytes, 1 lines download raw bytes

1import{B as p}from"./Base-BouCSPYx.js";import{i as u}from"./main.js";class w extends p{static className="Ellipsis";TEASER_LENGTH=149;init(){this.applyEllipsis()}applyEllipsis(){const e=this.container,t=e.textContent??"";if(t.length<=this.TEASER_LENGTH)return;const n=t.substring(0,this.TEASER_LENGTH),s=document.createElement("span");s.className="all",s.append(...Array.from(e.childNodes)),s.style.display="none",e.innerHTML="",e.appendChild(s);const o=document.createElement("span");o.className="ellipsis",o.textContent=n+" ...",e.appendChild(o);const r=document.createElement("a");r.className="readMore",r.href="#",r.innerHTML="<span>Weiterlesen</span>",r.addEventListener("click",c=>{c.preventDefault(),this.toggleEllipsis(s,o,r)}),e.appendChild(r)}toggleEllipsis(e,t,n){const s=e.style.display==="none";e.style.display=s?"block":"none",t.style.display=s?"none":"inline",n.innerHTML="",n.style.opacity="0",n.setAttribute("tabindex","-1")}}class y extends p{static className="Answers";VISIBLE_COUNT=5;submitBoundContainers=new WeakSet;init(){this.initCollapseAnswerFormButtons(),this.initCollapseAnswersButton()}async handleAnswerFormSubmit(e){this.submitBoundContainers.has(e)||(this.submitBoundContainers.add(e),e.addEventListener("submit",async t=>{const n=t.target;if(!n.matches("[data-answers-form] form"))return;t.preventDefault();const s=n.closest("[data-answers-form]");if(!s)return;const o=s.querySelector('[type="submit"]'),r=n.getAttribute("action")?.split("#")[0]??"",c=new FormData(n);o?.name&&c.append(o.name,o.value);const i=new URLSearchParams;c.forEach((a,l)=>{typeof a=="string"&&i.append(l,a)});try{const l=await(await fetch(r,{method:"POST",body:i.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})).text();s.outerHTML=l,u(e);const m=e.querySelector("[data-answers-form]");m?.classList.add("visible"),m?.querySelector("#commentAnswerFormSuccess")&&e.querySelector(".collapseControl")?.remove()}catch(a){console.error("Error submitting the answer form:",a)}}))}initCollapseAnswersButton(){Array.from(this.container.querySelectorAll(".answers")).forEach(t=>{const n=Array.from(t.querySelectorAll(".answer"));if(n.length<=this.VISIBLE_COUNT)return;const s=document.createElement("div");s.className="collapseControl";const o=document.createElement("button");o.className="toggleAnswers",o.innerHTML="<span>Weitere Antworten</span>",s.append(o);let r=this.VISIBLE_COUNT-1;const c=()=>{if(r+=this.VISIBLE_COUNT,r>=n.length-1){s.remove();return}n[r].append(s)};o.addEventListener("click",i=>{i.preventDefault(),c()}),n[r].append(s)})}initCollapseAnswerFormButtons(){Array.from(this.container.querySelectorAll("[data-answers-toggle]")).forEach(t=>{let n=!1;const s=t.getAttribute("data-answers-toggle");if(!s)return;const o=JSON.parse(s),r=o.url,c=o.count;t.addEventListener("click",async i=>{i.preventDefault();const a=t.closest(".answerSection");let l=a?.querySelector("[data-answers-form]");if(!n){const f=await(await fetch(r)).text();l&&(l.outerHTML=f,u(a),a.querySelector("[data-answers-form]")?.classList.add("visible"),await this.handleAnswerFormSubmit(a)),n=!0}t.classList.toggle("close");const m=t.classList.contains("close");t.querySelector("span").textContent=m?"Antwortfeld schließen":`Antworten${c!==void 0?` (${c})`:""}`,l=a.querySelector("[data-answers-form]"),l?.classList.toggle("visible",m)})})}}class d extends p{static className="Comments";init(){this.initSubcomponents(),this.initCollapseFormButton(),this.initLoadMoreCommentsButton()}initSubcomponents(e=this.container){this.getSubcomponentInstances(d.className,y,e),this.getSubcomponentInstances(d.className,w,e)}async loadMoreComments(e,t){const n=e.getAttribute("data-comments-more");if(!n)return;const o=JSON.parse(n).url;if(o)try{const c=await(await fetch(o)).text(),i=document.createElement("div");i.classList.add("commentsMoreContainer"),i.innerHTML=c,t.appendChild(i),this.initSubcomponents(i);const a=i.querySelector("hr");i.replaceWith(...i.childNodes),a?(e.setAttribute("data-comments-more",a.getAttribute("data-comments-more-next")||""),a.remove()):e.remove()}catch(r){console.error("Failed to load more comments:",r)}}initLoadMoreCommentsButton(){const e=this.container.querySelector(".loadMoreComments"),t=this.container.querySelector("#commentsList");!e||!t||e.addEventListener("click",()=>this.loadMoreComments(e,t))}initCollapseFormButton(){const e=this.container.querySelector(".collapseForm"),t=this.container.querySelector(".modForm");!e||!t||e.addEventListener("click",()=>{t.classList.toggle("visible"),e.remove()})}}export{d as default};

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.