1(function () { 2 const VERBOSE = /r26Debug/.test(window.location.search); 3 function error(...args) { 4 if (VERBOSE) console.error("[RINGBELL r26-ld-json.js]", ...args); 5 } 6 7 function removeAttr(e) { 8 e.removeAttribute("class"); 9 e.removeAttribute("style"); 10 } 11 12 function getHtml(element) { 13 if (element instanceof Text) return element.nodeValue.trim(); 14 if (!(element instanceof HTMLElement)) return ""; 15 16 const src = element.cloneNode(true); 17 removeAttr(src); 18 for (const x of src.querySelectorAll("*")) removeAttr(x); 19 return src.innerHTML.trim().replace(/[ \t]*(\r\n|\n|\r)+[ \t]*/g, ""); 20 } 21 22 function faq() { 23 const result = { 24 "@context": "https://schema.org", 25 "@type": "FAQPage", 26 mainEntity: [] 27 }; 28 for (const item of document.querySelectorAll("[data-r26-faq]")) { 29 const qList = Array.from( 30 item.querySelectorAll("[data-r26-faq-question]") 31 ); 32 const aList = Array.from(item.querySelectorAll("[data-r26-faq-answer]")); 33 if (qList.length !== aList.length) { 34 error( 35 `[data-r26-faq-question] 㨠[data-r26-faq-answer] ã®æ°ããã£ã¦ãã¾ãã: ${qList.length} !==${aList.length}` 36 ); 37 continue; 38 } 39 for (let i = 0; i < qList.length; i += 1) { 40 result.mainEntity.push({ 41 "@type": "Question", 42 name: getHtml(qList[i]), 43 acceptedAnswer: { 44 "@type": "Answer", 45 text: getHtml(aList[i]) 46 } 47 }); 48 } 49 } 50 51 const tag = document.createElement("script"); 52 tag.type = "application/ld+json"; 53 tag.textContent = JSON.stringify(result, null, 4); 54 document.head.appendChild(tag); 55 } 56 57 faq(); 58})();
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.