https://yakumouranai.com/wp-content/themes/yakumo-brand/assets/js/iching/iching-table.js?ver=0.1.660
1/** 2 * ============================================================ 3 * ã¤ã¼ãã³ãã¤ã¹ - å ååå¦ä¸è¦§è¡¨ 4 * ============================================================ 5 * 6 * 2026-10-04ãå «é²ãã¾ã®ãæç¤ºããã®è¡¨ããã®ã¾ã¾ãã¤ã¼ãã³ãã¤ã¹ã®ã¨ããã«ãããã 7 * ï¼æçµå ã ekikyo.netãå ååå¦ä¸è¦§ãã®è¡¨ï¼ã並ã³ã¯ãã®è¡¨ã¨åãã«ããï¼ 8 * ã»æ¨ªï¼åï¼ãä¸å¦ï¼å·¦ãã å¤ã»è®ã»åã»å·½ã»éã»é¢ã»å ã»ä¹¾ 9 * ã»ç¸¦ï¼è¡ï¼ãä¸å¦ï¼ä¸ãã ä¹¾ã»å ã»é¢ã»éã»å·½ã»åã»è®ã»å¤ 10 * ã»ãã¡ã°ãå³ã®åã«ä¸å¦ã®ååããã¡ã°ãä¸ã®è¡ã«ä¸å¦ã®åå 11 * ã»åã¾ãã«ãå¦ã®çªå·ã»å¦ã®å½¢ã»å¦ã®åå 12 * 表ã®ä¸èº«ã¯ iching-data.js ããçµã¿ç«ã¦ãï¼ãµã¤ãã®çµµãæç« ã¯åãã¦ããªãï¼ã 13 * 14 * ã¾ããæ¼ãã¨ããã®å¦ã®è§£èª¬ï¼å¦è¾ã»è§£èª¬ã»å ã¤ã®ç»è¾ï¼ã表ã®ä¸ã«åºãã 15 * å¦ãç«ã¦ããã¨ã¯ãæ¬å¦ï¼æ±ï¼ã¨ä¹å¦ï¼å¢¨ã®æ ï¼ã表ã®ä¸ã§ç®ç«ãããã 16 * ============================================================ 17 */ 18 19import { HEXAGRAMS, trigramByNumber, hexagramByTrigrams } from './iching-data.js'; 20 21export const UPPER_ORDER = [8, 7, 6, 5, 4, 3, 2, 1]; 22export const LOWER_ORDER = [1, 2, 3, 4, 5, 6, 7, 8]; 23 24function escapeHtml(text) { 25 return String(text).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]); 26} 27 28/** ç»ã®ä¸¦ã³ï¼ä¸ããä¸ã1=é½ï¼ããå°ããªæ¨ªç·ã®çµµã«ãã */ 29function barsSvg(lines) { 30 const n = lines.length; 31 const rows = lines 32 .map((bit, i) => { 33 const y = (n - 1 - i) * 7; 34 return bit 35 ? `<rect x="0" y="${y}" width="30" height="4"/>` 36 : `<rect x="0" y="${y}" width="13" height="4"/><rect x="17" y="${y}" width="13" height="4"/>`; 37 }) 38 .join(''); 39 return `<svg class="iching-table-bars" viewBox="0 0 30 ${n * 7 - 3}" aria-hidden="true">${rows}</svg>`; 40} 41 42function trigramHead(no) { 43 const t = trigramByNumber(no); 44 return `${barsSvg(t.lines)}<span class="iching-table-tri">${t.name}</span><span class="iching-table-img">ï¼${t.image}ï¼</span>`; 45} 46 47export class HexagramTable { 48 /** 49 * @param {HTMLElement} wrap 表ãå ¥ããç®± 50 * @param {HTMLElement} detail æ¼ããå¦ã®è§£èª¬ãåºãç®± 51 * @param {() => Promise<object|null>} loadTexts 解説ãã¼ã¿ãèªã¿è¾¼ã颿° 52 */ 53 constructor(wrap, detail, loadTexts) { 54 this.wrap = wrap; 55 this.detail = detail; 56 this.loadTexts = loadTexts; 57 this.render(); 58 wrap.addEventListener('click', (e) => { 59 const cell = e.target.closest('[data-hex]'); 60 if (cell) this.show(Number(cell.dataset.hex)); 61 }); 62 } 63 64 render() { 65 const head = UPPER_ORDER.map((u) => `<th scope="col" class="iching-table-head">${trigramHead(u)}</th>`).join(''); 66 const body = LOWER_ORDER.map((l) => { 67 const cells = UPPER_ORDER.map((u) => { 68 const h = hexagramByTrigrams(u, l); 69 return `<td><button type="button" class="iching-table-cell" data-hex="${h.number}" aria-label="第${h.number}å¦ ${h.name}"> 70 <span class="iching-table-no">${h.number}</span>${barsSvg(h.lines)}<span class="iching-table-name">${h.name}</span> 71 </button></td>`; 72 }).join(''); 73 return `<tr>${cells}<th scope="row" class="iching-table-head is-lower">${trigramHead(l)}</th></tr>`; 74 }).join(''); 75 this.wrap.innerHTML = ` 76 <table class="iching-table"> 77 <thead><tr>${head}
77<th scope="col" class="iching-table-corner">âä¸å¦<br>âä¸å¦</th></tr></thead> 78 <tbody>${body}</tbody> 79 </table>`; 80 } 81 82 /** ç«ã¦ãå¦ã表ã®ä¸ã§ç®ç«ãããï¼æ¬å¦ã¯æ±ãä¹å¦ã¯å¢¨ã®æ ï¼ãnull ã§æ¶ã */ 83 mark(primaryNo = null, changedNo = null) { 84 this.wrap.querySelectorAll('.iching-table-cell').forEach((b) => { 85 const n = Number(b.dataset.hex); 86 b.classList.toggle('is-primary', n === primaryNo); 87 b.classList.toggle('is-changed', n === changedNo); 88 }); 89 } 90 91 async show(number) { 92 const h = HEXAGRAMS[number - 1]; 93 const texts = await this.loadTexts(); 94 const t = texts?.[number]; 95 this.wrap.querySelectorAll('.iching-table-cell').forEach((b) => b.classList.toggle('is-open', Number(b.dataset.hex) === number)); 96 if (!t) return; 97 const lines = t.lines 98 .map((l) => `<li><p class="iching-reading-classic">${escapeHtml(l.text)}</p><p class="iching-reading-text">${escapeHtml(l.meaning)}</p></li>`) 99 .join(''); 100 const extra = t.extra 101 ? `<li><p class="iching-reading-classic">${escapeHtml(t.extra.text)}</p><p class="iching-reading-text">${escapeHtml(t.extra.meaning)}</p></li>` 102 : ''; 103 this.detail.innerHTML = ` 104 <section class="iching-reading-block"> 105 <h3 class="iching-reading-head"><span class="iching-reading-tag">第${h.number}å¦</span>${escapeHtml(h.name)}<span class="iching-reading-key">${escapeHtml(t.keyword)}</span></h3> 106 <p class="iching-table-parts">ä¸å¦ ${h.upper.symbol} ${h.upper.name}ï¼${h.upper.image}ï¼ã»ä¸å¦ ${h.lower.symbol} ${h.lower.name}ï¼${h.lower.image}ï¼</p> 107 <p class="iching-reading-classic">${escapeHtml(t.judgment)}</p> 108 <p class="iching-reading-text">${escapeHtml(t.meaning)}</p> 109 <p class="iching-reading-advice">${escapeHtml(t.advice)}</p> 110 <h4 class="iching-table-subhead">ç»è¾ï¼ä¸ã®åç»ããä¸ç»ã¸ï¼</h4> 111 <ul class="iching-reading-lines">${lines}${extra}</ul> 112 </section>`; 113 this.detail.hidden = false; 114 this.detail.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); 115 } 116}
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.