cbz fixes

This commit is contained in:
AppleTheGolden 2025-10-11 17:50:01 +02:00
parent 076bf52c13
commit e9c855e1f8
No known key found for this signature in database
GPG key ID: F6AC8A62154C42AA
2 changed files with 15 additions and 17 deletions

View file

@ -171,7 +171,7 @@ window.baguetteBox = (function () {
};
var imageItem = {
eventHandler: imageElementClickHandler,
imageElement: imageElement
imageElement: imageElement,
};
bind(imageElement, 'click', imageElementClickHandler);
gallery.push(imageItem);
@ -210,6 +210,9 @@ window.baguetteBox = (function () {
}
function fillCbzGallery(gallery, cbzElement, eventHandler) {
if (gallery.length !== 0) {
return Promise.resolve();
}
var href = cbzElement.href
var zlsHref = href + (href.indexOf("?") === -1 ? "?" : "&") + "zls";
console.log("pre-fetch")
@ -221,7 +224,7 @@ window.baguetteBox = (function () {
&& cbz_pics.indexOf(name.split(".").pop()) !== -1
).sort();
imagesList.forEach((imageName) => {
imagesList.forEach((imageName, index) => {
var imageHref = href
+ (href.indexOf("?") === -1 ? "?" : "&")
+ "zget="
@ -718,7 +721,7 @@ window.baguetteBox = (function () {
}, 50);
if (options.onChange && !url_ts)
options.onChange(currentIndex, imagesElements.length);
options.onChange.call(currentGallery, currentIndex, imagesElements.length);
url_ts = null;
documentLastFocus = document.activeElement;
@ -850,7 +853,7 @@ window.baguetteBox = (function () {
is_vid = re_v.test(imageSrc),
thumbnailElement = imageElement.querySelector('img, video'),
imageCaption = typeof options.captions === 'function' ?
options.captions.call(currentGallery, imageElement) :
options.captions.call(currentGallery, imageElement, index) :
imageElement.getAttribute('data-caption') || imageElement.title;
imageSrc = addq(imageSrc, 'cache');
@ -990,7 +993,7 @@ window.baguetteBox = (function () {
unfig(index);
if (options.onChange)
options.onChange(currentIndex, imagesElements.length);
options.onChange.call(currentGallery, currentIndex, imagesElements.length);
return true;
}

View file

@ -17552,25 +17552,20 @@ var thegrid = (function () {
afterShow: function () {
r.bbox_opts.refocus = true;
},
captions: function (g) {
var idx = -1,
h = '' + g;
for (var a = 0; a < r.bbox.length; a++)
if (r.bbox[a].imageElement == g)
idx = a;
captions: function (g, idx) {
var h = '' + g;
return '<a download href="' + h +
'">' + (idx + 1) + ' / ' + r.bbox.length + ' -- ' +
'">' + (idx + 1) + ' / ' + this.length + ' -- ' +
esc(uricom_dec(h.split('/').pop())) + '</a>';
},
onChange: function (i) {
if (r.bbox[i]) {
sethash('g' + r.bbox[i].imageElement.getAttribute('ref') + getsort());
onChange: function (i, maxIdx) {
if (this[i].imageElement) {
sethash('g' + this[i].imageElement.getAttribute('ref') + getsort());
}
}
});
r.bbox = br[0][0];
r.bbox = true;
r.bbox_opts = br[1];
};