[InPageEdit] 没有编辑摘要
imported>=海豚= (创建页面,内容为“(async () => { if (!["edit", "submit"].includes(mw.config.get("wgAction"))) { return; } await mw.loader.using("mw.Api"); mw.loader.using('med…”) |
imported>=海豚= ([InPageEdit] 没有编辑摘要) |
||
| 第24行: | 第24行: | ||
needCheckFlag = false; | needCheckFlag = false; | ||
setTimeout(async () => { | setTimeout(async () => { | ||
disable(wpSave.attr("disabled", "disabled").val("正在提交 | disable(wpSave.attr("disabled", "disabled").val("正在提交...")); | ||
for (let i = 1; i <= 4; i++) { | for (let i = 1; i <= 4; i++) { | ||
try { | try { | ||
| 第37行: | 第37行: | ||
if (pageid > 0 && result.query.pages[pageid].revisions[0].revid > wgCurRevisionId) { | if (pageid > 0 && result.query.pages[pageid].revisions[0].revid > wgCurRevisionId) { | ||
wpSave.val("存在编辑冲突!"); | wpSave.val("存在编辑冲突!"); | ||
$("body").append(`<div style="background: #3366CC; color: white; text-align: center; padding: .5rem; position: fixed; top: 0; left: 0; right: 0; z-index: 9999;"><p>本页面已被他人更改。请 | $("body").append(`<div style="background: #3366CC; color: white; text-align: center; padding: .5rem; position: fixed; top: 0; left: 0; right: 0; z-index: 9999;"><p>本页面已被他人更改。请比对后重新开始编辑,以避免这中间的编辑丢失。</p><p><span id="copyCurrentRawCode" class="mw-ui-button">复制当前编辑内容</span> <span id="showNewestRevisionDiff" class="mw-ui-button">查看最新版本差异</span> <span id="refreshPage" class="mw-ui-button mw-ui-destructive">不保存内容,直接刷新页面(慎重!)</span></div>`); | ||
const pre = $("<pre/>", { | const pre = $("<pre/>", { | ||
css: { | css: { | ||
| 第67行: | 第67行: | ||
}); | }); | ||
$("#refreshPage").on("click", () => { | $("#refreshPage").on("click", () => { | ||
if (confirm(" | if (confirm(" 请注意 刷新后原来的编辑内容将会被最新版本的源码替换!\n历时如果您想找回您的编辑请点击还原备份\n点击确定将会刷新页面!!")) { | ||
location.reload(false); | location.reload(false); | ||
} | } | ||
| 第83行: | 第83行: | ||
}).appendTo("body"); | }).appendTo("body"); | ||
} else { | } else { | ||
wpSave.val("正在提交 | wpSave.val("正在提交..."); | ||
editform.submit(); | editform.submit(); | ||
} | } | ||