Skip to content

Commit 1d601ee

Browse files
committed
chore(Picviewer CE+): Auto-generate dist.user.js with timestamp
1 parent 08f740e commit 1d601ee

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

Picviewer CE+/dist.user.js

Lines changed: 37 additions & 8 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 2025.9.5.2
15+
// @version 2025.9.10.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://github.com/hoothin/UserScripts/tree/master/Picviewer%20CE%2B
@@ -45,9 +45,9 @@
4545
// @grant GM.registerMenuCommand
4646
// @grant GM.notification
4747
// @grant unsafeWindow
48-
// @require http://hoothin.github.io/UserScripts/Picviewer%20CE%2B/GM_config%20CN.js?v=1757244391
49-
// @require http://hoothin.github.io/UserScripts/Picviewer%20CE%2B/pvcep_rules.js?v=1757244391
50-
// @require http://hoothin.github.io/UserScripts/Picviewer%20CE%2B/pvcep_lang.js?v=1757244391
48+
// @require http://hoothin.github.io/UserScripts/Picviewer%20CE%2B/GM_config%20CN.js?v=1757505897
49+
// @require http://hoothin.github.io/UserScripts/Picviewer%20CE%2B/pvcep_rules.js?v=1757505897
50+
// @require http://hoothin.github.io/UserScripts/Picviewer%20CE%2B/pvcep_lang.js?v=1757505897
5151
// @match *://*/*
5252
// @exclude http://www.toodledo.com/tasks/*
5353
// @exclude http*://maps.google.com*/*
@@ -12218,7 +12218,33 @@ ImgOps | https://imgops.com/#b#`;
1221812218
img.src = dataurl;
1221912219
}
1222012220
function urlToBlobWithFetch(urlString, cb){
12221-
fetch(urlString).then(response => response.blob()).then(blob => cb(blob)).catch(error => {
12221+
fetch(urlString).then(response => response.blob()).then(blob => {
12222+
let ext = blob.type.replace(/.*image\/([\w\-]+).*/, "$1");
12223+
if (ext === "text/html" && (blob.size || 0) < 1000) return cb(null, '');
12224+
if (ext === "none") ext = "webp";
12225+
let conversion = formatDict.get(ext);
12226+
if (canvas && conversion) {
12227+
var self = this;
12228+
var a = new FileReader();
12229+
a.readAsDataURL(blob);
12230+
a.onload = function (e) {
12231+
dataURLToCanvas(e.target.result, canvas => {
12232+
canvas.toBlob(nblob => {
12233+
if (!nblob) {
12234+
cb(blob);
12235+
} else {
12236+
cb(nblob, conversion || "png");
12237+
}
12238+
}, "image/" + (conversion || "png"));
12239+
});
12240+
};
12241+
a.onerror = function (e){
12242+
cb(blob);
12243+
}
12244+
} else {
12245+
cb(blob);
12246+
}
12247+
}).catch(error => {
1222212248
cb(null);
1222312249
});
1222412250
}
@@ -15756,9 +15782,10 @@ ImgOps | https://imgops.com/#b#`;
1575615782
var len = saveParams.length;
1575715783
function downloadOne(imgSrc, imgName, over){
1575815784
let crosHandler = imgSrc => {
15759-
urlToBlob(imgSrc, blob=>{
15785+
urlToBlob(imgSrc, (blob, ext)=>{
1576015786
if (blob && blob.size>58) {
1576115787
let fileName = imgName.replace(/\//g, "");
15788+
if (ext) fileName = fileName.replace(/\.\w+$/, "") + "." + ext;
1576215789
zip.file(fileName, blob);
1576315790
} else console.debug("error: "+imgSrc);
1576415791
downloaded++;
@@ -15776,13 +15803,15 @@ ImgOps | https://imgops.com/#b#`;
1577615803
});
1577715804
}
1577815805
if(canvas && (/^data:/.test(imgSrc) || imgSrc.split("/")[2] == document.domain)){
15779-
urlToBlobWithFetch(imgSrc, blob=>{
15806+
urlToBlobWithFetch(imgSrc, (blob, ext)=>{
1578015807
if(!blob){
1578115808
crosHandler(imgSrc);
1578215809
return;
1578315810
}
1578415811
self.showTips("Downloading "+(downloaded+1)+"/"+len, 1000000);
15785-
zip.file(imgName.replace(/^data:.*/, "img").replace(/\//g,""), blob);
15812+
let fileName = imgName.replace(/^data:.*/, "img").replace(/\//g,"");
15813+
if (ext) fileName = fileName.replace(/\.\w+$/, "") + "." + ext;
15814+
zip.file(fileName, blob);
1578615815
downloaded++;
1578715816
over && over();
1578815817
if(downloaded == len){

0 commit comments

Comments
 (0)