Update png_auto_download.js
Browse files- png_auto_download.js +21 -9
png_auto_download.js
CHANGED
|
@@ -33,6 +33,21 @@
|
|
| 33 |
window.URL.revokeObjectURL(url);
|
| 34 |
});
|
| 35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
//t2i下载
|
| 38 |
let t2idownload=(ParentNode)=>{
|
|
@@ -45,9 +60,8 @@
|
|
| 45 |
{
|
| 46 |
// console.log(mutation);
|
| 47 |
t2iState='fufilled';
|
| 48 |
-
[...ParentNode.querySelectorAll('.thumbnail-item > img')].forEach(resNode=>{
|
| 49 |
-
|
| 50 |
-
let name=decodeURIComponent(nameArr[nameArr.length-1])
|
| 51 |
downloadImage(resNode.src,name)
|
| 52 |
})
|
| 53 |
observer.disconnect();
|
|
@@ -72,9 +86,8 @@
|
|
| 72 |
{
|
| 73 |
// console.log(mutation);
|
| 74 |
i2iState='fufilled';
|
| 75 |
-
[...ParentNode.querySelectorAll('.thumbnail-item > img')].forEach(resNode=>{
|
| 76 |
-
|
| 77 |
-
let name=decodeURIComponent(nameArr[nameArr.length-1])
|
| 78 |
downloadImage(resNode.src,name)
|
| 79 |
})
|
| 80 |
observer.disconnect();
|
|
@@ -99,9 +112,8 @@
|
|
| 99 |
{
|
| 100 |
// console.log(mutation);
|
| 101 |
extState='fufilled';
|
| 102 |
-
[...ParentNode.querySelectorAll('.thumbnail-item > img')].forEach(resNode=>{
|
| 103 |
-
|
| 104 |
-
let name=decodeURIComponent(nameArr[nameArr.length-1])
|
| 105 |
downloadImage(resNode.src,name)
|
| 106 |
})
|
| 107 |
observer.disconnect();
|
|
|
|
| 33 |
window.URL.revokeObjectURL(url);
|
| 34 |
});
|
| 35 |
}
|
| 36 |
+
function getDataName(index){
|
| 37 |
+
const now = new Date();
|
| 38 |
+
|
| 39 |
+
// 获取年、月、日、时、分、秒
|
| 40 |
+
const year = now.getFullYear();
|
| 41 |
+
const month = String(now.getMonth() + 1).padStart(2, '0');
|
| 42 |
+
const day = String(now.getDate()).padStart(2, '0');
|
| 43 |
+
const hours = String(now.getHours()).padStart(2, '0');
|
| 44 |
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
| 45 |
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}${index}.png`;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
|
| 52 |
//t2i下载
|
| 53 |
let t2idownload=(ParentNode)=>{
|
|
|
|
| 60 |
{
|
| 61 |
// console.log(mutation);
|
| 62 |
t2iState='fufilled';
|
| 63 |
+
[...ParentNode.querySelectorAll('.thumbnail-item > img')].forEach((resNode,index)=>{
|
| 64 |
+
let name=getDataName(index)
|
|
|
|
| 65 |
downloadImage(resNode.src,name)
|
| 66 |
})
|
| 67 |
observer.disconnect();
|
|
|
|
| 86 |
{
|
| 87 |
// console.log(mutation);
|
| 88 |
i2iState='fufilled';
|
| 89 |
+
[...ParentNode.querySelectorAll('.thumbnail-item > img')].forEach((resNode,index)=>{
|
| 90 |
+
let name=getDataName(index)
|
|
|
|
| 91 |
downloadImage(resNode.src,name)
|
| 92 |
})
|
| 93 |
observer.disconnect();
|
|
|
|
| 112 |
{
|
| 113 |
// console.log(mutation);
|
| 114 |
extState='fufilled';
|
| 115 |
+
[...ParentNode.querySelectorAll('.thumbnail-item > img')].forEach((resNode,index)=>{
|
| 116 |
+
let name=getDataName(index)
|
|
|
|
| 117 |
downloadImage(resNode.src,name)
|
| 118 |
})
|
| 119 |
observer.disconnect();
|