Skip to content

Commit 4b73ec9

Browse files
committed
Update Picviewer CE+.user.js
1 parent c8320dd commit 4b73ec9

File tree

1 file changed

+36
-11
lines changed

1 file changed

+36
-11
lines changed

Picviewer CE+/Picviewer CE+.user.js

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// @description:ja 画像を強力に閲覧できるツール。ポップアップ表示、拡大・縮小、回転、一括保存などの機能を自動で実行できます
1313
// @description:pt-BR Poderosa ferramenta de visualização de imagens on-line, que pode pop-up/dimensionar/girar/salvar em lote imagens automaticamente
1414
// @description:ru Мощный онлайн-инструмент для просмотра изображений, который может автоматически отображать/масштабировать/вращать/пакетно сохранять изображения
15-
// @version 2026.1.13.1
15+
// @version 2026.1.17.1
1616
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAV1BMVEUAAAD////29vbKysoqKioiIiKysrKhoaGTk5N9fX3z8/Pv7+/r6+vk5OTb29vOzs6Ojo5UVFQzMzMZGRkREREMDAy4uLisrKylpaV4eHhkZGRPT08/Pz/IfxjQAAAAgklEQVQoz53RRw7DIBBAUb5pxr2m3/+ckfDImwyJlL9DDzQgDIUMRu1vWOxTBdeM+onApENF0qHjpkOk2VTwLVEF40Kbfj1wK8AVu2pQA1aBBYDHJ1wy9Cf4cXD5chzNAvsAnc8TjoLAhIzsBao9w1rlVTIvkOYMd9nm6xPi168t9AYkbANdajpjcwAAAABJRU5ErkJggg==
1717
// @namespace https://github.com/hoothin/UserScripts
1818
// @homepage https://pv.hoothin.com/
@@ -24224,15 +24224,33 @@ ImgOps | https://imgops.com/#b#`;
2422424224
const loaded = await Promise.all(srcs.map(src => this.loadImageForStitch(src)));
2422524225
let totalW = 0;
2422624226
let totalH = 0;
24227+
let maxW = 0;
24228+
let maxH = 0;
24229+
loaded.forEach(({img}) => {
24230+
const w = img.naturalWidth || img.width;
24231+
const h = img.naturalHeight || img.height;
24232+
if (w > maxW) maxW = w;
24233+
if (h > maxH) maxH = h;
24234+
});
2422724235
if (layout === 'column') {
2422824236
loaded.forEach(({img}) => {
24229-
totalW = Math.max(totalW, img.naturalWidth || img.width);
24230-
totalH += img.naturalHeight || img.height;
24237+
const w = img.naturalWidth || img.width;
24238+
const h = img.naturalHeight || img.height;
24239+
const ratio = w ? (maxW / w) : 1;
24240+
const drawW = maxW || w;
24241+
const drawH = h * ratio;
24242+
totalW = Math.max(totalW, drawW);
24243+
totalH += drawH;
2423124244
});
2423224245
} else {
2423324246
loaded.forEach(({img}) => {
24234-
totalW += img.naturalWidth || img.width;
24235-
totalH = Math.max(totalH, img.naturalHeight || img.height);
24247+
const w = img.naturalWidth || img.width;
24248+
const h = img.naturalHeight || img.height;
24249+
const ratio = h ? (maxH / h) : 1;
24250+
const drawH = maxH || h;
24251+
const drawW = w * ratio;
24252+
totalW += drawW;
24253+
totalH = Math.max(totalH, drawH);
2423624254
});
2423724255
}
2423824256
const canvas = document.createElement('canvas');
@@ -24244,11 +24262,17 @@ ImgOps | https://imgops.com/#b#`;
2424424262
const w = img.naturalWidth || img.width;
2424524263
const h = img.naturalHeight || img.height;
2424624264
if (layout === 'column') {
24247-
ctx.drawImage(img, 0, offset, w, h);
24248-
offset += h;
24265+
const ratio = w ? (maxW / w) : 1;
24266+
const drawW = maxW || w;
24267+
const drawH = h * ratio;
24268+
ctx.drawImage(img, 0, offset, drawW, drawH);
24269+
offset += drawH;
2424924270
} else {
24250-
ctx.drawImage(img, offset, 0, w, h);
24251-
offset += w;
24271+
const ratio = h ? (maxH / h) : 1;
24272+
const drawH = maxH || h;
24273+
const drawW = w * ratio;
24274+
ctx.drawImage(img, offset, 0, drawW, drawH);
24275+
offset += drawW;
2425224276
}
2425324277
});
2425424278
const blob = await new Promise(resolve => canvas.toBlob(resolve, 'image/png'));
@@ -28266,7 +28290,7 @@ ImgOps | https://imgops.com/#b#`;
2826628290
var configStyle = document.createElement("style");
2826728291
configStyle.textContent = "#pv-prefs { display: initial; }";
2826828292
configStyle.type = 'text/css';
28269-
if (location.hostname == "hoothin.github.io" && location.pathname == "/UserScripts/Picviewer%20CE+/") {
28293+
if ((location.hostname == "hoothin.github.io" && location.pathname == "/UserScripts/Picviewer%20CE+/") || (location.hostname == "pv.hoothin.com" && location.pathname.indexOf("open-settings") !== -1)) {
2827028294
openPrefs();
2827128295
} else if (location.hostname == "hoothin.github.io" && location.pathname == "/UserScripts/Picviewer%20CE+/gallery.html") {
2827228296
let gallery = new GalleryC();
@@ -28382,7 +28406,7 @@ ImgOps | https://imgops.com/#b#`;
2838228406

2838328407
setTimeout(()=>{
2838428408
if (GM_config.frame && GM_config.frame.contentDocument.body.innerHTML === "") {
28385-
_GM_openInTab("https://hoothin.github.io/UserScripts/Picviewer%20CE+/", {active:true});
28409+
_GM_openInTab("https://pv.hoothin.com/open-settings", {active:true});
2838628410
return;
2838728411
}
2838828412
if (GM_config.frame && GM_config.frame.style && GM_config.frame.style.display == "none") {
@@ -28420,6 +28444,7 @@ ImgOps | https://imgops.com/#b#`;
2842028444
try {
2842128445
if (localStorage && localStorage.setItem) {
2842228446
if (!storage.getItem('inited')) {
28447+
_GM_openInTab("https://pv.hoothin.com/first-run");
2842328448
localStorage.setItem('picviewerCE.config.curTab', 4);
2842428449
storage.setItem('inited', true);
2842528450
}

0 commit comments

Comments
 (0)