Skip to content

Commit 026afc3

Browse files
committed
download all
1 parent 23eced6 commit 026afc3

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

Picviewer CE+/Picviewer CE+.user.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// @name:zh-TW Picviewer CE+
55
// @author NLF && ywzhaiqi && hoothin
66
// @description Powerful picture viewing tool online, which can popup/scale/rotate/batch save pictures or find the HD original picture automatically
7-
// @description:zh-CN NLF 的围观图修改版,增加高清原图查找显示(在线看图工具,支持图片翻转、旋转、缩放、弹出大图、批量保存、查找原图
8-
// @description:zh-TW NLF 的圍觀圖修改版,增加高清原圖查詢顯示(線上看圖工具,支援圖片翻轉、旋轉、縮放、彈出大圖、批量儲存、查詢原圖
9-
// @version 2019.9.2.1
7+
// @description:zh-CN 在线看图工具,支持图片翻转、旋转、缩放、弹出大图、批量保存、查找原图
8+
// @description:zh-TW 線上看圖工具,支援圖片翻轉、旋轉、縮放、彈出大圖、批量儲存、查詢原圖
9+
// @version 2019.9.19.1
1010
// @created 2011-6-15
1111
// @namespace http://userscripts.org/users/NLF
1212
// @homepage http://hoothin.com
@@ -27,6 +27,7 @@
2727
// @require https://greasyfork.org/scripts/6158-gm-config-cn/code/GM_config%20CN.js?version=23710
2828
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=rixixi@sina.com&item_name=Greasy+Fork+donation
2929
// @contributionAmount 1
30+
// @require https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js
3031
// @run-at document-end
3132
// @include http://*
3233
// @include https://*
@@ -92,8 +93,8 @@
9293
cantFind:"图片不在文档中,或者被隐藏了,无法定位!",
9394
exportImages:"导出大图",
9495
exportImagesTip:"导出所有图片到新窗口",
95-
downloadImage:"下载图片",
96-
downloadImageTip:"下载当前图片",
96+
downloadImage:"下载所有图片",
97+
downloadImageTip:"下载当前所有显示图片",
9798
copyImagesUrl:"复制所有",
9899
copyImagesUrlTip:"复制所有大图地址",
99100
copySuccess:"已成功复制 #t# 张大图地址",
@@ -275,8 +276,8 @@
275276
cantFind:"圖片不在文檔中,或者被隱藏了,無法定位!",
276277
exportImages:"導出大圖",
277278
exportImagesTip:"導出所有圖片到新窗口",
278-
downloadImage:"下載圖片",
279-
downloadImageTip:"下載當前圖片",
279+
downloadImage:"下載所有圖片",
280+
downloadImageTip:"下載當前所有顯示圖片",
280281
copyImagesUrl:"複製所有",
281282
copyImagesUrlTip:"複製所有大圖地址",
282283
copySuccess:"已成功複製 #t# 張大圖地址",
@@ -458,8 +459,8 @@
458459
cantFind:"The image is not in the document, or it is hidden and cannot be located!",
459460
exportImages:"Export big Images",
460461
exportImagesTip:"Export all images to new window",
461-
downloadImage:"Download Image",
462-
downloadImageTip:"Download the current picture",
462+
downloadImage:"Download all shown Images",
463+
downloadImageTip:"Download the current shown pictures",
463464
copyImagesUrl:"Copy all images Urls",
464465
copyImagesUrlTip:"Copy all large image Urls",
465466
copySuccess:"Successfully copied #t# Url",
@@ -2439,9 +2440,9 @@
24392440
'<span class="pv-gallery-head-command-drop-list-item" data-command="psImage" title="'+i18n("onlineEditTip",prefs.gallery.editSite)+'">'+i18n("onlineEdit")+'</span>'+
24402441
'<span class="pv-gallery-head-command-drop-list-item" data-command="exportImages" title="'+i18n("exportImagesTip")+'">'+i18n("exportImages")+'</span>'+
24412442
'<span class="pv-gallery-head-command-drop-list-item" data-command="copyImages" title="'+i18n("copyImagesUrlTip")+'">'+i18n("copyImagesUrl")+'</span>'+
2443+
'<span class="pv-gallery-head-command-drop-list-item" data-command="downloadImage" title="'+i18n("downloadImageTip")+'">'+i18n("downloadImage")+'</span>'+
24422444
'<span class="pv-gallery-head-command-drop-list-item" data-command="scrollIntoView" title="'+i18n("findInPageTip")+'">'+i18n("findInPage")+'</span>'+
24432445
'<span class="pv-gallery-head-command-drop-list-item" data-command="enterCollection" title="'+i18n("viewCollectionTip")+'">'+i18n("viewCollection")+'</span>'+
2444-
'<span class="pv-gallery-head-command-drop-list-item" data-command="downloadImage" title="'+i18n("downloadImageTip")+'">'+i18n("downloadImage")+'</span>'+
24452446
'<span class="pv-gallery-head-command-drop-list-item" data-command="openInNewWindow" title="'+i18n("openInNewWindowTip")+'">'+i18n("openInNewWindow")+'</span>'+
24462447
'<span class="pv-gallery-head-command-drop-list-item" title="'+i18n("autoRefreshTip")+'">'+
24472448
'<input type="checkbox" data-command="scrollToEndAndReload"/>'+
@@ -3030,7 +3031,7 @@
30303031
},true);
30313032

30323033

3033-
var downloadEle=document.createElement("a"),srcSplit;
3034+
var srcSplit;
30343035
//命令下拉列表的点击处理
30353036
eleMaps['head-command-drop-list-others'].addEventListener('click',function(e){
30363037
if(e.button!=0)return;//左键
@@ -3092,10 +3093,14 @@
30923093
self.exportImages();
30933094
break;
30943095
case 'downloadImage':
3095-
srcSplit=self.src.split("/");
3096-
downloadEle.href=self.src;
3097-
downloadEle.setAttribute("download",srcSplit[srcSplit.length-1]);
3098-
downloadEle.click();
3096+
var nodes = document.querySelectorAll('.pv-gallery-sidebar-thumb-container[data-src]');
3097+
var urls = [];
3098+
[].forEach.call(nodes, function(node){
3099+
if(getComputedStyle(node).display!="none"){
3100+
srcSplit=node.dataset.src.split("/");
3101+
saveAs(node.dataset.src, srcSplit[srcSplit.length-1]);
3102+
}
3103+
});
30993104
break;
31003105
case 'copyImages':
31013106
self.copyImages(true);

0 commit comments

Comments
 (0)