Skip to content

Commit 2d43a5b

Browse files
committed
fix
1 parent 52e7554 commit 2d43a5b

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

Picviewer CE+/Picviewer CE+.user.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// @description Powerful picture viewing tool online, which can popup/scale/rotate/batch save pictures or find the HD original picture automatically
77
// @description:zh-CN NLF 的围观图修改版,增加高清原图查找显示(在线看图工具,支持图片翻转、旋转、缩放、弹出大图、批量保存、查找原图)
88
// @description:zh-TW NLF 的圍觀圖修改版,增加高清原圖查詢顯示(線上看圖工具,支援圖片翻轉、旋轉、縮放、彈出大圖、批量儲存、查詢原圖)
9-
// @version 2018.5.27.1
9+
// @version 2018.5.28.1
1010
// @created 2011-6-15
1111
// @namespace http://userscripts.org/users/NLF
1212
// @homepage http://hoothin.com
@@ -3773,9 +3773,36 @@
37733773
img.className='pv-gallery-img';
37743774

37753775
if(error){
3776-
this.imgError=true;
3777-
this.img.style.display='none';
3778-
this.eleMaps['img_broken'].style.display='inline-block';
3776+
if(relatedThumb.querySelector("img").src==this.img.src){
3777+
this.imgError=true;
3778+
this.img.style.display='none';
3779+
this.eleMaps['img_broken'].style.display='inline-block';
3780+
}else{
3781+
var srcs=dataset(relatedThumb, 'srcs').split(",");
3782+
var self=this;
3783+
this.img.onload=function(){
3784+
var imgNaturalSize={
3785+
h:this.naturalHeight,
3786+
w:this.naturalWidth,
3787+
};
3788+
3789+
self.imgNaturalSize=imgNaturalSize;
3790+
self.fitToScreen();
3791+
}
3792+
if(srcs){
3793+
var src=srcs.shift();
3794+
dataset(relatedThumb, 'srcs',srcs.join(","));
3795+
if(src){
3796+
dataset(relatedThumb, 'src',src);
3797+
this.img.onerror=function(e){
3798+
this.src=relatedThumb.querySelector("img").src;
3799+
dataset(relatedThumb, 'src',this.src);
3800+
}
3801+
this.img.src=src;
3802+
}
3803+
}
3804+
else this.img.src=relatedThumb.querySelector("img").src;
3805+
}
37793806
}else{
37803807
this.imgError=false;
37813808
this.eleMaps['img_broken'].style.display='';
@@ -3853,7 +3880,7 @@
38533880
};
38543881
scaled=(scaled*100).toFixed(2) + '%';
38553882
}else if(prefs.gallery.fitToScreenSmall){
3856-
if(contentSSize.h/contentSSize.w >=containerSize.h/containerSize.w){
3883+
if(this.imgNaturalSize.h/this.imgNaturalSize.w >=containerSize.h/containerSize.w){
38573884
var height=contentSSize.h-50;
38583885
height=height<0?contentSSize.h:height;
38593886
imgSty.height=height + 'px';
@@ -3912,6 +3939,7 @@
39123939
spanMark.outerHTML = '<span class="pv-gallery-sidebar-thumb-container' +
39133940
'" data-type="' + item.type +
39143941
'" data-src="' + item.src +
3942+
'" data-srcs="' + (item.srcs?item.srcs.join(","):"") +
39153943
(item.xhr ? '" data-xhr="' + encodeURIComponent(JSON.stringify(item.xhr)) : '') +
39163944
'" data-description="' + encodeURIComponent(item.description || '') +
39173945
'" data-thumb-src="' + item.imgSrc +
@@ -4652,7 +4680,7 @@
46524680
[].forEach.call(document.querySelectorAll("body>div"),function(i){\
46534681
i.onclick=function(){this.classList.toggle("select")}\
46544682
});\
4655-
</script></body>'
4683+
</script></body>';
46564684
GM_openInTab('data:text/html;charset=utf-8,' + encodeURIComponent(html));
46574685
},
46584686
copyImages: function(isAlert) {

0 commit comments

Comments
 (0)