2692 lines
112 KiB
C#
2692 lines
112 KiB
C#
using System.Text.Encodings.Web;
|
||
using System.Text.Json;
|
||
using WebImageViewer.Class.Legacy.Models;
|
||
|
||
namespace WebImageViewer.Class.Legacy.Renderers;
|
||
|
||
/// <summary>
|
||
/// WebImageViewerの洗練されたモダンUI HTMLを生成するレンダークラス
|
||
/// </summary>
|
||
public static class HtmlRenderer
|
||
{
|
||
private static readonly HtmlEncoder Encoder = HtmlEncoder.Default;
|
||
|
||
/// <summary>
|
||
/// ギャラリー閲覧画面のHTMLを生成します。
|
||
/// </summary>
|
||
public static string RenderGalleryViewer(GalleryItem gallery)
|
||
{
|
||
var title = Encoder.Encode(gallery.Title);
|
||
var category = Encoder.Encode(gallery.Category);
|
||
var circle = !string.IsNullOrEmpty(gallery.Circle) ? Encoder.Encode(gallery.Circle) : null;
|
||
var author = !string.IsNullOrEmpty(gallery.Author) ? Encoder.Encode(gallery.Author) : null;
|
||
var sourceSite = Encoder.Encode(gallery.SourceSite);
|
||
var sourceUrl = Encoder.Encode(gallery.SourceUrl);
|
||
var totalPages = gallery.TotalPages;
|
||
|
||
var galleryJson = JsonSerializer.Serialize(gallery, new JsonSerializerOptions
|
||
{
|
||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||
});
|
||
|
||
// タグバッジHTMLの生成
|
||
var tagsHtml = string.Empty;
|
||
if (gallery.Tags.Count > 0)
|
||
{
|
||
var tagItems = string.Join("\n", gallery.Tags.Select(t => $"<span class=\"tag-pill\">#{Encoder.Encode(t)}</span>"));
|
||
tagsHtml = $"""
|
||
<div class="info-tags">
|
||
{tagItems}
|
||
</div>
|
||
""";
|
||
}
|
||
|
||
// スクロール用画像リストHTMLの生成
|
||
var imagesHtml = string.Join("\n", gallery.Images.Select(img =>
|
||
{
|
||
var imgUrl = Encoder.Encode(img.ImageUrl);
|
||
var altText = Encoder.Encode(img.AltText ?? $"{gallery.Title} {img.PageNumber}ページ");
|
||
return $"""
|
||
<div class="scroll-image-wrapper" data-page="{img.PageNumber}">
|
||
<img src="{imgUrl}" loading="lazy" decoding="async" alt="{altText}" onload="this.classList.add('loaded')" />
|
||
<div class="page-badge">{img.PageNumber} / {totalPages}</div>
|
||
</div>
|
||
""";
|
||
}));
|
||
|
||
// サムネイル一覧HTMLの生成
|
||
var thumbsHtml = string.Join("\n", gallery.Images.Select(img =>
|
||
{
|
||
var thumbUrl = Encoder.Encode(img.ThumbnailUrl ?? img.ImageUrl);
|
||
return $"""
|
||
<div class="thumb-item" data-page="{img.PageNumber}">
|
||
<img src="{thumbUrl}" loading="lazy" alt="{img.PageNumber}" />
|
||
<div class="thumb-num">{img.PageNumber}</div>
|
||
</div>
|
||
""";
|
||
}));
|
||
|
||
var circleHeaderHtml = circle != null ? $"<span>サークル: {circle}</span>" : "";
|
||
var authorHeaderHtml = author != null ? $"<span>作者: {author}</span>" : "";
|
||
var circleInfoHtml = circle != null ? $"<span>🏢 サークル: <strong>{circle}</strong></span>" : "";
|
||
var authorInfoHtml = author != null ? $"<span>✍️ 作者: <strong>{author}</strong></span>" : "";
|
||
|
||
return $$"""
|
||
<!DOCTYPE html>
|
||
<html lang="ja">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes">
|
||
<title>{{title}} - 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&family=Noto+Sans+JP:wght@400;500;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
|
||
<style>
|
||
:root {
|
||
--bg-base: #0a0d14;
|
||
--bg-surface: #111726;
|
||
--bg-surface-elevated: #1a2236;
|
||
--bg-glass: rgba(17, 23, 38, 0.82);
|
||
--border-subtle: rgba(255, 255, 255, 0.08);
|
||
--border-glow: rgba(99, 102, 241, 0.3);
|
||
--accent-primary: #6366f1;
|
||
--accent-primary-hover: #4f46e5;
|
||
--accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
|
||
--text-main: #f8fafc;
|
||
--text-muted: #94a3b8;
|
||
--text-subtle: #64748b;
|
||
--header-height: 64px;
|
||
--toolbar-height: 56px;
|
||
--radius-md: 12px;
|
||
--radius-lg: 16px;
|
||
--shadow-float: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
|
||
--transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||
}
|
||
|
||
* {
|
||
box-sizing: border-box;
|
||
margin: 0;
|
||
padding: 0;
|
||
-webkit-tap-highlight-color: transparent;
|
||
}
|
||
|
||
body {
|
||
font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
|
||
background-color: var(--bg-base);
|
||
color: var(--text-main);
|
||
line-height: 1.5;
|
||
overflow-x: hidden;
|
||
user-select: none;
|
||
min-height: 100vh;
|
||
}
|
||
|
||
/* ヘッダー */
|
||
header.top-header {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
height: var(--header-height);
|
||
background: var(--bg-glass);
|
||
backdrop-filter: blur(16px);
|
||
-webkit-backdrop-filter: blur(16px);
|
||
border-bottom: 1px solid var(--border-subtle);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 0 20px;
|
||
z-index: 100;
|
||
transition: transform 0.3s ease;
|
||
}
|
||
|
||
.header-left {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 16px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.back-btn {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 40px;
|
||
height: 40px;
|
||
border-radius: var(--radius-md);
|
||
background: var(--bg-surface-elevated);
|
||
color: var(--text-main);
|
||
text-decoration: none;
|
||
border: 1px solid var(--border-subtle);
|
||
transition: var(--transition-smooth);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.back-btn:hover {
|
||
background: var(--accent-primary);
|
||
border-color: var(--accent-primary);
|
||
transform: scale(1.05);
|
||
}
|
||
|
||
.gallery-title-wrapper {
|
||
min-width: 0;
|
||
}
|
||
|
||
.gallery-title {
|
||
font-size: 1.05rem;
|
||
font-weight: 700;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
max-width: 50vw;
|
||
}
|
||
|
||
.gallery-sub {
|
||
font-size: 0.75rem;
|
||
color: var(--text-muted);
|
||
display: flex;
|
||
gap: 10px;
|
||
align-items: center;
|
||
}
|
||
|
||
.badge-category {
|
||
background: rgba(99, 102, 241, 0.2);
|
||
color: #818cf8;
|
||
padding: 2px 8px;
|
||
border-radius: 6px;
|
||
font-size: 0.7rem;
|
||
font-weight: 600;
|
||
text-transform: uppercase;
|
||
}
|
||
|
||
.header-right {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
|
||
.action-btn {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
padding: 8px 14px;
|
||
border-radius: var(--radius-md);
|
||
background: var(--bg-surface-elevated);
|
||
color: var(--text-main);
|
||
border: 1px solid var(--border-subtle);
|
||
font-size: 0.85rem;
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
transition: var(--transition-smooth);
|
||
}
|
||
|
||
.action-btn:hover, .action-btn.active {
|
||
background: var(--accent-primary);
|
||
border-color: var(--accent-primary);
|
||
color: #fff;
|
||
box-shadow: 0 0 15px var(--border-glow);
|
||
}
|
||
|
||
/* メインビューアーコンテナ */
|
||
main.viewer-container {
|
||
padding-top: calc(var(--header-height) + 12px);
|
||
padding-bottom: calc(var(--toolbar-height) + 24px);
|
||
min-height: 100vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
/* 縦スクロールモード */
|
||
.scroll-mode-view {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 8px;
|
||
width: 100%;
|
||
max-width: 1000px;
|
||
padding: 0 12px;
|
||
}
|
||
|
||
.scroll-image-wrapper {
|
||
position: relative;
|
||
width: 100%;
|
||
background: var(--bg-surface);
|
||
border-radius: var(--radius-md);
|
||
overflow: hidden;
|
||
box-shadow: var(--shadow-float);
|
||
min-height: 300px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.scroll-image-wrapper img {
|
||
width: 100%;
|
||
height: auto;
|
||
display: block;
|
||
object-fit: contain;
|
||
opacity: 0;
|
||
transition: opacity 0.3s ease;
|
||
}
|
||
|
||
.scroll-image-wrapper img.loaded {
|
||
opacity: 1;
|
||
}
|
||
|
||
.scroll-image-wrapper .page-badge {
|
||
position: absolute;
|
||
bottom: 12px;
|
||
right: 12px;
|
||
background: rgba(0, 0, 0, 0.7);
|
||
backdrop-filter: blur(8px);
|
||
color: #fff;
|
||
padding: 4px 10px;
|
||
border-radius: 6px;
|
||
font-size: 0.75rem;
|
||
font-weight: 600;
|
||
pointer-events: none;
|
||
}
|
||
|
||
/* スライド(単ページ・見開き)モード */
|
||
.slide-mode-view {
|
||
display: none;
|
||
position: fixed;
|
||
top: var(--header-height);
|
||
bottom: var(--toolbar-height);
|
||
left: 0;
|
||
right: 0;
|
||
align-items: center;
|
||
justify-content: center;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.slide-mode-view.active {
|
||
display: flex;
|
||
}
|
||
|
||
.slide-stage {
|
||
width: 100%;
|
||
height: 100%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: relative;
|
||
touch-action: pan-y;
|
||
}
|
||
|
||
.slide-image {
|
||
max-width: 100%;
|
||
max-height: 100%;
|
||
object-fit: contain;
|
||
user-select: none;
|
||
transition: transform 0.2s ease-out;
|
||
box-shadow: var(--shadow-float);
|
||
}
|
||
|
||
.slide-nav-zone {
|
||
position: absolute;
|
||
top: 0;
|
||
bottom: 0;
|
||
width: 35%;
|
||
z-index: 10;
|
||
cursor: pointer;
|
||
display: flex;
|
||
align-items: center;
|
||
opacity: 0;
|
||
transition: opacity 0.2s ease;
|
||
}
|
||
|
||
.slide-nav-zone:hover {
|
||
opacity: 1;
|
||
}
|
||
|
||
.slide-nav-prev {
|
||
left: 0;
|
||
justify-content: flex-start;
|
||
padding-left: 24px;
|
||
background: linear-gradient(to right, rgba(0,0,0,0.4), transparent);
|
||
}
|
||
|
||
.slide-nav-next {
|
||
right: 0;
|
||
justify-content: flex-end;
|
||
padding-right: 24px;
|
||
background: linear-gradient(to left, rgba(0,0,0,0.4), transparent);
|
||
}
|
||
|
||
.nav-arrow-icon {
|
||
width: 48px;
|
||
height: 48px;
|
||
border-radius: 50%;
|
||
background: var(--bg-glass);
|
||
border: 1px solid var(--border-subtle);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0 4px 12px rgba(0,0,0,0.5);
|
||
}
|
||
|
||
/* 下部ツールバー */
|
||
footer.bottom-toolbar {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
height: var(--toolbar-height);
|
||
background: var(--bg-glass);
|
||
backdrop-filter: blur(16px);
|
||
-webkit-backdrop-filter: blur(16px);
|
||
border-top: 1px solid var(--border-subtle);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 0 20px;
|
||
z-index: 100;
|
||
transition: transform 0.3s ease;
|
||
}
|
||
|
||
.page-counter {
|
||
font-family: 'Outfit', sans-serif;
|
||
font-size: 0.95rem;
|
||
font-weight: 600;
|
||
color: var(--text-main);
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
}
|
||
|
||
.page-counter span.current-page {
|
||
color: #818cf8;
|
||
font-size: 1.1rem;
|
||
}
|
||
|
||
.progress-bar-container {
|
||
flex: 1;
|
||
max-width: 450px;
|
||
margin: 0 20px;
|
||
height: 6px;
|
||
background: var(--bg-surface-elevated);
|
||
border-radius: 3px;
|
||
overflow: hidden;
|
||
cursor: pointer;
|
||
position: relative;
|
||
}
|
||
|
||
.progress-bar-fill {
|
||
height: 100%;
|
||
width: 0%;
|
||
background: var(--accent-gradient);
|
||
transition: width 0.15s ease;
|
||
}
|
||
|
||
/* サムネイル一覧ドロワー */
|
||
.drawer-overlay {
|
||
position: fixed;
|
||
inset: 0;
|
||
background: rgba(0, 0, 0, 0.6);
|
||
backdrop-filter: blur(4px);
|
||
opacity: 0;
|
||
pointer-events: none;
|
||
transition: opacity 0.3s ease;
|
||
z-index: 150;
|
||
}
|
||
|
||
.drawer-overlay.active {
|
||
opacity: 1;
|
||
pointer-events: auto;
|
||
}
|
||
|
||
.thumb-drawer {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
height: 240px;
|
||
background: var(--bg-surface);
|
||
border-top: 1px solid var(--border-subtle);
|
||
z-index: 160;
|
||
transform: translateY(100%);
|
||
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 16px;
|
||
}
|
||
|
||
.thumb-drawer.active {
|
||
transform: translateY(0);
|
||
}
|
||
|
||
.drawer-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 12px;
|
||
}
|
||
|
||
.drawer-header h3 {
|
||
font-size: 0.95rem;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.thumb-list {
|
||
display: flex;
|
||
gap: 12px;
|
||
overflow-x: auto;
|
||
padding-bottom: 8px;
|
||
scroll-behavior: smooth;
|
||
}
|
||
|
||
.thumb-item {
|
||
flex: 0 0 100px;
|
||
height: 145px;
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
background: var(--bg-surface-elevated);
|
||
border: 2px solid transparent;
|
||
cursor: pointer;
|
||
position: relative;
|
||
transition: var(--transition-smooth);
|
||
}
|
||
|
||
.thumb-item:hover, .thumb-item.active {
|
||
border-color: var(--accent-primary);
|
||
transform: translateY(-4px);
|
||
box-shadow: 0 6px 16px var(--border-glow);
|
||
}
|
||
|
||
.thumb-item img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
|
||
.thumb-item .thumb-num {
|
||
position: absolute;
|
||
bottom: 4px;
|
||
right: 4px;
|
||
background: rgba(0, 0, 0, 0.75);
|
||
font-size: 0.65rem;
|
||
padding: 2px 6px;
|
||
border-radius: 4px;
|
||
}
|
||
|
||
/* メタ情報カード(最上部/最下部) */
|
||
.info-card {
|
||
background: var(--bg-surface);
|
||
border: 1px solid var(--border-subtle);
|
||
border-radius: var(--radius-lg);
|
||
padding: 24px;
|
||
margin-bottom: 16px;
|
||
width: 100%;
|
||
box-shadow: var(--shadow-float);
|
||
}
|
||
|
||
.info-tags {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
margin-top: 14px;
|
||
}
|
||
|
||
.tag-pill {
|
||
background: var(--bg-surface-elevated);
|
||
border: 1px solid var(--border-subtle);
|
||
color: var(--text-muted);
|
||
padding: 4px 12px;
|
||
border-radius: 20px;
|
||
font-size: 0.75rem;
|
||
font-weight: 500;
|
||
text-decoration: none;
|
||
}
|
||
|
||
/* キーボードショートカットヘルプモーダル */
|
||
.modal {
|
||
display: none;
|
||
position: fixed;
|
||
inset: 0;
|
||
background: rgba(0, 0, 0, 0.7);
|
||
backdrop-filter: blur(8px);
|
||
align-items: center;
|
||
justify-content: center;
|
||
z-index: 200;
|
||
padding: 20px;
|
||
}
|
||
|
||
.modal.active {
|
||
display: flex;
|
||
}
|
||
|
||
.modal-body {
|
||
background: var(--bg-surface);
|
||
border: 1px solid var(--border-subtle);
|
||
border-radius: var(--radius-lg);
|
||
padding: 28px;
|
||
max-width: 440px;
|
||
width: 100%;
|
||
box-shadow: var(--shadow-float);
|
||
}
|
||
|
||
.shortcut-row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 8px 0;
|
||
border-bottom: 1px solid var(--border-subtle);
|
||
}
|
||
|
||
.kbd-key {
|
||
background: var(--bg-surface-elevated);
|
||
border: 1px solid rgba(255, 255, 255, 0.15);
|
||
padding: 3px 8px;
|
||
border-radius: 6px;
|
||
font-family: monospace;
|
||
font-size: 0.8rem;
|
||
color: #818cf8;
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.gallery-title { max-width: 38vw; }
|
||
.header-right .text-label { display: none; }
|
||
.action-btn { padding: 8px 10px; }
|
||
.progress-bar-container { max-width: 180px; }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
|
||
<!-- ヘッダー -->
|
||
<header class="top-header" id="topHeader">
|
||
<div class="header-left">
|
||
<a href="/" class="back-btn" title="ホームへ戻る">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
|
||
</a>
|
||
<div class="gallery-title-wrapper">
|
||
<div class="gallery-title" title="{{title}}">{{title}}</div>
|
||
<div class="gallery-sub">
|
||
<span class="badge-category">{{category}}</span>
|
||
{{circleHeaderHtml}}
|
||
{{authorHeaderHtml}}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="header-right">
|
||
<button class="action-btn" id="modeToggleBtn" title="縦スクロール / スライド表示切替 (M)">
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 21V9"/></svg>
|
||
<span class="text-label" id="modeLabel">スライド表示へ</span>
|
||
</button>
|
||
<button class="action-btn" id="thumbToggleBtn" title="サムネイル一覧 (T)">
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
|
||
</button>
|
||
<button class="action-btn" id="fullscreenBtn" title="全画面表示 (F)">
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><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>
|
||
</button>
|
||
<button class="action-btn" id="helpBtn" title="ショートカット一覧 (?)">
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
|
||
</button>
|
||
</div>
|
||
</header>
|
||
|
||
<!-- メインビューアー -->
|
||
<main class="viewer-container">
|
||
|
||
<!-- 縦スクロールモード表示 -->
|
||
<div class="scroll-mode-view" id="scrollModeView">
|
||
|
||
<!-- メタ情報カード -->
|
||
<div class="info-card">
|
||
<h2>{{title}}</h2>
|
||
<div style="margin-top: 8px; color: var(--text-muted); font-size: 0.85rem; display: flex; gap: 16px; flex-wrap: wrap;">
|
||
<span>📁 カテゴリ: <strong>{{category}}</strong></span>
|
||
{{circleInfoHtml}}
|
||
{{authorInfoHtml}}
|
||
<span>📄 総ページ数: <strong>{{totalPages}} ページ</strong></span>
|
||
<span>🔗 元サイト: <a href="{{sourceUrl}}" target="_blank" rel="noopener noreferrer" style="color:#818cf8; text-decoration:underline;">{{sourceSite}}</a></span>
|
||
</div>
|
||
{{tagsHtml}}
|
||
</div>
|
||
|
||
<!-- 画像リスト -->
|
||
{{imagesHtml}}
|
||
|
||
<!-- 終了カード -->
|
||
<div class="info-card" style="text-align: center; margin-top: 24px;">
|
||
<h3>🎉 最後のページに到達しました(全 {{totalPages}} ページ)</h3>
|
||
<p style="color: var(--text-muted); margin-top: 8px; font-size: 0.85rem;">閲覧ありがとうございます!</p>
|
||
<div style="margin-top: 16px;">
|
||
<a href="/" class="action-btn" style="text-decoration:none;">ホームに戻る</a>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- スライドモード表示 -->
|
||
<div class="slide-mode-view" id="slideModeView">
|
||
<div class="slide-stage" id="slideStage">
|
||
<img class="slide-image" id="currentSlideImage" src="" alt="Slide Image" />
|
||
|
||
<div class="slide-nav-zone slide-nav-prev" id="slidePrevZone" title="前のページへ (← / A)">
|
||
<div class="nav-arrow-icon">
|
||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M15 18l-6-6 6-6"/></svg>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="slide-nav-zone slide-nav-next" id="slideNextZone" title="次のページへ (→ / D / Space)">
|
||
<div class="nav-arrow-icon">
|
||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M9 18l6-6-6-6"/></svg>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</main>
|
||
|
||
<!-- 下部ツールバー -->
|
||
<footer class="bottom-toolbar" id="bottomToolbar">
|
||
<div class="page-counter">
|
||
<span class="current-page" id="currentPageDisplay">1</span>
|
||
<span>/</span>
|
||
<span>{{totalPages}}</span>
|
||
</div>
|
||
|
||
<div class="progress-bar-container" id="progressBar">
|
||
<div class="progress-bar-fill" id="progressFill"></div>
|
||
</div>
|
||
|
||
<div style="display: flex; gap: 8px;">
|
||
<button class="action-btn" id="prevPageBtn" title="前のページ">
|
||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6"/></svg>
|
||
</button>
|
||
<button class="action-btn" id="nextPageBtn" title="次のページ">
|
||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>
|
||
</button>
|
||
</div>
|
||
</footer>
|
||
|
||
<!-- サムネイルドロワー -->
|
||
<div class="drawer-overlay" id="drawerOverlay"></div>
|
||
<div class="thumb-drawer" id="thumbDrawer">
|
||
<div class="drawer-header">
|
||
<h3>📖 サムネイル一覧 ({{totalPages}} ページ)</h3>
|
||
<button class="action-btn" id="closeDrawerBtn">✕ 閉じる</button>
|
||
</div>
|
||
<div class="thumb-list" id="thumbList">
|
||
{{thumbsHtml}}
|
||
</div>
|
||
</div>
|
||
|
||
<!-- ヘルプモーダル -->
|
||
<div class="modal" id="helpModal">
|
||
<div class="modal-body">
|
||
<h3 style="margin-bottom: 16px; font-weight: 700;">⌨️ キーボードショートカット</h3>
|
||
<div class="shortcut-row"><span>次のページへ</span><span class="kbd-key">→ / D / Space</span></div>
|
||
<div class="shortcut-row"><span>前のページへ</span><span class="kbd-key">← / A</span></div>
|
||
<div class="shortcut-row"><span>表示モード切替</span><span class="kbd-key">M</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">Home / End</span></div>
|
||
<div class="shortcut-row"><span>マウスホイール (スライド時)</span><span class="kbd-key">上: 前 / 下: 次</span></div>
|
||
<div class="shortcut-row"><span>左右スワイプ (タッチ操作)</span><span class="kbd-key">左: 次 / 右: 前</span></div>
|
||
<div style="margin-top: 20px; text-align: right;">
|
||
<button class="action-btn" id="closeHelpBtn">閉じる</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
const galleryData = {{galleryJson}};
|
||
const totalPages = {{totalPages}};
|
||
let currentPage = 1;
|
||
let isSlideMode = false;
|
||
|
||
// 要素参照
|
||
const scrollModeView = document.getElementById('scrollModeView');
|
||
const slideModeView = document.getElementById('slideModeView');
|
||
const modeToggleBtn = document.getElementById('modeToggleBtn');
|
||
const modeLabel = document.getElementById('modeLabel');
|
||
const currentSlideImage = document.getElementById('currentSlideImage');
|
||
const currentPageDisplay = document.getElementById('currentPageDisplay');
|
||
const progressFill = document.getElementById('progressFill');
|
||
const progressBar = document.getElementById('progressBar');
|
||
const thumbToggleBtn = document.getElementById('thumbToggleBtn');
|
||
const thumbDrawer = document.getElementById('thumbDrawer');
|
||
const drawerOverlay = document.getElementById('drawerOverlay');
|
||
const closeDrawerBtn = document.getElementById('closeDrawerBtn');
|
||
const thumbItems = document.querySelectorAll('.thumb-item');
|
||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||
const helpBtn = document.getElementById('helpBtn');
|
||
const helpModal = document.getElementById('helpModal');
|
||
const closeHelpBtn = document.getElementById('closeHelpBtn');
|
||
const prevPageBtn = document.getElementById('prevPageBtn');
|
||
const nextPageBtn = document.getElementById('nextPageBtn');
|
||
const slidePrevZone = document.getElementById('slidePrevZone');
|
||
const slideNextZone = document.getElementById('slideNextZone');
|
||
|
||
// 表示モード切替
|
||
function toggleMode() {
|
||
isSlideMode = !isSlideMode;
|
||
if (isSlideMode) {
|
||
scrollModeView.style.display = 'none';
|
||
slideModeView.classList.add('active');
|
||
modeLabel.textContent = 'スクロール表示へ';
|
||
updateSlideImage();
|
||
} else {
|
||
slideModeView.classList.remove('active');
|
||
scrollModeView.style.display = 'flex';
|
||
modeLabel.textContent = 'スライド表示へ';
|
||
scrollToPage(currentPage);
|
||
}
|
||
}
|
||
|
||
// ページ更新
|
||
function setPage(page, smoothScroll = true) {
|
||
if (page < 1) page = 1;
|
||
if (page > totalPages) page = totalPages;
|
||
currentPage = page;
|
||
|
||
currentPageDisplay.textContent = currentPage;
|
||
const progress = ((currentPage - 1) / Math.max(1, totalPages - 1)) * 100;
|
||
progressFill.style.width = `${progress}%`;
|
||
|
||
// サムネイルのアクティブ状態更新
|
||
thumbItems.forEach(item => {
|
||
const itemPage = parseInt(item.dataset.page);
|
||
item.classList.toggle('active', itemPage === currentPage);
|
||
if (itemPage === currentPage && thumbDrawer.classList.contains('active')) {
|
||
item.scrollIntoView({ behavior: 'smooth', inline: 'center', block: 'nearest' });
|
||
}
|
||
});
|
||
|
||
if (isSlideMode) {
|
||
updateSlideImage();
|
||
} else if (smoothScroll) {
|
||
scrollToPage(currentPage);
|
||
}
|
||
}
|
||
|
||
function scrollToPage(page) {
|
||
const el = document.querySelector(`.scroll-image-wrapper[data-page="${page}"]`);
|
||
if (el) {
|
||
const offset = 80;
|
||
const bodyRect = document.body.getBoundingClientRect().top;
|
||
const elementRect = el.getBoundingClientRect().top;
|
||
const elementPosition = elementRect - bodyRect;
|
||
const offsetPosition = elementPosition - offset;
|
||
|
||
window.scrollTo({
|
||
top: offsetPosition,
|
||
behavior: 'smooth'
|
||
});
|
||
}
|
||
}
|
||
|
||
function updateSlideImage() {
|
||
if (galleryData.images && galleryData.images[currentPage - 1]) {
|
||
const imgObj = galleryData.images[currentPage - 1];
|
||
currentSlideImage.src = imgObj.imageUrl;
|
||
currentSlideImage.alt = imgObj.altText || `${galleryData.title} ${currentPage}ページ`;
|
||
|
||
preloadAdjacentImages();
|
||
}
|
||
}
|
||
|
||
function preloadAdjacentImages() {
|
||
if (!galleryData.images) return;
|
||
const nextIdx = currentPage;
|
||
if (nextIdx < totalPages) {
|
||
const preloadImg = new Image();
|
||
preloadImg.src = galleryData.images[nextIdx].imageUrl;
|
||
}
|
||
const prevIdx = currentPage - 2;
|
||
if (prevIdx >= 0) {
|
||
const preloadImg = new Image();
|
||
preloadImg.src = galleryData.images[prevIdx].imageUrl;
|
||
}
|
||
}
|
||
|
||
// サムネイルドロワー開閉
|
||
function toggleDrawer(open) {
|
||
const shouldOpen = open !== undefined ? open : !thumbDrawer.classList.contains('active');
|
||
thumbDrawer.classList.toggle('active', shouldOpen);
|
||
drawerOverlay.classList.toggle('active', shouldOpen);
|
||
if (shouldOpen) {
|
||
const activeThumb = document.querySelector(`.thumb-item[data-page="${currentPage}"]`);
|
||
if (activeThumb) {
|
||
setTimeout(() => activeThumb.scrollIntoView({ behavior: 'smooth', inline: 'center' }), 100);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 全画面表示切替
|
||
function toggleFullscreen() {
|
||
if (!document.fullscreenElement) {
|
||
document.documentElement.requestFullscreen().catch(() => {});
|
||
} else {
|
||
document.exitFullscreen().catch(() => {});
|
||
}
|
||
}
|
||
|
||
// スクロール検知によるページ番号自動更新
|
||
let scrollTimeout;
|
||
window.addEventListener('scroll', () => {
|
||
if (isSlideMode) return;
|
||
clearTimeout(scrollTimeout);
|
||
scrollTimeout = setTimeout(() => {
|
||
const wrappers = document.querySelectorAll('.scroll-image-wrapper');
|
||
let foundPage = currentPage;
|
||
const viewCenter = window.innerHeight / 2;
|
||
|
||
wrappers.forEach(w => {
|
||
const rect = w.getBoundingClientRect();
|
||
if (rect.top <= viewCenter && rect.bottom >= viewCenter) {
|
||
foundPage = parseInt(w.dataset.page);
|
||
}
|
||
});
|
||
|
||
if (foundPage !== currentPage) {
|
||
setPage(foundPage, false);
|
||
}
|
||
}, 50);
|
||
});
|
||
|
||
// イベントリスナー
|
||
modeToggleBtn.addEventListener('click', toggleMode);
|
||
thumbToggleBtn.addEventListener('click', () => toggleDrawer());
|
||
closeDrawerBtn.addEventListener('click', () => toggleDrawer(false));
|
||
drawerOverlay.addEventListener('click', () => toggleDrawer(false));
|
||
fullscreenBtn.addEventListener('click', toggleFullscreen);
|
||
|
||
helpBtn.addEventListener('click', () => helpModal.classList.add('active'));
|
||
closeHelpBtn.addEventListener('click', () => helpModal.classList.remove('active'));
|
||
helpModal.addEventListener('click', (e) => { if (e.target === helpModal) helpModal.classList.remove('active'); });
|
||
|
||
prevPageBtn.addEventListener('click', () => setPage(currentPage - 1));
|
||
nextPageBtn.addEventListener('click', () => setPage(currentPage + 1));
|
||
slidePrevZone.addEventListener('click', () => setPage(currentPage - 1));
|
||
slideNextZone.addEventListener('click', () => setPage(currentPage + 1));
|
||
|
||
thumbItems.forEach(item => {
|
||
item.addEventListener('click', () => {
|
||
const p = parseInt(item.dataset.page);
|
||
setPage(p);
|
||
toggleDrawer(false);
|
||
});
|
||
});
|
||
|
||
progressBar.addEventListener('click', (e) => {
|
||
const rect = progressBar.getBoundingClientRect();
|
||
const ratio = (e.clientX - rect.left) / rect.width;
|
||
const targetPage = Math.max(1, Math.min(totalPages, Math.round(ratio * totalPages)));
|
||
setPage(targetPage);
|
||
});
|
||
|
||
window.addEventListener('keydown', (e) => {
|
||
if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return;
|
||
|
||
switch (e.key) {
|
||
case 'ArrowRight':
|
||
case 'd':
|
||
case 'D':
|
||
case ' ':
|
||
e.preventDefault();
|
||
setPage(currentPage + 1);
|
||
break;
|
||
case 'ArrowLeft':
|
||
case 'a':
|
||
case 'A':
|
||
e.preventDefault();
|
||
setPage(currentPage - 1);
|
||
break;
|
||
case 'm':
|
||
case 'M':
|
||
toggleMode();
|
||
break;
|
||
case 't':
|
||
case 'T':
|
||
toggleDrawer();
|
||
break;
|
||
case 'f':
|
||
case 'F':
|
||
toggleFullscreen();
|
||
break;
|
||
case 'Home':
|
||
e.preventDefault();
|
||
setPage(1);
|
||
break;
|
||
case 'End':
|
||
e.preventDefault();
|
||
setPage(totalPages);
|
||
break;
|
||
case 'Escape':
|
||
toggleDrawer(false);
|
||
helpModal.classList.remove('active');
|
||
break;
|
||
}
|
||
});
|
||
|
||
// マウスホイールによるページ送り(スライド表示モード時のみ)
|
||
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;
|
||
}, 50);
|
||
}, { passive: false });
|
||
|
||
// スマホ・タッチ操作での左右スワイプによるページ送り
|
||
let touchStartX = 0;
|
||
let touchStartY = 0;
|
||
let touchStartTime = 0;
|
||
let isTouching = false;
|
||
let lastSwipeTime = 0;
|
||
|
||
window.addEventListener('touchstart', (e) => {
|
||
// ヘルプモーダルやサムネイルドロワーが開いているとき、ヘッダー・ツールバー・ボタン・リンクの操作時は除外
|
||
if (helpModal.classList.contains('active') || thumbDrawer.classList.contains('active')) return;
|
||
if (e.target.closest('header, footer, button, a, input, textarea, .thumb-drawer, .modal')) return;
|
||
|
||
// マルチタッチ(ピンチズーム等)は除外
|
||
if (e.touches.length > 1) {
|
||
isTouching = false;
|
||
return;
|
||
}
|
||
|
||
const touch = e.touches[0];
|
||
touchStartX = touch.clientX;
|
||
touchStartY = touch.clientY;
|
||
touchStartTime = Date.now();
|
||
isTouching = true;
|
||
}, { passive: true });
|
||
|
||
window.addEventListener('touchmove', (e) => {
|
||
if (!isTouching || e.touches.length > 1) return;
|
||
|
||
const touch = e.touches[0];
|
||
const diffX = touch.clientX - touchStartX;
|
||
const diffY = touch.clientY - touchStartY;
|
||
|
||
// スライドモード時、水平方向のスワイプであれば縦スクロールやブラウザバウンスを防止
|
||
if (isSlideMode && Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 10) {
|
||
if (e.cancelable) {
|
||
e.preventDefault();
|
||
}
|
||
}
|
||
}, { passive: false });
|
||
|
||
window.addEventListener('touchend', (e) => {
|
||
if (!isTouching) return;
|
||
isTouching = false;
|
||
|
||
if (!e.changedTouches || e.changedTouches.length === 0) return;
|
||
|
||
const touch = e.changedTouches[0];
|
||
const diffX = touch.clientX - touchStartX;
|
||
const diffY = touch.clientY - touchStartY;
|
||
const elapsed = Date.now() - touchStartTime;
|
||
|
||
// スワイプ判定:水平移動量が40px以上、水平移動が垂直移動の1.2倍以上、所要時間600ms以内、直近50ms以上の間隔
|
||
const minSwipeDistance = 40;
|
||
if (Math.abs(diffX) >= minSwipeDistance &&
|
||
Math.abs(diffX) > Math.abs(diffY) * 1.2 &&
|
||
elapsed < 600 &&
|
||
Date.now() - lastSwipeTime >= 50) {
|
||
|
||
lastSwipeTime = Date.now();
|
||
|
||
if (diffX < 0) {
|
||
// 左スワイプ(指を右から左へ): 次のページへ
|
||
setPage(currentPage + 1);
|
||
} else {
|
||
// 右スワイプ(指を左から右へ): 前のページへ
|
||
setPage(currentPage - 1);
|
||
}
|
||
}
|
||
}, { passive: true });
|
||
|
||
// スワイプ操作完了直後の誤タップ(clickイベント)を防止
|
||
window.addEventListener('click', (e) => {
|
||
if (Date.now() - lastSwipeTime < 350) {
|
||
e.preventDefault();
|
||
e.stopImmediatePropagation();
|
||
}
|
||
}, true);
|
||
|
||
setPage(1, false);
|
||
</script>
|
||
</body>
|
||
</html>
|
||
""";
|
||
}
|
||
|
||
/// <summary>
|
||
/// ホーム画面(URL・ID入力フォーム)のHTMLを生成します。
|
||
/// </summary>
|
||
public static string RenderHomePage()
|
||
{
|
||
return """
|
||
<!DOCTYPE html>
|
||
<html lang="ja">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>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.7);
|
||
--border-subtle: rgba(255, 255, 255, 0.08);
|
||
--accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
|
||
--accent-primary: #6366f1;
|
||
--text-main: #f8fafc;
|
||
--text-muted: #94a3b8;
|
||
--radius-lg: 18px;
|
||
--shadow-glow: 0 0 35px rgba(99, 102, 241, 0.25);
|
||
}
|
||
|
||
* { 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;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 24px;
|
||
background-image:
|
||
radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.15), transparent 40%),
|
||
radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.12), transparent 40%);
|
||
}
|
||
|
||
.container {
|
||
max-width: 680px;
|
||
width: 100%;
|
||
}
|
||
|
||
.hero {
|
||
text-align: center;
|
||
margin-bottom: 36px;
|
||
}
|
||
|
||
.hero-title {
|
||
font-family: 'Outfit', sans-serif;
|
||
font-size: 2.8rem;
|
||
font-weight: 800;
|
||
background: var(--accent-gradient);
|
||
-webkit-background-clip: text;
|
||
-webkit-text-fill-color: transparent;
|
||
letter-spacing: -0.02em;
|
||
margin-bottom: 8px;
|
||
}
|
||
|
||
.hero-subtitle {
|
||
color: var(--text-muted);
|
||
font-size: 1.05rem;
|
||
}
|
||
|
||
.search-card {
|
||
background: var(--bg-card);
|
||
backdrop-filter: blur(20px);
|
||
-webkit-backdrop-filter: blur(20px);
|
||
border: 1px solid var(--border-subtle);
|
||
border-radius: var(--radius-lg);
|
||
padding: 32px;
|
||
box-shadow: var(--shadow-glow);
|
||
}
|
||
|
||
.input-group {
|
||
display: flex;
|
||
gap: 12px;
|
||
margin-top: 16px;
|
||
}
|
||
|
||
.url-input {
|
||
flex: 1;
|
||
background: rgba(0, 0, 0, 0.4);
|
||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||
border-radius: 12px;
|
||
padding: 14px 18px;
|
||
color: #fff;
|
||
font-size: 1rem;
|
||
outline: none;
|
||
transition: all 0.2s ease;
|
||
}
|
||
|
||
.url-input:focus {
|
||
border-color: var(--accent-primary);
|
||
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
|
||
}
|
||
|
||
.submit-btn {
|
||
background: var(--accent-gradient);
|
||
border: none;
|
||
border-radius: 12px;
|
||
padding: 14px 28px;
|
||
color: #fff;
|
||
font-size: 1rem;
|
||
font-weight: 700;
|
||
cursor: pointer;
|
||
transition: all 0.2s ease;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.submit-btn:hover {
|
||
transform: translateY(-2px);
|
||
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
|
||
}
|
||
|
||
.quick-links {
|
||
margin-top: 28px;
|
||
padding-top: 20px;
|
||
border-top: 1px solid var(--border-subtle);
|
||
}
|
||
|
||
.quick-links-title {
|
||
font-size: 0.85rem;
|
||
color: var(--text-muted);
|
||
margin-bottom: 12px;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.05em;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.sample-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
background: rgba(255, 255, 255, 0.03);
|
||
border: 1px solid var(--border-subtle);
|
||
padding: 12px 16px;
|
||
border-radius: 10px;
|
||
text-decoration: none;
|
||
color: var(--text-main);
|
||
transition: all 0.2s ease;
|
||
}
|
||
|
||
.sample-item:hover {
|
||
background: rgba(99, 102, 241, 0.15);
|
||
border-color: rgba(99, 102, 241, 0.4);
|
||
transform: translateX(4px);
|
||
}
|
||
|
||
.features-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, 1fr);
|
||
gap: 16px;
|
||
margin-top: 36px;
|
||
}
|
||
|
||
.feature-box {
|
||
background: rgba(255, 255, 255, 0.02);
|
||
border: 1px solid var(--border-subtle);
|
||
border-radius: 14px;
|
||
padding: 20px 16px;
|
||
text-align: center;
|
||
}
|
||
|
||
.feature-icon {
|
||
font-size: 1.8rem;
|
||
margin-bottom: 8px;
|
||
}
|
||
|
||
.feature-title {
|
||
font-size: 0.95rem;
|
||
font-weight: 700;
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.feature-desc {
|
||
font-size: 0.78rem;
|
||
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) {
|
||
.hero-title { font-size: 2.2rem; }
|
||
.input-group { flex-direction: column; }
|
||
.features-grid { grid-template-columns: 1fr; }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<div class="hero">
|
||
<h1 class="hero-title">WebImageViewer</h1>
|
||
<p class="hero-subtitle">高速スクレイピングと洗練されたモダンUIで快適な画像・動画閲覧体験を</p>
|
||
</div>
|
||
|
||
<div class="search-card">
|
||
<div class="tabs-nav">
|
||
<button type="button" class="tab-btn active" id="tabGalleryBtn" onclick="switchTab('gallery')">
|
||
<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>画像ギャラリー</span>
|
||
</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>動画プレイヤー (123av / missav / SpankBang)</span>
|
||
</button>
|
||
</div>
|
||
|
||
<!-- 画像ギャラリー パネル -->
|
||
<div id="galleryPanel" class="tab-panel active">
|
||
<form id="viewForm">
|
||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
||
<label for="urlInput" style="font-size: 0.9rem; font-weight: 600; color: var(--text-main);">作品URL または サイト/ID を入力</label>
|
||
<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>
|
||
</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;">
|
||
<option value="auto">🌐 自動判定 (Auto)</option>
|
||
<option value="ehentai">🐼 E-Hentai (/ehentai/{gid}/{token})</option>
|
||
<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="mangalear">📖 mangalear (/mangalear/{id})</option>
|
||
<option value="hentaipaw">🐾 HentaiPaw (/hentaipaw/{id})</option>
|
||
<option value="123av">🎬 123av (/123av/{id})</option>
|
||
<option value="missav">🌸 missav.ai (/missav/{id})</option>
|
||
<option value="spankbang">🎥 SpankBang (/spankbang/{id})</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="input-group">
|
||
<input type="text" id="urlInput" class="url-input" placeholder="例: 4159771/95d2fa13bd, 4159707, 013597, 289385, 2299095, または元URL" required autocomplete="off" />
|
||
<button type="submit" class="submit-btn">閲覧する</button>
|
||
</div>
|
||
</form>
|
||
|
||
<div class="quick-links">
|
||
<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 style="color: #818cf8; font-weight: 700;">開く →</div>
|
||
</a>
|
||
<a href="/hitomi/4159707/" class="sample-item">
|
||
<div>
|
||
<div style="display: flex; align-items: center; gap: 8px;">
|
||
<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>
|
||
<span style="font-weight: 600; font-size: 0.95rem;">/hitomi/4159707</span>
|
||
</div>
|
||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">gzrさんのヘンタイ露出排泄 / 作者: ajisio (27ページ)</div>
|
||
</div>
|
||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||
</a>
|
||
<a href="/aurahentai/013597/" 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;">AURA</span>
|
||
<span style="font-weight: 600; font-size: 0.95rem;">/aurahentai/013597</span>
|
||
</div>
|
||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">作者: ajisio / にじさんじ (17ページ)</div>
|
||
</div>
|
||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||
</a>
|
||
<a href="/momonga/mo3469109/" class="sample-item">
|
||
<div>
|
||
<div style="display: flex; align-items: center; gap: 8px;">
|
||
<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>
|
||
<span style="font-weight: 600; font-size: 0.95rem;">/momonga/mo3469109</span>
|
||
</div>
|
||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">新妻契約 / サークル: Whisker Pad (52ページ)</div>
|
||
</div>
|
||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||
</a>
|
||
<a href="/mangalear/289385/" class="sample-item">
|
||
<div>
|
||
<div style="display: flex; align-items: center; gap: 8px;">
|
||
<span style="background: rgba(245, 158, 11, 0.2); color: #fbbf24; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">MANGALEAR</span>
|
||
<span style="font-weight: 600; font-size: 0.95rem;">/mangalear/289385</span>
|
||
</div>
|
||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">これが…本当のセクササイズだ… / 羽川ハスミ (24ページ)</div>
|
||
</div>
|
||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||
</a>
|
||
<a href="/hentaipaw/2299095/" class="sample-item">
|
||
<div>
|
||
<div style="display: flex; align-items: center; gap: 8px;">
|
||
<span style="background: rgba(14, 165, 233, 0.2); color: #38bdf8; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">HENTAIPAW</span>
|
||
<span style="font-weight: 600; font-size: 0.95rem;">/hentaipaw/2299095</span>
|
||
</div>
|
||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">時間停止と催眠と透明人間で水着の担任の先生をプールの授業中に犯しまくる (50ページ)</div>
|
||
</div>
|
||
<div style="color: #818cf8; font-weight: 700;">開く →</div>
|
||
</a>
|
||
</div>
|
||
</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);">動画ページ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: /{site}/{id}</span>
|
||
</div>
|
||
<p style="font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px;">123av、missav.ai、SpankBang の動画URLまたはIDを入力して動画を直接再生します。</p>
|
||
|
||
<div class="input-group">
|
||
<input type="text" id="videoUrlInput" class="url-input" placeholder="例: 123avのURL/ID, missavのURL/ID, 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">動画プレイヤー クイック再生例</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 (SpankBang プレイヤー)</div>
|
||
</div>
|
||
<div style="color: #ec4899; font-weight: 700;">再生 →</div>
|
||
</a>
|
||
<a href="/123av/sample" class="sample-item">
|
||
<div>
|
||
<div style="display: flex; align-items: center; gap: 8px;">
|
||
<span style="background: rgba(99, 102, 241, 0.2); color: #818cf8; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">123AV</span>
|
||
<span style="font-weight: 600; font-size: 0.95rem;">/123av/{ID}</span>
|
||
</div>
|
||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">123av.com 動画プレイヤー</div>
|
||
</div>
|
||
<div style="color: #6366f1; font-weight: 700;">再生 →</div>
|
||
</a>
|
||
<a href="/missav/sample" class="sample-item">
|
||
<div>
|
||
<div style="display: flex; align-items: center; gap: 8px;">
|
||
<span style="background: rgba(244, 63, 94, 0.2); color: #fb7185; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700;">MISSAV</span>
|
||
<span style="font-weight: 600; font-size: 0.95rem;">/missav/{ID}</span>
|
||
</div>
|
||
<div style="font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;">missav.ai HLS 高画質ストリーミングプレイヤー</div>
|
||
</div>
|
||
<div style="color: #f43f5e; font-weight: 700;">再生 →</div>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="features-grid">
|
||
<div class="feature-box">
|
||
<div class="feature-icon">🌐</div>
|
||
<div class="feature-title">マルチサイト統一対応</div>
|
||
<div class="feature-desc">/{site}/{id} でどのサイトの作品も瞬時に閲覧可能</div>
|
||
</div>
|
||
<div class="feature-box">
|
||
<div class="feature-icon">⚡</div>
|
||
<div class="feature-title">超高速キャッシュ</div>
|
||
<div class="feature-desc">メモリキャッシュによるストレスフリーな即時表示</div>
|
||
</div>
|
||
<div class="feature-box">
|
||
<div class="feature-icon">📱</div>
|
||
<div class="feature-title">2つの閲覧モード</div>
|
||
<div class="feature-desc">快適な縦スクロール&コミックスライド表示に対応</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<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');
|
||
}
|
||
}
|
||
|
||
// 汎用URL/IDナビゲーション処理(画像ギャラリー・動画の両対応判定)
|
||
function navigateUniversalInput(input) {
|
||
if (!input) return;
|
||
input = input.trim();
|
||
|
||
// 1. フルURL(http:// または https://)の場合
|
||
if (input.startsWith('http://') || input.startsWith('https://')) {
|
||
try {
|
||
const urlObj = new URL(input);
|
||
const host = urlObj.hostname.toLowerCase();
|
||
const path = urlObj.pathname.replace(/^\/+|\/+$/g, '');
|
||
|
||
// 画像ギャラリーサイト判定
|
||
if (host.includes('e-hentai.org') || host.includes('exhentai.org')) {
|
||
const gm = path.match(/g\/(\d+)\/([a-z0-9]+)/i);
|
||
if (gm) {
|
||
window.location.href = '/ehentai/' + gm[1] + '/' + gm[2] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('hitomi.la')) {
|
||
const hm = path.match(/(?:doujinshi|manga|gamecg|artistcg|anime)\/[^\/]+-(\d+)\.html/i) || path.match(/(\d+)\.html/i) || path.match(/(\d+)$/i);
|
||
if (hm) {
|
||
window.location.href = '/hitomi/' + hm[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('aurahentai.com')) {
|
||
const am = path.match(/gallery\/([0-9a-zA-Z_\-]+)/i);
|
||
if (am) {
|
||
window.location.href = '/aurahentai/' + am[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('momon-ga.com') || host.includes('momonga')) {
|
||
const mm = path.match(/(?:fanzine|magazine|comic)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(mo\d+)/i);
|
||
if (mm) {
|
||
window.location.href = '/momonga/' + mm[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('mangalear.com') || host.includes('mangalear.blog')) {
|
||
const p = urlObj.searchParams.get('p');
|
||
if (p) {
|
||
window.location.href = '/mangalear/' + p + '/';
|
||
return;
|
||
}
|
||
const ml = path.match(/(?:manga|series|detail)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i);
|
||
if (ml) {
|
||
window.location.href = '/mangalear/' + ml[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('hentaipaw.com')) {
|
||
const hp = path.match(/doujinshi\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i);
|
||
if (hp) {
|
||
window.location.href = '/hentaipaw/' + hp[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
|
||
// 主要動画サイト判定
|
||
if (host.includes('123av')) {
|
||
const match = path.match(/(?:video\/|^)([a-zA-Z0-9_-]+)/i);
|
||
if (match) {
|
||
window.location.href = '/123av/' + encodeURIComponent(match[1]);
|
||
return;
|
||
}
|
||
}
|
||
if (host.includes('missav')) {
|
||
const match = path.match(/(?:[a-z]{2}\/)?([a-zA-Z0-9_-]+)$/i);
|
||
if (match) {
|
||
window.location.href = '/missav/' + encodeURIComponent(match[1]);
|
||
return;
|
||
}
|
||
}
|
||
if (host.includes('spankbang')) {
|
||
const sbMatch = path.match(/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i);
|
||
if (sbMatch) {
|
||
window.location.href = '/spankbang/' + encodeURIComponent(sbMatch[1]);
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 動画ホストまたはまとめブログ等は /video?url=
|
||
const videoHosts = ['do-ga.eroterest.net', 'movie.eroterest.net', 'vjav.com', 'laxd.com', 'fc2.com', 'inporn.com', 'bdsmx.tube', 'senzuri.tube', 'txxx.com', 'hclips.com', 'hdzog.com', 'upornia.com', 'youjizz.com', 'xvideos.com', 'blogterest.net', 'blog.2nt.com'];
|
||
if (videoHosts.some(vh => host.includes(vh))) {
|
||
window.location.href = '/video?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
|
||
// デフォルト画像ビューアー
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
} catch (e) {
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 2. プレフィックス付きサイト指定 (/site/id や site/id)
|
||
const slashMatch = input.match(/^([a-z0-9_-]+)\/([a-z0-9_\-\/]+)$/i);
|
||
if (slashMatch) {
|
||
const s = slashMatch[1].toLowerCase();
|
||
const v = slashMatch[2].replace(/^\/+|\/+$/g, '');
|
||
const gallerySites = ['ehentai', 'hitomi', 'aurahentai', 'momonga', 'mangalear', 'hentaipaw'];
|
||
const videoSites = ['123av', 'missav', 'spankbang', 'doga', 'vjav', 'laxd', 'fc2', 'xvideos', 'inporn', 'bdsmx', 'senzuri', 'txxx', 'hclips', 'hdzog', 'upornia', 'youjizz'];
|
||
if (gallerySites.includes(s)) {
|
||
window.location.href = '/' + s + '/' + v + '/';
|
||
return;
|
||
}
|
||
if (videoSites.includes(s)) {
|
||
window.location.href = '/' + s + '/' + encodeURIComponent(v);
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 3. 123av / missav / spankbang のキーワード判定
|
||
if (input.toLowerCase().includes('123av')) {
|
||
const id = input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, '');
|
||
window.location.href = '/123av/' + encodeURIComponent(id);
|
||
return;
|
||
}
|
||
if (input.toLowerCase().includes('missav')) {
|
||
const id = input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, '');
|
||
window.location.href = '/missav/' + encodeURIComponent(id);
|
||
return;
|
||
}
|
||
if (input.toLowerCase().includes('spankbang')) {
|
||
const id = input.replace(/^spankbang\//i, '').replace(/^\/+|\/+$/g, '');
|
||
window.location.href = '/spankbang/' + encodeURIComponent(id);
|
||
return;
|
||
}
|
||
|
||
// 4. E-Hentai の gid/token 形式 (例: 4159771/95d2fa13bd または 4159771_95d2fa13bd)
|
||
const ehPair = input.match(/^(\d+)[/_ -]([a-z0-9]{10})$/i);
|
||
if (ehPair) {
|
||
window.location.href = '/ehentai/' + ehPair[1] + '/' + ehPair[2] + '/';
|
||
return;
|
||
}
|
||
|
||
// 5. 自動判定
|
||
if (/^\d{7,}$/.test(input)) {
|
||
window.location.href = '/hitomi/' + input + '/';
|
||
} else if (/^\d+$/.test(input)) {
|
||
window.location.href = '/aurahentai/' + input + '/';
|
||
} else if (input.startsWith('mo') || input.startsWith('MO')) {
|
||
window.location.href = '/momonga/' + input + '/';
|
||
} else {
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
}
|
||
}
|
||
|
||
// 動画用フォーム送信イベント
|
||
document.getElementById('videoForm').addEventListener('submit', function(e) {
|
||
e.preventDefault();
|
||
const input = document.getElementById('videoUrlInput').value.trim();
|
||
navigateUniversalInput(input);
|
||
});
|
||
|
||
// 画像用フォーム送信イベント
|
||
document.getElementById('viewForm').addEventListener('submit', function(e) {
|
||
e.preventDefault();
|
||
let input = document.getElementById('urlInput').value.trim();
|
||
const siteSelect = document.getElementById('siteSelect').value;
|
||
if (!input) return;
|
||
|
||
// サイト選択が明示されている場合
|
||
if (siteSelect !== 'auto') {
|
||
const cleanId = input.replace(/^\/+|\/+$/g, '');
|
||
const videoSites = ['123av', 'missav', 'spankbang'];
|
||
if (videoSites.includes(siteSelect)) {
|
||
window.location.href = '/' + siteSelect + '/' + encodeURIComponent(cleanId);
|
||
return;
|
||
}
|
||
window.location.href = '/' + siteSelect + '/' + cleanId + '/';
|
||
return;
|
||
}
|
||
|
||
// URLまたはIDを画像・動画両対応でスマートに判定・遷移
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|
||
|
||
|
||
|
||
""";
|
||
}
|
||
|
||
/// <summary>
|
||
/// エラー画面(ギャラリーが見つからない場合等)のHTMLを生成します。
|
||
/// </summary>
|
||
public static string RenderErrorPage(string message, int statusCode = 404)
|
||
{
|
||
return $$"""
|
||
<!DOCTYPE html>
|
||
<html lang="ja">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>エラー {{statusCode}} - WebImageViewer</title>
|
||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Noto+Sans+JP:wght@400;700&family=Outfit:wght@700&display=swap" rel="stylesheet">
|
||
<style>
|
||
body {
|
||
background-color: #0a0d14;
|
||
color: #f8fafc;
|
||
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 100vh;
|
||
margin: 0;
|
||
padding: 20px;
|
||
}
|
||
.card {
|
||
background: #111726;
|
||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||
border-radius: 16px;
|
||
padding: 40px;
|
||
max-width: 480px;
|
||
text-align: center;
|
||
box-shadow: 0 20px 40px rgba(0,0,0,0.6);
|
||
}
|
||
.code {
|
||
font-family: 'Outfit', sans-serif;
|
||
font-size: 4rem;
|
||
font-weight: 800;
|
||
color: #ef4444;
|
||
line-height: 1;
|
||
margin-bottom: 12px;
|
||
}
|
||
.msg {
|
||
color: #94a3b8;
|
||
margin-bottom: 24px;
|
||
font-size: 1rem;
|
||
}
|
||
.btn {
|
||
display: inline-block;
|
||
background: #6366f1;
|
||
color: #fff;
|
||
padding: 12px 24px;
|
||
border-radius: 10px;
|
||
text-decoration: none;
|
||
font-weight: 600;
|
||
transition: 0.2s;
|
||
}
|
||
.btn:hover { background: #4f46e5; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="card">
|
||
<div class="code">{{statusCode}}</div>
|
||
<h2>ギャラリーを取得できませんでした</h2>
|
||
<p class="msg">{{Encoder.Encode(message)}}</p>
|
||
<a href="/" class="btn">ホームへ戻る</a>
|
||
</div>
|
||
</body>
|
||
</html>
|
||
""";
|
||
}
|
||
|
||
/// <summary>
|
||
/// SpankBang動画プレイヤー画面のHTMLを生成します(後方互換用)。
|
||
/// </summary>
|
||
public static string RenderVideoPlayer(string videoId, string? originalUrl = null)
|
||
{
|
||
var safeId = videoId.Trim();
|
||
var origUrl = !string.IsNullOrWhiteSpace(originalUrl) ? originalUrl : $"https://jp.spankbang.com/{safeId}/video/";
|
||
var embedUrl = $"https://spankbang.com/{safeId}/embed/";
|
||
return RenderVideoPlayer("spankbang", safeId, embedUrl, null, origUrl, $"SpankBang 動画 ({safeId})");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 各種動画サイト(SpankBang, 123av, missav等)に対応したプレミアム動画プレイヤー画面のHTMLを生成します。
|
||
/// </summary>
|
||
public static string RenderVideoPlayer(
|
||
string site,
|
||
string videoId,
|
||
string? playerUrl = null,
|
||
string? streamUrl = null,
|
||
string? originalUrl = null,
|
||
string? title = null)
|
||
{
|
||
var normalizedSite = (site ?? "video").Trim().ToLowerInvariant();
|
||
var safeId = Encoder.Encode(videoId?.Trim() ?? "video");
|
||
|
||
// originalUrl からのサイトおよびIDの自動救済(サイト名がvideoまたはsafeIdがvideo/未解決の場合)
|
||
if (!string.IsNullOrWhiteSpace(originalUrl) && (normalizedSite == "video" || safeId == "video" || string.IsNullOrWhiteSpace(playerUrl)))
|
||
{
|
||
if (originalUrl.Contains("vjav.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "vjav";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/videos/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://vjav.com/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("video.laxd.com", StringComparison.OrdinalIgnoreCase) || originalUrl.Contains("laxd.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "laxd";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"laxd\.com/(?:a/content/|content/|embed/)?([0-9a-zA-Z_\-]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://video.laxd.com/a/embed/player/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("contents.fc2.com", StringComparison.OrdinalIgnoreCase) || originalUrl.Contains("video.fc2.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "fc2";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"(?:article/|aid=|content/|video/)([0-9a-zA-Z_\-]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://video.fc2.com/a/embed/player/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("xvideos.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "xvideos";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"(?:video\.|video|embedframe/)([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://www.xvideos.com/embedframe/{safeId}";
|
||
}
|
||
else if (originalUrl.Contains("inporn.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "inporn";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/video/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://inporn.com/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("bdsmx.tube", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "bdsmx";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/video/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://bdsmx.tube/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("senzuri.tube", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "senzuri";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/videos/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://senzuri.tube/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("txxx.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "txxx";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/videos/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://www.txxx.com/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("hclips.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "hclips";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/videos/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://www.hclips.com/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("hdzog.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "hdzog";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/videos/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://www.hdzog.com/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("upornia.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "upornia";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/videos/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://upornia.com/embed/{safeId}/";
|
||
}
|
||
else if (originalUrl.Contains("youjizz.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "youjizz";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"/videos/([0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://www.youjizz.com/embed/{safeId}";
|
||
}
|
||
else if (originalUrl.Contains("spankbang.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "spankbang";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"(?:jp\.)?spankbang\.com/([a-zA-Z0-9]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://spankbang.com/{safeId}/embed/";
|
||
}
|
||
else if (originalUrl.Contains("123av.com", StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
normalizedSite = "123av";
|
||
var m = System.Text.RegularExpressions.Regex.Match(originalUrl, @"video/([a-zA-Z0-9_-]+)");
|
||
if (m.Success) safeId = m.Groups[1].Value;
|
||
playerUrl ??= $"https://javplayer.cc/v/{safeId}";
|
||
}
|
||
}
|
||
|
||
// サイト別の設定(名称、バッジ、グラデーション、プライマリカラー)
|
||
string siteDisplayName;
|
||
string badgeText;
|
||
string accentGradient;
|
||
string accentPrimary;
|
||
string glowColor;
|
||
string defaultOrigUrl;
|
||
|
||
switch (normalizedSite)
|
||
{
|
||
case "inporn":
|
||
siteDisplayName = "InPorn";
|
||
badgeText = "INPORN VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #e45257 0%, #f43f5e 100%)";
|
||
accentPrimary = "#e45257";
|
||
glowColor = "rgba(228, 82, 87, 0.3)";
|
||
defaultOrigUrl = $"https://inporn.com/video/{safeId}/";
|
||
playerUrl ??= $"https://inporn.com/embed/{safeId}/";
|
||
break;
|
||
|
||
case "bdsmx":
|
||
siteDisplayName = "BDSMx";
|
||
badgeText = "BDSMX TUBE";
|
||
accentGradient = "linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%)";
|
||
accentPrimary = "#8b5cf6";
|
||
glowColor = "rgba(139, 92, 246, 0.3)";
|
||
defaultOrigUrl = $"https://bdsmx.tube/video/{safeId}/";
|
||
playerUrl ??= $"https://bdsmx.tube/embed/{safeId}/";
|
||
break;
|
||
|
||
case "galgaldoga":
|
||
siteDisplayName = "GalGalドーガ";
|
||
badgeText = "GALGAL DOGA";
|
||
accentGradient = "linear-gradient(135deg, #ec4899 0%, #f43f5e 50%, #fb7185 100%)";
|
||
accentPrimary = "#ec4899";
|
||
glowColor = "rgba(236, 72, 153, 0.3)";
|
||
defaultOrigUrl = $"https://galgaldoga.blogterest.net/page/{safeId}/";
|
||
break;
|
||
|
||
case "doga":
|
||
case "eroterest_doga":
|
||
siteDisplayName = "エロタレドーガ";
|
||
badgeText = "EROTEREST DOGA";
|
||
accentGradient = "linear-gradient(135deg, #e11d48 0%, #ec4899 50%, #f43f5e 100%)";
|
||
accentPrimary = "#e11d48";
|
||
glowColor = "rgba(225, 29, 72, 0.3)";
|
||
defaultOrigUrl = $"https://do-ga.eroterest.net/video/detail/{safeId}/";
|
||
break;
|
||
|
||
case "vjav":
|
||
case "vjav.com":
|
||
siteDisplayName = "VJAV";
|
||
badgeText = "VJAV VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #e11d48 0%, #be123c 100%)";
|
||
accentPrimary = "#e11d48";
|
||
glowColor = "rgba(225, 29, 72, 0.3)";
|
||
defaultOrigUrl = originalUrl ?? $"https://vjav.com/videos/{safeId}/";
|
||
playerUrl ??= $"https://vjav.com/embed/{safeId}/";
|
||
break;
|
||
|
||
case "laxd":
|
||
case "video.laxd.com":
|
||
siteDisplayName = "LAXD";
|
||
badgeText = "LAXD VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #f59e0b 0%, #d97706 100%)";
|
||
accentPrimary = "#f59e0b";
|
||
glowColor = "rgba(245, 158, 11, 0.3)";
|
||
defaultOrigUrl = originalUrl ?? $"https://video.laxd.com/a/content/{safeId}";
|
||
playerUrl ??= $"https://video.laxd.com/a/embed/player/{safeId}/";
|
||
break;
|
||
|
||
case "upornia":
|
||
siteDisplayName = "Upornia";
|
||
badgeText = "UPORNIA VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #f10048 0%, #be123c 100%)";
|
||
accentPrimary = "#f10048";
|
||
glowColor = "rgba(241, 0, 72, 0.3)";
|
||
defaultOrigUrl = $"https://upornia.com/videos/{safeId}/";
|
||
playerUrl ??= $"https://upornia.com/embed/{safeId}/";
|
||
break;
|
||
|
||
case "xvideos":
|
||
siteDisplayName = "XVIDEOS";
|
||
badgeText = "XVIDEOS";
|
||
accentGradient = "linear-gradient(135deg, #dc2626 0%, #ef4444 100%)";
|
||
accentPrimary = "#dc2626";
|
||
glowColor = "rgba(220, 38, 38, 0.3)";
|
||
defaultOrigUrl = $"https://www.xvideos.com/video.{safeId}/";
|
||
playerUrl ??= $"https://www.xvideos.com/embedframe/{safeId}";
|
||
break;
|
||
|
||
case "youjizz":
|
||
siteDisplayName = "YouJizz";
|
||
badgeText = "YOUJIZZ VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%)";
|
||
accentPrimary = "#0ea5e9";
|
||
glowColor = "rgba(14, 165, 233, 0.3)";
|
||
defaultOrigUrl = $"https://www.youjizz.com/videos/{safeId}.html";
|
||
playerUrl ??= $"https://www.youjizz.com/embed/{safeId}";
|
||
break;
|
||
|
||
case "eroterest":
|
||
case "movie.eroterest.net":
|
||
siteDisplayName = "動画エロタレスト";
|
||
badgeText = "EROTEREST";
|
||
accentGradient = "linear-gradient(135deg, #6366f1 0%, #ec4899 100%)";
|
||
accentPrimary = "#6366f1";
|
||
glowColor = "rgba(99, 102, 241, 0.3)";
|
||
defaultOrigUrl = $"https://movie.eroterest.net/page/{safeId}/";
|
||
break;
|
||
|
||
case "123av":
|
||
siteDisplayName = "123av";
|
||
badgeText = "123AV VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #6366f1 0%, #3b82f6 100%)";
|
||
accentPrimary = "#6366f1";
|
||
glowColor = "rgba(99, 102, 241, 0.3)";
|
||
defaultOrigUrl = $"https://123av.com/ja/video/{safeId}";
|
||
playerUrl ??= $"https://javplayer.cc/v/{safeId}";
|
||
break;
|
||
|
||
case "missav":
|
||
case "missav.ai":
|
||
siteDisplayName = "missav.ai";
|
||
badgeText = "MISSAV VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #f43f5e 0%, #ec4899 50%, #a855f7 100%)";
|
||
accentPrimary = "#f43f5e";
|
||
glowColor = "rgba(244, 63, 94, 0.3)";
|
||
defaultOrigUrl = $"https://missav.ai/ja/{safeId}";
|
||
break;
|
||
|
||
case "spankbang":
|
||
siteDisplayName = "SpankBang";
|
||
badgeText = "SPANKBANG VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%)";
|
||
accentPrimary = "#ec4899";
|
||
glowColor = "rgba(236, 72, 153, 0.3)";
|
||
defaultOrigUrl = $"https://jp.spankbang.com/{safeId}/video/";
|
||
playerUrl ??= $"https://spankbang.com/{safeId}/embed/";
|
||
break;
|
||
|
||
case "senzuri":
|
||
case "senzuri.tube":
|
||
siteDisplayName = "Senzuri";
|
||
badgeText = "SENZURI TUBE";
|
||
accentGradient = "linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%)";
|
||
accentPrimary = "#8b5cf6";
|
||
glowColor = "rgba(139, 92, 246, 0.3)";
|
||
defaultOrigUrl = originalUrl ?? $"https://senzuri.tube/videos/{safeId}/";
|
||
playerUrl ??= $"https://senzuri.tube/embed/{safeId}/";
|
||
break;
|
||
|
||
case "txxx":
|
||
case "txxx.com":
|
||
case "hclips":
|
||
case "hclips.com":
|
||
case "hdzog":
|
||
case "hdzog.com":
|
||
bool isHclips = normalizedSite.Contains("hclips") || (originalUrl != null && originalUrl.Contains("hclips.com", StringComparison.OrdinalIgnoreCase));
|
||
siteDisplayName = isHclips ? "HClips" : "TXXX";
|
||
badgeText = isHclips ? "HCLIPS VIDEO" : "TXXX VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #ef4444 0%, #f97316 100%)";
|
||
accentPrimary = "#ef4444";
|
||
glowColor = "rgba(239, 68, 68, 0.3)";
|
||
defaultOrigUrl = originalUrl ?? (isHclips ? $"https://www.hclips.com/videos/{safeId}/" : $"https://www.txxx.com/videos/{safeId}/");
|
||
playerUrl ??= isHclips ? $"https://www.hclips.com/embed/{safeId}/" : $"https://www.txxx.com/embed/{safeId}/";
|
||
break;
|
||
|
||
case "fc2":
|
||
case "fc2video":
|
||
case "video.fc2.com":
|
||
siteDisplayName = "FC2動画";
|
||
badgeText = "FC2 VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #10b981 0%, #059669 100%)";
|
||
accentPrimary = "#10b981";
|
||
glowColor = "rgba(16, 185, 129, 0.3)";
|
||
defaultOrigUrl = originalUrl ?? $"https://adult.contents.fc2.com/article/{safeId}/";
|
||
playerUrl ??= $"https://video.fc2.com/a/embed/player/{safeId}/";
|
||
break;
|
||
|
||
|
||
default:
|
||
siteDisplayName = !string.IsNullOrWhiteSpace(site) ? site.ToUpperInvariant() : "動画プレイヤー";
|
||
badgeText = "WEB VIDEO";
|
||
accentGradient = "linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%)";
|
||
accentPrimary = "#06b6d4";
|
||
glowColor = "rgba(6, 182, 212, 0.3)";
|
||
defaultOrigUrl = originalUrl ?? (safeId.StartsWith("http") ? safeId : "");
|
||
break;
|
||
}
|
||
|
||
var safeTitle = !string.IsNullOrWhiteSpace(title) ? Encoder.Encode(title) : $"{siteDisplayName} 動画プレイヤー ({safeId})";
|
||
var safeOriginalUrl = !string.IsNullOrWhiteSpace(originalUrl) ? Encoder.Encode(originalUrl) : defaultOrigUrl;
|
||
var safePlayerUrl = !string.IsNullOrWhiteSpace(playerUrl) ? Encoder.Encode(playerUrl) : "";
|
||
var safeStreamUrl = !string.IsNullOrWhiteSpace(streamUrl) ? Encoder.Encode(streamUrl) : "";
|
||
|
||
bool hasStream = !string.IsNullOrEmpty(safeStreamUrl);
|
||
bool hasPlayer = !string.IsNullOrEmpty(safePlayerUrl);
|
||
|
||
return $$"""
|
||
<!DOCTYPE html>
|
||
<html lang="ja">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>{{safeTitle}} - 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">
|
||
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||
<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: {{glowColor}};
|
||
--accent-primary: {{accentPrimary}};
|
||
--accent-gradient: {{accentGradient}};
|
||
--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(99, 102, 241, 0.12), transparent 40%),
|
||
radial-gradient(circle at 85% 85%, rgba(236, 72, 153, 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 var(--border-glow);
|
||
border: 1px solid var(--border-subtle);
|
||
aspect-ratio: 16 / 9;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.player-iframe {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
border: none;
|
||
}
|
||
|
||
.player-video {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: contain;
|
||
background: #000;
|
||
}
|
||
|
||
.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(255, 255, 255, 0.12);
|
||
color: #fff;
|
||
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 var(--border-glow);
|
||
}
|
||
|
||
.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 var(--border-glow);
|
||
}
|
||
|
||
@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">{{badgeText}}</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">
|
||
{{(hasStream ? $$"""
|
||
<video id="hlsVideo" class="player-video" controls playsinline preload="auto" poster=""></video>
|
||
""" : (hasPlayer ? $$"""
|
||
<iframe
|
||
id="videoIframe"
|
||
src="{{safePlayerUrl}}"
|
||
class="player-iframe"
|
||
frameborder="0"
|
||
scrolling="no"
|
||
referrerpolicy="no-referrer-when-downgrade"
|
||
allowfullscreen="true"
|
||
webkitallowfullscreen="true"
|
||
mozallowfullscreen="true"
|
||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen">
|
||
</iframe>
|
||
""" : $$"""
|
||
<div style="text-align: center; padding: 40px 20px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px;">
|
||
<div style="font-size: 3rem; margin-bottom: 14px;">🎬</div>
|
||
<h3 style="font-size: 1.25rem; margin-bottom: 8px; color: #fff; font-weight: 700;">{{siteDisplayName}} で動画を視聴する</h3>
|
||
<p style="font-size: 0.92rem; margin-bottom: 20px; color: var(--text-muted); max-width: 480px; line-height: 1.6;">
|
||
この動画は配信元({{siteDisplayName}})にて安全に提供されています。<br>外部プレイヤー公式ページにて本編をご視聴いただけます。
|
||
</p>
|
||
<a href="{{safeOriginalUrl}}" target="_blank" rel="noopener noreferrer" class="btn-action" style="background: var(--accent-gradient); color: #fff; font-size: 1.05rem; padding: 12px 28px; box-shadow: 0 4px 20px var(--accent-glow);">
|
||
<span>▶ {{siteDisplayName}} で動画を再生する ↗</span>
|
||
</a>
|
||
</div>
|
||
"""))}}
|
||
</div>
|
||
|
||
<div class="video-meta-card">
|
||
<div class="meta-top-row">
|
||
<div class="meta-tags">
|
||
<span class="meta-tag-site" style="background: var(--accent-gradient);">{{siteDisplayName}}</span>
|
||
<span class="meta-tag-id">ID: {{safeId}}</span>
|
||
</div>
|
||
<div style="display: flex; gap: 10px; flex-wrap: wrap;">
|
||
<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;">別の作品・動画を閲覧/再生する (画像・動画のURLまたはIDに対応)</label>
|
||
<form id="switchForm" class="quick-switch-form">
|
||
<input type="text" id="switchInput" class="quick-input" placeholder="URL または ID (画像ギャラリー / 各種動画 / まとめブログ等)" 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 currentSite = "{{normalizedSite}}";
|
||
|
||
// シアターモード切替
|
||
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(() => {});
|
||
}
|
||
});
|
||
|
||
// 動画ストリーミング初期化(HLS m3u8 または直接 MP4/WebM 動画)
|
||
const hlsVideo = document.getElementById('hlsVideo');
|
||
const streamUrl = "{{safeStreamUrl}}";
|
||
if (streamUrl && hlsVideo) {
|
||
const isHls = streamUrl.includes('.m3u8') || streamUrl.includes('m3u8');
|
||
if (isHls && Hls.isSupported()) {
|
||
const hls = new Hls({
|
||
enableWorker: true,
|
||
lowLatencyMode: true
|
||
});
|
||
hls.loadSource(streamUrl);
|
||
hls.attachMedia(hlsVideo);
|
||
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||
hlsVideo.play().catch(() => {});
|
||
});
|
||
hls.on(Hls.Events.ERROR, function(event, data) {
|
||
console.warn('HLS Event Error:', data);
|
||
if (data.fatal) {
|
||
switch (data.type) {
|
||
case Hls.ErrorTypes.NETWORK_ERROR:
|
||
hls.startLoad();
|
||
break;
|
||
case Hls.ErrorTypes.MEDIA_ERROR:
|
||
hls.recoverMediaError();
|
||
break;
|
||
default:
|
||
hls.destroy();
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
} else if (isHls && hlsVideo.canPlayType('application/vnd.apple.mpegurl')) {
|
||
hlsVideo.src = streamUrl;
|
||
hlsVideo.addEventListener('loadedmetadata', function() {
|
||
hlsVideo.play().catch(() => {});
|
||
});
|
||
} else {
|
||
// 通常の MP4 / WebM 動画ファイル等の直接再生
|
||
hlsVideo.src = streamUrl;
|
||
hlsVideo.addEventListener('loadedmetadata', function() {
|
||
hlsVideo.play().catch(() => {});
|
||
});
|
||
}
|
||
}
|
||
|
||
// 汎用URL・IDナビゲーション処理(画像ギャラリー・動画の両対応判定)
|
||
function navigateUniversalInput(input) {
|
||
if (!input) return;
|
||
input = input.trim();
|
||
|
||
// 1. フルURL(http:// または https://)の場合
|
||
if (input.startsWith('http://') || input.startsWith('https://')) {
|
||
try {
|
||
const urlObj = new URL(input);
|
||
const host = urlObj.hostname.toLowerCase();
|
||
const path = urlObj.pathname.replace(/^\/+|\/+$/g, '');
|
||
|
||
// 画像ギャラリーサイト判定
|
||
if (host.includes('e-hentai.org') || host.includes('exhentai.org')) {
|
||
const gm = path.match(/g\/(\d+)\/([a-z0-9]+)/i);
|
||
if (gm) {
|
||
window.location.href = '/ehentai/' + gm[1] + '/' + gm[2] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('hitomi.la')) {
|
||
const hm = path.match(/(?:doujinshi|manga|gamecg|artistcg|anime)\/[^\/]+-(\d+)\.html/i) || path.match(/(\d+)\.html/i) || path.match(/(\d+)$/i);
|
||
if (hm) {
|
||
window.location.href = '/hitomi/' + hm[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('aurahentai.com')) {
|
||
const am = path.match(/gallery\/([0-9a-zA-Z_\-]+)/i);
|
||
if (am) {
|
||
window.location.href = '/aurahentai/' + am[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('momon-ga.com') || host.includes('momonga')) {
|
||
const mm = path.match(/(?:fanzine|magazine|comic)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(mo\d+)/i);
|
||
if (mm) {
|
||
window.location.href = '/momonga/' + mm[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('mangalear.com')) {
|
||
const ml = path.match(/(?:manga|series|detail)\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i);
|
||
if (ml) {
|
||
window.location.href = '/mangalear/' + ml[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
if (host.includes('hentaipaw.com')) {
|
||
const hp = path.match(/doujinshi\/([0-9a-zA-Z_\-]+)/i) || path.match(/(\d+)/i);
|
||
if (hp) {
|
||
window.location.href = '/hentaipaw/' + hp[1] + '/';
|
||
return;
|
||
}
|
||
window.location.href = '/view?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
|
||
// 主要動画サイト判定
|
||
if (host.includes('123av')) {
|
||
const match = path.match(/(?:video\/|^)([a-zA-Z0-9_-]+)/i);
|
||
if (match) {
|
||
window.location.href = '/123av/' + encodeURIComponent(match[1]);
|
||
return;
|
||
}
|
||
}
|
||
if (host.includes('missav')) {
|
||
const match = path.match(/(?:[a-z]{2}\/)?([a-zA-Z0-9_-]+)$/i);
|
||
if (match) {
|
||
window.location.href = '/missav/' + encodeURIComponent(match[1]);
|
||
return;
|
||
}
|
||
}
|
||
if (host.includes('spankbang')) {
|
||
const sbMatch = path.match(/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i);
|
||
if (sbMatch) {
|
||
window.location.href = '/spankbang/' + encodeURIComponent(sbMatch[1]);
|
||
return;
|
||
}
|
||
}
|
||
|
||
// その他の動画ホストまたはまとめブログ等は /video?url= でサーバー自動解決
|
||
window.location.href = '/video?url=' + encodeURIComponent(input);
|
||
return;
|
||
} catch (e) {
|
||
window.location.href = '/video?url=' + encodeURIComponent(input);
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 2. プレフィックス付きサイト指定 (/site/id や site/id)
|
||
const slashMatch = input.match(/^([a-z0-9_-]+)\/([a-z0-9_\-\/]+)$/i);
|
||
if (slashMatch) {
|
||
const s = slashMatch[1].toLowerCase();
|
||
const v = slashMatch[2].replace(/^\/+|\/+$/g, '');
|
||
const gallerySites = ['ehentai', 'hitomi', 'aurahentai', 'momonga', 'mangalear', 'hentaipaw'];
|
||
const videoSites = ['123av', 'missav', 'spankbang', 'doga', 'vjav', 'laxd', 'fc2', 'xvideos', 'inporn', 'bdsmx', 'senzuri', 'txxx', 'hclips', 'hdzog', 'upornia', 'youjizz'];
|
||
if (gallerySites.includes(s)) {
|
||
window.location.href = '/' + s + '/' + v + '/';
|
||
return;
|
||
}
|
||
if (videoSites.includes(s)) {
|
||
window.location.href = '/' + s + '/' + encodeURIComponent(v);
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 3. 123av / missav / spankbang のキーワード判定
|
||
if (input.toLowerCase().includes('123av')) {
|
||
const id = input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, '');
|
||
window.location.href = '/123av/' + encodeURIComponent(id);
|
||
return;
|
||
}
|
||
if (input.toLowerCase().includes('missav')) {
|
||
const id = input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, '');
|
||
window.location.href = '/missav/' + encodeURIComponent(id);
|
||
return;
|
||
}
|
||
if (input.toLowerCase().includes('spankbang')) {
|
||
const id = input.replace(/^spankbang\//i, '').replace(/^\/+|\/+$/g, '');
|
||
window.location.href = '/spankbang/' + encodeURIComponent(id);
|
||
return;
|
||
}
|
||
|
||
// 4. E-Hentai の {gid}/{token} 形式判定
|
||
if (/^\d+\/[a-z0-9]+$/i.test(input)) {
|
||
window.location.href = '/ehentai/' + input + '/';
|
||
return;
|
||
}
|
||
|
||
// 5. 現在のサイトが動画プレイヤーの場合のフォールバック
|
||
if (currentSite && currentSite !== 'video') {
|
||
window.location.href = '/' + currentSite + '/' + encodeURIComponent(input);
|
||
} else {
|
||
window.location.href = '/video?id=' + encodeURIComponent(input);
|
||
}
|
||
}
|
||
|
||
// 切り替えフォーム送信イベント
|
||
document.getElementById('switchForm').addEventListener('submit', (e) => {
|
||
e.preventDefault();
|
||
const input = document.getElementById('switchInput').value.trim();
|
||
navigateUniversalInput(input);
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|
||
""";
|
||
}
|
||
}
|
||
|