|
6 | 6 | // @description Powerful picture viewing tool online, which can popup/scale/rotate/batch save pictures automatically |
7 | 7 | // @description:zh-CN 在线看图工具,支持图片翻转、旋转、缩放、弹出大图、批量保存 |
8 | 8 | // @description:zh-TW 線上看圖工具,支援圖片翻轉、旋轉、縮放、彈出大圖、批量儲存 |
9 | | -// @version 2020.2.2.1 |
| 9 | +// @version 2020.4.15.1 |
10 | 10 | // @created 2011-6-15 |
11 | 11 | // @namespace http://userscripts.org/users/NLF |
12 | 12 | // @homepage http://hoothin.com |
|
144 | 144 | forceShowTip:"非缩放的图片大小超过下面设定的尺寸时显示浮动工具栏", |
145 | 145 | px:"像素", |
146 | 146 | minSizeLimit:"缩放图片,超过该尺寸,显示浮框", |
147 | | - minSizeLimitTip:"图片被缩放(图片原始大小与实际大小不一致)后,原图长宽大于设定值时显示浮动工具栏", |
| 147 | + minSizeLimitTip:"图片被缩放(图片原始大小与实际大小不一致)后,显示长宽大于设定值时显示浮动工具栏", |
148 | 148 | listenBg:"监听背景图", |
149 | 149 | listenBgTip:"在有背景图的元素上显示悬浮框", |
150 | 150 | butonOrder:"工具栏图标排序", |
|
328 | 328 | forceShowTip:"非縮放的圖片大小超過下面設定的尺寸時顯示浮動工具欄", |
329 | 329 | px:"像素", |
330 | 330 | minSizeLimit:"縮放圖片,超過該尺寸,顯示浮框", |
331 | | - minSizeLimitTip:"圖片被縮放(圖片原始大小與實際大小不一致)後,原圖長寬大於設定值時顯示浮動工具欄", |
| 331 | + minSizeLimitTip:"圖片被縮放(圖片原始大小與實際大小不一致)後,顯示長寬大於設定值時顯示浮動工具欄", |
332 | 332 | listenBg:"監聽背景圖", |
333 | 333 | listenBgTip:"在有背景圖的元素上顯示懸浮框", |
334 | 334 | butonOrder:"工具欄圖標排序", |
|
512 | 512 | forceShowTip:"Floating toolbar when non-scaled image size exceeds the size set below", |
513 | 513 | px:"px", |
514 | 514 | minSizeLimit:"Zoom the image, beyond that size, display the float frame", |
515 | | - minSizeLimitTip:"After the image is scaled (the original size of the image does not match the actual size), the floating toolbar is displayed when the original image length is greater than the set value.", |
| 515 | + minSizeLimitTip:"After the image is scaled (the original size of the image does not match the actual size), the floating toolbar is displayed when the shown image length is greater than the set value.", |
516 | 516 | listenBg:"Listening background image", |
517 | 517 | listenBgTip:"Show the hover box on the element with the background image", |
518 | 518 | butonOrder:"Sort of toolbar icons", |
|
622 | 622 | forceShow:{//在没有被缩放的图片上,但是大小超过下面设定的尺寸时,强制显示浮动框. |
623 | 623 | enabled:true,//启用强制显示. |
624 | 624 | size:{//图片尺寸.单位(像素); |
625 | | - w:166, |
626 | | - h:166, |
| 625 | + w:155, |
| 626 | + h:155, |
627 | 627 | }, |
628 | 628 | }, |
629 | | - minSizeLimit:{//就算是图片被缩放了(看到的图片被设定了width或者height限定了大小,这种情况下),如果没有被缩放的原图片小于设定值,那么也不显示浮动工具栏. |
| 629 | + minSizeLimit:{//就算是图片被缩放了(看到的图片被设定了width或者height限定了大小,这种情况下),如果图片显示大小小于设定值,那么也不显示浮动工具栏. |
630 | 630 | w:100, |
631 | 631 | h:100, |
632 | 632 | }, |
|
3101 | 3101 | [].forEach.call(nodes, function(node){ |
3102 | 3102 | if(getComputedStyle(node).display!="none"){ |
3103 | 3103 | srcSplit=node.dataset.src.split("/"); |
3104 | | - saveAs(node.dataset.src, srcSplit[srcSplit.length-1]); |
| 3104 | + saveAs(node.dataset.src, location.host+"-"+srcSplit[srcSplit.length-1]); |
3105 | 3105 | } |
3106 | 3106 | }); |
3107 | 3107 | break; |
@@ -8713,7 +8713,24 @@ left: -45px;\ |
8713 | 8713 | imgSrc = img.src||img.srcset, // img 节点的 src |
8714 | 8714 | xhr, |
8715 | 8715 | description; // 图片的注释 |
8716 | | - |
| 8716 | + var imgCStyle=unsafeWindow.getComputedStyle(img); |
| 8717 | + var imgCS={ |
| 8718 | + h: parseFloat(imgCStyle.height), |
| 8719 | + w: parseFloat(imgCStyle.width), |
| 8720 | + }; |
| 8721 | + var imgAS={//实际尺寸。 |
| 8722 | + h:img.naturalHeight, |
| 8723 | + w:img.naturalWidth, |
| 8724 | + }; |
| 8725 | + if(!(imgAS.w==imgCS.w && imgAS.h==imgCS.h)){//如果不是两者完全相等,那么被缩放了. |
| 8726 | + if(imgCS.h <= prefs.floatBar.minSizeLimit.h || imgCS.w <= prefs.floatBar.minSizeLimit.w){//最小限定判断. |
| 8727 | + return; |
| 8728 | + } |
| 8729 | + }else{ |
| 8730 | + if(imgCS.w <= prefs.floatBar.forceShow.size.w || imgCS.h <= prefs.floatBar.forceShow.size.h){ |
| 8731 | + return; |
| 8732 | + } |
| 8733 | + } |
8717 | 8734 | if(!src && matchedRule && !base64Img){// 通过高级规则获取. |
8718 | 8735 | // 排除 |
8719 | 8736 | if (matchedRule.exclude && matchedRule.exclude.test(imgSrc)) { |
@@ -8786,20 +8803,10 @@ left: -45px;\ |
8786 | 8803 | if(src)type='scale'; |
8787 | 8804 | }; |
8788 | 8805 |
|
8789 | | - var imgAS={//实际尺寸。 |
8790 | | - h:img.naturalHeight, |
8791 | | - w:img.naturalWidth, |
8792 | | - }; |
8793 | 8806 | if(!src || src==imgSrc){//本图片是否被缩放. |
8794 | 8807 | noActual=true; |
8795 | | - |
8796 | | - var imgCStyle=unsafeWindow.getComputedStyle(img); |
8797 | | - var imgCS={ |
8798 | | - h: parseFloat(imgCStyle.height), |
8799 | | - w: parseFloat(imgCStyle.width), |
8800 | | - }; |
8801 | 8808 | if(!(imgAS.w==imgCS.w && imgAS.h==imgCS.h)){//如果不是两者完全相等,那么被缩放了. |
8802 | | - if(imgAS.h > prefs.floatBar.minSizeLimit.h && imgAS.w > prefs.floatBar.minSizeLimit.w){//最小限定判断. |
| 8809 | + if(imgCS.h > prefs.floatBar.minSizeLimit.h && imgCS.w > prefs.floatBar.minSizeLimit.w){//最小限定判断. |
8803 | 8810 | src=imgSrc; |
8804 | 8811 | type='scale'; |
8805 | 8812 | } |
|
0 commit comments