instruction
\n${data.title || ''}
\n${data.msg}
\n \n `\n\n theme.register(wrap)\n lang.register(wrap)\n\n const btn = wrap.querySelector('.btn') as HTMLButtonElement\n\n if (btn) {\n wrap.addEventListener('click', (ev) => {\n ev.stopPropagation()\n })\n\n btn.addEventListener('click', () => {\n this.remove(wrap)\n })\n\n window.addEventListener(EVT.list.closeCenterPanel, () => {\n this.remove(wrap)\n })\n }\n\n document.body.append(wrap)\n btn.focus()\n\n bg.useBG(wrap)\n }\n\n private remove(el: HTMLDivElement) {\n el && el.parentNode && el.parentNode.removeChild(el)\n }\n}\n\nconst msgBox = new MsgBox()\nexport { msgBox }\n","import { WorkThumbnail } from './WorkThumbnail'\nimport { pageType } from './PageType'\nimport { Tools } from './Tools'\nimport { Config } from './Config'\n\n// 查找小说作品的缩略图,当鼠标进入、移出时等动作触发时执行回调函数\nclass NovelThumbnail extends WorkThumbnail {\n constructor() {\n super()\n\n if (Config.mobile) {\n // 移动端的作品选择器就这一个\n this.selectors = ['.works-item-novel']\n } else {\n this.selectors = [\n 'li[size=\"1\"]>div',\n 'section li>div',\n 'nav>div>div',\n 'div.gtm-novel-work-recommend-link',\n 'section ul>div',\n 'section ul>li',\n 'div._ranking-item',\n 'div[size=\"496\"]',\n 'li',\n ]\n }\n\n this.findThumbnail(document.body)\n this.createObserver(document.body)\n }\n\n protected readonly selectors: string[] = []\n\n protected findThumbnail(parent: HTMLElement) {\n if (!parent.querySelectorAll) {\n return\n }\n // 遍历所有的选择器,为找到的元素绑定事件\n // 注意:有时候一个节点里会含有多种尺寸的缩略图,为了全部查找到它们,必须遍历所有的选择器。\n // 如果在查找到某个选择器之后,不再查找剩余的选择器,就可能会遗漏一部分缩略图。\n // 但是,这有可能会导致事件的重复绑定,所以下载器添加了 dataset.mouseover 标记以减少重复绑定\n for (const selector of this.selectors) {\n // 处理桌面端特殊情况中使用的选择器\n if (!Config.mobile) {\n // 在用户主页只使用指定的选择器,避免其他选择器导致顶部“精选”的小说作品被重复绑定事件\n if (\n pageType.type === pageType.list.UserHome &&\n selector !== 'section ul>li' &&\n selector !== 'li[size=\"1\"]>div'\n ) {\n continue\n }\n\n // 在小说排行榜里只使用 div._ranking-item\n if (\n pageType.type === pageType.list.NovelRanking &&\n selector !== 'div._ranking-item'\n ) {\n continue\n }\n\n // 在小说系列页面里只使用 section ul>li\n if (\n pageType.type === pageType.list.NovelSeries &&\n selector !== 'section ul>li'\n ) {\n continue\n }\n\n // div.gtm-novel-work-recommend-link 只能在小说页面里使用\n if (\n selector === 'div.gtm-novel-work-recommend-link' &&\n pageType.type !== pageType.list.Novel\n ) {\n continue\n }\n }\n\n let elements: HTMLElement[] | NodeListOf${r18HTML} ${aiHTML}
\n${workData.body.title}
\n${workData.body.description}
\n \n${workData.body.width} x ${workData.body.height}
\n${bmkHTML.join('')}
\n${new Date(\n workData.body.uploadDate\n ).toLocaleString()}
\n \n${defaultName}: ${fullNameHtml}
`\n resultArr.push(nowResult)\n } else {\n // 小说作品不显示原文件名(因为没有此数据)\n const nowResult = `${fullNameHtml}
`\n resultArr.push(nowResult)\n }\n }\n\n result = resultArr.join('')\n } else {\n // 不生成 html 标签,只生成纯文本,保存为 txt 文件\n for (let i = 0; i < length; i++) {\n const data = store.result[i]\n const fullName = fileName.createFileName(data)\n\n if (data.type !== 3) {\n // 图片作品,在文件名前面显示文件 url 里的文件名\n let defaultName = data.original.replace(/.*\\//, '')\n resultArr.push(`${defaultName}: ${fullName}`)\n } else {\n // 小说作品不显示原文件名(因为没有此数据)\n resultArr.push(fullName)\n }\n }\n\n result = resultArr.join('\\n')\n }\n\n EVT.fire('output', {\n content: result,\n title: '_预览文件名',\n })\n }\n}\n\nnew PreviewFileName()\n","import { store } from '../store/Store'\nimport { EVT } from '../EVT'\nimport { lang } from '../Lang'\nimport { settings } from '../setting/Settings'\nimport { toast } from '../Toast'\nimport { Config } from '../Config'\n\n// 显示 url\nclass ShowURLs {\n constructor() {\n this.bindEvents()\n }\n\n private bindEvents() {\n window.addEventListener(EVT.list.showURLs, () => {\n this.showURLs()\n })\n }\n\n private showURLs() {\n const urls: string[] = []\n const size = settings.imageSize\n for (const data of store.result) {\n // 只输出图片文件的 url\n // 小说文件没有固定的 url 所以不输出\n if (data.type !== 3) {\n urls.push(data[size])\n }\n }\n\n if (store.result.length === 0 || urls.length === 0) {\n return toast.error(lang.transl('_没有可用的抓取结果'))\n }\n\n let result = ''\n if (store.result.length < Config.outputMax) {\n result = urls.join('instruction
\n${data.title || ''}
\n${data.msg}
\n \n `\n\n theme.register(wrap)\n lang.register(wrap)\n\n const btn = wrap.querySelector('.btn') as HTMLButtonElement\n\n if (btn) {\n wrap.addEventListener('click', (ev) => {\n ev.stopPropagation()\n })\n\n btn.addEventListener('click', () => {\n this.remove(wrap)\n })\n\n window.addEventListener(EVT.list.closeCenterPanel, () => {\n this.remove(wrap)\n })\n }\n\n document.body.append(wrap)\n btn.focus()\n\n bg.useBG(wrap)\n }\n\n private remove(el: HTMLDivElement) {\n el && el.parentNode && el.parentNode.removeChild(el)\n }\n}\n\nconst msgBox = new MsgBox()\nexport { msgBox }\n","import { WorkThumbnail } from './WorkThumbnail'\nimport { pageType } from './PageType'\nimport { Tools } from './Tools'\nimport { Config } from './Config'\n\n// 查找小说作品的缩略图,当鼠标进入、移出时等动作触发时执行回调函数\nclass NovelThumbnail extends WorkThumbnail {\n constructor() {\n super()\n\n if (Config.mobile) {\n // 移动端的作品选择器就这一个\n this.selectors = ['.works-item-novel']\n } else {\n this.selectors = [\n 'li[size=\"1\"]>div',\n 'section li>div',\n 'nav>div>div',\n 'div.gtm-novel-work-recommend-link',\n 'section ul>div',\n 'section ul>li',\n 'div._ranking-item',\n 'div[size=\"496\"]',\n 'li',\n ]\n }\n\n this.findThumbnail(document.body)\n this.createObserver(document.body)\n }\n\n protected readonly selectors: string[] = []\n\n protected findThumbnail(parent: HTMLElement) {\n if (!parent.querySelectorAll) {\n return\n }\n // 遍历所有的选择器,为找到的元素绑定事件\n // 注意:有时候一个节点里会含有多种尺寸的缩略图,为了全部查找到它们,必须遍历所有的选择器。\n // 如果在查找到某个选择器之后,不再查找剩余的选择器,就可能会遗漏一部分缩略图。\n // 但是,这有可能会导致事件的重复绑定,所以下载器添加了 dataset.mouseover 标记以减少重复绑定\n for (const selector of this.selectors) {\n // 处理桌面端特殊情况中使用的选择器\n if (!Config.mobile) {\n // 在用户主页只使用指定的选择器,避免其他选择器导致顶部“精选”的小说作品被重复绑定事件\n if (\n pageType.type === pageType.list.UserHome &&\n selector !== 'section ul>li' &&\n selector !== 'li[size=\"1\"]>div'\n ) {\n continue\n }\n\n // 在小说排行榜里只使用 div._ranking-item\n if (\n pageType.type === pageType.list.NovelRanking &&\n selector !== 'div._ranking-item'\n ) {\n continue\n }\n\n // 在小说系列页面里只使用 section ul>li\n if (\n pageType.type === pageType.list.NovelSeries &&\n selector !== 'section ul>li'\n ) {\n continue\n }\n\n // div.gtm-novel-work-recommend-link 只能在小说页面里使用\n if (\n selector === 'div.gtm-novel-work-recommend-link' &&\n pageType.type !== pageType.list.Novel\n ) {\n continue\n }\n }\n\n let elements: HTMLElement[] | NodeListOf${r18HTML} ${aiHTML}
\n${workData.body.title}
\n${workData.body.description}
\n \n${workData.body.width} x ${workData.body.height}
\n${bmkHTML.join('')}
\n${new Date(\n workData.body.uploadDate\n ).toLocaleString()}
\n \n