|
6 | 6 | // @description Powerful picture viewing tool online, which can popup/scale/rotate/batch save pictures or find the HD original picture automatically |
7 | 7 | // @description:zh-CN NLF 的围观图修改版,增加高清原图查找显示(在线看图工具,支持图片翻转、旋转、缩放、弹出大图、批量保存、查找原图) |
8 | 8 | // @description:zh-TW NLF 的圍觀圖修改版,增加高清原圖查詢顯示(線上看圖工具,支援圖片翻轉、旋轉、縮放、彈出大圖、批量儲存、查詢原圖) |
9 | | -// @version 2018.5.27.1 |
| 9 | +// @version 2018.5.28.1 |
10 | 10 | // @created 2011-6-15 |
11 | 11 | // @namespace http://userscripts.org/users/NLF |
12 | 12 | // @homepage http://hoothin.com |
|
3773 | 3773 | img.className='pv-gallery-img'; |
3774 | 3774 |
|
3775 | 3775 | 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 | + } |
3779 | 3806 | }else{ |
3780 | 3807 | this.imgError=false; |
3781 | 3808 | this.eleMaps['img_broken'].style.display=''; |
|
3853 | 3880 | }; |
3854 | 3881 | scaled=(scaled*100).toFixed(2) + '%'; |
3855 | 3882 | }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){ |
3857 | 3884 | var height=contentSSize.h-50; |
3858 | 3885 | height=height<0?contentSSize.h:height; |
3859 | 3886 | imgSty.height=height + 'px'; |
|
3912 | 3939 | spanMark.outerHTML = '<span class="pv-gallery-sidebar-thumb-container' + |
3913 | 3940 | '" data-type="' + item.type + |
3914 | 3941 | '" data-src="' + item.src + |
| 3942 | + '" data-srcs="' + (item.srcs?item.srcs.join(","):"") + |
3915 | 3943 | (item.xhr ? '" data-xhr="' + encodeURIComponent(JSON.stringify(item.xhr)) : '') + |
3916 | 3944 | '" data-description="' + encodeURIComponent(item.description || '') + |
3917 | 3945 | '" data-thumb-src="' + item.imgSrc + |
|
4652 | 4680 | [].forEach.call(document.querySelectorAll("body>div"),function(i){\ |
4653 | 4681 | i.onclick=function(){this.classList.toggle("select")}\ |
4654 | 4682 | });\ |
4655 | | - </script></body>' |
| 4683 | + </script></body>'; |
4656 | 4684 | GM_openInTab('data:text/html;charset=utf-8,' + encodeURIComponent(html)); |
4657 | 4685 | }, |
4658 | 4686 | copyImages: function(isAlert) { |
|
0 commit comments