chore: remove unused plainText helper, bump SW cache
Made-with: Cursor
This commit is contained in:
parent
ca658f6369
commit
7647d8137c
13
js/app.js
13
js/app.js
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* HTML 方針:
|
* HTML 方針:
|
||||||
* - マークアップを描画する箇所は x-html="safeHtml(...)" のみ。
|
* - マークアップを描画する箇所は x-html="safeHtml(...)" のみ。
|
||||||
* - タグを出さない一行表示には plainText(...)(サニタイズ後に textContent 化)。
|
* - タグを出さない一行が必要なら、サニタイズ済み文字列を一時 DOM に載せて textContent を取る等(テンプレ用ヘルパーは必要時に追加)。
|
||||||
* - 状態に保持する解説文字列は保存時に sanitizeStoredHtml で正規化。
|
* - 状態に保持する解説文字列は保存時に sanitizeStoredHtml で正規化。
|
||||||
*/
|
*/
|
||||||
import { DRILLS } from './data/drills.js';
|
import { DRILLS } from './data/drills.js';
|
||||||
|
|
@ -28,22 +28,11 @@ function sanitizeStoredHtml(html) {
|
||||||
return sanitizeTrustedHtml(html);
|
return sanitizeTrustedHtml(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** サニタイズ済み HTML からプレーン文字列(x-text 向け) */
|
|
||||||
function plainTextFromSanitizedHtml(html) {
|
|
||||||
if (html == null || html === '') return '';
|
|
||||||
const d = document.createElement('div');
|
|
||||||
d.innerHTML = sanitizeTrustedHtml(String(html));
|
|
||||||
return (d.textContent || '').replace(/\s+/g, ' ').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('alpine:init', () => {
|
document.addEventListener('alpine:init', () => {
|
||||||
Alpine.data('bokiApp', () => ({
|
Alpine.data('bokiApp', () => ({
|
||||||
safeHtml(s) {
|
safeHtml(s) {
|
||||||
return sanitizeTrustedHtml(s);
|
return sanitizeTrustedHtml(s);
|
||||||
},
|
},
|
||||||
plainText(s) {
|
|
||||||
return plainTextFromSanitizedHtml(s);
|
|
||||||
},
|
|
||||||
categories:[],
|
categories:[],
|
||||||
currentUnit:null,
|
currentUnit:null,
|
||||||
quizState:{},
|
quizState:{},
|
||||||
|
|
|
||||||
2
sw.js
2
sw.js
|
|
@ -1,5 +1,5 @@
|
||||||
// posimai-boki SW — stale-while-revalidate + skipWaiting
|
// posimai-boki SW — stale-while-revalidate + skipWaiting
|
||||||
const CACHE = 'posimai-boki-v17';
|
const CACHE = 'posimai-boki-v18';
|
||||||
const STATIC = ['/', '/index.html', '/manifest.json', '/logo.png', '/js/app.js', '/js/data/drills.js', '/js/data/categories.js'];
|
const STATIC = ['/', '/index.html', '/manifest.json', '/logo.png', '/js/app.js', '/js/data/drills.js', '/js/data/categories.js'];
|
||||||
|
|
||||||
self.addEventListener('install', e => {
|
self.addEventListener('install', e => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue