MediaWiki:Common.js/uploader.js:修订间差异
imported>=海豚= 无编辑摘要 |
小无编辑摘要 |
||
| (未显示1个用户的14个中间版本) | |||
| 第1行: | 第1行: | ||
// <pre> | // <pre> | ||
"use strict"; | "use strict"; | ||
$(() => (async () => { | $(() => (async () => { | ||
await mw.loader.using([ | await mw.loader.using(["mediawiki.api"]); | ||
const commonsApi = new mw.Api({ | const commonsApi = new mw.Api({ | ||
timeout: 7000, | timeout: 7000, | ||
| 第289行: | 第288行: | ||
@click="submit(true)" | @click="submit(true)" | ||
>差分上传</button> | >差分上传</button> | ||
<button title="将当前文件除文件名的信息同步到全部文件" @click="asyncCurrentFileInfo"> | <button title="将当前文件除文件名的信息同步到全部文件" @click="asyncCurrentFileInfo">同步已输入信息至全部</button> | ||
<button @click="showManual">使用说明</button> | <button @click="showManual">-使用说明-</button> | ||
</div> | </div> | ||
</div> | </div> | ||
| 第645行: | 第644行: | ||
source: "", | source: "", | ||
prefix: "", | prefix: "", | ||
license: "", | license: "Copyright", | ||
}, | }, | ||
doubleClickTimeoutKey: 0, // 用于双击复制文件名 | doubleClickTimeoutKey: 0, // 用于双击复制文件名 | ||
| 第703行: | 第702行: | ||
charaName: "", | charaName: "", | ||
source: "", | source: "", | ||
}; | }; | ||
}, | }, | ||
| 第788行: | 第786行: | ||
if (!this.allowedFileTypes.includes(file.name.replace(/.+\.(.+?)$/, "$1"))) { return alert(`【${file.name}】不支持上传这种格式的文件!`); } | if (!this.allowedFileTypes.includes(file.name.replace(/.+\.(.+?)$/, "$1"))) { return alert(`【${file.name}】不支持上传这种格式的文件!`); } | ||
if (file.size / 1024 / 1024 > | if (file.size / 1024 / 1024 > 8) { return alert(`【${file.name}】的大小超过8m,无法上传!`); } | ||
this.files.push(this.createFileItem(file)); | this.files.push(this.createFileItem(file)); | ||
}); | }); | ||
| 第821行: | 第819行: | ||
addSourceUrlFile() { | addSourceUrlFile() { | ||
const url = (prompt(" | const url = (prompt("请输入文件地址:(萌娘百科、哔哩哔哩等网站图片加入了防盗链,你必须把图片下载下来后使用本地上传)") || "").trim(); | ||
if (!url) { return; } | if (!url) { return; } | ||
this.files.push(this.createFileItem(url)); | this.files.push(this.createFileItem(url)); | ||
| 第855行: | 第853行: | ||
alert([ | alert([ | ||
"使用说明", | "使用说明", | ||
"1. | "1. 该插件是一个批量上传图片工具,同时支持拖拽上传,批量上传。", | ||
"2. | "2. 若文件上传时发生异常,请以本站的最近更改为准。", | ||
"3. 每个文件拥有独立的信息,但“分类”和“添加前缀”是共享的。在需要同步每个文件的角色名、作者等信息时可以使用“同步文件信息”的功能。", | "3. 每个文件拥有独立的信息,但“分类”和“添加前缀”是共享的。在需要同步每个文件的角色名、作者等信息时可以使用“同步文件信息”的功能。", | ||
"4. | "4. 差分上传是指在发生文件名已存在的情况时,自动滤掉已存在的文件。通常用于在上一次批量上传中一部分失败后,再次尝试将之前没传上去的文件重新上传。", | ||
"5. 双击文件可以自动复制“前缀 + 文件名”。", | "5. 双击文件可以自动复制“前缀 + 文件名”。", | ||
].join("\n")); | ].join("\n")); | ||
| 第896行: | 第894行: | ||
const comment = []; | const comment = []; | ||
if (item.charaName) { | if (item.charaName) { | ||
comment.push(`人物:[[分类:${item.charaName}|${item.charaName}]]`); | comment.push(`人物:[[分类:${item.charaName}|${item.charaName}]]`); | ||
| 第913行: | 第908行: | ||
const pageContent = [ | const pageContent = [ | ||
"== 文件说明 ==", | "== 文件说明 ==", | ||
source, | |||
"基于批量上传工具上传的文件", | |||
metaCategories + this.form.categories.map(item => `[[分类:${item}]]`).join(""), | metaCategories + this.form.categories.map(item => `[[分类:${item}]]`).join(""), | ||
].join("\n"); | ].join("\n"); | ||
| 第974行: | 第968行: | ||
); | ); | ||
} else { | } else { | ||
printLog.warn("上传文件超过3个,执行分段上传"); | printLog.warn("上传文件超过3个,执行分段上传"); | ||