Update PNG_info_web.js
Browse files- PNG_info_web.js +31 -16
PNG_info_web.js
CHANGED
|
@@ -556,6 +556,13 @@ let imgStorage=(img)=>{
|
|
| 556 |
shadowRoot.querySelector("#txt2img_enable_hr input").checked =true
|
| 557 |
shadowRoot.querySelector("#txt2img_enable_hr input").dispatchEvent(changeEvent);
|
| 558 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
}
|
| 560 |
//高清
|
| 561 |
//hr放大器
|
|
@@ -599,11 +606,14 @@ let imgStorage=(img)=>{
|
|
| 599 |
// 将函数加入到任务队列待下一次轮询延迟下拉框加载完毕后执行
|
| 600 |
var Hirescheckpoint=result.Hirescheckpoint
|
| 601 |
// ?result.Hirescheckpoint.replace(/ \[.*\]$/,""):""
|
| 602 |
-
console.log(Hirescheckpoint)
|
| 603 |
const Hirescheckpoint_list_elem = document.querySelector(
|
| 604 |
`[data-value="${Hirescheckpoint || "Use same checkpoint"}"]`
|
| 605 |
);
|
|
|
|
| 606 |
Hirescheckpoint_list_elem.dispatchEvent(mousevent);
|
|
|
|
|
|
|
|
|
|
| 607 |
});
|
| 608 |
}
|
| 609 |
|
|
@@ -714,7 +724,6 @@ let imgStorage=(img)=>{
|
|
| 714 |
const dataTransfer = new DataTransfer();
|
| 715 |
dataTransfer.items.add(file);
|
| 716 |
const fileList = dataTransfer.files;
|
| 717 |
-
console.log([this.shadowRoot.querySelector("#img2img_image input")])
|
| 718 |
this.shadowRoot.querySelector("#img2img_image input").files = fileList;
|
| 719 |
this.shadowRoot.querySelector('#img2img_image input').dispatchEvent(changeEvent);
|
| 720 |
};
|
|
@@ -854,27 +863,33 @@ let imgStorage=(img)=>{
|
|
| 854 |
const result = {};
|
| 855 |
// const match = inputString.match(/(?<=prompt:)(.*)(?=Negative prompt:)/s)[0].trim();]
|
| 856 |
let tempRes=res[0].text
|
| 857 |
-
console.log(1223)
|
| 858 |
result.prompt = res[0].text.match(/(.+)(?=(\nNegative prompt))/s)?
|
| 859 |
-
res[0].text.match(/(.+)(?=(\
|
| 860 |
-
console.log(result.prompt)
|
| 861 |
result.negativePrompt = res[0].text.match(/(?<=Negative prompt:)(.*)(?=\nSteps:)/s)?
|
| 862 |
res[0].text.match(/(?<=Negative prompt:)(.*)(?=\nSteps:)/s)[0]:""
|
| 863 |
//否定预查来确认第一个或者最后一个来确保不重复
|
| 864 |
-
|
| 865 |
-
res[0].text.match(/(?<=Hires prompt:)(.*?)(?=(?!Hires negative prompt) Hires upscale
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 872 |
let resArr = tempRes.trim().split(",");
|
| 873 |
-
console.log(resArr)
|
| 874 |
resArr.forEach((e) => {
|
| 875 |
-
result[e.split(":")[0].replace(/\s+/g, "")] = e.split(":")[1].
|
|
|
|
|
|
|
|
|
|
|
|
|
| 876 |
});
|
| 877 |
-
console.log(result)
|
| 878 |
this.result = result;
|
| 879 |
|
| 880 |
//txt2img
|
|
|
|
| 556 |
shadowRoot.querySelector("#txt2img_enable_hr input").checked =true
|
| 557 |
shadowRoot.querySelector("#txt2img_enable_hr input").dispatchEvent(changeEvent);
|
| 558 |
}
|
| 559 |
+
}else{
|
| 560 |
+
if (!!result.Hiresupscaler) {
|
| 561 |
+
shadowRoot.querySelector("#txt2img_hr > div:nth-child(3)").style.display ="block"
|
| 562 |
+
}
|
| 563 |
+
else{
|
| 564 |
+
shadowRoot.querySelector("#txt2img_hr > div:nth-child(3)").style.display ="none"
|
| 565 |
+
}
|
| 566 |
}
|
| 567 |
//高清
|
| 568 |
//hr放大器
|
|
|
|
| 606 |
// 将函数加入到任务队列待下一次轮询延迟下拉框加载完毕后执行
|
| 607 |
var Hirescheckpoint=result.Hirescheckpoint
|
| 608 |
// ?result.Hirescheckpoint.replace(/ \[.*\]$/,""):""
|
|
|
|
| 609 |
const Hirescheckpoint_list_elem = document.querySelector(
|
| 610 |
`[data-value="${Hirescheckpoint || "Use same checkpoint"}"]`
|
| 611 |
);
|
| 612 |
+
try {
|
| 613 |
Hirescheckpoint_list_elem.dispatchEvent(mousevent);
|
| 614 |
+
} catch (error) {
|
| 615 |
+
console.error(`出错了,可能没有指定的ckpt:${Hirescheckpoint}`);
|
| 616 |
+
}
|
| 617 |
});
|
| 618 |
}
|
| 619 |
|
|
|
|
| 724 |
const dataTransfer = new DataTransfer();
|
| 725 |
dataTransfer.items.add(file);
|
| 726 |
const fileList = dataTransfer.files;
|
|
|
|
| 727 |
this.shadowRoot.querySelector("#img2img_image input").files = fileList;
|
| 728 |
this.shadowRoot.querySelector('#img2img_image input').dispatchEvent(changeEvent);
|
| 729 |
};
|
|
|
|
| 863 |
const result = {};
|
| 864 |
// const match = inputString.match(/(?<=prompt:)(.*)(?=Negative prompt:)/s)[0].trim();]
|
| 865 |
let tempRes=res[0].text
|
|
|
|
| 866 |
result.prompt = res[0].text.match(/(.+)(?=(\nNegative prompt))/s)?
|
| 867 |
+
res[0].text.match(/(.+)(?=(\nNegativeck prompt))/s)[0].trim():res[0].text.match(/(.+)(?=(\nSteps))/s)[0].trim()
|
|
|
|
| 868 |
result.negativePrompt = res[0].text.match(/(?<=Negative prompt:)(.*)(?=\nSteps:)/s)?
|
| 869 |
res[0].text.match(/(?<=Negative prompt:)(.*)(?=\nSteps:)/s)[0]:""
|
| 870 |
//否定预查来确认第一个或者最后一个来确保不重复
|
| 871 |
+
let HiresPrompt = res[0].text.match(/(?<=Hires prompt: )(.*?)(?=(?!Hires negative prompt) Hires upscale|Hires negative prompt)/s)?
|
| 872 |
+
res[0].text.match(/(?<=Hires prompt: )(.*?)(?=(?!Hires negative prompt), Hires upscale|, Hires negative prompt)/s)[0]:""
|
| 873 |
+
// console.log(HiresPrompt)
|
| 874 |
+
result.HiresPrompt=HiresPrompt.includes(",")?HiresPrompt.replace(/^"|"$/g, "").replace(/\\\\/g,"\\"):HiresPrompt
|
| 875 |
+
|
| 876 |
+
let HiresNegativePrompt =res[0].text.match(/(?<=Hires negative prompt:)(.*)(?=Hires upscale)/s)?
|
| 877 |
+
res[0].text.match(/(?<=Hires negative prompt: )(.*)(?=, Hires upscale[^r])/s)[0].trim():""
|
| 878 |
+
result.HiresNegativePrompt=HiresNegativePrompt.includes(",")?HiresNegativePrompt.replace(/^"|"$/g, "").replace(/\\\\/g,"\\"):HiresNegativePrompt
|
| 879 |
+
// console.log(result.prompt)
|
| 880 |
+
tempRes=tempRes.replace(`${result.prompt}`,"").replace(`\nNegative prompt: ${result.negativePrompt}`,"")
|
| 881 |
+
.replace(` Hires prompt: ${HiresPrompt},`,"").replace(` Hires negative prompt: ${HiresNegativePrompt}, `,"")
|
| 882 |
+
// console.log(tempRes)
|
| 883 |
let resArr = tempRes.trim().split(",");
|
| 884 |
+
// console.log(resArr)
|
| 885 |
resArr.forEach((e) => {
|
| 886 |
+
try{result[e.split(":")[0].replace(/\s+/g, "")] = e.split(":")[1].
|
| 887 |
+
replace(/<comma>/g, ",").replace(/<maohao>/g, ":").trim();}
|
| 888 |
+
catch(err){
|
| 889 |
+
console.log(err+"e")
|
| 890 |
+
}
|
| 891 |
});
|
| 892 |
+
// console.log(result)
|
| 893 |
this.result = result;
|
| 894 |
|
| 895 |
//txt2img
|