1document.addEventListener("DOMContentLoaded", (event) => { 2 // æ¬æã®ãã¼ã¸ã³å¯¾ç 3 const entryContents = document.querySelectorAll(".tcdce-body"); 4 if (entryContents) { 5 entryContents.forEach((el) => { 6 // æ¡ä»¶ãå¤å®ããããã®é¢æ° 7 const isTextOnlyParagraph = (el) => { 8 // pã¿ã°ãããªããã°çµäº 9 if (!el || el.tagName?.toLowerCase() !== "p") return false; 10 11 // å²ã¿æ ã®å ´åã¯çµäº 12 if (el.classList.contains("tcdce-box")) { 13 return false; 14 } 15 16 // ãã¿ã³ãå«ãå ´åã¯çµäº 17 if (el.querySelector(".tcdce-button")) { 18 return false; 19 } 20 21 // ç»åãå«ãå ´åã¯çµäº 22 if (el.querySelector("img")) { 23 return false; 24 } 25 26 // ããã¹ãã空ç½ã ããªãé¤å¤ 27 const text = el.textContent.trim(); 28 if (!text) { 29 // ããã¹ããå®å ¨ã«ç©ºãªãfalse 30 return false; 31 } 32 33 return true; 34 }; 35 36 // æåã®è¦ç´ 37 const firstEl = el.firstElementChild; 38 if (isTextOnlyParagraph(firstEl)) { 39 firstEl.style.marginTop = "calc((1em - 1lh) / 2)"; 40 } 41 42 // æå¾ã®è¦ç´ 43 const lastEl = el.lastElementChild; 44 if (isTextOnlyParagraph(lastEl)) { 45 lastEl.style.marginBottom = "calc((1em - 1lh) / 2)"; 46 } 47 }); 48 } 49 50 // marker 51 var markers = document.querySelectorAll(".tcdce-marker"); 52 if (markers.length) { 53 markers.forEach((el) => { 54 el.classList.add("is-hide"); 55 56 // borderColor䏿¸ã 57 var markerColor = el.style.getPropertyValue("border-bottom-color"); 58 if (markerColor) { 59 el.setAttribute("style", "--tcdce-marker-color:" + markerColor + ";"); 60 } 61 62 const options = { 63 root: null, 64 rootMargin: "0px", 65 threshold: 0.5, 66 }; 67 68 new IntersectionObserver(function (entries) { 69 entries.forEach((entry) => { 70 if ( 71 entry.isIntersecting && 72 !entry.target.classList.contains("is-active") 73 ) { 74 entry.target.classList.remove("is-hide"); 75 } 76 }); 77 }, options).observe(el); 78 }); 79 } 80 81 // toc 82 var toc = document.querySelector(".tcdce-body .p-toc"); 83 var tocOpen = document.getElementById("js-tcdce-toc-open"); 84 var tocClose = document.querySelectorAll(".js-tcdce-toc-close"); 85 var tocModalLinks = document.querySelectorAll( 86 '#js-tcdce-toc-modal a[href^="#"]' 87 ); 88 if (tocOpen && tocClose.length) { 89 // modal open 90 tocOpen.addEventListener("click", (e) => { 91 document 92 .getElementById("js-tcdce-toc-modal") 93 .classList.toggle("is-active"); 94 }); 95 96 // modal close 97 tocClose.forEach((el) => { 98 el.addEventListener("click", (e) => { 99 tocOpen.click(); 100 }); 101 }); 102 103 // scroll icon 104 window.addEventListener("scroll", (e) => { 105 var scrollTop = window.pageYOffset || document.documentElement.scrollTop; 106 var tocOffset = 107 toc == null ? 1 : toc.getBoundingClientRect().top + scrollTop; 108 if (tocOffset > scrollTop) { 109 tocOpen.classList.remove("is-active"); 110 } else { 111 tocOpen.classList.add("is-active"); 112 } 113 }); 114 115 if (tocModalLinks.length) { 116 for (let tocLink of tocModalLinks) { 117 tocLink.addEventListener("click", (e) => { 118 tocOpen.click(); 119 }); 120 } 121 } 122 } 123 124 // tab content 125 var tabs = document.querySelectorAll(".tcdce-tab__label-item"); 126 if (tabs.length) { 127 for (let tab of tabs) { 128 tab.addEventListener("click", (e) => { 129 let children = e.target.parentNode.children; 130 for (let child of children) { 131 child.classList.remove("is-active"); 132 } 133 e.target.classList.add("is-active"); 134 }); 135 } 136 } 137});
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.