feat: implement HtmlRenderer for modern web gallery viewing with support for scrolling and slide modes
This commit is contained in:
1 parent
544f145f4f
commit
a8f5e4a068
3 files changed
+690
-59
No files matched your search
@@ -725,6 +725,7 @@ public static class HtmlRenderer
|
|||||||
<div class="shortcut-row"><span>サムネイル一覧開閉</span><span class="kbd-key">T</span></div>
|
<div class="shortcut-row"><span>サムネイル一覧開閉</span><span class="kbd-key">T</span></div>
|
||||||
<div class="shortcut-row"><span>全画面表示切替</span><span class="kbd-key">F</span></div>
|
<div class="shortcut-row"><span>全画面表示切替</span><span class="kbd-key">F</span></div>
|
||||||
<div class="shortcut-row"><span>先頭 / 末尾ページへ</span><span class="kbd-key">Home / End</span></div>
|
<div class="shortcut-row"><span>先頭 / 末尾ページへ</span><span class="kbd-key">Home / End</span></div>
|
||||||
|
<div class="shortcut-row"><span>マウスホイール (スライド時)</span><span class="kbd-key">上: 前 / 下: 次</span></div>
|
||||||
<div style="margin-top: 20px; text-align: right;">
|
<div style="margin-top: 20px; text-align: right;">
|
||||||
<button class="action-btn" id="closeHelpBtn">閉じる</button>
|
<button class="action-btn" id="closeHelpBtn">閉じる</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -962,6 +963,31 @@ public static class HtmlRenderer
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// マウスホイールによるページ送り(スライド表示モード時のみ)
|
||||||
|
let wheelCooldown = false;
|
||||||
|
window.addEventListener('wheel', (e) => {
|
||||||
|
if (!isSlideMode) return;
|
||||||
|
// ヘルプモーダルやサムネイルドロワーが開いているときは無視
|
||||||
|
if (helpModal.classList.contains('active') || thumbDrawer.classList.contains('active')) return;
|
||||||
|
|
||||||
|
// 微小なスクロールノイズを無視
|
||||||
|
if (Math.abs(e.deltaY) < 5) return;
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
if (wheelCooldown) return;
|
||||||
|
|
||||||
|
if (e.deltaY > 0) {
|
||||||
|
setPage(currentPage + 1);
|
||||||
|
} else if (e.deltaY < 0) {
|
||||||
|
setPage(currentPage - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
wheelCooldown = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
wheelCooldown = false;
|
||||||
|
}, 200);
|
||||||
|
}, { passive: false });
|
||||||
|
|
||||||
setPage(1, false);
|
setPage(1, false);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
@@ -1156,6 +1182,52 @@ public static class HtmlRenderer
|
|||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabs-nav {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
background: rgba(0, 0, 0, 0.35);
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-btn {
|
||||||
|
flex: 1;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-muted);
|
||||||
|
padding: 10px 16px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 9px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-btn:hover {
|
||||||
|
color: #fff;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-btn.active {
|
||||||
|
background: var(--accent-gradient);
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-panel {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-panel.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
.hero-title { font-size: 2.2rem; }
|
.hero-title { font-size: 2.2rem; }
|
||||||
.input-group { flex-direction: column; }
|
.input-group { flex-direction: column; }
|
||||||
@@ -1167,75 +1239,122 @@ public static class HtmlRenderer
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="hero">
|
<div class="hero">
|
||||||
<h1 class="hero-title">WebImageViewer</h1>
|
<h1 class="hero-title">WebImageViewer</h1>
|
||||||
<p class="hero-subtitle">高速スクレイピングと洗練されたモダンUIで快適な画像閲覧体験を</p>
|
<p class="hero-subtitle">高速スクレイピングと洗練されたモダンUIで快適な画像・動画閲覧体験を</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="search-card">
|
<div class="search-card">
|
||||||
<form id="viewForm">
|
<div class="tabs-nav">
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
<button type="button" class="tab-btn active" id="tabGalleryBtn" onclick="switchTab('gallery')">
|
||||||
<label for="urlInput" style="font-size: 0.9rem; font-weight: 600; color: var(--text-main);">作品URL または サイト/ID を入力</label>
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
|
||||||
<span style="font-size: 0.75rem; color: #818cf8; background: rgba(99, 102, 241, 0.15); padding: 2px 8px; border-radius: 6px;">統一URL: /{site}/{id}</span>
|
<span>画像ギャラリー</span>
|
||||||
</div>
|
</button>
|
||||||
|
<button type="button" class="tab-btn" id="tabVideoBtn" onclick="switchTab('video')">
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="5 3 19 12 5 21 5 3"/></svg>
|
||||||
|
<span>動画プレイヤー (SpankBang)</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div style="display: flex; gap: 8px; margin-bottom: 12px;">
|
<!-- 画像ギャラリー パネル -->
|
||||||
<select id="siteSelect" style="background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; color: #f8fafc; padding: 8px 12px; font-size: 0.85rem; outline: none; cursor: pointer;">
|
<div id="galleryPanel" class="tab-panel active">
|
||||||
<option value="auto">🌐 自動判定 (Auto)</option>
|
<form id="viewForm">
|
||||||
<option value="ehentai">🐼 E-Hentai (/ehentai/{gid}/{token})</option>
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
||||||
<option value="hitomi">📕 Hitomi.la (/hitomi/{id})</option>
|
<label for="urlInput" style="font-size: 0.9rem; font-weight: 600; color: var(--text-main);">作品URL または サイト/ID を入力</label>
|
||||||
<option value="aurahentai">✨ AuraHentai (/aurahentai/{id})</option>
|
<span style="font-size: 0.75rem; color: #818cf8; background: rgba(99, 102, 241, 0.15); padding: 2px 8px; border-radius: 6px;">統一URL: /{site}/{id}</span>
|
||||||
<option value="momonga">🐿️ momon-ga (/momonga/{id})</option>
|
</div>
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="input-group">
|
<div style="display: flex; gap: 8px; margin-bottom: 12px;">
|
||||||
<input type="text" id="urlInput" class="url-input" placeholder="例: 4159771/95d2fa13bd, 4159707, 013597, または元URL" required autocomplete="off" />
|
<select id="siteSelect" style="background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; color: #f8fafc; padding: 8px 12px; font-size: 0.85rem; outline: none; cursor: pointer;">
|
||||||
<button type="submit" class="submit-btn">閲覧する</button>
|
<option value="auto">🌐 自動判定 (Auto)</option>
|
||||||
</div>
|
<option value="ehentai">🐼 E-Hentai (/ehentai/{gid}/{token})</option>
|
||||||
</form>
|
<option value="hitomi">📕 Hitomi.la (/hitomi/{id})</option>
|
||||||
|
<option value="aurahentai">✨ AuraHentai (/aurahentai/{id})</option>
|
||||||
|
<option value="momonga">🐿️ momon-ga (/momonga/{id})</option>
|
||||||
|
<option value="spankbang">🎥 SpankBang (/spankbang/{id})</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="quick-links">
|
<div class="input-group">
|
||||||
<div class="quick-links-title">統一URL クイックアクセス例</div>
|
<input type="text" id="urlInput" class="url-input" placeholder="例: 4159771/95d2fa13bd, 4159707, 013597, または元URL" required autocomplete="off" />
|
||||||
<div style="display: flex; flex-direction: column; gap: 10px;">
|
<button type="submit" class="submit-btn">閲覧する</button>
|
||||||
<a href="/ehentai/4159771/95d2fa13bd/" class="sample-item">
|
</div>
|
||||||
<div>
|
</form>
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
|
||||||
<span style="background: rgba(16, 185, 129, 0.2); color: #34d399; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">E-HENTAI</span>
|
<div class="quick-links">
|
||||||
<span style="font-weight: 600; font-size: 0.95rem;">/ehentai/4159771/95d2fa13bd</span>
|
<div class="quick-links-title">統一URL クイックアクセス例</div>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 10px;">
|
||||||
|
<a href="/ehentai/4159771/95d2fa13bd/" class="sample-item">
|
||||||
|
<div>
|
||||||
|
<div style="display: flex; align-items: center; gap: 8px;">
|
||||||
|
<span style="background: rgba(16, 185, 129, 0.2); color: #34d399; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">E-HENTAI</span>
|
||||||
|
<span style="font-weight: 600; font-size: 0.95rem;">/ehentai/4159771/95d2fa13bd</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">Marian Kelly Mating / Western (15ページ)</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">Marian Kelly Mating / Western (15ページ)</div>
|
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||||||
</div>
|
</a>
|
||||||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
<a href="/hitomi/4159707/" class="sample-item">
|
||||||
</a>
|
<div>
|
||||||
<a href="/hitomi/4159707/" class="sample-item">
|
<div style="display: flex; align-items: center; gap: 8px;">
|
||||||
<div>
|
<span style="background: rgba(239, 68, 68, 0.2); color: #f87171; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">HITOMI</span>
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
<span style="font-weight: 600; font-size: 0.95rem;">/hitomi/4159707</span>
|
||||||
<span style="background: rgba(239, 68, 68, 0.2); color: #f87171; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">HITOMI</span>
|
</div>
|
||||||
<span style="font-weight: 600; font-size: 0.95rem;">/hitomi/4159707</span>
|
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">gzrさんのヘンタイ露出排泄 / 作者: ajisio (27ページ)</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">gzrさんのヘンタイ露出排泄 / 作者: ajisio (27ページ)</div>
|
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||||||
</div>
|
</a>
|
||||||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
<a href="/aurahentai/013597/" class="sample-item">
|
||||||
</a>
|
<div>
|
||||||
<a href="/aurahentai/013597/" class="sample-item">
|
<div style="display: flex; align-items: center; gap: 8px;">
|
||||||
<div>
|
<span style="background: rgba(236, 72, 153, 0.2); color: #f472b6; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">AURA</span>
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
<span style="font-weight: 600; font-size: 0.95rem;">/aurahentai/013597</span>
|
||||||
<span style="background: rgba(236, 72, 153, 0.2); color: #f472b6; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">AURA</span>
|
</div>
|
||||||
<span style="font-weight: 600; font-size: 0.95rem;">/aurahentai/013597</span>
|
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">作者: ajisio / にじさんじ (17ページ)</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">作者: ajisio / にじさんじ (17ページ)</div>
|
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||||||
</div>
|
</a>
|
||||||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
<a href="/momonga/mo3469109/" class="sample-item">
|
||||||
</a>
|
<div>
|
||||||
<a href="/momonga/mo3469109/" class="sample-item">
|
<div style="display: flex; align-items: center; gap: 8px;">
|
||||||
<div>
|
<span style="background: rgba(99, 102, 241, 0.2); color: #818cf8; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">MOMONGA</span>
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
<span style="font-weight: 600; font-size: 0.95rem;">/momonga/mo3469109</span>
|
||||||
<span style="background: rgba(99, 102, 241, 0.2); color: #818cf8; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">MOMONGA</span>
|
</div>
|
||||||
<span style="font-weight: 600; font-size: 0.95rem;">/momonga/mo3469109</span>
|
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">新妻契約 / サークル: Whisker Pad (52ページ)</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">新妻契約 / サークル: Whisker Pad (52ページ)</div>
|
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||||||
</div>
|
</a>
|
||||||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
</div>
|
||||||
</a>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 動画プレイヤー パネル -->
|
||||||
|
<div id="videoPanel" class="tab-panel">
|
||||||
|
<form id="videoForm">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
||||||
|
<label for="videoUrlInput" style="font-size: 0.9rem; font-weight: 600; color: var(--text-main);">SpankBang 動画ページURL または 動画ID を入力</label>
|
||||||
|
<span style="font-size: 0.75rem; color: #ec4899; background: rgba(236, 72, 153, 0.15); padding: 2px 8px; border-radius: 6px;">URL: /spankbang/{id}</span>
|
||||||
|
</div>
|
||||||
|
<p style="font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px;">jp.spankbang.com の動画URL、埋め込みURL、または動画IDを入力して再生します。</p>
|
||||||
|
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" id="videoUrlInput" class="url-input" placeholder="例: https://jp.spankbang.com/56b3d/video/ または 56b3d" required autocomplete="off" />
|
||||||
|
<button type="submit" class="submit-btn" style="background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);">動画を再生</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="quick-links">
|
||||||
|
<div class="quick-links-title">SpankBang クイック再生例</div>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 10px;">
|
||||||
|
<a href="/spankbang/56b3d" class="sample-item">
|
||||||
|
<div>
|
||||||
|
<div style="display: flex; align-items: center; gap: 8px;">
|
||||||
|
<span style="background: rgba(236, 72, 153, 0.2); color: #f472b6; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">SPANKBANG</span>
|
||||||
|
<span style="font-weight: 600; font-size: 0.95rem;">/spankbang/56b3d</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">動画ID: 56b3d (サンプル動画プレイヤー)</div>
|
||||||
|
</div>
|
||||||
|
<div style="color: #ec4899; font-weight: 700;">再生 →</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1260,12 +1379,69 @@ public static class HtmlRenderer
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// タブ切り替え処理
|
||||||
|
function switchTab(tab) {
|
||||||
|
const galleryBtn = document.getElementById('tabGalleryBtn');
|
||||||
|
const videoBtn = document.getElementById('tabVideoBtn');
|
||||||
|
const galleryPanel = document.getElementById('galleryPanel');
|
||||||
|
const videoPanel = document.getElementById('videoPanel');
|
||||||
|
|
||||||
|
if (tab === 'gallery') {
|
||||||
|
galleryBtn.classList.add('active');
|
||||||
|
videoBtn.classList.remove('active');
|
||||||
|
galleryPanel.classList.add('active');
|
||||||
|
videoPanel.classList.remove('active');
|
||||||
|
} else {
|
||||||
|
videoBtn.classList.add('active');
|
||||||
|
galleryBtn.classList.remove('active');
|
||||||
|
videoPanel.classList.add('active');
|
||||||
|
galleryPanel.classList.remove('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpankBangのURLまたはIDからIDを抽出する関数
|
||||||
|
function extractSpankBangId(str) {
|
||||||
|
if (!str) return null;
|
||||||
|
str = str.trim();
|
||||||
|
// https://jp.spankbang.com/{id}/video/... または /embed/ または /play/
|
||||||
|
const urlMatch = str.match(/spankbang\.(?:com|party)\/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i);
|
||||||
|
if (urlMatch) return urlMatch[1];
|
||||||
|
// spankbang/{id}
|
||||||
|
const pathMatch = str.match(/^spankbang\/([a-z0-9]+)/i);
|
||||||
|
if (pathMatch) return pathMatch[1];
|
||||||
|
// IDのみ (例: 56b3d)
|
||||||
|
const idMatch = str.match(/^[a-z0-9]{3,12}$/i);
|
||||||
|
if (idMatch) return idMatch[0];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 動画用フォーム送信イベント
|
||||||
|
document.getElementById('videoForm').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = document.getElementById('videoUrlInput').value.trim();
|
||||||
|
if (!input) return;
|
||||||
|
const id = extractSpankBangId(input);
|
||||||
|
if (id) {
|
||||||
|
window.location.href = '/spankbang/' + id;
|
||||||
|
} else {
|
||||||
|
window.location.href = '/video?url=' + encodeURIComponent(input);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 画像用フォーム送信イベント
|
||||||
document.getElementById('viewForm').addEventListener('submit', function(e) {
|
document.getElementById('viewForm').addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let input = document.getElementById('urlInput').value.trim();
|
let input = document.getElementById('urlInput').value.trim();
|
||||||
const siteSelect = document.getElementById('siteSelect').value;
|
const siteSelect = document.getElementById('siteSelect').value;
|
||||||
if (!input) return;
|
if (!input) return;
|
||||||
|
|
||||||
|
// SpankBang の判定(画像入力フォームに入力された場合でも自動遷移)
|
||||||
|
const sbId = extractSpankBangId(input);
|
||||||
|
if (sbId && (input.includes('spankbang') || siteSelect === 'spankbang')) {
|
||||||
|
window.location.href = '/spankbang/' + sbId;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 完全URLの場合
|
// 完全URLの場合
|
||||||
if (input.startsWith('http://') || input.startsWith('https://')) {
|
if (input.startsWith('http://') || input.startsWith('https://')) {
|
||||||
try {
|
try {
|
||||||
@@ -1426,6 +1602,366 @@ public static class HtmlRenderer
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SpankBang動画プレイヤー画面のHTMLを生成します。
|
||||||
|
/// </summary>
|
||||||
|
public static string RenderVideoPlayer(string videoId, string? originalUrl = null)
|
||||||
|
{
|
||||||
|
var safeId = Encoder.Encode(videoId);
|
||||||
|
var safeOriginalUrl = !string.IsNullOrWhiteSpace(originalUrl) ? Encoder.Encode(originalUrl) : $"https://jp.spankbang.com/{safeId}/video/";
|
||||||
|
var embedUrl = $"https://spankbang.com/{safeId}/embed/";
|
||||||
|
|
||||||
|
return $$"""
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ja">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>SpankBang 動画プレイヤー (ID: {{safeId}}) - WebImageViewer</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+JP:wght@400;500;700&family=Outfit:wght@600;700;800&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg-base: #07090e;
|
||||||
|
--bg-surface: #0f1420;
|
||||||
|
--bg-card: rgba(18, 24, 38, 0.85);
|
||||||
|
--border-subtle: rgba(255, 255, 255, 0.08);
|
||||||
|
--border-glow: rgba(236, 72, 153, 0.3);
|
||||||
|
--accent-primary: #ec4899;
|
||||||
|
--accent-secondary: #8b5cf6;
|
||||||
|
--accent-gradient: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
|
||||||
|
--text-main: #f8fafc;
|
||||||
|
--text-muted: #94a3b8;
|
||||||
|
--header-height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
body {
|
||||||
|
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
||||||
|
background-color: var(--bg-base);
|
||||||
|
color: var(--text-main);
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-image:
|
||||||
|
radial-gradient(circle at 15% 15%, rgba(236, 72, 153, 0.12), transparent 40%),
|
||||||
|
radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.12), transparent 40%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
height: var(--header-height);
|
||||||
|
background: rgba(15, 20, 32, 0.85);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
border-bottom: 1px solid var(--border-subtle);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 24px;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #fff;
|
||||||
|
font-family: 'Outfit', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.15rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-badge {
|
||||||
|
background: var(--accent-gradient);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-action {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: rgba(255, 255, 255, 0.06);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
color: var(--text-main);
|
||||||
|
padding: 8px 14px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-action:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.12);
|
||||||
|
border-color: rgba(255, 255, 255, 0.2);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-action.active {
|
||||||
|
background: var(--accent-gradient);
|
||||||
|
color: #fff;
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 24px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
transition: max-width 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content.theater-mode {
|
||||||
|
max-width: 96vw;
|
||||||
|
padding: 12px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-container {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
background: #000;
|
||||||
|
border-radius: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(236, 72, 153, 0.15);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
aspect-ratio: 16 / 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-iframe {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-meta-card {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
background: var(--bg-card);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
-webkit-backdrop-filter: blur(16px);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 20px 24px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-top-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-tags {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-tag-site {
|
||||||
|
background: rgba(236, 72, 153, 0.18);
|
||||||
|
color: #f472b6;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-tag-id {
|
||||||
|
background: rgba(255, 255, 255, 0.07);
|
||||||
|
color: var(--text-main);
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-switch-form {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-input {
|
||||||
|
flex: 1;
|
||||||
|
background: rgba(0, 0, 0, 0.4);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
outline: none;
|
||||||
|
transition: 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-input:focus {
|
||||||
|
border-color: var(--accent-primary);
|
||||||
|
box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-submit-btn {
|
||||||
|
background: var(--accent-gradient);
|
||||||
|
border: none;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px 18px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: 0.2s;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-submit-btn:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.header { padding: 0 16px; }
|
||||||
|
.main-content { padding: 12px; }
|
||||||
|
.quick-switch-form { flex-direction: column; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header class="header">
|
||||||
|
<div class="header-left">
|
||||||
|
<a href="/" class="brand-link">
|
||||||
|
<span>WebImageViewer</span>
|
||||||
|
<span class="brand-badge">SPANKBANG VIDEO</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="header-actions">
|
||||||
|
<button class="btn-action" id="theaterBtn" title="シアターモード切替">
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="4" width="20" height="16" rx="2"/><line x1="2" y1="10" x2="22" y2="10"/></svg>
|
||||||
|
<span>シアター</span>
|
||||||
|
</button>
|
||||||
|
<button class="btn-action" id="fullscreenBtn" title="全画面切替">
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>
|
||||||
|
<span>全画面</span>
|
||||||
|
</button>
|
||||||
|
<a href="/" class="btn-action">
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
|
||||||
|
<span>ホームへ戻る</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content" id="mainContainer">
|
||||||
|
<div class="player-container" id="playerWrapper">
|
||||||
|
<iframe
|
||||||
|
id="videoIframe"
|
||||||
|
src="{{embedUrl}}"
|
||||||
|
class="player-iframe"
|
||||||
|
frameborder="0"
|
||||||
|
scrolling="no"
|
||||||
|
allowfullscreen="true"
|
||||||
|
webkitallowfullscreen="true"
|
||||||
|
mozallowfullscreen="true"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen">
|
||||||
|
</iframe>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="video-meta-card">
|
||||||
|
<div class="meta-top-row">
|
||||||
|
<div class="meta-tags">
|
||||||
|
<span class="meta-tag-site">SpankBang</span>
|
||||||
|
<span class="meta-tag-id">ID: {{safeId}}</span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; gap: 10px;">
|
||||||
|
<a href="{{safeOriginalUrl}}" target="_blank" rel="noopener noreferrer" class="btn-action" style="font-size: 0.8rem;">
|
||||||
|
<span>公式ページを開く ↗</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label style="font-size: 0.85rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px;">別の動画を再生する</label>
|
||||||
|
<form id="switchForm" class="quick-switch-form">
|
||||||
|
<input type="text" id="switchInput" class="quick-input" placeholder="動画URL または ID (例: 56b3d)" required autocomplete="off" />
|
||||||
|
<button type="submit" class="quick-submit-btn">再生切り替え</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theaterBtn = document.getElementById('theaterBtn');
|
||||||
|
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||||
|
const mainContainer = document.getElementById('mainContainer');
|
||||||
|
const playerWrapper = document.getElementById('playerWrapper');
|
||||||
|
const videoIframe = document.getElementById('videoIframe');
|
||||||
|
|
||||||
|
// シアターモード切替
|
||||||
|
theaterBtn.addEventListener('click', () => {
|
||||||
|
mainContainer.classList.toggle('theater-mode');
|
||||||
|
theaterBtn.classList.toggle('active');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 全画面表示切替
|
||||||
|
fullscreenBtn.addEventListener('click', () => {
|
||||||
|
if (!document.fullscreenElement) {
|
||||||
|
if (playerWrapper.requestFullscreen) {
|
||||||
|
playerWrapper.requestFullscreen().catch(() => {});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
document.exitFullscreen().catch(() => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 動画切り替えフォーム
|
||||||
|
document.getElementById('switchForm').addEventListener('submit', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = document.getElementById('switchInput').value.trim();
|
||||||
|
if (!input) return;
|
||||||
|
|
||||||
|
// ID抽出
|
||||||
|
const urlMatch = input.match(/spankbang\.(?:com|party)\/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i);
|
||||||
|
const id = urlMatch ? urlMatch[1] : input.replace(/^spankbang\//i, '').replace(/^\/+|\/+$/g, '');
|
||||||
|
if (id) {
|
||||||
|
window.location.href = '/spankbang/' + id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,9 +77,59 @@ app.MapGet("/view", async (string? url, string? site, string? id, string? catego
|
|||||||
return Results.Redirect("/");
|
return Results.Redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SpankBang の動画判定
|
||||||
|
if (string.Equals(site, "spankbang", StringComparison.OrdinalIgnoreCase) || target.Contains("spankbang", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var sbId = ExtractSpankBangId(target);
|
||||||
|
if (!string.IsNullOrWhiteSpace(sbId))
|
||||||
|
{
|
||||||
|
return Results.Redirect($"/spankbang/{sbId}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return await RenderGalleryResponseAsync(site, target, category, galleryService, ct);
|
return await RenderGalleryResponseAsync(site, target, category, galleryService, ct);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// SpankBang 動画プレイヤー画面
|
||||||
|
app.MapGet("/video", (string? url, string? id) =>
|
||||||
|
{
|
||||||
|
var target = url ?? id;
|
||||||
|
if (string.IsNullOrWhiteSpace(target))
|
||||||
|
{
|
||||||
|
return Results.Redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
var videoId = ExtractSpankBangId(target);
|
||||||
|
if (string.IsNullOrWhiteSpace(videoId))
|
||||||
|
{
|
||||||
|
return Results.Content(
|
||||||
|
HtmlRenderer.RenderErrorPage($"指定された動画URLまたはID({target})を認識できませんでした。jp.spankbang.com のURLまたは動画IDをご確認ください。", 400),
|
||||||
|
"text/html; charset=utf-8",
|
||||||
|
statusCode: 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Results.Content(HtmlRenderer.RenderVideoPlayer(videoId, target), "text/html; charset=utf-8");
|
||||||
|
});
|
||||||
|
|
||||||
|
// SpankBang 統一プレイヤー画面
|
||||||
|
app.MapGet("/spankbang/{id}", (string id) =>
|
||||||
|
{
|
||||||
|
var videoId = ExtractSpankBangId(id) ?? id.Trim();
|
||||||
|
return Results.Content(HtmlRenderer.RenderVideoPlayer(videoId, $"https://jp.spankbang.com/{videoId}/video/"), "text/html; charset=utf-8");
|
||||||
|
});
|
||||||
|
|
||||||
|
// SpankBang 動画情報 JSON API
|
||||||
|
app.MapGet("/api/video/spankbang/{id}", (string id) =>
|
||||||
|
{
|
||||||
|
var videoId = ExtractSpankBangId(id) ?? id.Trim();
|
||||||
|
return Results.Ok(new
|
||||||
|
{
|
||||||
|
id = videoId,
|
||||||
|
embedUrl = $"https://spankbang.com/{videoId}/embed/",
|
||||||
|
sourceUrl = $"https://jp.spankbang.com/{videoId}/video/"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 統一ビューアー画面(3階層)
|
// 統一ビューアー画面(3階層)
|
||||||
app.MapGet("/{site}/{category}/{id}", async (string site, string category, string id, GalleryService galleryService, CancellationToken ct) =>
|
app.MapGet("/{site}/{category}/{id}", async (string site, string category, string id, GalleryService galleryService, CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
@@ -193,4 +243,32 @@ static async Task<IResult> RenderJsonResponseAsync(
|
|||||||
return Results.Ok(gallery);
|
return Results.Ok(gallery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string? ExtractSpankBangId(string input)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(input)) return null;
|
||||||
|
input = input.Trim();
|
||||||
|
|
||||||
|
// URL形式 (例: https://jp.spankbang.com/56b3d/video/... または /embed/ または /play/)
|
||||||
|
var match = System.Text.RegularExpressions.Regex.Match(
|
||||||
|
input,
|
||||||
|
@"spankbang\.(?:com|party)/(?<id>[a-z0-9]+)(?:/(?:video|play|embed)|/|$)",
|
||||||
|
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
return match.Groups["id"].Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// spankbang/<id> 形式
|
||||||
|
var matchSlash = System.Text.RegularExpressions.Regex.Match(
|
||||||
|
input,
|
||||||
|
@"^(?:spankbang/)?(?<id>[a-z0-9]{3,12})$",
|
||||||
|
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||||
|
if (matchSlash.Success)
|
||||||
|
{
|
||||||
|
return matchSlash.Groups["id"].Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>SpankBang Embed Test</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Spankbang Embed Test</h1>
|
||||||
|
<div style="margin-bottom: 20px;">
|
||||||
|
<h3>1. https://spankbang.com/2y3td/embed/</h3>
|
||||||
|
<iframe src="https://spankbang.com/2y3td/embed/" width="640" height="360" frameborder="0" allowfullscreen="true" allow="fullscreen; autoplay"></iframe>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 20px;">
|
||||||
|
<h3>2. https://jp.spankbang.com/2y3td/embed/</h3>
|
||||||
|
<iframe src="https://jp.spankbang.com/2y3td/embed/" width="640" height="360" frameborder="0" allowfullscreen="true" allow="fullscreen; autoplay"></iframe>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in new issue
Block a user