|
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 2017.7.27.2 |
| 9 | +// @version 2017.7.31.1 |
10 | 10 | // @created 2011-6-15 |
11 | 11 | // @namespace http://userscripts.org/users/NLF |
12 | 12 | // @homepage http://hoothin.com |
|
1786 | 1786 | '<span class="pv-gallery-head-command-drop-list-item" data-command="scrollIntoView" title="滚动到当前图片所在的位置">定位到图片</span>'+ |
1787 | 1787 | '<span class="pv-gallery-head-command-drop-list-item" data-command="enterCollection" title="查看所有收藏的图片">查看收藏</span>'+ |
1788 | 1788 | '<span class="pv-gallery-head-command-drop-list-item" data-command="exportImages" title="导出所有图片到新窗口">导出图片</span>'+ |
| 1789 | + '<span class="pv-gallery-head-command-drop-list-item" data-command="downloadImage" title="下载图片">下载图片</span>'+ |
1789 | 1790 | '<span class="pv-gallery-head-command-drop-list-item" data-command="copyImages" title="复制所有大图的地址">复制图片</span>'+ |
1790 | 1791 | '<span class="pv-gallery-head-command-drop-list-item" title="最后几张图片时,滚动主窗口到最底部,然后自动加载新的图片">'+ |
1791 | 1792 | '<input type="checkbox" data-command="scrollToEndAndReload"/>'+ |
|
2357 | 2358 | },true); |
2358 | 2359 |
|
2359 | 2360 |
|
| 2361 | + var downloadEle=document.createElement("a"),srcSplit; |
2360 | 2362 | //命令下拉列表的点击处理 |
2361 | 2363 | eleMaps['head-command-drop-list-others'].addEventListener('click',function(e){ |
2362 | 2364 | if(e.button!=0)return;//左键 |
|
2414 | 2416 | case 'exportImages': |
2415 | 2417 | self.exportImages(); |
2416 | 2418 | break; |
| 2419 | + case 'downloadImage': |
| 2420 | + srcSplit=self.src.split("/"); |
| 2421 | + downloadEle.href=self.src; |
| 2422 | + downloadEle.setAttribute("download",srcSplit[srcSplit.length-1]); |
| 2423 | + downloadEle.click(); |
| 2424 | + break; |
2417 | 2425 | case 'copyImages': |
2418 | 2426 | self.copyImages(true); |
2419 | 2427 | break; |
@@ -3574,7 +3582,7 @@ padding-left:24px;">'+shareItem.name+'</span>'); |
3574 | 3582 | var container = document.querySelector('.pv-gallery-container'), |
3575 | 3583 | preloadContainer = document.querySelector('.pv-gallery-preloaded-img-container'); |
3576 | 3584 | imgs = Array.prototype.slice.call(imgs).filter(function(img){ |
3577 | | - return !(container.contains(img) || preloadContainer.contains(img)); |
| 3585 | + return !(container.contains(img) || (preloadContainer&&preloadContainer.contains(img))); |
3578 | 3586 | }); |
3579 | 3587 | imgs.forEach(function(img) { |
3580 | 3588 | var isrc=img.getAttribute("src"); |
@@ -3649,7 +3657,7 @@ padding-left:24px;">'+shareItem.name+'</span>'); |
3649 | 3657 | var container = document.querySelector('.pv-gallery-container'), |
3650 | 3658 | preloadContainer = document.querySelector('.pv-gallery-preloaded-img-container'); |
3651 | 3659 | imgs = Array.prototype.slice.call(imgs).filter(function(img){ |
3652 | | - return !(container.contains(img) || preloadContainer.contains(img)); |
| 3660 | + return !(container.contains(img) || (preloadContainer&&preloadContainer.contains(img))); |
3653 | 3661 | }); |
3654 | 3662 | imgs.forEach(function(img) { |
3655 | 3663 | var isrc=img.getAttribute("src"); |
@@ -3849,7 +3857,7 @@ display:none !important;\ |
3849 | 3857 | }); |
3850 | 3858 | // 排除库里面的图片 |
3851 | 3859 | imgs = imgs.filter(function(img){ |
3852 | | - return !(container.contains(img) || preloadContainer.contains(img)); |
| 3860 | + return !(container.contains(img) || (preloadContainer&&preloadContainer.contains(img))); |
3853 | 3861 | }); |
3854 | 3862 |
|
3855 | 3863 | // 已经在图库里面的 |
@@ -8290,21 +8298,34 @@ background-image:url("'+ prefs.icons.magnifier +'");\ |
8290 | 8298 | } |
8291 | 8299 |
|
8292 | 8300 | function keydown(event) { |
8293 | | - if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) |
8294 | | - return; |
8295 | | - |
8296 | | - if (floatBar && floatBar.shown && isKeyDownEffectiveTarget(event.target)) { |
8297 | | - var key = String.fromCharCode(event.keyCode).toLowerCase(); |
| 8301 | + var key = String.fromCharCode(event.keyCode).toLowerCase(); |
| 8302 | + if(event.ctrlKey && key==prefs.floatBar.keys['gallery']){ |
| 8303 | + if(!gallery){ |
| 8304 | + gallery=new GalleryC(); |
| 8305 | + } |
| 8306 | + gallery.data=[]; |
| 8307 | + var allData=gallery.getAllValidImgs(); |
| 8308 | + if(allData.length<1)return true; |
| 8309 | + gallery.data=allData; |
| 8310 | + gallery.load(gallery.data); |
| 8311 | + event.stopPropagation(); |
| 8312 | + event.preventDefault(); |
| 8313 | + return true; |
| 8314 | + }else{ |
| 8315 | + if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) |
| 8316 | + return; |
8298 | 8317 |
|
8299 | | - Object.keys(prefs.floatBar.keys).some(function(action) { |
8300 | | - if (action == 'enable') return; |
8301 | | - if (key == prefs.floatBar.keys[action]) { |
8302 | | - floatBar.open(null, action); |
8303 | | - event.stopPropagation(); |
8304 | | - event.preventDefault(); |
8305 | | - return true; |
8306 | | - } |
8307 | | - }) |
| 8318 | + if (floatBar && floatBar.shown && isKeyDownEffectiveTarget(event.target)) { |
| 8319 | + Object.keys(prefs.floatBar.keys).some(function(action) { |
| 8320 | + if (action == 'enable') return; |
| 8321 | + if (key == prefs.floatBar.keys[action]) { |
| 8322 | + floatBar.open(null, action); |
| 8323 | + event.stopPropagation(); |
| 8324 | + event.preventDefault(); |
| 8325 | + return true; |
| 8326 | + } |
| 8327 | + }) |
| 8328 | + } |
8308 | 8329 | } |
8309 | 8330 | } |
8310 | 8331 |
|
|
0 commit comments