PageSourceSearch

https://arpass.io/lib/index-main.js?v=67b695d8

js arpass.io collected 2026-10-02 01:57:10 UTC 2,189 bytes, 53 lines download raw bytes

1// ============================================================================
2// lib/index-main.js
3//
4// Extracted from inline <script type="module"> in index.html
5// to allow CSP `script-src 'self'` (no `unsafe-inline`) and achieve
6// SecurityHeaders.com A+ / Mozilla Observatory A+.
7//
8// DO NOT add inline JS back to index.html. Add to this file instead.
9// ============================================================================
10
11import { initI18n, mountLangPicker, getLang, onLangChange } from "/lib/i18n.js?v=a97271a3";
12import { initPwaInstall, registerServiceWorker } from "/lib/pwa-install.js?v=310ff450";
13import { initLpPricing } from "/lib/lp-pricing.js?v=47fccc70";
14
15/**
16 * ガイドリンクを現在の言語に応じて /guide/{lang}/ へ書き換える。
17 * - 日本語 (ja) のみ /guide/ (原本)
18 * - その他 15 言語 (en/zh-CN/zh-TW/ko/es/pt-BR/de/fr/it/ru/id/vi/hi/ar/tr) は /guide/{lang}/
19 *
20 * 対象要素:
21 *  - data-guide-link="hub"     → /guide/[{lang}/]
22 *  - data-guide-link="article" data-guide-article="{file}" → /guide/[{lang}/]{file}
23 */
24function updateGuideLinks(lang) {
25  const prefix = lang === "ja" ? "/guide/" : `/guide/${lang}/`;
26  const els = document.querySelectorAll("[data-guide-link]");
27  for (const el of els) {
28    const kind = el.dataset.guideLink;
29    if (kind === "hub") {
30      el.setAttribute("href", prefix);
31    } else if (kind === "article") {
32      const article = el.dataset.guideArticle || "";
33      el.setAttribute("href", prefix + article);
34    }
35  }
36}
37
38// 非ブロッキング初期化 — Safari で fetch がスローでもページ全体を止めない
39initI18n()
40  .then(() => {
41    mountLangPicker("#nav-lang", { compact: false });
42    updateGuideLinks(getLang());
43    // Phase 7.5ZM: LP 動的価格 (AR-linked) を /api/ar-price から live 取得して反映
44    initLpPricing();
45  })
46  .catch(err => console.warn("[i18n] init failed:", err));
47
48// 言語切替に追従してガイドリンクも書き換え
49onLangChange(lang => updateGuideLinks(lang));
50
51// PWA「ホーム画面に追加」コンポーネント (端末判定つき) + 最小 service worker。
52registerServiceWorker();
53initPwaInstall();

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.