diff --git a/WebImageViewer/Class/Renderers/HtmlRenderer.cs b/WebImageViewer/Class/Renderers/HtmlRenderer.cs
index 20c25cb..41b881a 100644
--- a/WebImageViewer/Class/Renderers/HtmlRenderer.cs
+++ b/WebImageViewer/Class/Renderers/HtmlRenderer.cs
@@ -1523,43 +1523,176 @@ public static class HtmlRenderer
}
}
- // 動画URL/IDの判定と遷移
- function navigateVideoInput(input) {
+ // 汎用URL/IDナビゲーション処理(画像ギャラリー・動画の両対応判定)
+ function navigateUniversalInput(input) {
if (!input) return;
input = input.trim();
- // 123av判定
+ // 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 match = input.match(/(?:123av\.com\/[a-z]{2}\/(?:video\/)?|^123av\/)([^/?#]+)/i);
- const id = match ? match[1] : input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, '');
+ const id = input.replace(/^123av\//i, '').replace(/^\/+|\/+$/g, '');
window.location.href = '/123av/' + encodeURIComponent(id);
return;
}
-
- // missav判定
if (input.toLowerCase().includes('missav')) {
- const match = input.match(/(?:missav\.[a-z]+\/[a-z]{2}\/|^missav\/)([^/?#]+)/i);
- const id = match ? match[1] : input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, '');
+ const id = input.replace(/^missav\//i, '').replace(/^\/+|\/+$/g, '');
window.location.href = '/missav/' + encodeURIComponent(id);
return;
}
-
- // SpankBang判定
- const sbMatch = input.match(/spankbang\.(?:com|party)\/([a-z0-9]+)(?:\/(?:video|play|embed)|\/|$)/i) || input.match(/^spankbang\/([a-z0-9]+)/i);
- if (sbMatch) {
- window.location.href = '/spankbang/' + encodeURIComponent(sbMatch[1]);
+ if (input.toLowerCase().includes('spankbang')) {
+ const id = input.replace(/^spankbang\//i, '').replace(/^\/+|\/+$/g, '');
+ window.location.href = '/spankbang/' + encodeURIComponent(id);
return;
}
- // デフォルト: 汎用 /video
- window.location.href = '/video?url=' + encodeURIComponent(input);
+ // 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();
- navigateVideoInput(input);
+ navigateUniversalInput(input);
});
// 画像用フォーム送信イベント
@@ -1569,116 +1702,19 @@ public static class HtmlRenderer
const siteSelect = document.getElementById('siteSelect').value;
if (!input) return;
- // 動画サイト選択または動画URLの判定
- if (siteSelect === 'spankbang' || siteSelect === '123av' || siteSelect === 'missav' ||
- input.toLowerCase().includes('spankbang') || input.toLowerCase().includes('123av') || input.toLowerCase().includes('missav')) {
- if (siteSelect === '123av' && !input.toLowerCase().includes('123av')) {
- window.location.href = '/123av/' + encodeURIComponent(input);
- return;
- }
- if (siteSelect === 'missav' && !input.toLowerCase().includes('missav')) {
- window.location.href = '/missav/' + encodeURIComponent(input);
- return;
- }
- if (siteSelect === 'spankbang' && !input.toLowerCase().includes('spankbang')) {
- window.location.href = '/spankbang/' + encodeURIComponent(input);
- return;
- }
- navigateVideoInput(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;
- }
- if (host.includes('mangalear.blog')) {
- const p = url.searchParams.get('p');
- if (p) {
- window.location.href = '/mangalear/' + p + '/';
- return;
- }
- const segs = path.split('/');
- const id = segs.length >= 2 ? segs[1] : segs[0];
- window.location.href = '/mangalear/' + 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, '');
+ const videoSites = ['123av', 'missav', 'spankbang'];
+ if (videoSites.includes(siteSelect)) {
+ window.location.href = '/' + siteSelect + '/' + encodeURIComponent(cleanId);
+ return;
+ }
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);
- }
+ // URLまたはIDを画像・動画両対応でスマートに判定・遷移
});