This commit is contained in:
2025-05-11 18:58:43 +02:00
parent d5a73f342e
commit f3f3045ebf
48 changed files with 686 additions and 243 deletions

41
Bomtoon_JS/bomtoon.js Normal file
View File

@@ -0,0 +1,41 @@
async function downloadImages(blobUrls) {
for (let i = 0; i < blobUrls.length; i++) {
let response = await fetch(blobUrls[i]);
let blob = await response.blob();
let blobUrlObject = URL.createObjectURL(blob);
let indexStr = String(i).padStart(3, "0"); // 生成 3 位数格式
let filename = `${indexStr}.webp`; // e.g., 001.webp
let a = document.createElement("a");
a.href = blobUrlObject;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(blobUrlObject);
console.log(`Downloaded: ${filename}`);
await new Promise(resolve => setTimeout(resolve, 500)); // 避免 Chrome 限制
}
const div = document.querySelector('div.printView > div:not(style)');
const div2 = Array.from(div.children).filter(el => el.tagName.toLowerCase() === 'div')[1];
const div2_1_1 = div2.querySelector('div:nth-of-type(1) > div:nth-of-type(1)');
const count = Array.from(div2_1_1.children).filter(el => {
return el.tagName.toLowerCase() === 'div' &&
el.hasAttribute('width') &&
el.hasAttribute('height');
}).length;
console.log("div2.1.1 下的 <div> 数量为:", count);
console.log(document.title);
}
const blobs = [...document.querySelectorAll("img")]
.map(el => el.src)
.filter(src => src.startsWith("blob:"));
downloadImages(blobs);

View File

@@ -0,0 +1,53 @@
async function downloadCanvasImages() {
let seenCanvases = new Set(); // 存储已经下载过的 Canvas避免重复下载
let lastScrollTop = 0;
while (true) {
console.log("🔽 正在下载当前屏幕的所有 Canvas...");
// 获取所有 <canvas> 并下载
document.querySelectorAll("canvas").forEach((canvas, index) => {
if (!seenCanvases.has(canvas)) { // 确保不重复下载
seenCanvases.add(canvas);
let imgData = canvas.toDataURL("image/webp"); // 转为 Base64 webp
let a = document.createElement("a");
a.href = imgData;
a.download = `${String(seenCanvases.size).padStart(3, "0")}.webp`; // 命名 001, 002, ...
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
console.log(`✅ 下载: ${a.download}`);
}
});
// 记录滚动前的位置
lastScrollTop = window.scrollY;
// 向下滚动 1 屏
window.scrollBy(0, window.innerHeight);
await new Promise(resolve => setTimeout(resolve, 3000)); // 等待 3 秒加载新 Canvas
// 如果滚动到底,停止执行
if (window.scrollY === lastScrollTop) {
console.log("🎉 已滚动到底,所有 Canvas 下载完成!");
break;
}
}
const div = document.querySelector('div.printView > div:not(style)');
const div2 = Array.from(div.children).filter(el => el.tagName.toLowerCase() === 'div')[1];
const div2_1_1_1 = div2.querySelector('div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1)');
const count = Array.from(div2_1_1_1.children).filter(el => {
return el.tagName.toLowerCase() === 'div' &&
el.hasAttribute('width') &&
el.hasAttribute('height');
}).length;
console.log("div2.1.1.1 下的 <div> 数量为:", count);
console.log(document.title);
}
// 运行脚本
downloadCanvasImages();

View File

@@ -0,0 +1,14 @@
const divs = document.querySelectorAll('div[class^="CanvasViewer__Container"]');
console.log("符合条件的 div 总数:", divs.length);
const div = document.querySelector('div.printView > div:not(style)');
const div2 = Array.from(div.children).filter(el => el.tagName.toLowerCase() === 'div')[1];
const div2_1_1_1 = div2.querySelector('div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1)');
const count = Array.from(div2_1_1_1.children).filter(el => {
return el.tagName.toLowerCase() === 'div' &&
el.hasAttribute('width') &&
el.hasAttribute('height');
}).length;
console.log("div2.1.1.1 下的 <div> 数量为:", count);
console.log(document.title);

24
Bomtoon_JS/get_count.js Normal file
View File

@@ -0,0 +1,24 @@
(() => {
const count = document.querySelectorAll('div[class^="ImageContainer__Container"]').length;
const existing = localStorage.getItem("divCountList") || "";
localStorage.setItem("divCountList", existing + count + "\n");
console.log("✅ Count saved:", count);
})();
(() => {
const data = localStorage.getItem("divCountList") || "";
const blob = new Blob([data], { type: "text/plain" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "div_counts.txt";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
console.log("📦 File downloaded as div_counts.txt");
})();

29
Bomtoon_JS/search_tag.js Normal file
View File

@@ -0,0 +1,29 @@
const container = document.querySelector('.fmxVRH');
if (container) {
// 获取 container 下所有 size="16" 的 div 元素
const targetDivs = container.querySelectorAll('div[size="16"]');
// 提取每个 div 的文本内容
const contents = Array.from(targetDivs).map(div => div.textContent.trim());
const contentString = contents.join('\n');
// 保存到 localStorage
localStorage.setItem('searchTag', contentString);
} else {
console.log("没有找到 class 为 fmxVRH 的元素");
}
(() => {
const data = localStorage.getItem("searchTag") || "";
const blob = new Blob([data], { type: "text/plain" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "tag_results.txt";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
console.log("📦 File downloaded as tag_results.txt");
})();
localStorage.removeItem('searchTag');