@yui540/comimi 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/arrow-buttons.d.ts.map +1 -1
- package/dist/components/arrow-buttons.styles.d.ts +1 -1
- package/dist/components/arrow-buttons.styles.d.ts.map +1 -1
- package/dist/components/controls-dock.styles.d.ts +1 -1
- package/dist/components/controls-dock.styles.d.ts.map +1 -1
- package/dist/components/settings-panel.d.ts +0 -2
- package/dist/components/settings-panel.d.ts.map +1 -1
- package/dist/core/manga-viewer-core.d.ts.map +1 -1
- package/dist/defaults.d.ts.map +1 -1
- package/dist/index.js +112 -110
- package/dist/manga-viewer.global.js +37 -6
- package/dist/renderer/viewer-renderer.d.ts +3 -0
- package/dist/renderer/viewer-renderer.d.ts.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/USAGE.md +5 -5
- package/locales/en.json +0 -1
- package/locales/id.json +0 -1
- package/locales/ja.json +0 -1
- package/locales/ko.json +0 -1
- package/locales/th.json +0 -1
- package/locales/zh-CN.json +0 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={locale:`ja`,hasCover:!0,readingDirection:`rtl`,pageTurnMode:`single`,layoutMode:`inline`,autoPageTurnIntervalMs:5e3,pageTurnAnimation:!0,backgroundColor:`white`,zoom:{min:1,max:4,step:.25}};function n(e,t,n=0){let r=i(n,e.pages.length);return{manga:e,currentPageIndex:r,visiblePageIndexes:o(r,e.pages.length,t),overlayVisible:!1,autoPageTurnEnabled:!1,zoomScale:1,panX:0,panY:0,settings:t,layout:{mode:t.layoutMode},notifications:[],panel:`none`}}function r(e,t){return{...e,...t,zoom:{...e.zoom,...t?.zoom}}}function i(e,t){return t<=0?0:Math.min(Math.max(Math.round(e),0),t-1)}function a(e,t){return e.pageTurnMode===`single`||e.hasCover&&t===0?1:2}function o(e,t,n){let r=new Set,i=Math.max(0,e-1),a=Math.min(t-1,e+1);for(let e=i;e<=a;e+=1)r.add(e);if(n.pageTurnMode===`spread`&&!(n.hasCover&&e===0)){let i=n.hasCover&&e>0?e+(e%2==1?1:-1):e+(e%2==0?1:-1);i>=0&&i<t&&r.add(i)}return[...r].sort((e,t)=>e-t)}var s={"overlay.autoPageTurn":`Auto play`,"overlay.layout":`Layout`,"overlay.settings":`Settings`,"overlay.menu":`Menu`,"overlay.centerHint.desktop":`Click the center to close`,"overlay.centerHint.mobile":`Tap the center to close`,"splash.loading":`Starting viewer`,"autoplay.start":`Auto play started`,"autoplay.stop":`Auto play stopped`,"pageMode.single":`Single`,"pageMode.spread":`Spread`,"layout.inline":`Standard`,"layout.wide":`Wide`,"layout.browserFullscreen":`Fullscreen`,"settings.title":`Settings`,"settings.cover":`Has cover`,"settings.direction":`Page turn direction`,"settings.backgroundColor":`Background color`,"settings.backgroundColor.white":`White`,"settings.backgroundColor.black":`Black`,"settings.interval":`Auto play interval`,"settings.interval.unit":`s`,"settings.animation":`Page turn animation`,"settings.direction.rtl":`Right to left`,"settings.direction.ltr":`Left to right`,"menu.openShortcuts":`Keyboard shortcuts`,"menu.openPages":`Page list`,"menu.back":`Back`,"pageList.htmlContent":`HTML content`,"shortcut.section.page":`Page navigation`,"shortcut.section.viewMode":`View mode`,"shortcut.section.general":`General`,"shortcut.moveLeft":`Move left`,"shortcut.moveRight":`Move right`,"shortcut.autoPageTurnLabel":`Auto play`,"shortcut.pageModeToggle":`Toggle spread`,"shortcut.overlayToggle":`Toggle overlay`,"seek.previewAlt":`Preview of page {{page}}`,loading:`Loading`,"error.pageRequestFailed":`Request failed for page {{page}}`},c={"overlay.autoPageTurn":`Putar otomatis`,"overlay.layout":`Mode tampilan`,"overlay.settings":`Pengaturan`,"overlay.menu":`Menu`,"overlay.centerHint.desktop":`Klik bagian tengah untuk menutup`,"overlay.centerHint.mobile":`Ketuk bagian tengah untuk menutup`,"splash.loading":`Memulai viewer`,"autoplay.start":`Putar otomatis dimulai`,"autoplay.stop":`Putar otomatis dihentikan`,"pageMode.single":`Satu halaman`,"pageMode.spread":`Dua halaman`,"layout.inline":`Standar`,"layout.wide":`Lebar`,"layout.browserFullscreen":`Layar penuh`,"settings.title":`Pengaturan`,"settings.cover":`Ada sampul`,"settings.direction":`Arah balik halaman`,"settings.backgroundColor":`Warna latar`,"settings.backgroundColor.white":`Putih`,"settings.backgroundColor.black":`Hitam`,"settings.interval":`Interval putar otomatis`,"settings.interval.unit":`dtk`,"settings.animation":`Animasi balik halaman`,"settings.direction.rtl":`Kanan`,"settings.direction.ltr":`Kiri`,"menu.openShortcuts":`Pintasan keyboard`,"menu.openPages":`Daftar halaman`,"menu.back":`Kembali`,"pageList.htmlContent":`Konten HTML`,"shortcut.section.page":`Navigasi halaman`,"shortcut.section.viewMode":`Mode tampilan`,"shortcut.section.general":`Umum`,"shortcut.moveLeft":`Geser kiri`,"shortcut.moveRight":`Geser kanan`,"shortcut.autoPageTurnLabel":`Putar otomatis`,"shortcut.pageModeToggle":`Alih dua halaman`,"shortcut.overlayToggle":`Alih overlay`,"seek.previewAlt":`Pratinjau halaman {{page}}`,loading:`Memuat`,"error.pageRequestFailed":`Permintaan halaman {{page}} gagal`},l={"overlay.autoPageTurn":`自動再生`,"overlay.layout":`表示モード`,"overlay.settings":`設定`,"overlay.menu":`メニュー`,"overlay.centerHint.desktop":`閉じるには画面中央をクリック`,"overlay.centerHint.mobile":`閉じるには画面中央をタップ`,"splash.loading":`ビューワーを起動中`,"autoplay.start":`自動再生を開始`,"autoplay.stop":`自動再生を停止`,"pageMode.single":`1ページ`,"pageMode.spread":`見開き`,"layout.inline":`標準`,"layout.wide":`ワイド`,"layout.browserFullscreen":`全画面`,"settings.title":`設定`,"settings.cover":`表紙あり`,"settings.direction":`ページ移動方向`,"settings.backgroundColor":`背景色`,"settings.backgroundColor.white":`白`,"settings.backgroundColor.black":`黒`,"settings.interval":`自動再生の秒数`,"settings.interval.unit":`秒`,"settings.animation":`ページ移動アニメーション`,"settings.direction.rtl":`右`,"settings.direction.ltr":`左`,"menu.openShortcuts":`キーボードショートカット`,"menu.openPages":`ページ一覧`,"menu.back":`もどる`,"pageList.htmlContent":`HTMLコンテンツ`,"shortcut.section.page":`ページ移動`,"shortcut.section.viewMode":`表示モード`,"shortcut.section.general":`全般`,"shortcut.moveLeft":`左に移動`,"shortcut.moveRight":`右に移動`,"shortcut.autoPageTurnLabel":`自動再生`,"shortcut.pageModeToggle":`見開き切り替え`,"shortcut.overlayToggle":`オーバーレイ切り替え`,"seek.previewAlt":`{{page}}ページのプレビュー`,loading:`読み込み中`,"error.pageRequestFailed":`{{page}}ページのリクエストに失敗しました`},ee={"overlay.autoPageTurn":`자동 재생`,"overlay.layout":`표시 모드`,"overlay.settings":`설정`,"overlay.menu":`메뉴`,"overlay.centerHint.desktop":`화면 중앙을 클릭하여 닫기`,"overlay.centerHint.mobile":`화면 중앙을 탭하여 닫기`,"splash.loading":`뷰어를 시작 중`,"autoplay.start":`자동 재생 시작`,"autoplay.stop":`자동 재생 정지`,"pageMode.single":`한 페이지`,"pageMode.spread":`양면 보기`,"layout.inline":`표준`,"layout.wide":`와이드`,"layout.browserFullscreen":`전체 화면`,"settings.title":`설정`,"settings.cover":`표지 있음`,"settings.direction":`페이지 이동 방향`,"settings.backgroundColor":`배경색`,"settings.backgroundColor.white":`흰색`,"settings.backgroundColor.black":`검정`,"settings.interval":`자동 재생 간격`,"settings.interval.unit":`초`,"settings.animation":`페이지 넘김 애니메이션`,"settings.direction.rtl":`오른쪽`,"settings.direction.ltr":`왼쪽`,"menu.openShortcuts":`키보드 단축키`,"menu.openPages":`페이지 목록`,"menu.back":`뒤로`,"pageList.htmlContent":`HTML 콘텐츠`,"shortcut.section.page":`페이지 이동`,"shortcut.section.viewMode":`표시 모드`,"shortcut.section.general":`일반`,"shortcut.moveLeft":`왼쪽으로 이동`,"shortcut.moveRight":`오른쪽으로 이동`,"shortcut.autoPageTurnLabel":`자동 재생`,"shortcut.pageModeToggle":`양면 보기 전환`,"shortcut.overlayToggle":`오버레이 전환`,"seek.previewAlt":`{{page}}페이지 미리보기`,loading:`로딩 중`,"error.pageRequestFailed":`{{page}}페이지 요청 실패`},te={"overlay.autoPageTurn":`เล่นอัตโนมัติ`,"overlay.layout":`โหมดการแสดงผล`,"overlay.settings":`ตั้งค่า`,"overlay.menu":`เมนู`,"overlay.centerHint.desktop":`คลิกตรงกลางเพื่อปิด`,"overlay.centerHint.mobile":`แตะตรงกลางเพื่อปิด`,"splash.loading":`กำลังเปิดโปรแกรมอ่าน`,"autoplay.start":`เริ่มเล่นอัตโนมัติแล้ว`,"autoplay.stop":`หยุดเล่นอัตโนมัติแล้ว`,"pageMode.single":`หน้าเดียว`,"pageMode.spread":`สองหน้า`,"layout.inline":`มาตรฐาน`,"layout.wide":`กว้าง`,"layout.browserFullscreen":`เต็มจอ`,"settings.title":`ตั้งค่า`,"settings.cover":`มีหน้าปก`,"settings.direction":`ทิศทางการพลิกหน้า`,"settings.backgroundColor":`สีพื้นหลัง`,"settings.backgroundColor.white":`ขาว`,"settings.backgroundColor.black":`ดำ`,"settings.interval":`ระยะเวลาเล่นอัตโนมัติ`,"settings.interval.unit":`วินาที`,"settings.animation":`อนิเมชันการพลิกหน้า`,"settings.direction.rtl":`ขวา`,"settings.direction.ltr":`ซ้าย`,"menu.openShortcuts":`คีย์ลัด`,"menu.openPages":`รายการหน้า`,"menu.back":`ย้อนกลับ`,"pageList.htmlContent":`เนื้อหา HTML`,"shortcut.section.page":`การเลื่อนหน้า`,"shortcut.section.viewMode":`โหมดการแสดงผล`,"shortcut.section.general":`ทั่วไป`,"shortcut.moveLeft":`เลื่อนซ้าย`,"shortcut.moveRight":`เลื่อนขวา`,"shortcut.autoPageTurnLabel":`เล่นอัตโนมัติ`,"shortcut.pageModeToggle":`สลับสองหน้า`,"shortcut.overlayToggle":`สลับโอเวอร์เลย์`,"seek.previewAlt":`ตัวอย่างหน้า {{page}}`,loading:`กำลังโหลด`,"error.pageRequestFailed":`ขอหน้า {{page}} ไม่สำเร็จ`},u={"overlay.autoPageTurn":`自动播放`,"overlay.layout":`显示模式`,"overlay.settings":`设置`,"overlay.menu":`菜单`,"overlay.centerHint.desktop":`点击中央以关闭`,"overlay.centerHint.mobile":`点按中央以关闭`,"splash.loading":`正在启动阅读器`,"autoplay.start":`已开始自动播放`,"autoplay.stop":`已停止自动播放`,"pageMode.single":`单页`,"pageMode.spread":`跨页`,"layout.inline":`标准`,"layout.wide":`宽屏`,"layout.browserFullscreen":`全屏`,"settings.title":`设置`,"settings.cover":`有封面`,"settings.direction":`翻页方向`,"settings.backgroundColor":`背景颜色`,"settings.backgroundColor.white":`白色`,"settings.backgroundColor.black":`黑色`,"settings.interval":`自动播放间隔`,"settings.interval.unit":`秒`,"settings.animation":`翻页动画`,"settings.direction.rtl":`向右`,"settings.direction.ltr":`向左`,"menu.openShortcuts":`键盘快捷键`,"menu.openPages":`页面列表`,"menu.back":`返回`,"pageList.htmlContent":`HTML 内容`,"shortcut.section.page":`翻页`,"shortcut.section.viewMode":`显示模式`,"shortcut.section.general":`通用`,"shortcut.moveLeft":`向左移动`,"shortcut.moveRight":`向右移动`,"shortcut.autoPageTurnLabel":`自动播放`,"shortcut.pageModeToggle":`切换跨页`,"shortcut.overlayToggle":`切换控制层`,"seek.previewAlt":`第 {{page}} 页预览`,loading:`加载中`,"error.pageRequestFailed":`第 {{page}} 页请求失败`},d=class{locale;translations;constructor(e,t){this.locale=e,this.translations={ja:l,en:s,"zh-CN":u,ko:ee,th:te,id:c},t&&(this.translations[e]={...this.translations[e]??{},...t})}setLocale(e){this.locale=e}t(e,t={}){return(this.translations[this.locale]?.[e]??this.translations.ja[e]??e).replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}};function f(e,t){switch(e){case`arrow`:return p(`0 0 20 20`,[m(`M7.28685 6.64194L10.7742 10.0838L7.3011 13.3098C7.06547 13.5391 6.9336 13.8467 6.9336 14.1669C6.9336 14.4871 7.06547 14.7945 7.3011 15.0239C7.41902 15.1378 7.55971 15.2282 7.7149 15.29C7.87009 15.3517 8.03669 15.3835 8.20498 15.3835C8.37328 15.3835 8.53987 15.3517 8.69506 15.29C8.85025 15.2282 8.99095 15.1378 9.10887 15.0239L13.4787 10.9746C13.7134 10.7475 13.845 10.4422 13.845 10.1243C13.845 9.80629 13.7134 9.50107 13.4787 9.27399L9.10886 4.96826C8.86878 4.74159 8.54377 4.61426 8.20498 4.61426C7.86619 4.61426 7.54118 4.74159 7.3011 4.96826C7.18102 5.08007 7.08568 5.2134 7.02057 5.36056C6.95546 5.50772 6.92188 5.6657 6.92188 5.82528C6.92188 5.98487 6.95546 6.14293 7.02057 6.29009C7.08568 6.43725 7.18102 6.57058 7.3011 6.68239L7.28685 6.64194Z`)],t);case`default`:return p(`0 0 20 20`,[h(`1`,`4`,`18`,`12`,`3`)],t);case`wide`:return p(`0 0 20 20`,[h(`1`,`2.5`,`18`,`15`,`3`),m(`M5.5719 6.31811C5.88754 6.00907 6.39381 6.01422 6.70294 6.3298C7.01206 6.64539 7.00674 7.15165 6.69124 7.46084L5.06993 9.04896L14.7642 9.16988L13.1761 7.54857C12.867 7.23293 12.8722 6.72667 13.1878 6.41754C13.5034 6.10841 14.0096 6.11374 14.3188 6.42923L17.2579 9.42977C17.5671 9.7454 17.5619 10.2516 17.2462 10.5608L14.2457 13.4999C13.93 13.809 13.4238 13.8038 13.1146 13.4882C12.8055 13.1726 12.8109 12.6664 13.1263 12.3572L14.7477 10.7691L5.0534 10.6481L6.64152 12.2695C6.95055 12.5851 6.94541 13.0914 6.62982 13.4005C6.31424 13.7096 5.80797 13.7043 5.49879 13.3888L2.55967 10.3883C2.2505 10.0726 2.25573 9.5664 2.57136 9.25723L5.5719 6.31811Z`)],t);case`fullscreen`:return p(`0 0 20 20`,[h(`1`,`1`,`18`,`18`,`3`),m(`M8.69922 3.7002C9.14096 3.7003 9.49902 4.05824 9.49902 4.5C9.49902 4.94176 9.14096 5.2997 8.69922 5.2998H6.42969L14.6992 13.5693V11.2998C14.6993 10.8581 15.0573 10.5 15.499 10.5C15.9408 10.5 16.2987 10.8581 16.2988 11.2998V15.5C16.2988 15.9418 15.9409 16.2998 15.499 16.2998H11.2988C10.8571 16.2997 10.499 15.9418 10.499 15.5C10.499 15.0582 10.8571 14.7003 11.2988 14.7002H13.5684L5.29883 6.43066V8.7002C5.29872 9.14193 4.94079 9.5 4.49902 9.5C4.05726 9.5 3.69932 9.14193 3.69922 8.7002V4.5C3.69922 4.05817 4.0572 3.7002 4.49902 3.7002H8.69922Z`)],t);case`one`:return p(`0 0 20 20`,[h(`1`,`2`,`18`,`16`,`3`),g(`6`,`4`,`8`,`12`,`1.5`)],t);case`two`:return p(`0 0 20 20`,[h(`1`,`2`,`18`,`16`,`3`),m(`M3 5.5C3 4.67157 3.67157 4 4.5 4H9.5V16H4.5C3.67157 16 3 15.3284 3 14.5V5.5Z`),m(`M10.5 4H15.5C16.3284 4 17 4.67157 17 5.5V14.5C17 15.3284 16.3284 16 15.5 16H10.5V4Z`)],t);case`play`:return p(`0 0 20 20`,[m(`M17.0385 7.78428L6.49809 1.19667C4.68077 0.190227 2.5 1.37966 2.5 3.48403V16.5678C2.5 18.5806 4.68077 19.8616 6.49809 18.7636L17.0385 12.176C18.7649 11.1696 18.7649 8.79072 17.0385 7.78428Z`)],t);case`pause`:return p(`0 0 20 20`,[m(`M6.14289 18.3332H4.68573C3.47144 18.3332 2.5 17.3332 2.5 16.0832V3.9165C2.5 2.6665 3.47144 1.6665 4.68573 1.6665H6.14289C7.35718 1.6665 8.32862 2.6665 8.32862 3.9165V15.9998C8.40957 17.3332 7.43814 18.3332 6.14289 18.3332Z`),m(`M15.3138 18.3332H13.8555C12.6402 18.3332 11.668 17.3332 11.668 16.0832V3.9165C11.668 2.6665 12.6402 1.6665 13.8555 1.6665H15.3138C16.5291 1.6665 17.5013 2.6665 17.5013 3.9165V15.9998C17.5013 17.3332 16.5291 18.3332 15.3138 18.3332Z`)],t);case`settings`:return p(`0 0 24 24`,[m(`M10.0144 1.34782C11.2164 0.658798 12.6836 0.658798 13.8856 1.34782C13.8947 1.35299 13.9036 1.35831 13.9125 1.36376L20.1001 5.17383C21.3211 5.88071 22 7.15791 22 8.54376V15.56C22 16.9 21.3552 18.2127 20.1836 18.8369L14.0125 22.6368C14.0036 22.6423 13.9947 22.6476 13.9856 22.6527C12.7836 23.3418 11.3164 23.3418 10.1144 22.6527C10.1053 22.6476 10.0964 22.6423 10.0875 22.6368L3.89984 18.8267C2.67884 18.1198 2 16.8426 2 15.4568V8.54376C2 7.15919 2.6776 5.88306 3.8965 5.17578L9.98139 1.36758C9.99225 1.36078 10.0032 1.35419 10.0144 1.34782ZM11.0006 3.14323L4.91861 6.94964C4.90775 6.95644 4.89675 6.96302 4.88564 6.96939C4.31578 7.29605 4 7.87148 4 8.54376V15.4568C4 16.1291 4.31578 16.7045 4.88564 17.0312C4.89466 17.0364 4.9036 17.0417 4.91246 17.0471L11.0978 20.8558C11.6895 21.1893 12.4105 21.1893 13.0022 20.8558L19.1875 17.0471C19.2088 17.034 19.2306 17.0217 19.2528 17.0103C19.6582 16.8011 20 16.2698 20 15.56V8.54376C20 7.87148 19.6842 7.29605 19.1144 6.96939C19.1053 6.96422 19.0964 6.95891 19.0875 6.95346L12.9022 3.14482C12.3115 2.8118 11.5918 2.81127 11.0006 3.14323ZM12 9.8851C10.8402 9.8851 9.89999 10.8552 9.89999 12.0519C9.89999 13.2486 10.8402 14.2187 12 14.2187C13.1598 14.2187 14.1 13.2486 14.1 12.0519C14.1 10.8552 13.1598 9.8851 12 9.8851ZM7.89999 12.0519C7.89999 9.7155 9.73563 7.8215 12 7.8215C14.2644 7.8215 16.1 9.7155 16.1 12.0519C16.1 14.3883 14.2644 16.2823 12 16.2823C9.73563 16.2823 7.89999 14.3883 7.89999 12.0519Z`)],t);case`menu`:return _(t);case`close`:return ne(t)}}function p(e,t,n){let r=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return r.setAttribute(`viewBox`,e),r.setAttribute(`fill`,`none`),r.classList.add(`comimi-icon`),n&&r.classList.add(n),r.append(...t),r}function m(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return t.setAttribute(`d`,e),t.classList.add(`comimi-icon-fill`),t}function h(e,t,n,r,i){let a=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);return a.setAttribute(`x`,e),a.setAttribute(`y`,t),a.setAttribute(`width`,n),a.setAttribute(`height`,r),a.setAttribute(`rx`,i),a.classList.add(`comimi-icon-stroke`),a}function g(e,t,n,r,i){let a=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);return a.setAttribute(`x`,e),a.setAttribute(`y`,t),a.setAttribute(`width`,n),a.setAttribute(`height`,r),a.setAttribute(`rx`,i),a.classList.add(`comimi-icon-fill`),a}function _(e){let t=document.createElement(`span`);t.className=`comimi-menu-svg ${e??``}`.trim();for(let e=0;e<3;e+=1)t.append(document.createElement(`span`));return t}function ne(e){let t=document.createElement(`span`);return t.className=`comimi-close-svg ${e??``}`.trim(),t.append(document.createElement(`span`),document.createElement(`span`)),t}function re({state:e,callbacks:t}){let n=document.createElement(`div`);return n.className=`comimi-arrows`,n.dataset.overlay=String(e.overlayVisible),n.append(v(`prev`,()=>y(e,t,`left`)),v(`next`,()=>y(e,t,`right`))),n}function v(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-arrow-button comimi-arrow-${e}`,n.setAttribute(`aria-label`,e===`next`?`Next page`:`Previous page`),n.addEventListener(`click`,e=>{e.stopPropagation(),t()});let r=document.createElement(`span`);r.className=`comimi-arrow-inner`;let i=document.createElement(`span`);i.className=`comimi-arrow-bg`;let a=f(`arrow`);return a.classList.add(`comimi-arrow-icon`),r.append(i,a),n.append(r),n}function y(e,t,n){ie(n,e.settings.readingDirection)?t.nextPage():t.previousPage()}function ie(e,t){return t===`rtl`?e===`left`:e===`right`}function ae(e,t){let n=document.createElement(`div`);n.className=`comimi-center-message`,n.dataset.overlay=String(e.overlayVisible);let r=document.createElement(`div`);r.className=`comimi-center-message-text comimi-center-message-desktop`,r.textContent=t.t(`overlay.centerHint.desktop`);let i=document.createElement(`div`);return i.className=`comimi-center-message-text comimi-center-message-mobile`,i.textContent=t.t(`overlay.centerHint.mobile`),n.append(r,i),n}function b(e,t){return D(e,e.currentPageIndex,t)}function x(e,t,n){let r=b(e,n),i=t===`previous`?Math.min(...r)-1:Math.max(...r)+1;return i<0||i>=e.manga.pages.length?[]:D(e,i,n)}function S(e,t){let n=[];for(let r=1;r>=1;--r){let i=E(e,`previous`,r,t);i.length>0&&n.push({indexes:i,placement:`previous`,offset:C(e,`previous`,r)})}n.push({indexes:b(e,t),placement:`current`,offset:0});for(let r=1;r<=1;r+=1){let i=E(e,`next`,r,t);i.length>0&&n.push({indexes:i,placement:`next`,offset:C(e,`next`,r)})}return n}function C(e,t,n){let r=e.settings.readingDirection===`rtl`?-1:1;return(t===`next`?r:-r)*n}function w(e,t){if(t===`current`)return`center`;let n=e.settings.readingDirection===`rtl`?`left`:`right`;return t===`next`?n:n===`left`?`right`:`left`}function T(e,t){return t===`rtl`?e>0:e<0}function E(e,t,n,r){let i=b(e,r);for(let a=0;a<n;a+=1){let n=t===`previous`?Math.min(...i)-1:Math.max(...i)+1;if(n<0||n>=e.manga.pages.length)return[];i=D(e,n,r)}return i}function D(e,t,n){let{manga:r,settings:i}=e;if(n||i.pageTurnMode!==`spread`||i.hasCover&&t===0)return[t];let a=[t,oe(e,t)].filter(e=>e>=0&&e<r.pages.length),o=[...new Set(a)].sort((e,t)=>e-t);return i.readingDirection===`rtl`?o.reverse():o}function oe(e,t){return e.settings.hasCover?t%2==1?t+1:t-1:t%2==0?t+1:t-1}var se=`<svg viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg" class="comimi-rabbit-svg">
|
|
1
|
+
var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={locale:`ja`,hasCover:!0,readingDirection:`rtl`,pageTurnMode:`single`,layoutMode:`inline`,autoPageTurnIntervalMs:5e3,backgroundColor:`white`,zoom:{min:1,max:4,step:.25}};function n(e,t,n=0){let r=i(n,e.pages.length);return{manga:e,currentPageIndex:r,visiblePageIndexes:o(r,e.pages.length,t),overlayVisible:!1,autoPageTurnEnabled:!1,zoomScale:1,panX:0,panY:0,settings:t,layout:{mode:t.layoutMode},notifications:[],panel:`none`}}function r(e,t){return{...e,...t,zoom:{...e.zoom,...t?.zoom}}}function i(e,t){return t<=0?0:Math.min(Math.max(Math.round(e),0),t-1)}function a(e,t){return e.pageTurnMode===`single`||e.hasCover&&t===0?1:2}function o(e,t,n){let r=new Set,i=Math.max(0,e-1),a=Math.min(t-1,e+1);for(let e=i;e<=a;e+=1)r.add(e);if(n.pageTurnMode===`spread`&&!(n.hasCover&&e===0)){let i=n.hasCover&&e>0?e+(e%2==1?1:-1):e+(e%2==0?1:-1);i>=0&&i<t&&r.add(i)}return[...r].sort((e,t)=>e-t)}var s={"overlay.autoPageTurn":`Auto play`,"overlay.layout":`Layout`,"overlay.settings":`Settings`,"overlay.menu":`Menu`,"overlay.centerHint.desktop":`Click the center to close`,"overlay.centerHint.mobile":`Tap the center to close`,"splash.loading":`Starting viewer`,"autoplay.start":`Auto play started`,"autoplay.stop":`Auto play stopped`,"pageMode.single":`Single`,"pageMode.spread":`Spread`,"layout.inline":`Standard`,"layout.wide":`Wide`,"layout.browserFullscreen":`Fullscreen`,"settings.title":`Settings`,"settings.cover":`Has cover`,"settings.direction":`Page turn direction`,"settings.backgroundColor":`Background color`,"settings.backgroundColor.white":`White`,"settings.backgroundColor.black":`Black`,"settings.interval":`Auto play interval`,"settings.interval.unit":`s`,"settings.direction.rtl":`Right to left`,"settings.direction.ltr":`Left to right`,"menu.openShortcuts":`Keyboard shortcuts`,"menu.openPages":`Page list`,"menu.back":`Back`,"pageList.htmlContent":`HTML content`,"shortcut.section.page":`Page navigation`,"shortcut.section.viewMode":`View mode`,"shortcut.section.general":`General`,"shortcut.moveLeft":`Move left`,"shortcut.moveRight":`Move right`,"shortcut.autoPageTurnLabel":`Auto play`,"shortcut.pageModeToggle":`Toggle spread`,"shortcut.overlayToggle":`Toggle overlay`,"seek.previewAlt":`Preview of page {{page}}`,loading:`Loading`,"error.pageRequestFailed":`Request failed for page {{page}}`},c={"overlay.autoPageTurn":`Putar otomatis`,"overlay.layout":`Mode tampilan`,"overlay.settings":`Pengaturan`,"overlay.menu":`Menu`,"overlay.centerHint.desktop":`Klik bagian tengah untuk menutup`,"overlay.centerHint.mobile":`Ketuk bagian tengah untuk menutup`,"splash.loading":`Memulai viewer`,"autoplay.start":`Putar otomatis dimulai`,"autoplay.stop":`Putar otomatis dihentikan`,"pageMode.single":`Satu halaman`,"pageMode.spread":`Dua halaman`,"layout.inline":`Standar`,"layout.wide":`Lebar`,"layout.browserFullscreen":`Layar penuh`,"settings.title":`Pengaturan`,"settings.cover":`Ada sampul`,"settings.direction":`Arah balik halaman`,"settings.backgroundColor":`Warna latar`,"settings.backgroundColor.white":`Putih`,"settings.backgroundColor.black":`Hitam`,"settings.interval":`Interval putar otomatis`,"settings.interval.unit":`dtk`,"settings.direction.rtl":`Kanan`,"settings.direction.ltr":`Kiri`,"menu.openShortcuts":`Pintasan keyboard`,"menu.openPages":`Daftar halaman`,"menu.back":`Kembali`,"pageList.htmlContent":`Konten HTML`,"shortcut.section.page":`Navigasi halaman`,"shortcut.section.viewMode":`Mode tampilan`,"shortcut.section.general":`Umum`,"shortcut.moveLeft":`Geser kiri`,"shortcut.moveRight":`Geser kanan`,"shortcut.autoPageTurnLabel":`Putar otomatis`,"shortcut.pageModeToggle":`Alih dua halaman`,"shortcut.overlayToggle":`Alih overlay`,"seek.previewAlt":`Pratinjau halaman {{page}}`,loading:`Memuat`,"error.pageRequestFailed":`Permintaan halaman {{page}} gagal`},l={"overlay.autoPageTurn":`自動再生`,"overlay.layout":`表示モード`,"overlay.settings":`設定`,"overlay.menu":`メニュー`,"overlay.centerHint.desktop":`閉じるには画面中央をクリック`,"overlay.centerHint.mobile":`閉じるには画面中央をタップ`,"splash.loading":`ビューワーを起動中`,"autoplay.start":`自動再生を開始`,"autoplay.stop":`自動再生を停止`,"pageMode.single":`1ページ`,"pageMode.spread":`見開き`,"layout.inline":`標準`,"layout.wide":`ワイド`,"layout.browserFullscreen":`全画面`,"settings.title":`設定`,"settings.cover":`表紙あり`,"settings.direction":`ページ移動方向`,"settings.backgroundColor":`背景色`,"settings.backgroundColor.white":`白`,"settings.backgroundColor.black":`黒`,"settings.interval":`自動再生の秒数`,"settings.interval.unit":`秒`,"settings.direction.rtl":`右`,"settings.direction.ltr":`左`,"menu.openShortcuts":`キーボードショートカット`,"menu.openPages":`ページ一覧`,"menu.back":`もどる`,"pageList.htmlContent":`HTMLコンテンツ`,"shortcut.section.page":`ページ移動`,"shortcut.section.viewMode":`表示モード`,"shortcut.section.general":`全般`,"shortcut.moveLeft":`左に移動`,"shortcut.moveRight":`右に移動`,"shortcut.autoPageTurnLabel":`自動再生`,"shortcut.pageModeToggle":`見開き切り替え`,"shortcut.overlayToggle":`オーバーレイ切り替え`,"seek.previewAlt":`{{page}}ページのプレビュー`,loading:`読み込み中`,"error.pageRequestFailed":`{{page}}ページのリクエストに失敗しました`},ee={"overlay.autoPageTurn":`자동 재생`,"overlay.layout":`표시 모드`,"overlay.settings":`설정`,"overlay.menu":`메뉴`,"overlay.centerHint.desktop":`화면 중앙을 클릭하여 닫기`,"overlay.centerHint.mobile":`화면 중앙을 탭하여 닫기`,"splash.loading":`뷰어를 시작 중`,"autoplay.start":`자동 재생 시작`,"autoplay.stop":`자동 재생 정지`,"pageMode.single":`한 페이지`,"pageMode.spread":`양면 보기`,"layout.inline":`표준`,"layout.wide":`와이드`,"layout.browserFullscreen":`전체 화면`,"settings.title":`설정`,"settings.cover":`표지 있음`,"settings.direction":`페이지 이동 방향`,"settings.backgroundColor":`배경색`,"settings.backgroundColor.white":`흰색`,"settings.backgroundColor.black":`검정`,"settings.interval":`자동 재생 간격`,"settings.interval.unit":`초`,"settings.direction.rtl":`오른쪽`,"settings.direction.ltr":`왼쪽`,"menu.openShortcuts":`키보드 단축키`,"menu.openPages":`페이지 목록`,"menu.back":`뒤로`,"pageList.htmlContent":`HTML 콘텐츠`,"shortcut.section.page":`페이지 이동`,"shortcut.section.viewMode":`표시 모드`,"shortcut.section.general":`일반`,"shortcut.moveLeft":`왼쪽으로 이동`,"shortcut.moveRight":`오른쪽으로 이동`,"shortcut.autoPageTurnLabel":`자동 재생`,"shortcut.pageModeToggle":`양면 보기 전환`,"shortcut.overlayToggle":`오버레이 전환`,"seek.previewAlt":`{{page}}페이지 미리보기`,loading:`로딩 중`,"error.pageRequestFailed":`{{page}}페이지 요청 실패`},te={"overlay.autoPageTurn":`เล่นอัตโนมัติ`,"overlay.layout":`โหมดการแสดงผล`,"overlay.settings":`ตั้งค่า`,"overlay.menu":`เมนู`,"overlay.centerHint.desktop":`คลิกตรงกลางเพื่อปิด`,"overlay.centerHint.mobile":`แตะตรงกลางเพื่อปิด`,"splash.loading":`กำลังเปิดโปรแกรมอ่าน`,"autoplay.start":`เริ่มเล่นอัตโนมัติแล้ว`,"autoplay.stop":`หยุดเล่นอัตโนมัติแล้ว`,"pageMode.single":`หน้าเดียว`,"pageMode.spread":`สองหน้า`,"layout.inline":`มาตรฐาน`,"layout.wide":`กว้าง`,"layout.browserFullscreen":`เต็มจอ`,"settings.title":`ตั้งค่า`,"settings.cover":`มีหน้าปก`,"settings.direction":`ทิศทางการพลิกหน้า`,"settings.backgroundColor":`สีพื้นหลัง`,"settings.backgroundColor.white":`ขาว`,"settings.backgroundColor.black":`ดำ`,"settings.interval":`ระยะเวลาเล่นอัตโนมัติ`,"settings.interval.unit":`วินาที`,"settings.direction.rtl":`ขวา`,"settings.direction.ltr":`ซ้าย`,"menu.openShortcuts":`คีย์ลัด`,"menu.openPages":`รายการหน้า`,"menu.back":`ย้อนกลับ`,"pageList.htmlContent":`เนื้อหา HTML`,"shortcut.section.page":`การเลื่อนหน้า`,"shortcut.section.viewMode":`โหมดการแสดงผล`,"shortcut.section.general":`ทั่วไป`,"shortcut.moveLeft":`เลื่อนซ้าย`,"shortcut.moveRight":`เลื่อนขวา`,"shortcut.autoPageTurnLabel":`เล่นอัตโนมัติ`,"shortcut.pageModeToggle":`สลับสองหน้า`,"shortcut.overlayToggle":`สลับโอเวอร์เลย์`,"seek.previewAlt":`ตัวอย่างหน้า {{page}}`,loading:`กำลังโหลด`,"error.pageRequestFailed":`ขอหน้า {{page}} ไม่สำเร็จ`},u={"overlay.autoPageTurn":`自动播放`,"overlay.layout":`显示模式`,"overlay.settings":`设置`,"overlay.menu":`菜单`,"overlay.centerHint.desktop":`点击中央以关闭`,"overlay.centerHint.mobile":`点按中央以关闭`,"splash.loading":`正在启动阅读器`,"autoplay.start":`已开始自动播放`,"autoplay.stop":`已停止自动播放`,"pageMode.single":`单页`,"pageMode.spread":`跨页`,"layout.inline":`标准`,"layout.wide":`宽屏`,"layout.browserFullscreen":`全屏`,"settings.title":`设置`,"settings.cover":`有封面`,"settings.direction":`翻页方向`,"settings.backgroundColor":`背景颜色`,"settings.backgroundColor.white":`白色`,"settings.backgroundColor.black":`黑色`,"settings.interval":`自动播放间隔`,"settings.interval.unit":`秒`,"settings.direction.rtl":`向右`,"settings.direction.ltr":`向左`,"menu.openShortcuts":`键盘快捷键`,"menu.openPages":`页面列表`,"menu.back":`返回`,"pageList.htmlContent":`HTML 内容`,"shortcut.section.page":`翻页`,"shortcut.section.viewMode":`显示模式`,"shortcut.section.general":`通用`,"shortcut.moveLeft":`向左移动`,"shortcut.moveRight":`向右移动`,"shortcut.autoPageTurnLabel":`自动播放`,"shortcut.pageModeToggle":`切换跨页`,"shortcut.overlayToggle":`切换控制层`,"seek.previewAlt":`第 {{page}} 页预览`,loading:`加载中`,"error.pageRequestFailed":`第 {{page}} 页请求失败`},d=class{locale;translations;constructor(e,t){this.locale=e,this.translations={ja:l,en:s,"zh-CN":u,ko:ee,th:te,id:c},t&&(this.translations[e]={...this.translations[e]??{},...t})}setLocale(e){this.locale=e}t(e,t={}){return(this.translations[this.locale]?.[e]??this.translations.ja[e]??e).replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}};function f(e,t){switch(e){case`arrow`:return p(`0 0 20 20`,[m(`M7.28685 6.64194L10.7742 10.0838L7.3011 13.3098C7.06547 13.5391 6.9336 13.8467 6.9336 14.1669C6.9336 14.4871 7.06547 14.7945 7.3011 15.0239C7.41902 15.1378 7.55971 15.2282 7.7149 15.29C7.87009 15.3517 8.03669 15.3835 8.20498 15.3835C8.37328 15.3835 8.53987 15.3517 8.69506 15.29C8.85025 15.2282 8.99095 15.1378 9.10887 15.0239L13.4787 10.9746C13.7134 10.7475 13.845 10.4422 13.845 10.1243C13.845 9.80629 13.7134 9.50107 13.4787 9.27399L9.10886 4.96826C8.86878 4.74159 8.54377 4.61426 8.20498 4.61426C7.86619 4.61426 7.54118 4.74159 7.3011 4.96826C7.18102 5.08007 7.08568 5.2134 7.02057 5.36056C6.95546 5.50772 6.92188 5.6657 6.92188 5.82528C6.92188 5.98487 6.95546 6.14293 7.02057 6.29009C7.08568 6.43725 7.18102 6.57058 7.3011 6.68239L7.28685 6.64194Z`)],t);case`default`:return p(`0 0 20 20`,[h(`1`,`4`,`18`,`12`,`3`)],t);case`wide`:return p(`0 0 20 20`,[h(`1`,`2.5`,`18`,`15`,`3`),m(`M5.5719 6.31811C5.88754 6.00907 6.39381 6.01422 6.70294 6.3298C7.01206 6.64539 7.00674 7.15165 6.69124 7.46084L5.06993 9.04896L14.7642 9.16988L13.1761 7.54857C12.867 7.23293 12.8722 6.72667 13.1878 6.41754C13.5034 6.10841 14.0096 6.11374 14.3188 6.42923L17.2579 9.42977C17.5671 9.7454 17.5619 10.2516 17.2462 10.5608L14.2457 13.4999C13.93 13.809 13.4238 13.8038 13.1146 13.4882C12.8055 13.1726 12.8109 12.6664 13.1263 12.3572L14.7477 10.7691L5.0534 10.6481L6.64152 12.2695C6.95055 12.5851 6.94541 13.0914 6.62982 13.4005C6.31424 13.7096 5.80797 13.7043 5.49879 13.3888L2.55967 10.3883C2.2505 10.0726 2.25573 9.5664 2.57136 9.25723L5.5719 6.31811Z`)],t);case`fullscreen`:return p(`0 0 20 20`,[h(`1`,`1`,`18`,`18`,`3`),m(`M8.69922 3.7002C9.14096 3.7003 9.49902 4.05824 9.49902 4.5C9.49902 4.94176 9.14096 5.2997 8.69922 5.2998H6.42969L14.6992 13.5693V11.2998C14.6993 10.8581 15.0573 10.5 15.499 10.5C15.9408 10.5 16.2987 10.8581 16.2988 11.2998V15.5C16.2988 15.9418 15.9409 16.2998 15.499 16.2998H11.2988C10.8571 16.2997 10.499 15.9418 10.499 15.5C10.499 15.0582 10.8571 14.7003 11.2988 14.7002H13.5684L5.29883 6.43066V8.7002C5.29872 9.14193 4.94079 9.5 4.49902 9.5C4.05726 9.5 3.69932 9.14193 3.69922 8.7002V4.5C3.69922 4.05817 4.0572 3.7002 4.49902 3.7002H8.69922Z`)],t);case`one`:return p(`0 0 20 20`,[h(`1`,`2`,`18`,`16`,`3`),g(`6`,`4`,`8`,`12`,`1.5`)],t);case`two`:return p(`0 0 20 20`,[h(`1`,`2`,`18`,`16`,`3`),m(`M3 5.5C3 4.67157 3.67157 4 4.5 4H9.5V16H4.5C3.67157 16 3 15.3284 3 14.5V5.5Z`),m(`M10.5 4H15.5C16.3284 4 17 4.67157 17 5.5V14.5C17 15.3284 16.3284 16 15.5 16H10.5V4Z`)],t);case`play`:return p(`0 0 20 20`,[m(`M17.0385 7.78428L6.49809 1.19667C4.68077 0.190227 2.5 1.37966 2.5 3.48403V16.5678C2.5 18.5806 4.68077 19.8616 6.49809 18.7636L17.0385 12.176C18.7649 11.1696 18.7649 8.79072 17.0385 7.78428Z`)],t);case`pause`:return p(`0 0 20 20`,[m(`M6.14289 18.3332H4.68573C3.47144 18.3332 2.5 17.3332 2.5 16.0832V3.9165C2.5 2.6665 3.47144 1.6665 4.68573 1.6665H6.14289C7.35718 1.6665 8.32862 2.6665 8.32862 3.9165V15.9998C8.40957 17.3332 7.43814 18.3332 6.14289 18.3332Z`),m(`M15.3138 18.3332H13.8555C12.6402 18.3332 11.668 17.3332 11.668 16.0832V3.9165C11.668 2.6665 12.6402 1.6665 13.8555 1.6665H15.3138C16.5291 1.6665 17.5013 2.6665 17.5013 3.9165V15.9998C17.5013 17.3332 16.5291 18.3332 15.3138 18.3332Z`)],t);case`settings`:return p(`0 0 24 24`,[m(`M10.0144 1.34782C11.2164 0.658798 12.6836 0.658798 13.8856 1.34782C13.8947 1.35299 13.9036 1.35831 13.9125 1.36376L20.1001 5.17383C21.3211 5.88071 22 7.15791 22 8.54376V15.56C22 16.9 21.3552 18.2127 20.1836 18.8369L14.0125 22.6368C14.0036 22.6423 13.9947 22.6476 13.9856 22.6527C12.7836 23.3418 11.3164 23.3418 10.1144 22.6527C10.1053 22.6476 10.0964 22.6423 10.0875 22.6368L3.89984 18.8267C2.67884 18.1198 2 16.8426 2 15.4568V8.54376C2 7.15919 2.6776 5.88306 3.8965 5.17578L9.98139 1.36758C9.99225 1.36078 10.0032 1.35419 10.0144 1.34782ZM11.0006 3.14323L4.91861 6.94964C4.90775 6.95644 4.89675 6.96302 4.88564 6.96939C4.31578 7.29605 4 7.87148 4 8.54376V15.4568C4 16.1291 4.31578 16.7045 4.88564 17.0312C4.89466 17.0364 4.9036 17.0417 4.91246 17.0471L11.0978 20.8558C11.6895 21.1893 12.4105 21.1893 13.0022 20.8558L19.1875 17.0471C19.2088 17.034 19.2306 17.0217 19.2528 17.0103C19.6582 16.8011 20 16.2698 20 15.56V8.54376C20 7.87148 19.6842 7.29605 19.1144 6.96939C19.1053 6.96422 19.0964 6.95891 19.0875 6.95346L12.9022 3.14482C12.3115 2.8118 11.5918 2.81127 11.0006 3.14323ZM12 9.8851C10.8402 9.8851 9.89999 10.8552 9.89999 12.0519C9.89999 13.2486 10.8402 14.2187 12 14.2187C13.1598 14.2187 14.1 13.2486 14.1 12.0519C14.1 10.8552 13.1598 9.8851 12 9.8851ZM7.89999 12.0519C7.89999 9.7155 9.73563 7.8215 12 7.8215C14.2644 7.8215 16.1 9.7155 16.1 12.0519C16.1 14.3883 14.2644 16.2823 12 16.2823C9.73563 16.2823 7.89999 14.3883 7.89999 12.0519Z`)],t);case`menu`:return ne(t);case`close`:return re(t)}}function p(e,t,n){let r=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return r.setAttribute(`viewBox`,e),r.setAttribute(`fill`,`none`),r.classList.add(`comimi-icon`),n&&r.classList.add(n),r.append(...t),r}function m(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return t.setAttribute(`d`,e),t.classList.add(`comimi-icon-fill`),t}function h(e,t,n,r,i){let a=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);return a.setAttribute(`x`,e),a.setAttribute(`y`,t),a.setAttribute(`width`,n),a.setAttribute(`height`,r),a.setAttribute(`rx`,i),a.classList.add(`comimi-icon-stroke`),a}function g(e,t,n,r,i){let a=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);return a.setAttribute(`x`,e),a.setAttribute(`y`,t),a.setAttribute(`width`,n),a.setAttribute(`height`,r),a.setAttribute(`rx`,i),a.classList.add(`comimi-icon-fill`),a}function ne(e){let t=document.createElement(`span`);t.className=`comimi-menu-svg ${e??``}`.trim();for(let e=0;e<3;e+=1)t.append(document.createElement(`span`));return t}function re(e){let t=document.createElement(`span`);return t.className=`comimi-close-svg ${e??``}`.trim(),t.append(document.createElement(`span`),document.createElement(`span`)),t}function ie({state:e,callbacks:t}){let n=document.createElement(`div`);return n.className=`comimi-arrows`,n.dataset.overlay=String(e.overlayVisible),n.dataset.autoplay=String(e.autoPageTurnEnabled),n.append(_(`prev`,()=>v(e,t,`left`)),_(`next`,()=>v(e,t,`right`))),n}function _(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-arrow-button comimi-arrow-${e}`,n.setAttribute(`aria-label`,e===`next`?`Next page`:`Previous page`),n.addEventListener(`click`,e=>{e.stopPropagation(),t()});let r=document.createElement(`span`);r.className=`comimi-arrow-inner`;let i=document.createElement(`span`);i.className=`comimi-arrow-bg`;let a=f(`arrow`);return a.classList.add(`comimi-arrow-icon`),r.append(i,a),n.append(r),n}function v(e,t,n){ae(n,e.settings.readingDirection)?t.nextPage():t.previousPage()}function ae(e,t){return t===`rtl`?e===`left`:e===`right`}function y(e,t){let n=document.createElement(`div`);n.className=`comimi-center-message`,n.dataset.overlay=String(e.overlayVisible);let r=document.createElement(`div`);r.className=`comimi-center-message-text comimi-center-message-desktop`,r.textContent=t.t(`overlay.centerHint.desktop`);let i=document.createElement(`div`);return i.className=`comimi-center-message-text comimi-center-message-mobile`,i.textContent=t.t(`overlay.centerHint.mobile`),n.append(r,i),n}function b(e,t){return D(e,e.currentPageIndex,t)}function x(e,t,n){let r=b(e,n),i=t===`previous`?Math.min(...r)-1:Math.max(...r)+1;return i<0||i>=e.manga.pages.length?[]:D(e,i,n)}function S(e,t){let n=[];for(let r=1;r>=1;--r){let i=E(e,`previous`,r,t);i.length>0&&n.push({indexes:i,placement:`previous`,offset:C(e,`previous`,r)})}n.push({indexes:b(e,t),placement:`current`,offset:0});for(let r=1;r<=1;r+=1){let i=E(e,`next`,r,t);i.length>0&&n.push({indexes:i,placement:`next`,offset:C(e,`next`,r)})}return n}function C(e,t,n){let r=e.settings.readingDirection===`rtl`?-1:1;return(t===`next`?r:-r)*n}function w(e,t){if(t===`current`)return`center`;let n=e.settings.readingDirection===`rtl`?`left`:`right`;return t===`next`?n:n===`left`?`right`:`left`}function T(e,t){return t===`rtl`?e>0:e<0}function E(e,t,n,r){let i=b(e,r);for(let a=0;a<n;a+=1){let n=t===`previous`?Math.min(...i)-1:Math.max(...i)+1;if(n<0||n>=e.manga.pages.length)return[];i=D(e,n,r)}return i}function D(e,t,n){let{manga:r,settings:i}=e;if(n||i.pageTurnMode!==`spread`||i.hasCover&&t===0)return[t];let a=[t,oe(e,t)].filter(e=>e>=0&&e<r.pages.length),o=[...new Set(a)].sort((e,t)=>e-t);return i.readingDirection===`rtl`?o.reverse():o}function oe(e,t){return e.settings.hasCover?t%2==1?t+1:t-1:t%2==0?t+1:t-1}var se=`<svg viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg" class="comimi-rabbit-svg">
|
|
2
2
|
<mask id="comimi-rabbit-mask" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="50" height="50">
|
|
3
3
|
<rect width="50" height="50" fill="#D9D9D9"/>
|
|
4
4
|
</mask>
|
|
@@ -8,7 +8,7 @@ var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
|
|
|
8
8
|
<path d="M15.6152 45.4779C17.0919 45.4779 18.289 44.279 18.289 42.8C18.289 41.321 17.0919 40.1221 15.6152 40.1221C14.1385 40.1221 12.9414 41.321 12.9414 42.8C12.9414 44.279 14.1385 45.4779 15.6152 45.4779Z" fill="#E0E0E0"/>
|
|
9
9
|
<path d="M29.6113 45.4779C31.088 45.4779 32.2851 44.279 32.2851 42.8C32.2851 41.321 31.088 40.1221 29.6113 40.1221C28.1346 40.1221 26.9375 41.321 26.9375 42.8C26.9375 44.279 28.1346 45.4779 29.6113 45.4779Z" fill="#E0E0E0"/>
|
|
10
10
|
</g>
|
|
11
|
-
</svg>`;function O(e){if(e===!1)return null;let t=document.createElement(`div`);if(t.className=`comimi-rabbit`,e&&`render`in e)return t.append(e.render()),t;if(e&&`src`in e){let n=document.createElement(`img`);return n.className=`comimi-rabbit-img`,n.src=e.src,n.alt=e.alt??``,n.draggable=!1,t.append(n),t}return t.innerHTML=se,t}var k=class{root;constructor(e){this.root=document.createElement(`button`),this.root.type=`button`,this.root.className=`comimi-toggle-switch`,this.root.dataset.checked=`false`;let t=document.createElement(`span`);t.className=`comimi-toggle-track`;let n=document.createElement(`span`);n.className=`comimi-toggle-knob`,t.append(n);let r=document.createElement(`span`);r.className=`comimi-toggle-label-wrap`;let i=document.createElement(`span`);i.className=`comimi-toggle-label-inner`;let a=document.createElement(`span`);a.className=`comimi-toggle-label comimi-toggle-label-on`,a.textContent=`ON`;let o=document.createElement(`span`);o.className=`comimi-toggle-label comimi-toggle-label-off`,o.textContent=`OFF`,i.append(a,o),r.append(i),this.root.append(t,r),this.root.addEventListener(`click`,t=>{t.stopPropagation(),e(this.root.dataset.checked!==`true`)})}setChecked(e){this.root.dataset.checked=String(e)}getElement(){return this.root}},A=class{root;select;label;options=[];constructor(e){this.root=document.createElement(`div`),this.root.className=`comimi-selectbox`;let t=document.createElement(`span`);t.className=`comimi-selectbox-bg`,this.select=document.createElement(`select`),this.select.className=`comimi-selectbox-select`,this.select.addEventListener(`change`,()=>{let t=this.options.find(e=>String(e.value)===this.select.value);t&&e(t.value)}),this.label=document.createElement(`span`),this.label.className=`comimi-selectbox-label`;let n=f(`arrow`);n.classList.add(`comimi-selectbox-arrow`),this.root.append(t,this.select,this.label,n)}setOptions(e){let t=this.select.value;this.options=e,this.select.replaceChildren();for(let t of e){let e=document.createElement(`option`);e.value=String(t.value),e.textContent=t.label,this.select.append(e)}t&&this.setValue(t)}setValue(e){this.select.value=String(e);let t=this.options.find(t=>String(t.value)===String(e));this.label.textContent=t?.label??``}getElement(){return this.root}},ce=class{root;input;fill;valueLabel;unit=``;min=0;max=100;constructor(e){this.root=document.createElement(`div`),this.root.className=`comimi-range-slider`;let t=document.createElement(`div`);t.className=`comimi-range-slider-wrap`;let n=document.createElement(`div`);n.className=`comimi-range-slider-track`,this.fill=document.createElement(`div`),this.fill.className=`comimi-range-slider-fill`,this.fill.style.width=`0%`,n.append(this.fill),this.input=document.createElement(`input`),this.input.className=`comimi-range-slider-input`,this.input.type=`range`,this.input.addEventListener(`input`,()=>e(Number(this.input.value))),t.append(n,this.input),this.valueLabel=document.createElement(`span`),this.valueLabel.className=`comimi-range-slider-value`,this.root.append(t,this.valueLabel)}setRange(e,t,n=1){this.min=e,this.max=t,this.input.min=String(e),this.input.max=String(t),this.input.step=String(n)}setUnit(e){this.unit=e,this.refreshLabel()}setValue(e){this.input.value=String(e);let t=this.max===this.min?0:(e-this.min)/(this.max-this.min)*100;this.fill.style.width=`${Math.min(Math.max(t,0),100)}%`,this.refreshLabel()}refreshLabel(){this.valueLabel.textContent=`${this.input.value}${this.unit}`}getElement(){return this.root}};function j(e){e.classList.add(`comimi-scrollfade`);let t=()=>{let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;e.dataset.scrollUp=String(t>0),e.dataset.scrollDown=String(t+r<n-1)};if(e.addEventListener(`scroll`,t,{passive:!0}),typeof ResizeObserver<`u`){let n=new ResizeObserver(t);n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild)}typeof requestAnimationFrame==`function`?requestAnimationFrame(t):t()}var M=class{callbacks;i18n;root;body;inner;titleEl;localeLabel;coverLabel;directionLabel;backgroundColorLabel;animationLabel;intervalLabel;localeSelect;coverToggle;directionSelect;backgroundColorSelect;animationToggle;intervalSlider;constructor(e,t){this.callbacks=e,this.i18n=t,this.root=document.createElement(`div`),this.root.className=`comimi-settings-panel`,this.root.dataset.open=`false`,this.root.setAttribute(`role`,`dialog`),this.root.addEventListener(`click`,e=>e.stopPropagation()),this.body=document.createElement(`div`),this.body.className=`comimi-settings-panel-body`,this.inner=document.createElement(`div`),this.inner.className=`comimi-settings-panel-inner`,this.titleEl=document.createElement(`div`),this.titleEl.className=`comimi-settings-panel-title`,this.localeSelect=new A(e=>this.callbacks.updateSettings({locale:String(e)})),this.coverToggle=new k(e=>this.callbacks.updateSettings({hasCover:e})),this.directionSelect=new A(e=>this.callbacks.updateSettings({readingDirection:e})),this.backgroundColorSelect=new A(e=>this.callbacks.updateSettings({backgroundColor:e})),this.animationToggle=new k(e=>this.callbacks.updateSettings({pageTurnAnimation:e})),this.intervalSlider=new ce(e=>this.callbacks.updateSettings({autoPageTurnIntervalMs:Math.max(1,e)*1e3})),this.intervalSlider.setRange(3,30,1),this.localeLabel=this.createLabel(),this.coverLabel=this.createLabel(),this.directionLabel=this.createLabel(),this.backgroundColorLabel=this.createLabel(),this.animationLabel=this.createLabel(),this.intervalLabel=this.createLabel(),this.inner.append(this.titleEl,this.section(this.localeLabel,this.localeSelect.getElement()),this.section(this.coverLabel,this.coverToggle.getElement()),this.section(this.directionLabel,this.directionSelect.getElement()),this.section(this.animationLabel,this.animationToggle.getElement()),this.section(this.intervalLabel,this.intervalSlider.getElement()),this.section(this.backgroundColorLabel,this.backgroundColorSelect.getElement())),this.body.append(this.inner),this.root.append(this.body),j(this.body)}update(e){this.titleEl.textContent=this.i18n.t(`settings.title`),this.localeLabel.textContent=`Language`,this.coverLabel.textContent=this.i18n.t(`settings.cover`),this.directionLabel.textContent=this.i18n.t(`settings.direction`),this.backgroundColorLabel.textContent=this.i18n.t(`settings.backgroundColor`),this.animationLabel.textContent=this.i18n.t(`settings.animation`),this.intervalLabel.textContent=this.i18n.t(`settings.interval`),this.localeSelect.setOptions([{label:`日本語`,value:`ja`},{label:`English`,value:`en`},{label:`简体中文`,value:`zh-CN`},{label:`한국어`,value:`ko`},{label:`ภาษาไทย`,value:`th`},{label:`Indonesia`,value:`id`}]),this.directionSelect.setOptions([{label:this.i18n.t(`settings.direction.rtl`),value:`rtl`},{label:this.i18n.t(`settings.direction.ltr`),value:`ltr`}]),this.backgroundColorSelect.setOptions([{label:this.i18n.t(`settings.backgroundColor.white`),value:`white`},{label:this.i18n.t(`settings.backgroundColor.black`),value:`black`}]),this.intervalSlider.setUnit(this.i18n.t(`settings.interval.unit`)),this.localeSelect.setValue(e.settings.locale),this.coverToggle.setChecked(e.settings.hasCover),this.directionSelect.setValue(e.settings.readingDirection),this.backgroundColorSelect.setValue(e.settings.backgroundColor),this.animationToggle.setChecked(e.settings.pageTurnAnimation),this.intervalSlider.setValue(Math.round(e.settings.autoPageTurnIntervalMs/1e3)),this.root.dataset.open=String(e.panel===`settings`),this.scheduleHeightUpdate()}getElement(){return this.root}createLabel(){let e=document.createElement(`div`);return e.className=`comimi-settings-label`,e}section(e,t){let n=document.createElement(`div`);return n.className=`comimi-settings-section`,n.append(e,t),n}scheduleHeightUpdate(){let e=()=>{this.root.style.setProperty(`--comimi-settings-height`,`${this.body.offsetHeight}px`)};typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>requestAnimationFrame(e)):setTimeout(e,0)}},N=class{callbacks;i18n;mascot;root;seekCurrent;seekTotal;seekBar;seekFill;seekInput;seekPreview;seekPreviewThumbs;seekPreviewLabel;seekPreviewKey;currentState;autoplayContainer;autoplayButton;autoplaySlider;autoplayTooltip;autoplayProgress;autoplayProgressBar;side;pageMode;pageModeSingleBtn;pageModeSpreadBtn;pageModeSingleIcon;pageModeSpreadIcon;pageModeSingleTooltip;pageModeSpreadTooltip;settings;settingsContainer;settingsButton;settingsIcon;settingsTooltip;prevPageTurnMode;constructor(e,t,n){this.callbacks=e,this.i18n=t,this.mascot=n,this.root=document.createElement(`div`),this.root.className=`comimi-controls-dock`,this.root.dataset.overlay=`false`,this.root.dataset.autoplay=`false`;let r=document.createElement(`div`);r.className=`comimi-controls-bg`;let i=O(this.mascot),a=[r];i&&a.push(i),a.push(this.buildSeek(),this.buildRow()),this.root.append(...a)}getElement(){return this.root}update(e,t){this.currentState=e,this.root.dataset.autoplay=String(e.autoPageTurnEnabled);let n=e.manga.pages.length,r=Math.max(1,n),i=e.currentPageIndex+1,a=n<=1?0:e.currentPageIndex/(n-1);this.seekCurrent.textContent=String(i),this.seekTotal.textContent=` / ${r}`,this.seekFill.style.width=`${a*100}%`,this.seekBar.dataset.direction=e.settings.readingDirection,this.seekInput.max=String(Math.max(0,n-1)),document.activeElement!==this.seekInput&&(this.seekInput.value=String(e.currentPageIndex)),this.seekInput.dataset.direction=e.settings.readingDirection,this.autoplaySlider.dataset.active=String(e.autoPageTurnEnabled);let o=this.i18n.t(`overlay.autoPageTurn`);this.autoplayButton.setAttribute(`aria-label`,o),this.autoplayTooltip.textContent=o,e.autoPageTurnEnabled?(this.autoplayProgress||(this.autoplayProgress=document.createElement(`div`),this.autoplayProgress.className=`comimi-autoplay-progress`,this.autoplayProgressBar=document.createElement(`span`),this.autoplayProgressBar.className=`comimi-autoplay-progress-bar`,this.autoplayProgress.append(this.autoplayProgressBar),this.autoplayContainer.append(this.autoplayProgress)),this.autoplayProgressBar.style.animationDuration=`${e.settings.autoPageTurnIntervalMs}ms`):this.autoplayProgress&&(this.autoplayProgress.remove(),this.autoplayProgress=void 0,this.autoplayProgressBar=void 0);let s=e.settings.pageTurnMode===`spread`;if(this.pageModeSingleBtn.dataset.selected=String(!s),this.pageModeSpreadBtn.dataset.selected=String(s),this.prevPageTurnMode!==void 0&&this.prevPageTurnMode!==e.settings.pageTurnMode){let e=s?this.pageModeSpreadIcon:this.pageModeSingleIcon;this.applyPopAnimation(e)}this.pageModeSingleTooltip.textContent=this.i18n.t(`pageMode.single`),this.pageModeSpreadTooltip.textContent=this.i18n.t(`pageMode.spread`),this.pageMode.style.display=t?`none`:``;let c=this.i18n.t(`overlay.settings`);this.settingsButton.setAttribute(`aria-label`,c),this.settingsTooltip.textContent=c,this.settingsContainer.dataset.open=String(e.panel===`settings`),this.settings.update(e),this.prevPageTurnMode=e.settings.pageTurnMode}buildSeek(){let e=document.createElement(`div`);e.className=`comimi-seek`;let t=document.createElement(`div`);t.className=`comimi-seek-text`,this.seekCurrent=document.createElement(`span`),this.seekCurrent.className=`comimi-seek-current`,this.seekTotal=document.createElement(`span`),this.seekTotal.className=`comimi-seek-total`,t.append(this.seekCurrent,this.seekTotal),this.seekBar=document.createElement(`div`),this.seekBar.className=`comimi-seek-bar`,this.seekBar.dataset.direction=`rtl`;let n=document.createElement(`div`);return n.className=`comimi-seek-track`,this.seekFill=document.createElement(`div`),this.seekFill.className=`comimi-seek-fill`,this.seekFill.style.width=`0%`,n.append(this.seekFill),this.seekInput=document.createElement(`input`),this.seekInput.className=`comimi-seek-input`,this.seekInput.type=`range`,this.seekInput.min=`0`,this.seekInput.max=`0`,this.seekInput.step=`1`,this.seekInput.value=`0`,this.seekInput.setAttribute(`aria-label`,`Seek bar`),this.seekInput.addEventListener(`input`,()=>{this.callbacks.goToPage(Number(this.seekInput.value))}),this.seekPreview=document.createElement(`div`),this.seekPreview.className=`comimi-seek-preview`,this.seekPreview.dataset.show=`false`,this.seekPreviewThumbs=document.createElement(`div`),this.seekPreviewThumbs.className=`comimi-seek-preview-thumbs`,this.seekPreviewLabel=document.createElement(`div`),this.seekPreviewLabel.className=`comimi-seek-preview-label`,this.seekPreview.append(this.seekPreviewThumbs,this.seekPreviewLabel),this.seekBar.addEventListener(`mousemove`,e=>this.updateSeekPreview(e)),this.seekBar.addEventListener(`mouseleave`,()=>{this.seekPreview.dataset.show=`false`}),this.seekBar.append(n,this.seekInput,this.seekPreview),e.append(t,this.seekBar),e}updateSeekPreview(e){let t=this.currentState;if(!t)return;let n=t.manga.pages.length;if(n===0)return;let r=this.seekBar.getBoundingClientRect();if(r.width===0)return;let i=Math.max(0,Math.min(r.width,e.clientX-r.left)),a=i/r.width,o=t.settings.readingDirection===`rtl`?1-a:a,s=D(t,Math.min(n-1,Math.max(0,Math.floor(o*n))),!1),c=s.map(e=>t.manga.pages[e]).filter(e=>!!e);this.refreshSeekPreviewThumbs(s,c);let l=[...s].sort((e,t)=>e-t);this.seekPreviewLabel.textContent=l.length>1?`${l[0]+1} - ${l[l.length-1]+1}`:String(l[0]+1),this.seekPreview.style.left=`${i}px`,this.seekPreview.dataset.show=`true`}refreshSeekPreviewThumbs(e,t){let n=e.join(`,`);if(this.seekPreviewKey!==n){this.seekPreviewKey=n,this.seekPreviewThumbs.replaceChildren();for(let e of t){let t=document.createElement(`div`);if(t.className=`comimi-seek-preview-thumb`,e.type===`image`){let n=document.createElement(`img`);n.src=e.thumbnailSrc??e.src,n.alt=``,n.draggable=!1,t.append(n),t.dataset.kind=`image`}else{let e=document.createElement(`span`);e.textContent=this.i18n.t(`pageList.htmlContent`),t.append(e),t.dataset.kind=`html`}this.seekPreviewThumbs.append(t)}}}buildRow(){let e=document.createElement(`div`);return e.className=`comimi-controls-row`,e.append(this.buildAutoplay(),this.buildSide()),e}buildAutoplay(){this.autoplayContainer=document.createElement(`div`),this.autoplayContainer.className=`comimi-autoplay`,this.autoplayButton=document.createElement(`button`),this.autoplayButton.type=`button`,this.autoplayButton.className=`comimi-autoplay-button comimi-has-tooltip`,this.autoplayButton.addEventListener(`click`,e=>{e.stopPropagation(),this.callbacks.toggleAutoPageTurn()});let e=document.createElement(`span`);e.className=`comimi-autoplay-window`,this.autoplaySlider=document.createElement(`span`),this.autoplaySlider.className=`comimi-autoplay-slider`,this.autoplaySlider.dataset.active=`false`;let t=f(`play`);t.classList.add(`comimi-autoplay-icon`,`comimi-autoplay-icon-play`);let n=f(`pause`);return n.classList.add(`comimi-autoplay-icon`,`comimi-autoplay-icon-pause`),this.autoplaySlider.append(t,n),e.append(this.autoplaySlider),this.autoplayTooltip=document.createElement(`span`),this.autoplayTooltip.className=`comimi-tooltip`,this.autoplayButton.append(e,this.autoplayTooltip),this.autoplayContainer.append(this.autoplayButton),this.autoplayContainer}buildSide(){this.side=document.createElement(`div`),this.side.className=`comimi-controls-side`,this.pageMode=document.createElement(`div`),this.pageMode.className=`comimi-page-mode`;let e=document.createElement(`div`);return e.className=`comimi-page-mode-wrapper`,[this.pageModeSingleBtn,this.pageModeSingleIcon,this.pageModeSingleTooltip]=this.buildPageModeButton(`single`,`one`),[this.pageModeSpreadBtn,this.pageModeSpreadIcon,this.pageModeSpreadTooltip]=this.buildPageModeButton(`spread`,`two`),e.append(this.pageModeSingleBtn,this.pageModeSpreadBtn),this.pageMode.append(e),[this.settingsContainer,this.settingsButton,this.settingsIcon,this.settingsTooltip]=this.buildSettings(),this.settings=new M(this.callbacks,this.i18n),this.settingsContainer.append(this.settings.getElement()),this.side.append(this.pageMode,this.settingsContainer),this.side}buildPageModeButton(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-page-mode-button comimi-has-tooltip`,n.dataset.selected=`false`,n.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.updateSettings({pageTurnMode:e})});let r=f(t);r.classList.add(`comimi-page-mode-icon`);let i=document.createElement(`span`);return i.className=`comimi-tooltip`,n.append(r,i),[n,r,i]}buildSettings(){let e=document.createElement(`div`);e.className=`comimi-settings`,e.dataset.open=`false`;let t=document.createElement(`button`);t.type=`button`,t.className=`comimi-settings-button comimi-has-tooltip`,t.addEventListener(`click`,t=>{t.stopPropagation();let n=e.dataset.open===`true`;this.callbacks.setPanel(n?`none`:`settings`)});let n=f(`settings`);n.classList.add(`comimi-settings-icon`);let r=document.createElement(`span`);return r.className=`comimi-tooltip`,t.append(n,r),e.append(t),[e,t,n,r]}applyPopAnimation(e){e.classList.remove(`comimi-pop-animate`),e.offsetWidth,e.classList.add(`comimi-pop-animate`)}},P=class{callbacks;i18n;options;root;titleEl;authorEl;bottomEl;viewMenu;viewShortcut;viewPageList;pageListInner;pageListCacheKey;currentState;currentView=`menu`;i18nTexts=[];constructor(e,t,n={}){this.callbacks=e,this.i18n=t,this.options=n,this.root=document.createElement(`div`),this.root.className=`comimi-menu-panel`,this.root.setAttribute(`role`,`dialog`),this.root.dataset.open=`false`,this.root.dataset.view=`menu`,this.root.dataset.overlay=`false`;let r=document.createElement(`div`);r.className=`comimi-menu-bg`;let i=this.buildTop();[this.titleEl,this.authorEl]=this.findTitleNodes(i),this.bottomEl=document.createElement(`div`),this.bottomEl.className=`comimi-menu-bottom`,this.bottomEl.style.height=`0px`;let a=document.createElement(`div`);a.className=`comimi-menu-border`,this.viewMenu=this.buildMenuView(),this.viewShortcut=this.buildShortcutView(),[this.viewPageList,this.pageListInner]=this.buildPageListView(),this.bottomEl.append(a,this.viewMenu,this.viewShortcut,this.viewPageList);let o=O(this.options.mascot),s=[r];o&&s.push(o),s.push(i,this.bottomEl),this.root.append(...s)}getElement(){return this.root}bindI18nText(e,t){e.textContent=this.i18n.t(t),this.i18nTexts.push({el:e,key:t})}refreshI18nTexts(){for(let{el:e,key:t}of this.i18nTexts)e.textContent=this.i18n.t(t)}update(e){let t=e.panel===`menu`||e.panel===`pages`||e.panel===`shortcuts`,n=e.panel===`pages`?`pageList`:e.panel===`shortcuts`?`shortcut`:`menu`;this.root.dataset.open=String(t),this.root.dataset.view=n,this.root.dataset.overlay=String(e.overlayVisible),this.titleEl.textContent=e.manga.title,e.manga.author?(this.authorEl.textContent=`@${e.manga.author}`,this.authorEl.style.display=``):(this.authorEl.textContent=``,this.authorEl.style.display=`none`),this.refreshI18nTexts(),this.refreshPageList(e),this.applyHeight(t,n),this.currentState=e,this.currentView=n}applyHeight(e,t){if(!e){this.bottomEl.style.height=`0px`;return}let n=(t===`menu`?this.viewMenu:t===`shortcut`?this.viewShortcut:this.viewPageList).offsetHeight;this.bottomEl.style.height=`${n}px`}refreshPageList(e){let t=`${e.settings.locale}:${e.manga.id}:${e.manga.pages.length}`;this.pageListCacheKey!==t&&(this.pageListCacheKey=t,this.pageListInner.replaceChildren(),e.manga.pages.forEach((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-page-list-item`,n.addEventListener(`click`,e=>{e.stopPropagation(),this.callbacks.goToPage(t),this.callbacks.setPanel(`none`)});let r=document.createElement(`span`);if(r.className=`comimi-page-list-thumb`,e.type===`image`){let n=document.createElement(`img`);n.alt=e.alt??e.label??this.i18n.t(`seek.previewAlt`,{page:t+1}),n.draggable=!1,n.src=e.thumbnailSrc??e.src,r.append(n)}else if(e.type===`html`){let e=document.createElement(`span`);e.className=`comimi-page-list-thumb-html`,e.textContent=this.i18n.t(`pageList.htmlContent`),r.append(e)}let i=document.createElement(`span`);i.className=`comimi-page-list-text`,i.textContent=e.label??String(t+1),n.append(r,i),this.pageListInner.append(n)}))}buildTop(){let e=document.createElement(`button`);e.type=`button`,e.className=`comimi-menu-top`,e.addEventListener(`click`,e=>{e.stopPropagation();let t=this.currentState,n=t?.panel===`menu`||t?.panel===`pages`||t?.panel===`shortcuts`;this.callbacks.setPanel(n?`none`:`menu`)});let t=document.createElement(`span`);t.className=`comimi-menu-button`;let n=document.createElement(`span`);n.className=`comimi-menu-button-inner`,n.append(f(`menu`),f(`close`)),t.append(n);let r=document.createElement(`span`);r.className=`comimi-menu-title-wrap`;let i=document.createElement(`span`);i.className=`comimi-menu-title`;let a=document.createElement(`span`);return a.className=`comimi-menu-author`,r.append(i,a),e.append(t,r),e}findTitleNodes(e){let t=e.querySelector(`.comimi-menu-title`),n=e.querySelector(`.comimi-menu-author`);if(!t||!n)throw Error(`MenuPanel title nodes missing`);return[t,n]}buildMenuView(){let e=document.createElement(`div`);e.className=`comimi-menu-view comimi-menu-view-menu`;let t=document.createElement(`div`);return t.className=`comimi-menu-list`,t.append(this.renderMenuLink(`menu.openPages`,()=>this.callbacks.setPanel(`pages`)),this.renderMenuLink(`menu.openShortcuts`,()=>this.callbacks.setPanel(`shortcuts`))),e.append(t),e}renderMenuLink(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-menu-link`,n.addEventListener(`click`,e=>{e.stopPropagation(),t()});let r=document.createElement(`span`);r.className=`comimi-menu-link-text`,this.bindI18nText(r,e);let i=document.createElement(`span`);return i.className=`comimi-menu-link-arrow`,i.append(f(`arrow`)),n.append(r,i),n}buildShortcutView(){let e=document.createElement(`div`);e.className=`comimi-menu-view comimi-menu-view-shortcut`;let t=document.createElement(`div`);t.className=`comimi-shortcut-inner`;let n=document.createElement(`div`);return n.className=`comimi-shortcut-grid`,t.append(n),j(t),n.append(this.shortcutSection(`shortcut.section.page`,[[[`←`,`Space`],`shortcut.moveLeft`],[[`→`,`Space + Shift`],`shortcut.moveRight`],[[`A`],`shortcut.autoPageTurnLabel`]])),this.options.lockLayoutMode||n.append(this.shortcutSection(`shortcut.section.viewMode`,[[[`N`,`Esc`],`layout.inline`],[[`W`],`layout.wide`],[[`F`],`layout.browserFullscreen`]],!0)),n.append(this.shortcutSection(`shortcut.section.general`,[[[`O`],`shortcut.overlayToggle`],[[`M`],`overlay.menu`],[[`P`],`shortcut.pageModeToggle`],[[`S`],`overlay.settings`]],!0)),e.append(t,this.renderBackButton()),e}buildPageListView(){let e=document.createElement(`div`);e.className=`comimi-menu-view comimi-menu-view-page-list`;let t=document.createElement(`div`);t.className=`comimi-page-list-inner`;let n=document.createElement(`div`);return n.className=`comimi-page-list-grid`,t.append(n),j(t),e.append(t,this.renderBackButton()),[e,n]}shortcutSection(e,t,n=!1){let r=document.createElement(`div`);r.className=`comimi-shortcut-section`;let i=document.createElement(`div`);i.className=`comimi-shortcut-heading`,this.bindI18nText(i,e);let a=document.createElement(`div`);a.className=n?`comimi-shortcut-column`:`comimi-shortcut-list`;for(let[e,n]of t)a.append(this.shortcutItem(e,n));return r.append(i,a),r}shortcutItem(e,t){let n=document.createElement(`div`);n.className=`comimi-shortcut-item`;let r=document.createElement(`span`);r.className=`comimi-shortcut-badge`,e.forEach((e,t)=>{if(t>0){let e=document.createElement(`span`);e.className=`comimi-shortcut-or`,r.append(e)}let n=document.createElement(`span`);n.className=`comimi-shortcut-key`,n.textContent=e,r.append(n)});let i=document.createElement(`span`);return i.className=`comimi-shortcut-label`,this.bindI18nText(i,t),n.append(r,i),n}renderBackButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`comimi-back-button`,e.addEventListener(`click`,e=>{e.stopPropagation(),this.callbacks.setPanel(`menu`)});let t=document.createElement(`span`);t.className=`comimi-back-inner`;let n=document.createElement(`span`);n.className=`comimi-back-bg`;let r=document.createElement(`span`);r.className=`comimi-back-text`,this.bindI18nText(r,`menu.back`);let i=document.createElement(`span`);return i.className=`comimi-back-arrow`,i.append(f(`arrow`)),t.append(n,r,i),e.append(t),e}},F=class{callbacks;i18n;root;indicator;tooltip;entries;prevMode;constructor(e,t){this.callbacks=e,this.i18n=t,this.root=document.createElement(`div`),this.root.className=`comimi-view-switcher comimi-has-tooltip`,this.root.dataset.overlay=`false`,this.indicator=document.createElement(`span`),this.indicator.className=`comimi-view-switcher-indicator`,this.indicator.style.transform=`translateX(0px)`,this.root.append(this.indicator);let n=[[`inline`,`layout.inline`,`default`],[`wide`,`layout.wide`,`wide`],[`browserFullscreen`,`layout.browserFullscreen`,`fullscreen`]];this.entries=n.map(([e,n,r])=>{let i=document.createElement(`button`);i.type=`button`,i.className=`comimi-view-switcher-button`,i.dataset.selected=`false`,i.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.setLayoutMode(e)});let a=document.createElement(`span`);a.className=`comimi-view-switcher-icon-wrap`;let o=f(r);o.classList.add(`comimi-view-switcher-icon`),a.append(o);let s=document.createElement(`span`);return s.className=`comimi-view-switcher-label`,s.textContent=t.t(n),i.append(a,s),this.root.append(i),{mode:e,iconName:r,labelKey:n,button:i,iconWrap:a}}),this.tooltip=document.createElement(`span`),this.tooltip.className=`comimi-tooltip`,this.tooltip.textContent=t.t(`overlay.layout`),this.root.append(this.tooltip)}getElement(){return this.root}update(e){this.root.dataset.overlay=String(e.overlayVisible);let t=Math.max(0,this.entries.findIndex(t=>t.mode===e.layout.mode));this.indicator.style.transform=`translateX(${t*60}px)`;let n=this.prevMode!==void 0&&this.prevMode!==e.layout.mode;for(let t of this.entries){let r=t.mode===e.layout.mode;t.button.dataset.selected=String(r),t.iconWrap.classList.toggle(`comimi-pop-animate`,n&&r),t.button.querySelector(`.comimi-view-switcher-label`).textContent=this.i18n.t(t.labelKey)}this.tooltip.textContent=this.i18n.t(`overlay.layout`),this.prevMode=e.layout.mode}},I=`
|
|
11
|
+
</svg>`;function O(e){if(e===!1)return null;let t=document.createElement(`div`);if(t.className=`comimi-rabbit`,e&&`render`in e)return t.append(e.render()),t;if(e&&`src`in e){let n=document.createElement(`img`);return n.className=`comimi-rabbit-img`,n.src=e.src,n.alt=e.alt??``,n.draggable=!1,t.append(n),t}return t.innerHTML=se,t}var ce=class{root;constructor(e){this.root=document.createElement(`button`),this.root.type=`button`,this.root.className=`comimi-toggle-switch`,this.root.dataset.checked=`false`;let t=document.createElement(`span`);t.className=`comimi-toggle-track`;let n=document.createElement(`span`);n.className=`comimi-toggle-knob`,t.append(n);let r=document.createElement(`span`);r.className=`comimi-toggle-label-wrap`;let i=document.createElement(`span`);i.className=`comimi-toggle-label-inner`;let a=document.createElement(`span`);a.className=`comimi-toggle-label comimi-toggle-label-on`,a.textContent=`ON`;let o=document.createElement(`span`);o.className=`comimi-toggle-label comimi-toggle-label-off`,o.textContent=`OFF`,i.append(a,o),r.append(i),this.root.append(t,r),this.root.addEventListener(`click`,t=>{t.stopPropagation(),e(this.root.dataset.checked!==`true`)})}setChecked(e){this.root.dataset.checked=String(e)}getElement(){return this.root}},k=class{root;select;label;options=[];constructor(e){this.root=document.createElement(`div`),this.root.className=`comimi-selectbox`;let t=document.createElement(`span`);t.className=`comimi-selectbox-bg`,this.select=document.createElement(`select`),this.select.className=`comimi-selectbox-select`,this.select.addEventListener(`change`,()=>{let t=this.options.find(e=>String(e.value)===this.select.value);t&&e(t.value)}),this.label=document.createElement(`span`),this.label.className=`comimi-selectbox-label`;let n=f(`arrow`);n.classList.add(`comimi-selectbox-arrow`),this.root.append(t,this.select,this.label,n)}setOptions(e){let t=this.select.value;this.options=e,this.select.replaceChildren();for(let t of e){let e=document.createElement(`option`);e.value=String(t.value),e.textContent=t.label,this.select.append(e)}t&&this.setValue(t)}setValue(e){this.select.value=String(e);let t=this.options.find(t=>String(t.value)===String(e));this.label.textContent=t?.label??``}getElement(){return this.root}},A=class{root;input;fill;valueLabel;unit=``;min=0;max=100;constructor(e){this.root=document.createElement(`div`),this.root.className=`comimi-range-slider`;let t=document.createElement(`div`);t.className=`comimi-range-slider-wrap`;let n=document.createElement(`div`);n.className=`comimi-range-slider-track`,this.fill=document.createElement(`div`),this.fill.className=`comimi-range-slider-fill`,this.fill.style.width=`0%`,n.append(this.fill),this.input=document.createElement(`input`),this.input.className=`comimi-range-slider-input`,this.input.type=`range`,this.input.addEventListener(`input`,()=>e(Number(this.input.value))),t.append(n,this.input),this.valueLabel=document.createElement(`span`),this.valueLabel.className=`comimi-range-slider-value`,this.root.append(t,this.valueLabel)}setRange(e,t,n=1){this.min=e,this.max=t,this.input.min=String(e),this.input.max=String(t),this.input.step=String(n)}setUnit(e){this.unit=e,this.refreshLabel()}setValue(e){this.input.value=String(e);let t=this.max===this.min?0:(e-this.min)/(this.max-this.min)*100;this.fill.style.width=`${Math.min(Math.max(t,0),100)}%`,this.refreshLabel()}refreshLabel(){this.valueLabel.textContent=`${this.input.value}${this.unit}`}getElement(){return this.root}};function j(e){e.classList.add(`comimi-scrollfade`);let t=()=>{let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;e.dataset.scrollUp=String(t>0),e.dataset.scrollDown=String(t+r<n-1)};if(e.addEventListener(`scroll`,t,{passive:!0}),typeof ResizeObserver<`u`){let n=new ResizeObserver(t);n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild)}typeof requestAnimationFrame==`function`?requestAnimationFrame(t):t()}var M=class{callbacks;i18n;root;body;inner;titleEl;localeLabel;coverLabel;directionLabel;backgroundColorLabel;intervalLabel;localeSelect;coverToggle;directionSelect;backgroundColorSelect;intervalSlider;constructor(e,t){this.callbacks=e,this.i18n=t,this.root=document.createElement(`div`),this.root.className=`comimi-settings-panel`,this.root.dataset.open=`false`,this.root.setAttribute(`role`,`dialog`),this.root.addEventListener(`click`,e=>e.stopPropagation()),this.body=document.createElement(`div`),this.body.className=`comimi-settings-panel-body`,this.inner=document.createElement(`div`),this.inner.className=`comimi-settings-panel-inner`,this.titleEl=document.createElement(`div`),this.titleEl.className=`comimi-settings-panel-title`,this.localeSelect=new k(e=>this.callbacks.updateSettings({locale:String(e)})),this.coverToggle=new ce(e=>this.callbacks.updateSettings({hasCover:e})),this.directionSelect=new k(e=>this.callbacks.updateSettings({readingDirection:e})),this.backgroundColorSelect=new k(e=>this.callbacks.updateSettings({backgroundColor:e})),this.intervalSlider=new A(e=>this.callbacks.updateSettings({autoPageTurnIntervalMs:Math.max(1,e)*1e3})),this.intervalSlider.setRange(3,30,1),this.localeLabel=this.createLabel(),this.coverLabel=this.createLabel(),this.directionLabel=this.createLabel(),this.backgroundColorLabel=this.createLabel(),this.intervalLabel=this.createLabel(),this.inner.append(this.titleEl,this.section(this.localeLabel,this.localeSelect.getElement()),this.section(this.coverLabel,this.coverToggle.getElement()),this.section(this.directionLabel,this.directionSelect.getElement()),this.section(this.intervalLabel,this.intervalSlider.getElement()),this.section(this.backgroundColorLabel,this.backgroundColorSelect.getElement())),this.body.append(this.inner),this.root.append(this.body),j(this.body)}update(e){this.titleEl.textContent=this.i18n.t(`settings.title`),this.localeLabel.textContent=`Language`,this.coverLabel.textContent=this.i18n.t(`settings.cover`),this.directionLabel.textContent=this.i18n.t(`settings.direction`),this.backgroundColorLabel.textContent=this.i18n.t(`settings.backgroundColor`),this.intervalLabel.textContent=this.i18n.t(`settings.interval`),this.localeSelect.setOptions([{label:`日本語`,value:`ja`},{label:`English`,value:`en`},{label:`简体中文`,value:`zh-CN`},{label:`한국어`,value:`ko`},{label:`ภาษาไทย`,value:`th`},{label:`Indonesia`,value:`id`}]),this.directionSelect.setOptions([{label:this.i18n.t(`settings.direction.rtl`),value:`rtl`},{label:this.i18n.t(`settings.direction.ltr`),value:`ltr`}]),this.backgroundColorSelect.setOptions([{label:this.i18n.t(`settings.backgroundColor.white`),value:`white`},{label:this.i18n.t(`settings.backgroundColor.black`),value:`black`}]),this.intervalSlider.setUnit(this.i18n.t(`settings.interval.unit`)),this.localeSelect.setValue(e.settings.locale),this.coverToggle.setChecked(e.settings.hasCover),this.directionSelect.setValue(e.settings.readingDirection),this.backgroundColorSelect.setValue(e.settings.backgroundColor),this.intervalSlider.setValue(Math.round(e.settings.autoPageTurnIntervalMs/1e3)),this.root.dataset.open=String(e.panel===`settings`),this.scheduleHeightUpdate()}getElement(){return this.root}createLabel(){let e=document.createElement(`div`);return e.className=`comimi-settings-label`,e}section(e,t){let n=document.createElement(`div`);return n.className=`comimi-settings-section`,n.append(e,t),n}scheduleHeightUpdate(){let e=()=>{this.root.style.setProperty(`--comimi-settings-height`,`${this.body.offsetHeight}px`)};typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>requestAnimationFrame(e)):setTimeout(e,0)}},N=class{callbacks;i18n;mascot;root;seekCurrent;seekTotal;seekBar;seekFill;seekInput;seekPreview;seekPreviewThumbs;seekPreviewLabel;seekPreviewKey;currentState;autoplayContainer;autoplayButton;autoplaySlider;autoplayTooltip;autoplayProgress;autoplayProgressBar;side;pageMode;pageModeSingleBtn;pageModeSpreadBtn;pageModeSingleIcon;pageModeSpreadIcon;pageModeSingleTooltip;pageModeSpreadTooltip;settings;settingsContainer;settingsButton;settingsIcon;settingsTooltip;prevPageTurnMode;constructor(e,t,n){this.callbacks=e,this.i18n=t,this.mascot=n,this.root=document.createElement(`div`),this.root.className=`comimi-controls-dock`,this.root.dataset.overlay=`false`,this.root.dataset.autoplay=`false`;let r=document.createElement(`div`);r.className=`comimi-controls-bg`;let i=O(this.mascot),a=[r];i&&a.push(i),a.push(this.buildSeek(),this.buildRow()),this.root.append(...a)}getElement(){return this.root}update(e,t){this.currentState=e,this.root.dataset.autoplay=String(e.autoPageTurnEnabled);let n=e.manga.pages.length,r=Math.max(1,n),i=e.currentPageIndex+1,a=n<=1?0:e.currentPageIndex/(n-1);this.seekCurrent.textContent=String(i),this.seekTotal.textContent=` / ${r}`,this.seekFill.style.width=`${a*100}%`,this.seekBar.dataset.direction=e.settings.readingDirection,this.seekInput.max=String(Math.max(0,n-1)),document.activeElement!==this.seekInput&&(this.seekInput.value=String(e.currentPageIndex)),this.seekInput.dataset.direction=e.settings.readingDirection,this.autoplaySlider.dataset.active=String(e.autoPageTurnEnabled);let o=this.i18n.t(`overlay.autoPageTurn`);this.autoplayButton.setAttribute(`aria-label`,o),this.autoplayTooltip.textContent=o,e.autoPageTurnEnabled?(this.autoplayProgress||(this.autoplayProgress=document.createElement(`div`),this.autoplayProgress.className=`comimi-autoplay-progress`,this.autoplayProgressBar=document.createElement(`span`),this.autoplayProgressBar.className=`comimi-autoplay-progress-bar`,this.autoplayProgress.append(this.autoplayProgressBar),this.autoplayContainer.append(this.autoplayProgress)),this.autoplayProgressBar.style.animationDuration=`${e.settings.autoPageTurnIntervalMs}ms`):this.autoplayProgress&&(this.autoplayProgress.remove(),this.autoplayProgress=void 0,this.autoplayProgressBar=void 0);let s=e.settings.pageTurnMode===`spread`;if(this.pageModeSingleBtn.dataset.selected=String(!s),this.pageModeSpreadBtn.dataset.selected=String(s),this.prevPageTurnMode!==void 0&&this.prevPageTurnMode!==e.settings.pageTurnMode){let e=s?this.pageModeSpreadIcon:this.pageModeSingleIcon;this.applyPopAnimation(e)}this.pageModeSingleTooltip.textContent=this.i18n.t(`pageMode.single`),this.pageModeSpreadTooltip.textContent=this.i18n.t(`pageMode.spread`),this.pageMode.style.display=t?`none`:``;let c=this.i18n.t(`overlay.settings`);this.settingsButton.setAttribute(`aria-label`,c),this.settingsTooltip.textContent=c,this.settingsContainer.dataset.open=String(e.panel===`settings`),this.settings.update(e),this.prevPageTurnMode=e.settings.pageTurnMode}buildSeek(){let e=document.createElement(`div`);e.className=`comimi-seek`;let t=document.createElement(`div`);t.className=`comimi-seek-text`,this.seekCurrent=document.createElement(`span`),this.seekCurrent.className=`comimi-seek-current`,this.seekTotal=document.createElement(`span`),this.seekTotal.className=`comimi-seek-total`,t.append(this.seekCurrent,this.seekTotal),this.seekBar=document.createElement(`div`),this.seekBar.className=`comimi-seek-bar`,this.seekBar.dataset.direction=`rtl`;let n=document.createElement(`div`);return n.className=`comimi-seek-track`,this.seekFill=document.createElement(`div`),this.seekFill.className=`comimi-seek-fill`,this.seekFill.style.width=`0%`,n.append(this.seekFill),this.seekInput=document.createElement(`input`),this.seekInput.className=`comimi-seek-input`,this.seekInput.type=`range`,this.seekInput.min=`0`,this.seekInput.max=`0`,this.seekInput.step=`1`,this.seekInput.value=`0`,this.seekInput.setAttribute(`aria-label`,`Seek bar`),this.seekInput.addEventListener(`input`,()=>{this.callbacks.goToPage(Number(this.seekInput.value))}),this.seekPreview=document.createElement(`div`),this.seekPreview.className=`comimi-seek-preview`,this.seekPreview.dataset.show=`false`,this.seekPreviewThumbs=document.createElement(`div`),this.seekPreviewThumbs.className=`comimi-seek-preview-thumbs`,this.seekPreviewLabel=document.createElement(`div`),this.seekPreviewLabel.className=`comimi-seek-preview-label`,this.seekPreview.append(this.seekPreviewThumbs,this.seekPreviewLabel),this.seekBar.addEventListener(`mousemove`,e=>this.updateSeekPreview(e)),this.seekBar.addEventListener(`mouseleave`,()=>{this.seekPreview.dataset.show=`false`}),this.seekBar.append(n,this.seekInput,this.seekPreview),e.append(t,this.seekBar),e}updateSeekPreview(e){let t=this.currentState;if(!t)return;let n=t.manga.pages.length;if(n===0)return;let r=this.seekBar.getBoundingClientRect();if(r.width===0)return;let i=Math.max(0,Math.min(r.width,e.clientX-r.left)),a=i/r.width,o=t.settings.readingDirection===`rtl`?1-a:a,s=D(t,Math.min(n-1,Math.max(0,Math.floor(o*n))),!1),c=s.map(e=>t.manga.pages[e]).filter(e=>!!e);this.refreshSeekPreviewThumbs(s,c);let l=[...s].sort((e,t)=>e-t);this.seekPreviewLabel.textContent=l.length>1?`${l[0]+1} - ${l[l.length-1]+1}`:String(l[0]+1),this.seekPreview.style.left=`${i}px`,this.seekPreview.dataset.show=`true`}refreshSeekPreviewThumbs(e,t){let n=e.join(`,`);if(this.seekPreviewKey!==n){this.seekPreviewKey=n,this.seekPreviewThumbs.replaceChildren();for(let e of t){let t=document.createElement(`div`);if(t.className=`comimi-seek-preview-thumb`,e.type===`image`){let n=document.createElement(`img`);n.src=e.thumbnailSrc??e.src,n.alt=``,n.draggable=!1,t.append(n),t.dataset.kind=`image`}else{let e=document.createElement(`span`);e.textContent=this.i18n.t(`pageList.htmlContent`),t.append(e),t.dataset.kind=`html`}this.seekPreviewThumbs.append(t)}}}buildRow(){let e=document.createElement(`div`);return e.className=`comimi-controls-row`,e.append(this.buildAutoplay(),this.buildSide()),e}buildAutoplay(){this.autoplayContainer=document.createElement(`div`),this.autoplayContainer.className=`comimi-autoplay`,this.autoplayButton=document.createElement(`button`),this.autoplayButton.type=`button`,this.autoplayButton.className=`comimi-autoplay-button comimi-has-tooltip`,this.autoplayButton.addEventListener(`click`,e=>{e.stopPropagation(),this.callbacks.toggleAutoPageTurn()});let e=document.createElement(`span`);e.className=`comimi-autoplay-window`,this.autoplaySlider=document.createElement(`span`),this.autoplaySlider.className=`comimi-autoplay-slider`,this.autoplaySlider.dataset.active=`false`;let t=f(`play`);t.classList.add(`comimi-autoplay-icon`,`comimi-autoplay-icon-play`);let n=f(`pause`);return n.classList.add(`comimi-autoplay-icon`,`comimi-autoplay-icon-pause`),this.autoplaySlider.append(t,n),e.append(this.autoplaySlider),this.autoplayTooltip=document.createElement(`span`),this.autoplayTooltip.className=`comimi-tooltip`,this.autoplayButton.append(e,this.autoplayTooltip),this.autoplayContainer.append(this.autoplayButton),this.autoplayContainer}buildSide(){this.side=document.createElement(`div`),this.side.className=`comimi-controls-side`,this.pageMode=document.createElement(`div`),this.pageMode.className=`comimi-page-mode`;let e=document.createElement(`div`);return e.className=`comimi-page-mode-wrapper`,[this.pageModeSingleBtn,this.pageModeSingleIcon,this.pageModeSingleTooltip]=this.buildPageModeButton(`single`,`one`),[this.pageModeSpreadBtn,this.pageModeSpreadIcon,this.pageModeSpreadTooltip]=this.buildPageModeButton(`spread`,`two`),e.append(this.pageModeSingleBtn,this.pageModeSpreadBtn),this.pageMode.append(e),[this.settingsContainer,this.settingsButton,this.settingsIcon,this.settingsTooltip]=this.buildSettings(),this.settings=new M(this.callbacks,this.i18n),this.settingsContainer.append(this.settings.getElement()),this.side.append(this.pageMode,this.settingsContainer),this.side}buildPageModeButton(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-page-mode-button comimi-has-tooltip`,n.dataset.selected=`false`,n.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.updateSettings({pageTurnMode:e})});let r=f(t);r.classList.add(`comimi-page-mode-icon`);let i=document.createElement(`span`);return i.className=`comimi-tooltip`,n.append(r,i),[n,r,i]}buildSettings(){let e=document.createElement(`div`);e.className=`comimi-settings`,e.dataset.open=`false`;let t=document.createElement(`button`);t.type=`button`,t.className=`comimi-settings-button comimi-has-tooltip`,t.addEventListener(`click`,t=>{t.stopPropagation();let n=e.dataset.open===`true`;this.callbacks.setPanel(n?`none`:`settings`)});let n=f(`settings`);n.classList.add(`comimi-settings-icon`);let r=document.createElement(`span`);return r.className=`comimi-tooltip`,t.append(n,r),e.append(t),[e,t,n,r]}applyPopAnimation(e){e.classList.remove(`comimi-pop-animate`),e.offsetWidth,e.classList.add(`comimi-pop-animate`)}},P=class{callbacks;i18n;options;root;titleEl;authorEl;bottomEl;viewMenu;viewShortcut;viewPageList;pageListInner;pageListCacheKey;currentState;currentView=`menu`;i18nTexts=[];constructor(e,t,n={}){this.callbacks=e,this.i18n=t,this.options=n,this.root=document.createElement(`div`),this.root.className=`comimi-menu-panel`,this.root.setAttribute(`role`,`dialog`),this.root.dataset.open=`false`,this.root.dataset.view=`menu`,this.root.dataset.overlay=`false`;let r=document.createElement(`div`);r.className=`comimi-menu-bg`;let i=this.buildTop();[this.titleEl,this.authorEl]=this.findTitleNodes(i),this.bottomEl=document.createElement(`div`),this.bottomEl.className=`comimi-menu-bottom`,this.bottomEl.style.height=`0px`;let a=document.createElement(`div`);a.className=`comimi-menu-border`,this.viewMenu=this.buildMenuView(),this.viewShortcut=this.buildShortcutView(),[this.viewPageList,this.pageListInner]=this.buildPageListView(),this.bottomEl.append(a,this.viewMenu,this.viewShortcut,this.viewPageList);let o=O(this.options.mascot),s=[r];o&&s.push(o),s.push(i,this.bottomEl),this.root.append(...s)}getElement(){return this.root}bindI18nText(e,t){e.textContent=this.i18n.t(t),this.i18nTexts.push({el:e,key:t})}refreshI18nTexts(){for(let{el:e,key:t}of this.i18nTexts)e.textContent=this.i18n.t(t)}update(e){let t=e.panel===`menu`||e.panel===`pages`||e.panel===`shortcuts`,n=e.panel===`pages`?`pageList`:e.panel===`shortcuts`?`shortcut`:`menu`;this.root.dataset.open=String(t),this.root.dataset.view=n,this.root.dataset.overlay=String(e.overlayVisible),this.titleEl.textContent=e.manga.title,e.manga.author?(this.authorEl.textContent=`@${e.manga.author}`,this.authorEl.style.display=``):(this.authorEl.textContent=``,this.authorEl.style.display=`none`),this.refreshI18nTexts(),this.refreshPageList(e),this.applyHeight(t,n),this.currentState=e,this.currentView=n}applyHeight(e,t){if(!e){this.bottomEl.style.height=`0px`;return}let n=(t===`menu`?this.viewMenu:t===`shortcut`?this.viewShortcut:this.viewPageList).offsetHeight;this.bottomEl.style.height=`${n}px`}refreshPageList(e){let t=`${e.settings.locale}:${e.manga.id}:${e.manga.pages.length}`;this.pageListCacheKey!==t&&(this.pageListCacheKey=t,this.pageListInner.replaceChildren(),e.manga.pages.forEach((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-page-list-item`,n.addEventListener(`click`,e=>{e.stopPropagation(),this.callbacks.goToPage(t),this.callbacks.setPanel(`none`)});let r=document.createElement(`span`);if(r.className=`comimi-page-list-thumb`,e.type===`image`){let n=document.createElement(`img`);n.alt=e.alt??e.label??this.i18n.t(`seek.previewAlt`,{page:t+1}),n.draggable=!1,n.src=e.thumbnailSrc??e.src,r.append(n)}else if(e.type===`html`){let e=document.createElement(`span`);e.className=`comimi-page-list-thumb-html`,e.textContent=this.i18n.t(`pageList.htmlContent`),r.append(e)}let i=document.createElement(`span`);i.className=`comimi-page-list-text`,i.textContent=e.label??String(t+1),n.append(r,i),this.pageListInner.append(n)}))}buildTop(){let e=document.createElement(`button`);e.type=`button`,e.className=`comimi-menu-top`,e.addEventListener(`click`,e=>{e.stopPropagation();let t=this.currentState,n=t?.panel===`menu`||t?.panel===`pages`||t?.panel===`shortcuts`;this.callbacks.setPanel(n?`none`:`menu`)});let t=document.createElement(`span`);t.className=`comimi-menu-button`;let n=document.createElement(`span`);n.className=`comimi-menu-button-inner`,n.append(f(`menu`),f(`close`)),t.append(n);let r=document.createElement(`span`);r.className=`comimi-menu-title-wrap`;let i=document.createElement(`span`);i.className=`comimi-menu-title`;let a=document.createElement(`span`);return a.className=`comimi-menu-author`,r.append(i,a),e.append(t,r),e}findTitleNodes(e){let t=e.querySelector(`.comimi-menu-title`),n=e.querySelector(`.comimi-menu-author`);if(!t||!n)throw Error(`MenuPanel title nodes missing`);return[t,n]}buildMenuView(){let e=document.createElement(`div`);e.className=`comimi-menu-view comimi-menu-view-menu`;let t=document.createElement(`div`);return t.className=`comimi-menu-list`,t.append(this.renderMenuLink(`menu.openPages`,()=>this.callbacks.setPanel(`pages`)),this.renderMenuLink(`menu.openShortcuts`,()=>this.callbacks.setPanel(`shortcuts`))),e.append(t),e}renderMenuLink(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`comimi-menu-link`,n.addEventListener(`click`,e=>{e.stopPropagation(),t()});let r=document.createElement(`span`);r.className=`comimi-menu-link-text`,this.bindI18nText(r,e);let i=document.createElement(`span`);return i.className=`comimi-menu-link-arrow`,i.append(f(`arrow`)),n.append(r,i),n}buildShortcutView(){let e=document.createElement(`div`);e.className=`comimi-menu-view comimi-menu-view-shortcut`;let t=document.createElement(`div`);t.className=`comimi-shortcut-inner`;let n=document.createElement(`div`);return n.className=`comimi-shortcut-grid`,t.append(n),j(t),n.append(this.shortcutSection(`shortcut.section.page`,[[[`←`,`Space`],`shortcut.moveLeft`],[[`→`,`Space + Shift`],`shortcut.moveRight`],[[`A`],`shortcut.autoPageTurnLabel`]])),this.options.lockLayoutMode||n.append(this.shortcutSection(`shortcut.section.viewMode`,[[[`N`,`Esc`],`layout.inline`],[[`W`],`layout.wide`],[[`F`],`layout.browserFullscreen`]],!0)),n.append(this.shortcutSection(`shortcut.section.general`,[[[`O`],`shortcut.overlayToggle`],[[`M`],`overlay.menu`],[[`P`],`shortcut.pageModeToggle`],[[`S`],`overlay.settings`]],!0)),e.append(t,this.renderBackButton()),e}buildPageListView(){let e=document.createElement(`div`);e.className=`comimi-menu-view comimi-menu-view-page-list`;let t=document.createElement(`div`);t.className=`comimi-page-list-inner`;let n=document.createElement(`div`);return n.className=`comimi-page-list-grid`,t.append(n),j(t),e.append(t,this.renderBackButton()),[e,n]}shortcutSection(e,t,n=!1){let r=document.createElement(`div`);r.className=`comimi-shortcut-section`;let i=document.createElement(`div`);i.className=`comimi-shortcut-heading`,this.bindI18nText(i,e);let a=document.createElement(`div`);a.className=n?`comimi-shortcut-column`:`comimi-shortcut-list`;for(let[e,n]of t)a.append(this.shortcutItem(e,n));return r.append(i,a),r}shortcutItem(e,t){let n=document.createElement(`div`);n.className=`comimi-shortcut-item`;let r=document.createElement(`span`);r.className=`comimi-shortcut-badge`,e.forEach((e,t)=>{if(t>0){let e=document.createElement(`span`);e.className=`comimi-shortcut-or`,r.append(e)}let n=document.createElement(`span`);n.className=`comimi-shortcut-key`,n.textContent=e,r.append(n)});let i=document.createElement(`span`);return i.className=`comimi-shortcut-label`,this.bindI18nText(i,t),n.append(r,i),n}renderBackButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`comimi-back-button`,e.addEventListener(`click`,e=>{e.stopPropagation(),this.callbacks.setPanel(`menu`)});let t=document.createElement(`span`);t.className=`comimi-back-inner`;let n=document.createElement(`span`);n.className=`comimi-back-bg`;let r=document.createElement(`span`);r.className=`comimi-back-text`,this.bindI18nText(r,`menu.back`);let i=document.createElement(`span`);return i.className=`comimi-back-arrow`,i.append(f(`arrow`)),t.append(n,r,i),e.append(t),e}},F=class{callbacks;i18n;root;indicator;tooltip;entries;prevMode;constructor(e,t){this.callbacks=e,this.i18n=t,this.root=document.createElement(`div`),this.root.className=`comimi-view-switcher comimi-has-tooltip`,this.root.dataset.overlay=`false`,this.indicator=document.createElement(`span`),this.indicator.className=`comimi-view-switcher-indicator`,this.indicator.style.transform=`translateX(0px)`,this.root.append(this.indicator);let n=[[`inline`,`layout.inline`,`default`],[`wide`,`layout.wide`,`wide`],[`browserFullscreen`,`layout.browserFullscreen`,`fullscreen`]];this.entries=n.map(([e,n,r])=>{let i=document.createElement(`button`);i.type=`button`,i.className=`comimi-view-switcher-button`,i.dataset.selected=`false`,i.addEventListener(`click`,t=>{t.stopPropagation(),this.callbacks.setLayoutMode(e)});let a=document.createElement(`span`);a.className=`comimi-view-switcher-icon-wrap`;let o=f(r);o.classList.add(`comimi-view-switcher-icon`),a.append(o);let s=document.createElement(`span`);return s.className=`comimi-view-switcher-label`,s.textContent=t.t(n),i.append(a,s),this.root.append(i),{mode:e,iconName:r,labelKey:n,button:i,iconWrap:a}}),this.tooltip=document.createElement(`span`),this.tooltip.className=`comimi-tooltip`,this.tooltip.textContent=t.t(`overlay.layout`),this.root.append(this.tooltip)}getElement(){return this.root}update(e){this.root.dataset.overlay=String(e.overlayVisible);let t=Math.max(0,this.entries.findIndex(t=>t.mode===e.layout.mode));this.indicator.style.transform=`translateX(${t*60}px)`;let n=this.prevMode!==void 0&&this.prevMode!==e.layout.mode;for(let t of this.entries){let r=t.mode===e.layout.mode;t.button.dataset.selected=String(r),t.iconWrap.classList.toggle(`comimi-pop-animate`,n&&r),t.button.querySelector(`.comimi-view-switcher-label`).textContent=this.i18n.t(t.labelKey)}this.tooltip.textContent=this.i18n.t(`overlay.layout`),this.prevMode=e.layout.mode}},I=`
|
|
12
12
|
<svg viewBox="0 0 112.19 99.01" class="comimi-error-svg" xmlns="http://www.w3.org/2000/svg">
|
|
13
13
|
<g>
|
|
14
14
|
<path class="comimi-error-stroke" d="M17.43,53.54c-7.74,7.51-12.43,17.29-12.43,27.99,0,4.34.78,8.53,2.21,12.48" />
|
|
@@ -73,7 +73,8 @@ var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
|
|
|
73
73
|
opacity 0.3s linear;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.comimi-arrows[data-overlay="false"] .comimi-arrow-next .comimi-arrow-inner
|
|
76
|
+
.comimi-arrows[data-overlay="false"] .comimi-arrow-next .comimi-arrow-inner,
|
|
77
|
+
.comimi-arrows[data-autoplay="true"] .comimi-arrow-next .comimi-arrow-inner {
|
|
77
78
|
transform: translateX(35px);
|
|
78
79
|
opacity: 0;
|
|
79
80
|
transition:
|
|
@@ -81,7 +82,8 @@ var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
|
|
|
81
82
|
opacity 0.15s linear;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
.comimi-arrows[data-overlay="false"] .comimi-arrow-prev .comimi-arrow-inner
|
|
85
|
+
.comimi-arrows[data-overlay="false"] .comimi-arrow-prev .comimi-arrow-inner,
|
|
86
|
+
.comimi-arrows[data-autoplay="true"] .comimi-arrow-prev .comimi-arrow-inner {
|
|
85
87
|
transform: translateX(-35px);
|
|
86
88
|
opacity: 0;
|
|
87
89
|
transition:
|
|
@@ -89,7 +91,8 @@ var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
|
|
|
89
91
|
opacity 0.15s linear;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
.comimi-arrows[data-overlay="false"]
|
|
94
|
+
.comimi-arrows[data-overlay="false"],
|
|
95
|
+
.comimi-arrows[data-autoplay="true"] {
|
|
93
96
|
pointer-events: none;
|
|
94
97
|
}
|
|
95
98
|
|
|
@@ -713,6 +716,34 @@ var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
|
|
|
713
716
|
}
|
|
714
717
|
}
|
|
715
718
|
|
|
719
|
+
/* --- Autoplay progress shown outside the dock (overlay closed) -------- */
|
|
720
|
+
|
|
721
|
+
.comimi-autoplay-overlay-progress {
|
|
722
|
+
position: absolute;
|
|
723
|
+
bottom: 0;
|
|
724
|
+
left: 0;
|
|
725
|
+
width: 100%;
|
|
726
|
+
height: 3px;
|
|
727
|
+
z-index: 50;
|
|
728
|
+
pointer-events: none;
|
|
729
|
+
overflow: hidden;
|
|
730
|
+
background: rgba(0, 0, 0, 0.06);
|
|
731
|
+
opacity: 0;
|
|
732
|
+
transition: opacity 0.16s linear;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
.comimi-autoplay-overlay-progress[data-visible="true"] {
|
|
736
|
+
opacity: 1;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.comimi-autoplay-overlay-progress-bar {
|
|
740
|
+
display: block;
|
|
741
|
+
position: absolute;
|
|
742
|
+
inset: 0;
|
|
743
|
+
background: #666;
|
|
744
|
+
animation: comimi-autoplay-progress 3s linear 0s infinite;
|
|
745
|
+
}
|
|
746
|
+
|
|
716
747
|
@media (max-width: 767px) {
|
|
717
748
|
.comimi-controls-dock {
|
|
718
749
|
bottom: 0;
|
|
@@ -2519,4 +2550,4 @@ var MangaViewer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
|
|
|
2519
2550
|
}
|
|
2520
2551
|
}
|
|
2521
2552
|
`,q=!1,Ae=[Oe,_e,De,Se,ye,ge,pe,me,ke,he,ve,Te,be,xe,Ce,Ee,we].join(`
|
|
2522
|
-
`);function je(){if(q||typeof document>`u`)return;let e=document.createElement(`style`);e.dataset.comimiViewer=`true`,e.textContent=Ae,document.head.append(e),q=!0}var Me=180,Ne=2e3,Pe=class{container;callbacks;assetLoader;i18n;lockLayoutMode;mascot;root;cleanup=[];mouseStart;touchStart;pinchStart;pageStage;pageTurnTimer;splashRemoveTimer;splash;isPageTurnAnimating=!1;suppressNextClick=!1;prevOverlayVisible=!1;overlayApplyRaf;menuPanel;viewModeSwitcher;controlsDock;resizeHandle;viewSizeObserver;constructor(e,t,n,r,i,a,o=!1,s){this.container=e,this.callbacks=t,this.assetLoader=n,this.i18n=r,this.lockLayoutMode=o,this.mascot=s,je(),this.pageStage=new V({assetLoader:this.assetLoader,i18n:this.i18n,isMobileViewport:()=>this.isMobileViewport(),resolvePageSrc:a}),this.root=fe({className:i}),this.container.replaceChildren(this.root),this.observeViewSize()}observeViewSize(){let e=()=>{this.root.style.setProperty(`--view-width`,`${this.root.offsetWidth}px`),this.root.style.setProperty(`--view-height`,`${this.root.offsetHeight}px`)};e(),typeof ResizeObserver<`u`?(this.viewSizeObserver=new ResizeObserver(e),this.viewSizeObserver.observe(this.root)):(window.addEventListener(`resize`,e),this.cleanup.push(()=>window.removeEventListener(`resize`,e)))}update(e){if(this.isPageTurnAnimating)return;this.cleanup.forEach(e=>e()),this.cleanup=[],this.i18n.setLocale(e.settings.locale),this.root.dataset.layout=e.layout.mode,this.root.dataset.bg=e.settings.backgroundColor,e.layout.mode===`wide`&&e.layout.wideHeightPx?this.root.style.height=`${e.layout.wideHeightPx}px`:this.root.style.height=``;let t=this.prevOverlayVisible!==e.overlayVisible,n=t?{...e,overlayVisible:this.prevOverlayVisible}:e;this.menuPanel||=new P(this.callbacks,this.i18n,{lockLayoutMode:this.lockLayoutMode,mascot:this.mascot}),!this.viewModeSwitcher&&!this.lockLayoutMode&&(this.viewModeSwitcher=new F(this.callbacks,this.i18n)),this.controlsDock||=new N(this.callbacks,this.i18n,this.mascot);let r=this.pageStage.getElement(),i=this.menuPanel.getElement(),a=this.viewModeSwitcher?.getElement(),o=this.controlsDock.getElement();Array.from(this.root.children).forEach(e=>{e!==r&&e!==i&&e!==a&&e!==o&&e!==this.splash&&e.remove()}),r.parentNode!==this.root&&this.root.prepend(r),this.pageStage.update(e,this.isMobileViewport()),this.pageStage.snapTransform();let s=[ae(n,this.i18n),re({state:n,callbacks:this.callbacks}),U(e)];this.syncResizeHandle(e.layout.mode===`wide`);let c=i.parentNode===this.root?i:null;if(c?s.forEach(e=>this.root.insertBefore(e,c)):(s.forEach(e=>this.root.appendChild(e)),this.root.appendChild(i)),a&&a.parentNode!==this.root&&this.root.appendChild(a),o.parentNode!==this.root&&this.root.appendChild(o),this.menuPanel.update(n),this.viewModeSwitcher?.update(n),this.controlsDock.update(n,this.isMobileViewport()),this.splash&&this.splash.parentNode!==this.root&&this.root.append(this.splash),this.bindGestures(e),this.overlayApplyRaf!==void 0&&(cancelAnimationFrame(this.overlayApplyRaf),this.overlayApplyRaf=void 0),t){let t=e.overlayVisible;this.root.offsetWidth,this.overlayApplyRaf=requestAnimationFrame(()=>{this.overlayApplyRaf=void 0,this.applyOverlayVisibility(t)})}this.prevOverlayVisible=e.overlayVisible}applyOverlayVisibility(e){let t=String(e);this.root.querySelectorAll(`.comimi-arrows, .comimi-center-message, .comimi-menu-panel, .comimi-view-switcher, .comimi-controls-dock`).forEach(e=>{e.dataset.overlay=t})}showSplash(){this.splash||(this.splash=G(this.i18n,this.mascot),this.root.append(this.splash),this.splashRemoveTimer=window.setTimeout(()=>{this.splash?.remove(),this.splash=void 0},Ne))}destroy(){window.clearTimeout(this.pageTurnTimer),window.clearTimeout(this.splashRemoveTimer),this.overlayApplyRaf!==void 0&&(cancelAnimationFrame(this.overlayApplyRaf),this.overlayApplyRaf=void 0),this.cleanup.forEach(e=>e()),this.cleanup=[],this.viewSizeObserver?.disconnect(),this.viewSizeObserver=void 0,this.resizeHandle?.remove(),this.resizeHandle=void 0,this.root.remove()}getElement(){return this.root}isAnimatingPageTurn(){return this.isPageTurnAnimating}animatePageTurn(e,t,n){return window.clearTimeout(this.pageTurnTimer),!e.settings.pageTurnAnimation||e.autoPageTurnEnabled||this.isPageTurnAnimating||x(e,t,this.isMobileViewport()).length===0?!1:(this.isPageTurnAnimating=!0,this.setStageDragOffset(this.getPageTurnTargetOffset(e,t),!0),this.pageTurnTimer=window.setTimeout(()=>{this.isPageTurnAnimating=!1,n()},Me),!0)}isMobileViewport(){return window.matchMedia(`(max-width: 767px)`).matches}clampPan(e,t,n,r){if(n<=1)return{x:0,y:0};let i=b(r,this.isMobileViewport()).length>1?this.root.offsetWidth/2:this.root.offsetWidth,a=this.root.offsetHeight,o=i*(n-1)/2,s=a*(n-1)/2;return{x:Math.min(Math.max(e,-o),o),y:Math.min(Math.max(t,-s),s)}}clampedZoom(e,t){return Math.min(Math.max(e,t.settings.zoom.min),t.settings.zoom.max)}syncResizeHandle(e){e?(this.resizeHandle||=this.createResizeHandle(),this.resizeHandle.parentNode!==this.container&&this.container.appendChild(this.resizeHandle)):this.resizeHandle&&this.resizeHandle.remove()}createResizeHandle(){let e=document.createElement(`div`);e.className=`comimi-resize-handle`,e.setAttribute(`role`,`separator`),e.setAttribute(`aria-orientation`,`horizontal`);let t=0,n=0,r,i=e=>{e.pointerId===r&&this.callbacks.setWideHeight(n+e.clientY-t)},a=e=>{e.pointerId===r&&(window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a),r=void 0)};return e.addEventListener(`pointerdown`,e=>{e.preventDefault(),r=e.pointerId,t=e.clientY,n=this.root.getBoundingClientRect().height,window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)}),e}bindGestures(e){let t=t=>{if(this.suppressNextClick||this.isPageTurnAnimating){this.suppressNextClick=!1,t.preventDefault(),t.stopPropagation();return}if(!this.isInteractiveTarget(t.target)){if(!e.overlayVisible){let n=this.root.getBoundingClientRect(),r=(t.clientX-n.left)/n.width;if(r<.2||r>=.8){let t=r<.2?`left`:`right`;(e.settings.readingDirection===`rtl`?t===`left`:t===`right`)?this.callbacks.nextPage():this.callbacks.previousPage();return}}this.callbacks.toggleOverlay()}},n=t=>{if(this.isInteractiveTarget(t.target)||!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let n=t.deltaY>0?-e.settings.zoom.step:e.settings.zoom.step,r=this.clampedZoom(e.zoomScale+n,e),i=this.clampPan(e.panX,e.panY,r,e);this.callbacks.setZoom(r,i.x,i.y)},r=t=>{this.isPageTurnAnimating||this.isInteractiveTarget(t.target)||t.button===0&&(this.mouseStart={x:t.clientX,y:t.clientY,panX:e.panX,panY:e.panY})},i=t=>{if(!this.mouseStart)return;t.preventDefault();let n=t.clientX-this.mouseStart.x,r=t.clientY-this.mouseStart.y;if((Math.abs(n)>6||Math.abs(r)>6)&&(this.suppressNextClick=!0),e.zoomScale<=1){this.setStageDragOffset(this.constrainDragOffset(n,r,e));return}let i=this.mouseStart.panX+t.clientX-this.mouseStart.x,a=this.mouseStart.panY+t.clientY-this.mouseStart.y,o=this.clampPan(i,a,e.zoomScale,e);this.callbacks.setPan(o.x,o.y)},a=t=>{if(!this.mouseStart)return;let n=t.clientX-this.mouseStart.x,r=t.clientY-this.mouseStart.y;this.handleSwipeEnd(n,r,e),this.mouseStart=void 0},o=t=>{if(this.isPageTurnAnimating)return;if(t.touches.length===2){t.preventDefault(),this.touchStart=void 0,this.pinchStart={distance:J(t),scale:e.zoomScale};return}if(this.isInteractiveTarget(t.target))return;let n=t.touches[0];n&&(this.touchStart={x:n.clientX,y:n.clientY,panX:e.panX,panY:e.panY})},s=t=>{if(this.pinchStart&&t.touches.length===2){t.preventDefault();let n=this.pinchStart.scale*(J(t)/this.pinchStart.distance),r=this.clampedZoom(n,e),i=this.clampPan(e.panX,e.panY,r,e);this.callbacks.setZoom(r,i.x,i.y);return}if(this.isInteractiveTarget(t.target))return;let n=t.touches[0];if(!n||!this.touchStart)return;t.preventDefault();let r=n.clientX-this.touchStart.x,i=n.clientY-this.touchStart.y;if((Math.abs(r)>6||Math.abs(i)>6)&&(this.suppressNextClick=!0),e.zoomScale<=1){this.setStageDragOffset(this.constrainDragOffset(r,i,e));return}let a=this.touchStart.panX+n.clientX-this.touchStart.x,o=this.touchStart.panY+n.clientY-this.touchStart.y,s=this.clampPan(a,o,e.zoomScale,e);this.callbacks.setPan(s.x,s.y)},c=t=>{t.touches.length<2&&(this.pinchStart=void 0);let n=t.changedTouches[0];if(!n||!this.touchStart){this.touchStart=void 0;return}let r=n.clientX-this.touchStart.x,i=n.clientY-this.touchStart.y;this.handleSwipeEnd(r,i,e),this.touchStart=void 0},l=t=>{if(this.suppressNextClick||this.isPageTurnAnimating||e.panel!==`settings`)return;let n=t.target;n instanceof Element&&(n.closest(`.comimi-settings`)||this.callbacks.setPanel(`none`))};this.root.addEventListener(`click`,l,!0),this.root.addEventListener(`click`,t),this.root.addEventListener(`wheel`,n,{passive:!1}),this.root.addEventListener(`mousedown`,r),window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a),this.root.addEventListener(`touchstart`,o,{passive:!1}),this.root.addEventListener(`touchmove`,s,{passive:!1}),this.root.addEventListener(`touchend`,c),this.cleanup.push(()=>this.root.removeEventListener(`click`,l,!0),()=>this.root.removeEventListener(`click`,t),()=>this.root.removeEventListener(`wheel`,n),()=>this.root.removeEventListener(`mousedown`,r),()=>window.removeEventListener(`mousemove`,i),()=>window.removeEventListener(`mouseup`,a),()=>this.root.removeEventListener(`touchstart`,o),()=>this.root.removeEventListener(`touchmove`,s),()=>this.root.removeEventListener(`touchend`,c))}handleSwipeEnd(e,t,n){if(window.clearTimeout(this.pageTurnTimer),!(n.zoomScale<=1&&Math.abs(e)>40&&Math.abs(e)>Math.abs(t))){this.setStageDragOffset(0,!0);return}let r=T(e,n.settings.readingDirection)?`next`:`previous`;if(!(x(n,r,this.isMobileViewport()).length>0)){this.setStageDragOffset(0,!0);return}this.requestPageTurn(n,r)||(r===`next`?this.callbacks.commitNextPage():this.callbacks.commitPreviousPage())}requestPageTurn(e,t){return this.animatePageTurn(e,t,()=>{t===`next`?this.callbacks.commitNextPage():this.callbacks.commitPreviousPage()})}constrainDragOffset(e,t,n){return Math.abs(t)>Math.abs(e)?0:x(n,T(e,n.settings.readingDirection)?`next`:`previous`,this.isMobileViewport()).length>0?e:this.applyEdgeResistance(e)}applyEdgeResistance(e){let t=Math.sign(e),n=Math.abs(e),r=Math.max(this.root.clientWidth,1),i=Math.min(r*.22,140);return t*(i*(1-Math.exp(-n/i)))}setStageDragOffset(e,t=!1){this.pageStage.setDragOffset(e,t)}getPageTurnTargetOffset(e,t){return w(e,t)===`left`?this.root.clientWidth:-this.root.clientWidth}isInteractiveTarget(e){return e instanceof Element?!!e.closest([`.comimi-arrow-button`,`.comimi-view-switcher`,`.comimi-controls-dock`,`.comimi-menu-panel`,`.comimi-settings-panel`,`button`,`input`,`select`,`textarea`,`a`,`iframe`].join(`,`)):!1}};function J(e){let[t,n]=Array.from(e.touches);return!t||!n?1:Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY)}var Y=class{enabled;databaseName;dbPromise;constructor(e={}){this.enabled=e.enabled!==!1&&typeof indexedDB<`u`,this.databaseName=e.databaseName??`manga-viewer`}async getSettings(){return(await this.get(`settings`,`global`))?.value}async saveSettings(e){await this.put(`settings`,{id:`global`,value:e,updatedAt:Date.now()})}async getProgress(e){return(await this.get(`readingProgress`,e))?.pageIndex}async saveProgress(e,t){await this.put(`readingProgress`,{mangaId:e,pageIndex:t,updatedAt:Date.now()})}async saveLayout(e){await this.put(`layout`,{id:`global`,value:e,updatedAt:Date.now()})}async getLayout(){return(await this.get(`layout`,`global`))?.value}async get(e,t){if(this.enabled)return Z((await this.store(e,`readonly`)).get(t))}async put(e,t){this.enabled&&await Z((await this.store(e,`readwrite`)).put(t))}async delete(e,t){this.enabled&&await Z((await this.store(e,`readwrite`)).delete(t))}async store(e,t){return(await this.open()).transaction(e,t).objectStore(e)}open(){return this.enabled?(this.dbPromise??=new Promise((e,t)=>{let n=indexedDB.open(this.databaseName,1);n.onupgradeneeded=()=>{let e=n.result;X(e,`settings`,`id`),X(e,`readingProgress`,`mangaId`),X(e,`layout`,`id`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),this.dbPromise):Promise.reject(Error(`IndexedDB is not available`))}};function X(e,t,n){e.objectStoreNames.contains(t)||e.createObjectStore(t,{keyPath:n})}function Z(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}function Q(e,t){switch(t.type){case`setManga`:{let n=i(t.pageIndex??0,t.manga.pages.length);return $({...e,manga:t.manga,currentPageIndex:n,zoomScale:1,panX:0,panY:0})}case`goToPage`:{let n=i(t.pageIndex,e.manga.pages.length),r=e.zoomScale===1&&e.panX===0&&e.panY===0;return n===e.currentPageIndex&&r?e:$({...e,currentPageIndex:n,zoomScale:1,panX:0,panY:0})}case`nextPage`:{let t=a(e.settings,e.currentPageIndex);return Q(e,{type:`goToPage`,pageIndex:e.currentPageIndex+t})}case`previousPage`:{let t=a(e.settings,e.currentPageIndex);return Q(e,{type:`goToPage`,pageIndex:e.currentPageIndex-t})}case`setOverlayVisible`:return{...e,overlayVisible:t.visible,panel:t.visible?e.panel:`none`};case`toggleAutoPageTurn`:return{...e,autoPageTurnEnabled:!e.autoPageTurnEnabled};case`updateSettings`:{let n=r(e.settings,t.settings);return $({...e,settings:n,layout:{...e.layout,mode:n.layoutMode}})}case`setLayoutMode`:return Q(e,{type:`updateSettings`,settings:{layoutMode:t.layoutMode}});case`setWideHeight`:return{...e,layout:{...e.layout,wideHeightPx:Math.max(240,Math.round(t.heightPx))}};case`setZoom`:return{...e,zoomScale:Fe(t.scale,e),panX:t.panX??e.panX,panY:t.panY??e.panY};case`setPan`:return{...e,panX:t.panX,panY:t.panY};case`resetZoom`:return{...e,zoomScale:1,panX:0,panY:0};case`setPanel`:return{...e,panel:t.panel,overlayVisible:t.panel===`none`?e.overlayVisible:!0};case`pushNotification`:return{...e,notifications:[t.notification]};case`removeNotification`:return{...e,notifications:e.notifications.filter(e=>e.id!==t.id)}}}function $(e){return{...e,visiblePageIndexes:o(e.currentPageIndex,e.manga.pages.length,e.settings)}}function Fe(e,t){return Math.min(Math.max(e,t.settings.zoom.min),t.settings.zoom.max)}var Ie=class{state;listeners=new Set;constructor(e){this.state=e}getState(){return this.state}dispatch(e){let t=this.state,n=Q(t,e);if(n!==t){this.state=n;for(let e of this.listeners)e(n,t)}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}},Le=class{objectUrls=new Set;async resolveImageSource(e,t){return t.src}revokeAll(){for(let e of this.objectUrls)URL.revokeObjectURL(e);this.objectUrls.clear()}},Re=class{handlers=new Map;on(e,t){let n=this.handlers.get(e);return n||(n=new Set,this.handlers.set(e,n)),n.add(t),()=>{n.delete(t)}}emit(e,t){let n=this.handlers.get(e);if(n)for(let e of n)try{e(t)}catch(e){console.error(e)}}clear(){this.handlers.clear()}},ze=class{container;store;storage;assetLoader;renderer;i18n;events=new Re;unsubscribers=[];notificationTimers=new Map;autoTimer;mobileMediaQuery;lockLayoutMode=!1;constructor(e,i){this.container=e;let a=r(t,{...i.settings,locale:i.locale??i.settings?.locale??t.locale});this.lockLayoutMode=i.lockLayoutMode??!1,this.storage=new Y(i.storage),this.assetLoader=new Le,this.i18n=new d(a.locale,i.translations),this.store=new Ie(n(i.manga,a,i.initialPageIndex));let o={goToPage:e=>this.goToPage(e),nextPage:()=>this.nextPage(),previousPage:()=>this.previousPage(),commitNextPage:()=>this.commitNextPage(),commitPreviousPage:()=>this.commitPreviousPage(),toggleOverlay:e=>this.toggleOverlay(e),toggleAutoPageTurn:()=>this.toggleAutoPageTurn(),updateSettings:e=>{this.updateSettings(e)},setLayoutMode:e=>void this.setLayoutMode(e),setWideHeight:e=>this.setWideHeight(e),setPanel:e=>{this.store.dispatch({type:`setPanel`,panel:e})},setZoom:(e,t,n)=>this.store.dispatch({type:`setZoom`,scale:e,panX:t,panY:n}),setPan:(e,t)=>this.store.dispatch({type:`setPan`,panX:e,panY:t}),resetZoom:()=>this.store.dispatch({type:`resetZoom`})};this.renderer=new Pe(this.container,o,this.assetLoader,this.i18n,i.className,i.resolvePageSrc,this.lockLayoutMode,i.mascot);for(let[e,t]of Object.entries(i.events??{}))this.on(e,t);this.unsubscribers.push(this.store.subscribe((e,t)=>{this.renderer.update(e),this.afterStateChange(e,t)})),this.bindKeyboard(),this.bindViewportChange(),this.bootstrap()}destroy(){window.clearInterval(this.autoTimer);for(let e of this.notificationTimers.values())window.clearTimeout(e);this.notificationTimers.clear(),this.unsubscribers.forEach(e=>e()),this.assetLoader.revokeAll(),this.renderer.destroy(),this.events.emit(`destroy`,void 0),this.events.clear()}async setManga(e){let t=await this.storage.getProgress(e.id)??0;this.store.dispatch({type:`setManga`,manga:e,pageIndex:t})}async setPages(e){await this.setManga({...this.store.getState().manga,pages:e})}getState(){return this.store.getState()}async updateSettings(e){let t=e;this.lockLayoutMode&&`layoutMode`in e&&(t={...e},delete t.layoutMode),this.store.dispatch({type:`updateSettings`,settings:t});let n=this.store.getState().settings;this.i18n.setLocale(n.locale),await this.storage.saveSettings(n),this.events.emit(`settingsChange`,{settings:n})}goToPage(e){let t=this.store.getState().currentPageIndex;this.store.dispatch({type:`goToPage`,pageIndex:e});let n=this.store.getState().currentPageIndex;if(t!==n){let e=this.store.getState();this.storage.saveProgress(e.manga.id,n),this.events.emit(`pageChange`,{pageIndex:n,page:e.manga.pages[n]})}}nextPage(){if(this.renderer.isAnimatingPageTurn())return;let e=this.store.getState();this.renderer.animatePageTurn(e,`next`,()=>this.commitNextPage())||this.commitNextPage()}previousPage(){if(this.renderer.isAnimatingPageTurn())return;let e=this.store.getState();this.renderer.animatePageTurn(e,`previous`,()=>this.commitPreviousPage())||this.commitPreviousPage()}commitNextPage(){if(this.renderer.isMobileViewport()){this.goToPage(this.store.getState().currentPageIndex+1);return}let e=this.store.getState().currentPageIndex;this.store.dispatch({type:`nextPage`}),this.emitPageChangeIfNeeded(e)}commitPreviousPage(){if(this.renderer.isMobileViewport()){this.goToPage(this.store.getState().currentPageIndex-1);return}let e=this.store.getState().currentPageIndex;this.store.dispatch({type:`previousPage`}),this.emitPageChangeIfNeeded(e)}toggleOverlay(e){let t=this.store.getState().overlayVisible,n=e??!t;this.store.dispatch({type:`setOverlayVisible`,visible:n})}toggleAutoPageTurn(){this.store.dispatch({type:`toggleAutoPageTurn`}),this.syncAutoTimer();let e=this.store.getState().autoPageTurnEnabled;this.notify(this.i18n.t(e?`autoplay.start`:`autoplay.stop`))}async toggleFullscreen(){if(this.lockLayoutMode)return;let e=this.store.getState();if(document.fullscreenElement){await document.exitFullscreen(),await this.setLayoutMode(`inline`);return}await this.setLayoutMode(e.layout.mode===`nativeFullscreen`?`inline`:`nativeFullscreen`)}on(e,t){return this.events.on(e,t)}async bootstrap(){let e=await this.storage.getSettings(),t=await this.storage.getLayout(),n=this.store.getState().manga.id,r=await this.storage.getProgress(n);if(e){let t={...e};this.lockLayoutMode&&delete t.layoutMode,this.store.dispatch({type:`updateSettings`,settings:t})}if(!this.lockLayoutMode&&t?.mode){let e=t.mode===`theater`?`wide`:t.mode;this.store.dispatch({type:`setLayoutMode`,layoutMode:e})}let i=t?.wideHeightPx??t?.theaterHeightPx;i&&this.store.dispatch({type:`setWideHeight`,heightPx:i}),typeof r==`number`&&this.store.dispatch({type:`goToPage`,pageIndex:r}),this.renderer.update(this.store.getState()),this.renderer.showSplash(),window.setTimeout(()=>{this.toggleOverlay(!0)},1550),this.events.emit(`ready`,{manga:this.store.getState().manga})}bindKeyboard(){this.renderer.getElement();let e=e=>{if(this.shouldHandleKeyboardEvent(e))switch(e.key){case`ArrowLeft`:e.preventDefault(),this.moveFromKey(`left`);break;case`ArrowRight`:e.preventDefault(),this.moveFromKey(`right`);break;case` `:e.preventDefault(),this.moveFromKey(e.shiftKey?`right`:`left`);break;case`a`:case`A`:e.preventDefault(),this.toggleAutoPageTurn();break;case`n`:case`N`:case`Escape`:if(this.lockLayoutMode)break;e.preventDefault(),this.setLayoutMode(`inline`);break;case`w`:case`W`:if(this.lockLayoutMode)break;e.preventDefault(),this.setLayoutMode(`wide`);break;case`f`:case`F`:if(this.lockLayoutMode)break;e.preventDefault(),this.setLayoutMode(`browserFullscreen`);break;case`m`:case`M`:{e.preventDefault();let t=this.store.getState().panel,n=t===`menu`||t===`pages`||t===`shortcuts`;this.store.dispatch({type:`setPanel`,panel:n?`none`:`menu`}),n||this.toggleOverlay(!0);break}case`p`:case`P`:e.preventDefault(),this.updateSettings({pageTurnMode:this.store.getState().settings.pageTurnMode===`spread`?`single`:`spread`});break;case`o`:case`O`:e.preventDefault(),this.toggleOverlay();break;case`s`:case`S`:{e.preventDefault();let t=this.store.getState().panel===`settings`;this.store.dispatch({type:`setPanel`,panel:t?`none`:`settings`}),t||this.toggleOverlay(!0);break}case`Escape`:e.preventDefault(),this.store.dispatch({type:`setPanel`,panel:`none`}),document.fullscreenElement&&document.exitFullscreen();break}};window.addEventListener(`keydown`,e),this.unsubscribers.push(()=>window.removeEventListener(`keydown`,e))}shouldHandleKeyboardEvent(e){let t=e.target;return t instanceof Element?!t.closest(`input, select, textarea, [contenteditable='true']`):!0}bindViewportChange(){this.mobileMediaQuery=window.matchMedia(`(max-width: 676px)`);let e=()=>{this.renderer.update(this.store.getState())};this.mobileMediaQuery.addEventListener(`change`,e),this.unsubscribers.push(()=>this.mobileMediaQuery?.removeEventListener(`change`,e))}moveFromKey(e){this.store.getState().settings.readingDirection===`rtl`?e===`left`?this.nextPage():this.previousPage():e===`left`?this.previousPage():this.nextPage()}async setLayoutMode(e){if(!this.lockLayoutMode){if(e===`nativeFullscreen`)try{await this.renderer.getElement().requestFullscreen()}catch{e=`browserFullscreen`}else document.fullscreenElement&&await document.exitFullscreen();if(e===`wide`&&!this.store.getState().layout.wideHeightPx){let e=this.renderer.getElement().offsetHeight;e>0&&this.store.dispatch({type:`setWideHeight`,heightPx:e})}this.store.dispatch({type:`setLayoutMode`,layoutMode:e}),await this.storage.saveSettings(this.store.getState().settings),await this.storage.saveLayout(this.store.getState().layout),this.events.emit(`layoutChange`,{layoutMode:e})}}setWideHeight(e){this.store.dispatch({type:`setWideHeight`,heightPx:e}),this.storage.saveLayout(this.store.getState().layout)}afterStateChange(e,t){e.autoPageTurnEnabled!==t.autoPageTurnEnabled&&this.syncAutoTimer()}syncAutoTimer(){window.clearInterval(this.autoTimer),this.store.getState().autoPageTurnEnabled&&(this.autoTimer=window.setInterval(()=>{let e=this.store.getState(),t=a(e.settings,e.currentPageIndex);if(e.currentPageIndex+t>=e.manga.pages.length){this.toggleAutoPageTurn();return}this.nextPage()},this.store.getState().settings.autoPageTurnIntervalMs))}emitPageChangeIfNeeded(e){let t=this.store.getState();t.currentPageIndex!==e&&(this.storage.saveProgress(t.manga.id,t.currentPageIndex),this.events.emit(`pageChange`,{pageIndex:t.currentPageIndex,page:t.manga.pages[t.currentPageIndex]}))}notify(e,t=`info`){for(let e of this.notificationTimers.values())window.clearTimeout(e);this.notificationTimers.clear();let n=`${Date.now()}-${Math.random().toString(36).slice(2)}`;this.store.dispatch({type:`pushNotification`,notification:{id:n,message:e,tone:t,createdAt:Date.now()}});let r=window.setTimeout(()=>{this.store.dispatch({type:`removeNotification`,id:n}),this.notificationTimers.delete(n)},3e3);this.notificationTimers.set(n,r)}};function Be(e,t){return new ze(e,t)}return e.createMangaViewer=Be,e})({});
|
|
2553
|
+
`);function je(){if(q||typeof document>`u`)return;let e=document.createElement(`style`);e.dataset.comimiViewer=`true`,e.textContent=Ae,document.head.append(e),q=!0}var Me=180,Ne=2e3,Pe=class{container;callbacks;assetLoader;i18n;lockLayoutMode;mascot;root;cleanup=[];mouseStart;touchStart;pinchStart;pageStage;pageTurnTimer;splashRemoveTimer;splash;isPageTurnAnimating=!1;suppressNextClick=!1;prevOverlayVisible=!1;overlayApplyRaf;menuPanel;viewModeSwitcher;controlsDock;resizeHandle;viewSizeObserver;autoplayOverlayProgress;autoplayOverlayProgressBar;constructor(e,t,n,r,i,a,o=!1,s){this.container=e,this.callbacks=t,this.assetLoader=n,this.i18n=r,this.lockLayoutMode=o,this.mascot=s,je(),this.pageStage=new V({assetLoader:this.assetLoader,i18n:this.i18n,isMobileViewport:()=>this.isMobileViewport(),resolvePageSrc:a}),this.root=fe({className:i}),this.container.replaceChildren(this.root),this.observeViewSize()}observeViewSize(){let e=()=>{this.root.style.setProperty(`--view-width`,`${this.root.offsetWidth}px`),this.root.style.setProperty(`--view-height`,`${this.root.offsetHeight}px`)};e(),typeof ResizeObserver<`u`?(this.viewSizeObserver=new ResizeObserver(e),this.viewSizeObserver.observe(this.root)):(window.addEventListener(`resize`,e),this.cleanup.push(()=>window.removeEventListener(`resize`,e)))}update(e){if(this.isPageTurnAnimating)return;this.cleanup.forEach(e=>e()),this.cleanup=[],this.i18n.setLocale(e.settings.locale),this.root.dataset.layout=e.layout.mode,this.root.dataset.bg=e.settings.backgroundColor,e.layout.mode===`wide`&&e.layout.wideHeightPx?this.root.style.height=`${e.layout.wideHeightPx}px`:this.root.style.height=``;let t=this.prevOverlayVisible!==e.overlayVisible,n=t?{...e,overlayVisible:this.prevOverlayVisible}:e;this.menuPanel||=new P(this.callbacks,this.i18n,{lockLayoutMode:this.lockLayoutMode,mascot:this.mascot}),!this.viewModeSwitcher&&!this.lockLayoutMode&&(this.viewModeSwitcher=new F(this.callbacks,this.i18n)),this.controlsDock||=new N(this.callbacks,this.i18n,this.mascot);let r=this.pageStage.getElement(),i=this.menuPanel.getElement(),a=this.viewModeSwitcher?.getElement(),o=this.controlsDock.getElement();Array.from(this.root.children).forEach(e=>{e!==r&&e!==i&&e!==a&&e!==o&&e!==this.splash&&e!==this.autoplayOverlayProgress&&e.remove()}),r.parentNode!==this.root&&this.root.prepend(r),this.pageStage.update(e,this.isMobileViewport()),this.pageStage.snapTransform();let s=[y(n,this.i18n),ie({state:n,callbacks:this.callbacks}),U(e)];this.syncResizeHandle(e.layout.mode===`wide`);let c=i.parentNode===this.root?i:null;if(c?s.forEach(e=>this.root.insertBefore(e,c)):(s.forEach(e=>this.root.appendChild(e)),this.root.appendChild(i)),a&&a.parentNode!==this.root&&this.root.appendChild(a),o.parentNode!==this.root&&this.root.appendChild(o),this.menuPanel.update(n),this.viewModeSwitcher?.update(n),this.controlsDock.update(n,this.isMobileViewport()),this.syncAutoplayOverlayProgress(e),this.splash&&this.splash.parentNode!==this.root&&this.root.append(this.splash),this.bindGestures(e),this.overlayApplyRaf!==void 0&&(cancelAnimationFrame(this.overlayApplyRaf),this.overlayApplyRaf=void 0),t){let t=e.overlayVisible;this.root.offsetWidth,this.overlayApplyRaf=requestAnimationFrame(()=>{this.overlayApplyRaf=void 0,this.applyOverlayVisibility(t)})}this.prevOverlayVisible=e.overlayVisible}applyOverlayVisibility(e){let t=String(e);this.root.querySelectorAll(`.comimi-arrows, .comimi-center-message, .comimi-menu-panel, .comimi-view-switcher, .comimi-controls-dock`).forEach(e=>{e.dataset.overlay=t})}showSplash(){this.splash||(this.splash=G(this.i18n,this.mascot),this.root.append(this.splash),this.splashRemoveTimer=window.setTimeout(()=>{this.splash?.remove(),this.splash=void 0},Ne))}destroy(){window.clearTimeout(this.pageTurnTimer),window.clearTimeout(this.splashRemoveTimer),this.overlayApplyRaf!==void 0&&(cancelAnimationFrame(this.overlayApplyRaf),this.overlayApplyRaf=void 0),this.cleanup.forEach(e=>e()),this.cleanup=[],this.viewSizeObserver?.disconnect(),this.viewSizeObserver=void 0,this.resizeHandle?.remove(),this.resizeHandle=void 0,this.root.remove()}getElement(){return this.root}isAnimatingPageTurn(){return this.isPageTurnAnimating}animatePageTurn(e,t,n){return window.clearTimeout(this.pageTurnTimer),this.isPageTurnAnimating||x(e,t,this.isMobileViewport()).length===0?!1:(this.isPageTurnAnimating=!0,this.setStageDragOffset(this.getPageTurnTargetOffset(e,t),!0),this.pageTurnTimer=window.setTimeout(()=>{this.isPageTurnAnimating=!1,n()},Me),!0)}isMobileViewport(){return window.matchMedia(`(max-width: 767px)`).matches}syncAutoplayOverlayProgress(e){if(!e.autoPageTurnEnabled){this.autoplayOverlayProgress&&(this.autoplayOverlayProgress.remove(),this.autoplayOverlayProgress=void 0,this.autoplayOverlayProgressBar=void 0);return}this.autoplayOverlayProgress||(this.autoplayOverlayProgress=document.createElement(`div`),this.autoplayOverlayProgress.className=`comimi-autoplay-overlay-progress`,this.autoplayOverlayProgressBar=document.createElement(`span`),this.autoplayOverlayProgressBar.className=`comimi-autoplay-overlay-progress-bar`,this.autoplayOverlayProgress.append(this.autoplayOverlayProgressBar)),this.autoplayOverlayProgress.parentNode!==this.root&&this.root.appendChild(this.autoplayOverlayProgress),this.autoplayOverlayProgress.dataset.visible=String(!e.overlayVisible),this.autoplayOverlayProgressBar.style.animationDuration=`${e.settings.autoPageTurnIntervalMs}ms`}clampPan(e,t,n,r){if(n<=1)return{x:0,y:0};let i=b(r,this.isMobileViewport()).length>1?this.root.offsetWidth/2:this.root.offsetWidth,a=this.root.offsetHeight,o=i*(n-1)/2,s=a*(n-1)/2;return{x:Math.min(Math.max(e,-o),o),y:Math.min(Math.max(t,-s),s)}}clampedZoom(e,t){return Math.min(Math.max(e,t.settings.zoom.min),t.settings.zoom.max)}syncResizeHandle(e){e?(this.resizeHandle||=this.createResizeHandle(),this.resizeHandle.parentNode!==this.container&&this.container.appendChild(this.resizeHandle)):this.resizeHandle&&this.resizeHandle.remove()}createResizeHandle(){let e=document.createElement(`div`);e.className=`comimi-resize-handle`,e.setAttribute(`role`,`separator`),e.setAttribute(`aria-orientation`,`horizontal`);let t=0,n=0,r,i=e=>{e.pointerId===r&&this.callbacks.setWideHeight(n+e.clientY-t)},a=e=>{e.pointerId===r&&(window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a),r=void 0)};return e.addEventListener(`pointerdown`,e=>{e.preventDefault(),r=e.pointerId,t=e.clientY,n=this.root.getBoundingClientRect().height,window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)}),e}bindGestures(e){let t=t=>{if(this.suppressNextClick||this.isPageTurnAnimating){this.suppressNextClick=!1,t.preventDefault(),t.stopPropagation();return}if(!this.isInteractiveTarget(t.target)){if(!e.overlayVisible){let n=this.root.getBoundingClientRect(),r=(t.clientX-n.left)/n.width;if(r<.3||r>=.7){let t=r<.3?`left`:`right`;(e.settings.readingDirection===`rtl`?t===`left`:t===`right`)?this.callbacks.nextPage():this.callbacks.previousPage();return}}this.callbacks.toggleOverlay()}},n=t=>{if(this.isInteractiveTarget(t.target)||!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let n=t.deltaY>0?-e.settings.zoom.step:e.settings.zoom.step,r=this.clampedZoom(e.zoomScale+n,e),i=this.clampPan(e.panX,e.panY,r,e);this.callbacks.setZoom(r,i.x,i.y)},r=t=>{this.isPageTurnAnimating||this.isInteractiveTarget(t.target)||t.button===0&&(this.mouseStart={x:t.clientX,y:t.clientY,panX:e.panX,panY:e.panY})},i=t=>{if(!this.mouseStart)return;t.preventDefault();let n=t.clientX-this.mouseStart.x,r=t.clientY-this.mouseStart.y;if((Math.abs(n)>6||Math.abs(r)>6)&&(this.suppressNextClick=!0),e.zoomScale<=1){this.setStageDragOffset(this.constrainDragOffset(n,r,e));return}let i=this.mouseStart.panX+t.clientX-this.mouseStart.x,a=this.mouseStart.panY+t.clientY-this.mouseStart.y,o=this.clampPan(i,a,e.zoomScale,e);this.callbacks.setPan(o.x,o.y)},a=t=>{if(!this.mouseStart)return;let n=t.clientX-this.mouseStart.x,r=t.clientY-this.mouseStart.y;this.handleSwipeEnd(n,r,e),this.mouseStart=void 0},o=t=>{if(this.isPageTurnAnimating)return;if(t.touches.length===2){t.preventDefault(),this.touchStart=void 0,this.pinchStart={distance:J(t),scale:e.zoomScale};return}if(this.isInteractiveTarget(t.target))return;let n=t.touches[0];n&&(this.touchStart={x:n.clientX,y:n.clientY,panX:e.panX,panY:e.panY})},s=t=>{if(this.pinchStart&&t.touches.length===2){t.preventDefault();let n=this.pinchStart.scale*(J(t)/this.pinchStart.distance),r=this.clampedZoom(n,e),i=this.clampPan(e.panX,e.panY,r,e);this.callbacks.setZoom(r,i.x,i.y);return}if(this.isInteractiveTarget(t.target))return;let n=t.touches[0];if(!n||!this.touchStart)return;t.preventDefault();let r=n.clientX-this.touchStart.x,i=n.clientY-this.touchStart.y;if((Math.abs(r)>6||Math.abs(i)>6)&&(this.suppressNextClick=!0),e.zoomScale<=1){this.setStageDragOffset(this.constrainDragOffset(r,i,e));return}let a=this.touchStart.panX+n.clientX-this.touchStart.x,o=this.touchStart.panY+n.clientY-this.touchStart.y,s=this.clampPan(a,o,e.zoomScale,e);this.callbacks.setPan(s.x,s.y)},c=t=>{t.touches.length<2&&(this.pinchStart=void 0);let n=t.changedTouches[0];if(!n||!this.touchStart){this.touchStart=void 0;return}let r=n.clientX-this.touchStart.x,i=n.clientY-this.touchStart.y;this.handleSwipeEnd(r,i,e),this.touchStart=void 0},l=t=>{if(this.suppressNextClick||this.isPageTurnAnimating||e.panel!==`settings`)return;let n=t.target;n instanceof Element&&(n.closest(`.comimi-settings`)||this.callbacks.setPanel(`none`))};this.root.addEventListener(`click`,l,!0),this.root.addEventListener(`click`,t),this.root.addEventListener(`wheel`,n,{passive:!1}),this.root.addEventListener(`mousedown`,r),window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a),this.root.addEventListener(`touchstart`,o,{passive:!1}),this.root.addEventListener(`touchmove`,s,{passive:!1}),this.root.addEventListener(`touchend`,c),this.cleanup.push(()=>this.root.removeEventListener(`click`,l,!0),()=>this.root.removeEventListener(`click`,t),()=>this.root.removeEventListener(`wheel`,n),()=>this.root.removeEventListener(`mousedown`,r),()=>window.removeEventListener(`mousemove`,i),()=>window.removeEventListener(`mouseup`,a),()=>this.root.removeEventListener(`touchstart`,o),()=>this.root.removeEventListener(`touchmove`,s),()=>this.root.removeEventListener(`touchend`,c))}handleSwipeEnd(e,t,n){if(window.clearTimeout(this.pageTurnTimer),!(n.zoomScale<=1&&Math.abs(e)>30&&Math.abs(e)>Math.abs(t))){this.setStageDragOffset(0,!0);return}let r=T(e,n.settings.readingDirection)?`next`:`previous`;if(!(x(n,r,this.isMobileViewport()).length>0)){this.setStageDragOffset(0,!0);return}this.requestPageTurn(n,r)||(r===`next`?this.callbacks.commitNextPage():this.callbacks.commitPreviousPage())}requestPageTurn(e,t){return this.animatePageTurn(e,t,()=>{t===`next`?this.callbacks.commitNextPage():this.callbacks.commitPreviousPage()})}constrainDragOffset(e,t,n){return Math.abs(t)>Math.abs(e)?0:x(n,T(e,n.settings.readingDirection)?`next`:`previous`,this.isMobileViewport()).length>0?e:this.applyEdgeResistance(e)}applyEdgeResistance(e){let t=Math.sign(e),n=Math.abs(e),r=Math.max(this.root.clientWidth,1),i=Math.min(r*.22,140);return t*(i*(1-Math.exp(-n/i)))}setStageDragOffset(e,t=!1){this.pageStage.setDragOffset(e,t)}getPageTurnTargetOffset(e,t){return w(e,t)===`left`?this.root.clientWidth:-this.root.clientWidth}isInteractiveTarget(e){return e instanceof Element?!!e.closest([`.comimi-arrow-button`,`.comimi-view-switcher`,`.comimi-controls-dock`,`.comimi-menu-panel`,`.comimi-settings-panel`,`button`,`input`,`select`,`textarea`,`a`,`iframe`].join(`,`)):!1}};function J(e){let[t,n]=Array.from(e.touches);return!t||!n?1:Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY)}var Y=class{enabled;databaseName;dbPromise;constructor(e={}){this.enabled=e.enabled!==!1&&typeof indexedDB<`u`,this.databaseName=e.databaseName??`manga-viewer`}async getSettings(){return(await this.get(`settings`,`global`))?.value}async saveSettings(e){await this.put(`settings`,{id:`global`,value:e,updatedAt:Date.now()})}async getProgress(e){return(await this.get(`readingProgress`,e))?.pageIndex}async saveProgress(e,t){await this.put(`readingProgress`,{mangaId:e,pageIndex:t,updatedAt:Date.now()})}async saveLayout(e){await this.put(`layout`,{id:`global`,value:e,updatedAt:Date.now()})}async getLayout(){return(await this.get(`layout`,`global`))?.value}async get(e,t){if(this.enabled)return Z((await this.store(e,`readonly`)).get(t))}async put(e,t){this.enabled&&await Z((await this.store(e,`readwrite`)).put(t))}async delete(e,t){this.enabled&&await Z((await this.store(e,`readwrite`)).delete(t))}async store(e,t){return(await this.open()).transaction(e,t).objectStore(e)}open(){return this.enabled?(this.dbPromise??=new Promise((e,t)=>{let n=indexedDB.open(this.databaseName,1);n.onupgradeneeded=()=>{let e=n.result;X(e,`settings`,`id`),X(e,`readingProgress`,`mangaId`),X(e,`layout`,`id`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),this.dbPromise):Promise.reject(Error(`IndexedDB is not available`))}};function X(e,t,n){e.objectStoreNames.contains(t)||e.createObjectStore(t,{keyPath:n})}function Z(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}function Q(e,t){switch(t.type){case`setManga`:{let n=i(t.pageIndex??0,t.manga.pages.length);return $({...e,manga:t.manga,currentPageIndex:n,zoomScale:1,panX:0,panY:0})}case`goToPage`:{let n=i(t.pageIndex,e.manga.pages.length),r=e.zoomScale===1&&e.panX===0&&e.panY===0;return n===e.currentPageIndex&&r?e:$({...e,currentPageIndex:n,zoomScale:1,panX:0,panY:0})}case`nextPage`:{let t=a(e.settings,e.currentPageIndex);return Q(e,{type:`goToPage`,pageIndex:e.currentPageIndex+t})}case`previousPage`:{let t=a(e.settings,e.currentPageIndex);return Q(e,{type:`goToPage`,pageIndex:e.currentPageIndex-t})}case`setOverlayVisible`:return{...e,overlayVisible:t.visible,panel:t.visible?e.panel:`none`};case`toggleAutoPageTurn`:return{...e,autoPageTurnEnabled:!e.autoPageTurnEnabled};case`updateSettings`:{let n=r(e.settings,t.settings);return $({...e,settings:n,layout:{...e.layout,mode:n.layoutMode}})}case`setLayoutMode`:return Q(e,{type:`updateSettings`,settings:{layoutMode:t.layoutMode}});case`setWideHeight`:return{...e,layout:{...e.layout,wideHeightPx:Math.max(240,Math.round(t.heightPx))}};case`setZoom`:return{...e,zoomScale:Fe(t.scale,e),panX:t.panX??e.panX,panY:t.panY??e.panY};case`setPan`:return{...e,panX:t.panX,panY:t.panY};case`resetZoom`:return{...e,zoomScale:1,panX:0,panY:0};case`setPanel`:return{...e,panel:t.panel,overlayVisible:t.panel===`none`?e.overlayVisible:!0};case`pushNotification`:return{...e,notifications:[t.notification]};case`removeNotification`:return{...e,notifications:e.notifications.filter(e=>e.id!==t.id)}}}function $(e){return{...e,visiblePageIndexes:o(e.currentPageIndex,e.manga.pages.length,e.settings)}}function Fe(e,t){return Math.min(Math.max(e,t.settings.zoom.min),t.settings.zoom.max)}var Ie=class{state;listeners=new Set;constructor(e){this.state=e}getState(){return this.state}dispatch(e){let t=this.state,n=Q(t,e);if(n!==t){this.state=n;for(let e of this.listeners)e(n,t)}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}},Le=class{objectUrls=new Set;async resolveImageSource(e,t){return t.src}revokeAll(){for(let e of this.objectUrls)URL.revokeObjectURL(e);this.objectUrls.clear()}},Re=class{handlers=new Map;on(e,t){let n=this.handlers.get(e);return n||(n=new Set,this.handlers.set(e,n)),n.add(t),()=>{n.delete(t)}}emit(e,t){let n=this.handlers.get(e);if(n)for(let e of n)try{e(t)}catch(e){console.error(e)}}clear(){this.handlers.clear()}},ze=class{container;store;storage;assetLoader;renderer;i18n;events=new Re;unsubscribers=[];notificationTimers=new Map;autoTimer;mobileMediaQuery;lockLayoutMode=!1;constructor(e,i){this.container=e;let a=r(t,{...i.settings,locale:i.locale??i.settings?.locale??t.locale});this.lockLayoutMode=i.lockLayoutMode??!1,this.storage=new Y(i.storage),this.assetLoader=new Le,this.i18n=new d(a.locale,i.translations),this.store=new Ie(n(i.manga,a,i.initialPageIndex));let o={goToPage:e=>{this.store.getState().autoPageTurnEnabled||this.goToPage(e)},nextPage:()=>{this.store.getState().autoPageTurnEnabled||this.nextPage()},previousPage:()=>{this.store.getState().autoPageTurnEnabled||this.previousPage()},commitNextPage:()=>this.commitNextPage(),commitPreviousPage:()=>this.commitPreviousPage(),toggleOverlay:e=>this.toggleOverlay(e),toggleAutoPageTurn:()=>this.toggleAutoPageTurn(),updateSettings:e=>{this.updateSettings(e)},setLayoutMode:e=>void this.setLayoutMode(e),setWideHeight:e=>this.setWideHeight(e),setPanel:e=>{this.store.dispatch({type:`setPanel`,panel:e})},setZoom:(e,t,n)=>this.store.dispatch({type:`setZoom`,scale:e,panX:t,panY:n}),setPan:(e,t)=>this.store.dispatch({type:`setPan`,panX:e,panY:t}),resetZoom:()=>this.store.dispatch({type:`resetZoom`})};this.renderer=new Pe(this.container,o,this.assetLoader,this.i18n,i.className,i.resolvePageSrc,this.lockLayoutMode,i.mascot);for(let[e,t]of Object.entries(i.events??{}))this.on(e,t);this.unsubscribers.push(this.store.subscribe((e,t)=>{this.renderer.update(e),this.afterStateChange(e,t)})),this.bindKeyboard(),this.bindViewportChange(),this.bootstrap()}destroy(){window.clearInterval(this.autoTimer);for(let e of this.notificationTimers.values())window.clearTimeout(e);this.notificationTimers.clear(),this.unsubscribers.forEach(e=>e()),this.assetLoader.revokeAll(),this.renderer.destroy(),this.events.emit(`destroy`,void 0),this.events.clear()}async setManga(e){let t=await this.storage.getProgress(e.id)??0;this.store.dispatch({type:`setManga`,manga:e,pageIndex:t})}async setPages(e){await this.setManga({...this.store.getState().manga,pages:e})}getState(){return this.store.getState()}async updateSettings(e){let t=e;this.lockLayoutMode&&`layoutMode`in e&&(t={...e},delete t.layoutMode),this.store.dispatch({type:`updateSettings`,settings:t});let n=this.store.getState().settings;this.i18n.setLocale(n.locale),await this.storage.saveSettings(n),this.events.emit(`settingsChange`,{settings:n})}goToPage(e){let t=this.store.getState().currentPageIndex;this.store.dispatch({type:`goToPage`,pageIndex:e});let n=this.store.getState().currentPageIndex;if(t!==n){let e=this.store.getState();this.storage.saveProgress(e.manga.id,n),this.events.emit(`pageChange`,{pageIndex:n,page:e.manga.pages[n]})}}nextPage(){this.renderer.isAnimatingPageTurn()||this.commitNextPage()}previousPage(){this.renderer.isAnimatingPageTurn()||this.commitPreviousPage()}commitNextPage(){if(this.renderer.isMobileViewport()){this.goToPage(this.store.getState().currentPageIndex+1);return}let e=this.store.getState().currentPageIndex;this.store.dispatch({type:`nextPage`}),this.emitPageChangeIfNeeded(e)}commitPreviousPage(){if(this.renderer.isMobileViewport()){this.goToPage(this.store.getState().currentPageIndex-1);return}let e=this.store.getState().currentPageIndex;this.store.dispatch({type:`previousPage`}),this.emitPageChangeIfNeeded(e)}toggleOverlay(e){let t=this.store.getState().overlayVisible,n=e??!t;this.store.dispatch({type:`setOverlayVisible`,visible:n})}toggleAutoPageTurn(){this.store.dispatch({type:`toggleAutoPageTurn`}),this.syncAutoTimer();let e=this.store.getState().autoPageTurnEnabled;this.notify(this.i18n.t(e?`autoplay.start`:`autoplay.stop`))}async toggleFullscreen(){if(this.lockLayoutMode)return;let e=this.store.getState();if(document.fullscreenElement){await document.exitFullscreen(),await this.setLayoutMode(`inline`);return}await this.setLayoutMode(e.layout.mode===`nativeFullscreen`?`inline`:`nativeFullscreen`)}on(e,t){return this.events.on(e,t)}async bootstrap(){let e=await this.storage.getSettings(),t=await this.storage.getLayout(),n=this.store.getState().manga.id,r=await this.storage.getProgress(n);if(e){let t={...e};this.lockLayoutMode&&delete t.layoutMode,this.store.dispatch({type:`updateSettings`,settings:t})}if(!this.lockLayoutMode&&t?.mode){let e=t.mode===`theater`?`wide`:t.mode;this.store.dispatch({type:`setLayoutMode`,layoutMode:e})}let i=t?.wideHeightPx??t?.theaterHeightPx;i&&this.store.dispatch({type:`setWideHeight`,heightPx:i}),typeof r==`number`&&this.store.dispatch({type:`goToPage`,pageIndex:r}),this.renderer.update(this.store.getState()),this.renderer.showSplash(),window.setTimeout(()=>{this.toggleOverlay(!0)},1550),this.events.emit(`ready`,{manga:this.store.getState().manga})}bindKeyboard(){this.renderer.getElement();let e=e=>{if(this.shouldHandleKeyboardEvent(e))switch(e.key){case`ArrowLeft`:e.preventDefault(),this.moveFromKey(`left`);break;case`ArrowRight`:e.preventDefault(),this.moveFromKey(`right`);break;case` `:e.preventDefault(),this.moveFromKey(e.shiftKey?`right`:`left`);break;case`a`:case`A`:e.preventDefault(),this.toggleAutoPageTurn();break;case`n`:case`N`:case`Escape`:if(this.lockLayoutMode)break;e.preventDefault(),this.setLayoutMode(`inline`);break;case`w`:case`W`:if(this.lockLayoutMode)break;e.preventDefault(),this.setLayoutMode(`wide`);break;case`f`:case`F`:if(this.lockLayoutMode)break;e.preventDefault(),this.setLayoutMode(`browserFullscreen`);break;case`m`:case`M`:{e.preventDefault();let t=this.store.getState().panel,n=t===`menu`||t===`pages`||t===`shortcuts`;this.store.dispatch({type:`setPanel`,panel:n?`none`:`menu`}),n||this.toggleOverlay(!0);break}case`p`:case`P`:e.preventDefault(),this.updateSettings({pageTurnMode:this.store.getState().settings.pageTurnMode===`spread`?`single`:`spread`});break;case`o`:case`O`:e.preventDefault(),this.toggleOverlay();break;case`s`:case`S`:{e.preventDefault();let t=this.store.getState().panel===`settings`;this.store.dispatch({type:`setPanel`,panel:t?`none`:`settings`}),t||this.toggleOverlay(!0);break}case`Escape`:e.preventDefault(),this.store.dispatch({type:`setPanel`,panel:`none`}),document.fullscreenElement&&document.exitFullscreen();break}};window.addEventListener(`keydown`,e),this.unsubscribers.push(()=>window.removeEventListener(`keydown`,e))}shouldHandleKeyboardEvent(e){let t=e.target;return t instanceof Element?!t.closest(`input, select, textarea, [contenteditable='true']`):!0}bindViewportChange(){this.mobileMediaQuery=window.matchMedia(`(max-width: 676px)`);let e=()=>{this.renderer.update(this.store.getState())};this.mobileMediaQuery.addEventListener(`change`,e),this.unsubscribers.push(()=>this.mobileMediaQuery?.removeEventListener(`change`,e))}moveFromKey(e){this.store.getState().autoPageTurnEnabled||(this.store.getState().settings.readingDirection===`rtl`?e===`left`?this.nextPage():this.previousPage():e===`left`?this.previousPage():this.nextPage())}async setLayoutMode(e){if(!this.lockLayoutMode){if(e===`nativeFullscreen`)try{await this.renderer.getElement().requestFullscreen()}catch{e=`browserFullscreen`}else document.fullscreenElement&&await document.exitFullscreen();if(e===`wide`&&!this.store.getState().layout.wideHeightPx){let e=this.renderer.getElement().offsetHeight;e>0&&this.store.dispatch({type:`setWideHeight`,heightPx:e})}this.store.dispatch({type:`setLayoutMode`,layoutMode:e}),await this.storage.saveSettings(this.store.getState().settings),await this.storage.saveLayout(this.store.getState().layout),this.events.emit(`layoutChange`,{layoutMode:e})}}setWideHeight(e){this.store.dispatch({type:`setWideHeight`,heightPx:e}),this.storage.saveLayout(this.store.getState().layout)}afterStateChange(e,t){e.autoPageTurnEnabled!==t.autoPageTurnEnabled&&this.syncAutoTimer()}syncAutoTimer(){window.clearInterval(this.autoTimer),this.store.getState().autoPageTurnEnabled&&(this.autoTimer=window.setInterval(()=>{let e=this.store.getState(),t=a(e.settings,e.currentPageIndex);if(e.currentPageIndex+t>=e.manga.pages.length){this.toggleAutoPageTurn();return}this.commitNextPage()},this.store.getState().settings.autoPageTurnIntervalMs))}emitPageChangeIfNeeded(e){let t=this.store.getState();t.currentPageIndex!==e&&(this.storage.saveProgress(t.manga.id,t.currentPageIndex),this.events.emit(`pageChange`,{pageIndex:t.currentPageIndex,page:t.manga.pages[t.currentPageIndex]}))}notify(e,t=`info`){for(let e of this.notificationTimers.values())window.clearTimeout(e);this.notificationTimers.clear();let n=`${Date.now()}-${Math.random().toString(36).slice(2)}`;this.store.dispatch({type:`pushNotification`,notification:{id:n,message:e,tone:t,createdAt:Date.now()}});let r=window.setTimeout(()=>{this.store.dispatch({type:`removeNotification`,id:n}),this.notificationTimers.delete(n)},3e3);this.notificationTimers.set(n,r)}};function Be(e,t){return new ze(e,t)}return e.createMangaViewer=Be,e})({});
|
|
@@ -27,6 +27,8 @@ export declare class ViewerRenderer {
|
|
|
27
27
|
private controlsDock?;
|
|
28
28
|
private resizeHandle?;
|
|
29
29
|
private viewSizeObserver?;
|
|
30
|
+
private autoplayOverlayProgress?;
|
|
31
|
+
private autoplayOverlayProgressBar?;
|
|
30
32
|
constructor(container: HTMLElement, callbacks: RendererCallbacks, assetLoader: AssetLoader, i18n: I18n, className?: string, resolvePageSrc?: PageSrcResolver, lockLayoutMode?: boolean, mascot?: MascotOption | undefined);
|
|
31
33
|
private observeViewSize;
|
|
32
34
|
update(state: ViewerState): void;
|
|
@@ -37,6 +39,7 @@ export declare class ViewerRenderer {
|
|
|
37
39
|
isAnimatingPageTurn(): boolean;
|
|
38
40
|
animatePageTurn(state: ViewerState, direction: "previous" | "next", onComplete: () => void): boolean;
|
|
39
41
|
isMobileViewport(): boolean;
|
|
42
|
+
private syncAutoplayOverlayProgress;
|
|
40
43
|
private clampPan;
|
|
41
44
|
private clampedZoom;
|
|
42
45
|
private syncResizeHandle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer-renderer.d.ts","sourceRoot":"","sources":["../../src/renderer/viewer-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAgBnD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAY9D,qBAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"viewer-renderer.d.ts","sourceRoot":"","sources":["../../src/renderer/viewer-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAgBnD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAY9D,qBAAa,cAAc;IAuBvB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,IAAI;IAGZ,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,MAAM,CAAC;IA7BjB,OAAO,CAAC,IAAI,CAAiB;IAC7B,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAsC;IACzD,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,iBAAiB,CAAC,CAAS;IACnC,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7B,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,SAAS,CAAC,CAAY;IAC9B,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,YAAY,CAAC,CAAe;IACpC,OAAO,CAAC,YAAY,CAAC,CAAiB;IACtC,OAAO,CAAC,gBAAgB,CAAC,CAAiB;IAC1C,OAAO,CAAC,uBAAuB,CAAC,CAAiB;IACjD,OAAO,CAAC,0BAA0B,CAAC,CAAkB;gBAG3C,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,eAAe,EACxB,cAAc,UAAQ,EACtB,MAAM,CAAC,EAAE,YAAY,YAAA;IAc/B,OAAO,CAAC,eAAe;IAqBvB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAgHhC,OAAO,CAAC,sBAAsB;IAW9B,UAAU,IAAI,IAAI;IAalB,OAAO,IAAI,IAAI;IAgBf,UAAU,IAAI,WAAW;IAIzB,mBAAmB,IAAI,OAAO;IAI9B,eAAe,CACb,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,UAAU,GAAG,MAAM,EAC9B,UAAU,EAAE,MAAM,IAAI,GACrB,OAAO;IAoBV,gBAAgB,IAAI,OAAO;IAI3B,OAAO,CAAC,2BAA2B;IA6BnC,OAAO,CAAC,QAAQ;IAwBhB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,kBAAkB;IAmC1B,OAAO,CAAC,YAAY;IAoOpB,OAAO,CAAC,cAAc;IAoCtB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,mBAAmB;CAuB5B"}
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,KAAK,CAAC;AAC7C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC/C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,CAAC;AAChD,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,MAAM,GACN,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7C,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,KAAK,CAAC;AAC7C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC/C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,CAAC;AAChD,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,MAAM,GACN,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7C,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,eAAe,EAAE,eAAe,CAAC;IACjC,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE;QACN,IAAI,EAAE,UAAU,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,aAAa,EAAE,kBAAkB,EAAE,CAAC;IACpC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;CAC7D;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACzC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,MAAM,EAAE,MAAM,WAAW,CAAA;CAAE,GAC7B,KAAK,CAAC;AAEV,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,cAAc,KACpB,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9B,MAAM,WAAW,mBAAmB;IAClC,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,QAAQ,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC;IAClC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,IAAI,IAAI,CAAC;IACjB,YAAY,IAAI,IAAI,CAAC;IACrB,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACrC,kBAAkB,IAAI,IAAI,CAAC;IAC3B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,EAAE,CAAC,CAAC,SAAS,eAAe,EAC1B,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B,MAAM,IAAI,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;IACxB,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;IACnD,cAAc,EAAE;QAAE,QAAQ,EAAE,cAAc,CAAA;KAAE,CAAC;IAC7C,YAAY,EAAE;QAAE,UAAU,EAAE,UAAU,CAAA;KAAE,CAAC;IACzC,OAAO,EAAE,IAAI,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,cAAc,CAAC;AACnD,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,IAAI,CAC1D,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,KACvB,IAAI,CAAC;AACV,MAAM,MAAM,sBAAsB,GAAG;KAClC,CAAC,IAAI,eAAe,GAAG,kBAAkB,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,YAAY,EAAE,kBAAkB,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/docs/USAGE.md
CHANGED
|
@@ -141,7 +141,6 @@ interface HtmlPage {
|
|
|
141
141
|
| `pageTurnMode` | `"single"` | `"single"` / `"spread"`(2ページ見開き) |
|
|
142
142
|
| `layoutMode` | `"inline"` | `"inline"`, `"wide"`, `"browserFullscreen"`, `"nativeFullscreen"` |
|
|
143
143
|
| `autoPageTurnIntervalMs` | `5000` | 自動再生の間隔 (ms) |
|
|
144
|
-
| `pageTurnAnimation` | `true` | ページめくり時のスライドアニメ |
|
|
145
144
|
| `backgroundColor` | `"white"` | `"white"` / `"black"`(ビューワー本体の背景色) |
|
|
146
145
|
| `zoom.min` / `.max` / `.step` | `1` / `4` / `0.25` | ズームの範囲とステップ |
|
|
147
146
|
|
|
@@ -193,9 +192,10 @@ createMangaViewer(container, {
|
|
|
193
192
|
|
|
194
193
|
## ジェスチャー
|
|
195
194
|
|
|
196
|
-
- 中央
|
|
197
|
-
- 左
|
|
198
|
-
-
|
|
195
|
+
- 中央 40% のクリック / タップ: オーバーレイの表示切替
|
|
196
|
+
- 左 30% / 右 30% のクリック / タップ(オーバーレイ閉時のみ): 前 / 次ページ(`readingDirection` に応じて向きが変わる)。アニメーションなしで即時切替
|
|
197
|
+
- 左右ボタン / キーボード(←→Space): 同じく即時切替
|
|
198
|
+
- スワイプ / ドラッグ: ページ移動。しきい値 40px、横方向優先。**こちらは常にスライドアニメーションする**
|
|
199
199
|
- ピンチ: ズーム(`zoom.min`〜`zoom.max` でクランプ)
|
|
200
200
|
- ズーム中のドラッグ: パン(ページの範囲内にクランプ)
|
|
201
201
|
|
|
@@ -203,7 +203,7 @@ createMangaViewer(container, {
|
|
|
203
203
|
|
|
204
204
|
`storage.enabled` を `false` にしない限り、`indexedDB` が利用可能な環境では以下を自動で保存します。
|
|
205
205
|
|
|
206
|
-
- 全体設定(locale, readingDirection, hasCover, pageTurnMode,
|
|
206
|
+
- 全体設定(locale, readingDirection, hasCover, pageTurnMode, autoPageTurnIntervalMs, backgroundColor)
|
|
207
207
|
- 現在のレイアウトモードと wide の高さ
|
|
208
208
|
- 漫画ごとの現在ページ(`manga.id` をキーに保存)
|
|
209
209
|
|
package/locales/en.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"settings.backgroundColor.black": "Black",
|
|
22
22
|
"settings.interval": "Auto play interval",
|
|
23
23
|
"settings.interval.unit": "s",
|
|
24
|
-
"settings.animation": "Page turn animation",
|
|
25
24
|
"settings.direction.rtl": "Right to left",
|
|
26
25
|
"settings.direction.ltr": "Left to right",
|
|
27
26
|
"menu.openShortcuts": "Keyboard shortcuts",
|
package/locales/id.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"settings.backgroundColor.black": "Hitam",
|
|
22
22
|
"settings.interval": "Interval putar otomatis",
|
|
23
23
|
"settings.interval.unit": "dtk",
|
|
24
|
-
"settings.animation": "Animasi balik halaman",
|
|
25
24
|
"settings.direction.rtl": "Kanan",
|
|
26
25
|
"settings.direction.ltr": "Kiri",
|
|
27
26
|
"menu.openShortcuts": "Pintasan keyboard",
|
package/locales/ja.json
CHANGED
package/locales/ko.json
CHANGED
package/locales/th.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"settings.backgroundColor.black": "ดำ",
|
|
22
22
|
"settings.interval": "ระยะเวลาเล่นอัตโนมัติ",
|
|
23
23
|
"settings.interval.unit": "วินาที",
|
|
24
|
-
"settings.animation": "อนิเมชันการพลิกหน้า",
|
|
25
24
|
"settings.direction.rtl": "ขวา",
|
|
26
25
|
"settings.direction.ltr": "ซ้าย",
|
|
27
26
|
"menu.openShortcuts": "คีย์ลัด",
|
package/locales/zh-CN.json
CHANGED