mirror of
https://github.com/usero2/obsidian-plugins-cbz-reader.git
synced 2026-07-22 07:43:42 +00:00
1.0.1
This commit is contained in:
parent
b5517ceadc
commit
83efca6119
5 changed files with 47 additions and 18 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2026 usero2
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
A powerful and fast native CBZ (Comic Book Archive) reader for Obsidian. Read your favorite mangas, comics, and graphic novels directly inside your Obsidian vault with a beautifully crafted, high-performance interface.
|
||||
|
||||

|
||||

|
||||
|
||||
## ✨ Features
|
||||
|
||||
|
|
|
|||
20
main.js
20
main.js
|
|
@ -119,8 +119,10 @@ class CbzView extends ItemView {
|
|||
const exactPosition = p * maxThumbTop;
|
||||
|
||||
// Update UI instantly
|
||||
minimapThumb.style.top = exactPosition + 'px';
|
||||
minimapThumb.style.height = tHeight + 'px';
|
||||
minimapThumb.setCssStyles({
|
||||
top: exactPosition + 'px',
|
||||
height: tHeight + 'px'
|
||||
});
|
||||
minimapView.scrollTop = exactPosition - yScreen;
|
||||
|
||||
// Map exactPosition back to targetIndex and percentage for mainView
|
||||
|
|
@ -148,7 +150,7 @@ class CbzView extends ItemView {
|
|||
const onMouseUp = () => {
|
||||
if (isDown) {
|
||||
isDown = false;
|
||||
minimapThumb.style.cursor = '';
|
||||
minimapThumb.setCssStyles({ cursor: '' });
|
||||
setTimeout(() => { isDraggingThumb = false; }, 50);
|
||||
}
|
||||
document.removeEventListener('mousemove', onMouseMove);
|
||||
|
|
@ -167,7 +169,7 @@ class CbzView extends ItemView {
|
|||
const parentRect = minimapView.getBoundingClientRect();
|
||||
startYScreen = rect.top - parentRect.top;
|
||||
|
||||
minimapThumb.style.cursor = 'grabbing';
|
||||
minimapThumb.setCssStyles({ cursor: 'grabbing' });
|
||||
|
||||
document.addEventListener('mousemove', onMouseMove);
|
||||
document.addEventListener('mouseup', onMouseUp);
|
||||
|
|
@ -301,8 +303,10 @@ class CbzView extends ItemView {
|
|||
|
||||
const exactPosition = parseInt(indexStr) * currentItemHeight + (percentage * currentItemHeight);
|
||||
const tHeight = updateThumbHeight();
|
||||
minimapThumb.style.height = tHeight + 'px';
|
||||
minimapThumb.style.top = exactPosition + 'px';
|
||||
minimapThumb.setCssStyles({
|
||||
height: tHeight + 'px',
|
||||
top: exactPosition + 'px'
|
||||
});
|
||||
|
||||
const trackContentHeight = Math.max(minimapView.scrollHeight, (this.imageFiles ? this.imageFiles.length : 0) * currentItemHeight);
|
||||
const trackViewHeight = minimapView.clientHeight;
|
||||
|
|
@ -432,7 +436,7 @@ class CbzView extends ItemView {
|
|||
img.src = url;
|
||||
|
||||
if (img.parentElement) {
|
||||
img.parentElement.style.minHeight = 'auto';
|
||||
img.parentElement.setCssStyles({ minHeight: 'auto' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Failed to load image at index ${index}`, err);
|
||||
|
|
@ -446,7 +450,7 @@ class CbzView extends ItemView {
|
|||
URL.revokeObjectURL(url);
|
||||
img.removeAttribute("src");
|
||||
if (img.parentElement) {
|
||||
img.parentElement.style.minHeight = `${img.height || 800}px`;
|
||||
img.parentElement.setCssStyles({ minHeight: `${img.height || 800}px` });
|
||||
}
|
||||
}
|
||||
this.loadedImages.delete(index);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "cbz-reader",
|
||||
"name": "CBZ Reader",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"minAppVersion": "1.0.0",
|
||||
"description": "A powerful and fast native CBZ (Comic Book Archive) reader",
|
||||
"author": "usero2-endofday",
|
||||
|
|
|
|||
20
plugin.js
20
plugin.js
|
|
@ -100,8 +100,10 @@ class CbzView extends ItemView {
|
|||
const exactPosition = p * maxThumbTop;
|
||||
|
||||
// Update UI instantly
|
||||
minimapThumb.style.top = exactPosition + 'px';
|
||||
minimapThumb.style.height = tHeight + 'px';
|
||||
minimapThumb.setCssStyles({
|
||||
top: exactPosition + 'px',
|
||||
height: tHeight + 'px'
|
||||
});
|
||||
minimapView.scrollTop = exactPosition - yScreen;
|
||||
|
||||
// Map exactPosition back to targetIndex and percentage for mainView
|
||||
|
|
@ -129,7 +131,7 @@ class CbzView extends ItemView {
|
|||
const onMouseUp = () => {
|
||||
if (isDown) {
|
||||
isDown = false;
|
||||
minimapThumb.style.cursor = '';
|
||||
minimapThumb.setCssStyles({ cursor: '' });
|
||||
setTimeout(() => { isDraggingThumb = false; }, 50);
|
||||
}
|
||||
document.removeEventListener('mousemove', onMouseMove);
|
||||
|
|
@ -148,7 +150,7 @@ class CbzView extends ItemView {
|
|||
const parentRect = minimapView.getBoundingClientRect();
|
||||
startYScreen = rect.top - parentRect.top;
|
||||
|
||||
minimapThumb.style.cursor = 'grabbing';
|
||||
minimapThumb.setCssStyles({ cursor: 'grabbing' });
|
||||
|
||||
document.addEventListener('mousemove', onMouseMove);
|
||||
document.addEventListener('mouseup', onMouseUp);
|
||||
|
|
@ -282,8 +284,10 @@ class CbzView extends ItemView {
|
|||
|
||||
const exactPosition = parseInt(indexStr) * currentItemHeight + (percentage * currentItemHeight);
|
||||
const tHeight = updateThumbHeight();
|
||||
minimapThumb.style.height = tHeight + 'px';
|
||||
minimapThumb.style.top = exactPosition + 'px';
|
||||
minimapThumb.setCssStyles({
|
||||
height: tHeight + 'px',
|
||||
top: exactPosition + 'px'
|
||||
});
|
||||
|
||||
const trackContentHeight = Math.max(minimapView.scrollHeight, (this.imageFiles ? this.imageFiles.length : 0) * currentItemHeight);
|
||||
const trackViewHeight = minimapView.clientHeight;
|
||||
|
|
@ -413,7 +417,7 @@ class CbzView extends ItemView {
|
|||
img.src = url;
|
||||
|
||||
if (img.parentElement) {
|
||||
img.parentElement.style.minHeight = 'auto';
|
||||
img.parentElement.setCssStyles({ minHeight: 'auto' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Failed to load image at index ${index}`, err);
|
||||
|
|
@ -427,7 +431,7 @@ class CbzView extends ItemView {
|
|||
URL.revokeObjectURL(url);
|
||||
img.removeAttribute("src");
|
||||
if (img.parentElement) {
|
||||
img.parentElement.style.minHeight = `${img.height || 800}px`;
|
||||
img.parentElement.setCssStyles({ minHeight: `${img.height || 800}px` });
|
||||
}
|
||||
}
|
||||
this.loadedImages.delete(index);
|
||||
|
|
|
|||
Loading…
Reference in a new issue