// resources/js/modules/term-tooltip.js // 原 term-tooltip.js 移至此处(从 js/ 根目录移入 modules/)。 // 所有阅读页公用(tipitaka read、anthology read、wiki show、blog show)。 // 在 reader.js 中 import,不在 app.js 全局加载(仅阅读页需要)。 // // 文件内容:将现有 term-tooltip.js 内容直接复制至此,不做修改。 // 待 reader.js 建立后在此 import: // import './modules/term-tooltip'; import * as bootstrap from "bootstrap"; (function () { "use strict"; // ── 缓存层 ──────────────────────────────────────────────────────── const cache = {}; async function fetchTerm(id) { if (cache[id]) return cache[id]; const res = await fetch(`/api/v2/terms/${id}`); if (!res.ok) throw new Error(`fetchTerm ${id} failed: ${res.status}`); const json = await res.json(); cache[id] = json.data; return json.data; } // ── 设备判断 ────────────────────────────────────────────────────── const isMobile = () => window.innerWidth < 768; // ── Skeleton 模板 ───────────────────────────────────────────────── function buildSkeletonContent() { return `