1432 lines
53 KiB
C#
1432 lines
53 KiB
C#
using System.Text.Encodings.Web;
|
|
using System.Text.Json;
|
|
using WebImageViewer.Class.Models;
|
|
|
|
namespace WebImageViewer.Class.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;
|
|
}
|
|
|
|
.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 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;
|
|
}
|
|
});
|
|
|
|
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);
|
|
}
|
|
|
|
@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">
|
|
<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>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="input-group">
|
|
<input type="text" id="urlInput" class="url-input" placeholder="例: 4159771/95d2fa13bd, 4159707, 013597, または元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>
|
|
</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>
|
|
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;
|
|
|
|
// 完全URLの場合
|
|
if (input.startsWith('http://') || input.startsWith('https://')) {
|
|
try {
|
|
const url = new URL(input);
|
|
const host = url.hostname.toLowerCase();
|
|
const path = url.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;
|
|
}
|
|
const sm = path.match(/s\/([a-z0-9]+)\/(\d+)-/i);
|
|
if (sm) {
|
|
window.location.href = '/view?url=' + encodeURIComponent(input);
|
|
return;
|
|
}
|
|
}
|
|
if (host.includes('hitomi.la')) {
|
|
const m = path.match(/(?:-|\/)(\d{5,8})(?:\.html)?$/) || path.match(/\d{5,8}/);
|
|
const id = m ? m[1] || m[0] : path;
|
|
window.location.href = '/hitomi/' + id + '/';
|
|
return;
|
|
}
|
|
if (host.includes('aurahentai.com')) {
|
|
const segs = path.split('/');
|
|
const id = segs.length >= 2 ? segs[1] : segs[0];
|
|
window.location.href = '/aurahentai/' + id + '/';
|
|
return;
|
|
}
|
|
if (host.includes('momon-ga.com')) {
|
|
const segs = path.split('/');
|
|
const id = segs.length >= 2 ? segs[1] : segs[0];
|
|
window.location.href = '/momonga/' + id + '/';
|
|
return;
|
|
}
|
|
|
|
// 汎用ビューアーへ
|
|
window.location.href = '/view?url=' + encodeURIComponent(input);
|
|
return;
|
|
} catch(err) {
|
|
window.location.href = '/view?url=' + encodeURIComponent(input);
|
|
return;
|
|
}
|
|
}
|
|
|
|
// サイト選択が明示されている場合
|
|
if (siteSelect !== 'auto') {
|
|
const cleanId = input.replace(/^\/+|\/+$/g, '');
|
|
window.location.href = '/' + siteSelect + '/' + cleanId + '/';
|
|
return;
|
|
}
|
|
|
|
// 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;
|
|
}
|
|
|
|
// スラッシュが含まれる場合 (例: ehentai/4159771/95d2fa13bd や hitomi/4159707 や momonga/mo3469109)
|
|
if (input.includes('/')) {
|
|
window.location.href = '/' + input.replace(/^\/+|\/+$/g, '') + '/';
|
|
return;
|
|
}
|
|
|
|
// 自動判定
|
|
if (/^\d{7,}$/.test(input)) {
|
|
// 7桁以上の数字 -> hitomi
|
|
window.location.href = '/hitomi/' + input + '/';
|
|
} else if (/^\d+$/.test(input)) {
|
|
// 6桁以下の数字 -> aurahentai
|
|
window.location.href = '/aurahentai/' + input + '/';
|
|
} else if (input.startsWith('mo') || input.startsWith('MO')) {
|
|
// moで始まる -> momonga
|
|
window.location.href = '/momonga/' + input + '/';
|
|
} else {
|
|
window.location.href = '/view?id=' + encodeURIComponent(input);
|
|
}
|
|
});
|
|
</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>
|
|
""";
|
|
}
|
|
}
|