This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
//1.获取文本
let topDiff = -1;
let content = "";
var filename= document.getElementsByClassName('doc-title')[0].innerText;
const target = document.querySelectorAll(".reader-word-layer");
target.forEach(x => {
if (x.style.top !== topDiff) {
content += "\n";
topDiff = x.style.top;
};
content += x.innerText;
});
//2.创建下载链接,下载到本地
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(content));
element.setAttribute('download', filename+".doc");
element.style.display = ".reader-word-layer";
document.body.appendChild(element);
element.click();
document.body.removeChild(element);